We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Nice one
but you need to change one more thing
int j = 0;
for (int i = 3; i < n; i++) {
array[i%3] = array[0] + array[1] + array[2];
j = i%3;
}
//return array[array.length-1]; place of this return below
Recursion: Davis' Staircase
You are viewing a single comment's thread. Return to all comments →
Nice one but you need to change one more thing int j = 0; for (int i = 3; i < n; i++) { array[i%3] = array[0] + array[1] + array[2]; j = i%3; } //return array[array.length-1]; place of this return below