- The problem is asking to write a function that will take in a number and will return a string of roman numerals that corresponds with the number coming in. I am to use the roman numeral key provided.
- The problem that is being asked seems simple enough, as far as what it is asking me to do. However, I believe the solution may be more complex. My initial thought is to write a function with a series of conditionals regarding the num coming in and it will convert parts of the num to a string, then add that string to the output of calling the function again. The will need to be a condition for when the num is coming in is empty to stop the process.
- I know my solution will need to be a recursive fucntion, since that is the learning goal for this technical challenge.
- Define the function and set a parameter of num for my input
- Write a series of conditionals checking if the number coming in is first >= 1000, if so return M + call the function again and with the num - 1000
- Do this for each roman numeral character
- Write one last condition that checks if there isn't a num coming in, and if so return the last value.
- Since it appears my solution doesn't involve an iterator method, just conditionals without using state, I believe my Big O complexity is 0(log n) logarithmic time?