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

 

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

Given an int array of any length, if there is a 2 in the array immediately followed by a 3, set the 3 element to 0. Return the changed array. Solve this problem using recursion! I suggest making a helper method so you can pass in additional parameters if needed. You MUST have a recursive solution.


recursiveFix23([2, 3, 5, 6, 3, 8, 2, 1, 2, 3, 9, 10, 3, 2]) → [2, 0, 5, 6, 3, 8, 2, 1, 2, 0, 9, 10, 3, 2]
recursiveFix23([2, 3, 3, 3, 3, 2, 2, 3]) → [2, 0, 3, 3, 3, 2, 2, 0]
recursiveFix23([735, 2341, 324, 346, 412, 3, 3, 3, 896, 5, 67, 3, 2, 6, 7, 2, 3, 5, 1]) → [735, 2341, 324, 346, 412, 3, 3, 3, 896, 5, 67, 3, 2, 6, 7, 2, 0, 5, 1]

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

public int[] recursiveFix23(int[] nums) { }

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