about | help | code help+videos | done | prefs |
Write a method that returns the second greatest value in an array of unique integers. By "unique" I mean that no integers will appear more than one time in the array. As a precondition you may assume that the array contains at least two integers and that all integers in the array are unique. Please note that you may NOT make any other assumptions about these integers. For example, both positive and negative integers can appear in the array as can the value 0. As always, look at the test data for examples. Note: This is slightly more difficult than it initially appears! (Yet EVERYONE in all classes should be able to do this!) quiz2022_03_09_HL_secondGreatest([5, 3, 7, 1, 8, 2, 4]) → 7 quiz2022_03_09_HL_secondGreatest([241, 325, 45, 7352, 2345, 124, 346, 6865]) → 6865 quiz2022_03_09_HL_secondGreatest([-5, -2, 8, -1000, -4, -50]) → -2 ...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