id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > moveItDown
prev  |  next  |  chance

Write a recursive method that returns the number in the 'pos' position in a sequence of numbers. The sequence is generated using pos1 and pos2 as the first and second numbers in the sequence. To get the next number in the sequence, you always add the two previous numbers. For example, if pos1=1 and pos2=1, the sequence is the Fibonacci numbers: 1,1,2,3,5,8,13, etc. So moveItDown(1,1,7) returns 13 because that is the number in position 7 of that sequence.


moveItDown(202, 101, 3) → 303
moveItDown(202, 101, 11) → 12423
moveItDown(1, 1, 7) → 13

...Save, Compile, Run (ctrl-enter)

public int moveItDown(int pos1, int pos2, int pos) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 310

Copyright Nick Parlante 2017 - privacy