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

 

crehwinkel@frhsd.com introcs_array_problems > countInRange
prev  |  next  |  chance

Write a method called 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 array {14, 1, 22, 17, 36, 7, -43, 5}, there are four elements whose values fall between 4 and 17.


countInRange([14, 1, 22, 17, 36, 7, -43, 5], 4, 17) → 4
countInRange([-4, 0, 1, -2, 7, 11, 5, 21], -2, 3) → 3
countInRange([-17, 2, -2, -3, 3, 5, 7, 10], 20, 21) → 0

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

public int countInRange(int [] b, 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