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

 

norm.krumpe@muohio.edu > countArrayPairs
prev  |  next  |  chance

Given an array, count the number of times that a number in the array matches the number in the next location in the array. Note: You should solve this recursively (no loops). You will need a recursive helper method that takes an array and an index as parameters.


countArrayPairs([2, 2, 3, 4, 5, 5]) → 2
countArrayPairs([5, 5, 5, 5]) → 3
countArrayPairs([1, 0]) → 0

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

int countArrayPairs(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