about | help | code help+videos | done | prefs |
Write a method that accepts an array of ten names of digits, called 'names'. The index of this array matches the digit that the string names. For example, if 'names' element 0 is "zero" then we will call the digit 0 "zero". The idea of this method is that we can pass in an array containing the "normal" names for digits, or we can make up our own names for the digits. A number 'num' is also passed in, which will be non-negative. Return a string that names the digits of 'num' in order. For example, if our array uses the "normal" names for digits, and 'num' is 578, we would return "five seven eight". Notice that there is a space between each digit name, but no space at the end of the resulting string. Look at the test data for examples. quiz2024_02_20_HL_digitNames(["zed", "own", "toe", "tree", "fer", "fyyve", "sox", "syvyn", "ate", "naan"], 128214) → "own toe ate toe own fer" quiz2024_02_20_HL_digitNames(["zorp", "oit", "twy", "toop", "flanggy", "flig", "spooch", "slinept", "eweni", "nalaa"], 128093) → "oit twy eweni zorp nalaa toop" quiz2024_02_20_HL_digitNames(["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"], 542) → "five four two" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy