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

 

frew@mclean.com > countInRange
prev  |  next  |  chance

Write a method named countInRange that accepts an array of integers, a minimum value, and a maximum value as parameters and returns the count of how many elements from the array fall between the minimum and maximum (inclusive). For example, in the list containing {14, 1, 22, 17, 36, 7, -43, 5}, there are 4 elements whose values fall between 4 and 17. The input would be the list, the minimum value 4, and the maximum value 17. The output would be 4 since there are 4 elements in that range.


countInRange([14, 1, 22, 17, 36, 7, -43, 5], 4, 17) → 4
countInRange([1, 2, 3, 4, 5], 1, 5) → 5
countInRange([1, 2, 3, 4, 5], 6, 100) → 0

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

public int countInRange(int[] list, int min, int max) { }

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: 200

Copyright Nick Parlante 2017 - privacy