about | help | code help+videos | done | prefs |
Write a method that finds the product with the greatest number of digits that match 'digit'. The product comes from selecting two different elements in the array 'nums'. If there is a tie for the same number of times 'digit' appears in the results, use the first combination that produces that result. You will return the result as a string that shows the two numbers being multiplied together to produce the appropriate product. Note that the order the two numbers appear is important. In other words, if the test data shows "57*46=2622" your result must be exactly that and not "46*57=2622". So, you must determine how the order is established from the test data (I am not going to explain that part as I want you to figure it out from the test data). If NONE of the product combinations produce any numbers that contain 'digit', return "not found". Obviously, look at the test data for help! I suggest using a helper method, but you do not have to. test2022_11_17_HL_mostMatchDigits([40, 100, 77, 18], 0) → "40*100=4000" test2022_11_17_HL_mostMatchDigits([21, 37, 51, 97], 2) → "21*97=2037" test2022_11_17_HL_mostMatchDigits([42, 54, 643, 81], 4) → "54*81=4374" ...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: 260
Copyright Nick Parlante 2017 - privacy