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

 

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

Write a method that accepts an array containing at least one integer. Return the longest "run" of identical numbers in the array. To be a "run" the same number must appear repeatedly with no other numbers in between. The length of the "run" is how many matching numbers appeared in a row. Look at the test data for examples.


jan11_2016_SLHLlongestSame([5, 23, 1, 3, 6, 5, 7, 5, 1]) → 1
jan11_2016_SLHLlongestSame([7, 7, 5, 2, 2, 2, 2, 6, 8, 8, 8]) → 4
jan11_2016_SLHLlongestSame([6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 4, 4, 8]) → 9

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

public int jan11_2016_SLHLlongestSame(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: 250

Copyright Nick Parlante 2017 - privacy