about | help | code help+videos | done | prefs |
Write a method that returns the greatest difference between a pair of numbers in the 'nums' array. Only consider numbers in 'nums' that are between 'min' and 'max', inclusive. As preconditions, you may make the following assumptions: 'nums' will contain at least one element. The first element in 'nums' WILL be in the range of 'min' to 'max', inclusive. min<max. NOTE: You are NOT allowed to use maps, functional programming, strings, or array lists. You are NOT allowed to have any nested loops or nested recursion. You are NOT allowed to make a giant array that is way longer than the input parameter arrays. Kyle, you must resist your natural impulses! test2021_06_03_APP1SLdiffInRange([3, 6, 4, -10, -50, -40, 200, 50, 40, 30, 220], -40, 90) → 90 test2021_06_03_APP1SLdiffInRange([3, 6, 4, -10, -50, -40, 200, 50, 40, 30, 220], -40, 80) → 90 test2021_06_03_APP1SLdiffInRange([60, 50, 70, 80, 90, 40, 100, 120, 20, 200, 110], 41, 119) → 60 ...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: 220
Copyright Nick Parlante 2017 - privacy