You are working on a team that is building an app that stores information about a wocket making machines. Each wocket requires a number of widgets to be plugged into machines to make them. You have been tasked with assigning the letter associated with a plug on the wocket making machine with the widget going into it.
For this challenge we’ll be working with arrays and sorting. We’ll sort the array of objects with letters into alphabetical order so that we can find the next letter or any missing ones.
No matter the level you choose to work with write a test case before you start your code. Then write just enough code to pass the test. Once you have passing code refactor to pass other test cases.
Your task for level 1 is to take an array of letters and find then find the next letter in the array.
['A', 'B', 'C', 'D']
Going a step further add a new widget to the array of widgets. In order to add it you’ll need to find the last letter for a slot in a widget in the array of widgets and then get the next letter to
For level 2 you’ve been asked to take into account the fact that there may be more than 26 widgets on a machine. After the last letter “Z” use double letters “AA”, “AB”, “AC”, then “BA”, “BB”, “BC”, etc.
Going a step further make is so that it can keep going infinitely adding extra letters so that you have “AAA” or “AAAA”.
For level 3 you find out that they may have removed some widgets from the wocket machine. So before adding a new widget find out if there are any letters missing in the sequence and fill in the missing spots with the new widget.
Going a step further ensure no two widgets have the same slot letter.