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

 

sspiege3@schools.nyc.gov > getMaxSection
prev  |  next  |  chance

Find the MAXIMUM value in a given portion of an array.
Preconditions: the array will NOT be null. 0<=start<=end<nums.length

For example, if int [] nums = { 0, 10, 7, 8, 9}
the maximum for the values between indices 0 and 2 inclusive is 10
the maximum for the values between indices 2 and 4 inclusive is 9
the maximum for the values between indices 1 and 4 inclusive is 10
the maximum for the values between indices 2 and 3 inclusive is 8


getMaxSection([0, 10, 7, 8, 9], 0, 2) → 10
getMaxSection([0, 10, 7, 8, 9], 2, 4) → 9
getMaxSection([0, 10, 7, 8, 9], 1, 4) → 10

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

public int getMaxSection( int [] nums, int start, int end){ }

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: 201 Post-solution available

Copyright Nick Parlante 2017 - privacy