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

 

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

Write a method the returns the SUM of the numbers in the longest strictly increasing sequence of numbers in the array 'nums'. In the event of one or more ties for the longest increasing sequence, the one with the greatest SUM is returned (if there is also a tie for greatest sum, you will return that sum). As preconditions, you may assume that any numbers in 'nums' are positive and that 'nums' will not be empty. Look at the test data for examples.


test2022_04_21_SLHL_longestSumInc([5, 6, 12, 22, 4, 7, 11, 200, 42, 235, 346, 124, 12, 1]) → 222
test2022_04_21_SLHL_longestSumInc([5, 11, 24, 43, 5, 2, 1, 8, 3, 6, 7, 12, 9, 2, 5, 7, 11]) → 83
test2022_04_21_SLHL_longestSumInc([142, 3445, 45645, 12, 124, 23, 34534, 45, 325, 4, 776, 97, 43, 214, 788, 34, 789690, 43346, 235, 34346, 7235]) → 49232

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

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