about | help | code help+videos | done | prefs |
Write a method that accepts two positive numbers with the same number of digits, 'num1' and 'num2'. Return a new number that combines the digits of 'num1' and 'num2' by alternately taking digits from each number. For example, if 'num1' is 753 and 'num2' is 246, you would return 725436. If you look carefully at the result you will notice that the 7, 5, and 3 came from 753, which was 'num1', while the 2, 4, and 6 came from 246, which was 'num2'. In solving this problem you are NOT allowed to use strings, arrays, or ArrayList. Preconditions: 'num1' and 'num2' will both be positive and will have the same number of digits. Look at the test data for more examples. test2024_02_08_P1SLHL_comboNum(45, 18) → 4158 test2024_02_08_P1SLHL_comboNum(123, 456) → 142536 test2024_02_08_P1SLHL_comboNum(8913, 4571) → 84951731 ...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