about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy