about | help | code help+videos | done | prefs |
Write a method that recursively computes the "oceanOceanOcean" of a number. This is found RECURSIVELY, but I will show you how to find it without using recursion. Keep in mind that your solution MUST be truly recursive. Let's look at an example: 2348 has an oceanOceanOcean of 18 because 2*3=6, 6+4=10, 10+8=18. Basically, starting with the most significant digit, you either add the next digit to the total or multiply the total by the next digit, depending on if that digit is even or odd (respectively). Look at the test data for further examples. oceanOceanOcean(348) → 15 oceanOceanOcean(2348) → 18 oceanOceanOcean(734) → 25 ...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: 430
Copyright Nick Parlante 2017 - privacy