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

 

norm.krumpe@muohio.edu recursionarrays > first5
prev  |  next  |  chance

Given an array of integers, recursively compute the index of the first occurrence of that value in the array. If the value does not appear in the array, return -1. Note: You should solve this recursively (no loops). You will need a recursive helper method that takes an array and an index as parameters.


first5([3, 7, 5]) → 2
first5([3, 7, 2, 11]) → -1
first5([5]) → 0

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

int first5(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: 300

Copyright Nick Parlante 2017 - privacy