## Code Challenge problem: Plate number Following my problem in the first post of Code Challenge series, it’s a solution.

## Problem

A motor bike plate number is in the format [AB-CD EFG.HI]. Its value is defined by: AB x C + EFG x HI, if C is a letter, its value is its ASCII code. A plate number is called NICE one if its EFG contains its HI, then its value is doubled than normal. Give you a list of place numbers, find the biggest value.

For example: A plate 29-C1 320.12 has value 5783 (= 29*67+320*12)

What is the biggest value of

28-A1 493.68

83-Y3 453.83

17-Z7 439.48

29-C1 292.29

## Solution

It seems easy where we can compute the value of a specific plate number and find a biggest value afterward.

But, please aware that there is a trick at if C is a letter, its value is its ASCII code. So C can be a digit or letter. Only if it is not a digit, we need to get its value by ASCII code.

Here is my solution in C#

Here is the solution in Objective-C, credit to Nghia Luong to share.

## No code

Yes, at least we can solve it by Excel as can compute a plate number value by this function

Note:

My full input is in attachment, not just a simple input above as it’s easy to solve manually.

[wpba-attachment-list]

1,015 total views, no views today