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

 

james.shockey@austinisd.org > LASA_minSpan_KS
prev  |  next  |  chance

Think about the leftmost and rightmost appearances of each unique value in the array. If the span is the inclusive number of elements between the leftmost and rightmost appearances of that value, find the span between the two of every unique value and return the minimum span that is greater than 1 (if the maximum span is also 1, return 1). A single value has a span of 1.


LASA_minSpan_KS([1, 2, 1, 1, 3]) → 4
LASA_minSpan_KS([1, 4, 2, 1, 4, 1, 4]) → 6
LASA_minSpan_KS([1, 4, 2, 1, 4, 1]) → 4

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

public int LASA_minSpan_KS(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

Copyright Nick Parlante 2017 - privacy