DevTalk
November 1, 2024
5
min read

CODE100 Challenge - 'The License Plate' Challenge Solution and Winners

Daniel Cranney

As you've probably seen, we've been releasing a new CODE100 challenge as part of each of our WeAreDevelopers LIVE days! At our recent .NET day, we gave you a chance to win a ticket to the World Congress in 2025, challenging you to work with some license plate data and analyse it with code.

The Challenge

This time, we gave you two data sets to work with: a CSV file listing valid German license plate prefixes, city/area names, and their states, and a JSON array with 2000 license plates.

The challenge tasked you with processing these datasets to find the number of invalid licenses, licenses from Bavaria, and electric vehicle licenses. By validating the license plates to check they follow the correct formatting structure, your code would return totals for invalid, Bavarian, and electric vehicle licenses.

A Solution

Of course, there are many ways you could solve this, but here's one way you might have tackled it.

  1. Begin by cleaning up the data, handling exceptions like poorly-formatted plates.
  2. Split the comma-separated values at the line breaks, converting the content into arrays, and use the shift() method to remove the headers (such as "License Name") as they will also be included in the conversion process.
  3. Create two arrays, for valid cities and Bavarian cities.
  4. Using a forEach loop, iterate over the lines of data, cleaning it up along the way (removing the quote marks and additional parentheses within it), adding the lines to the valid licenses array.
  5. Check if the city is equal to Bayern, and if so, add this plate to the array containing the Bavarian cities.
  6. Now that our data has been cleaned up, we can organise it within a result object, using the length method to check out how many items feature in each array.
  7. When iterating over the cleaned up list of licenses, licenses are sorted into the electric category by checking if the license ends with 'E'.
  8. Finally, we collect together our arrays in our result object, returning an object containing invalidLicenses, bavarianLicenses, electricLicenses, all as numbers.

We had quite a few submissions and a Math.random() on them all came up with two winners who will move on to the CODE100 final in Berlin in July 2025 at the WeAreDevelopers World Congress! These are:

Jack Barber and Jordi Busquets!

See you next time!

CODE100 Challenge - 'The License Plate' Challenge Solution and Winners

November 1, 2024
5
min read

Subscribe to DevDigest

Get a weekly, curated and easy to digest email with everything that matters in the developer world.

From developers. For developers.