about | help | code help+videos | done | prefs |
Write a method that returns an integer that is made up of the digits in 'num', but in reverse order. You may NOT use any strings, arrays, array lists, maps, or any other advanced data structures. In fact, you may ONLY use integer variables! You can do this recursively or iteratively. I can do it recursively in one line or iteratively in 5 lines (not counting the header or braces). Think div and mod! Note: When you reverse 900 you get 009, but that just gets returned as a 9. test2021_04_29_APP1SLHL_reverseNum(5000) → 5 test2021_04_29_APP1SLHL_reverseNum(4070) → 704 test2021_04_29_APP1SLHL_reverseNum(8) → 8 ...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: 250
Copyright Nick Parlante 2017 - privacy