about | help | code help+videos | done | prefs |
Write a method that returns how many "buttons" appear in an array of integers. A "button" is defined (for this problem) as an integer surrounded by integers that are one off from it. For example, in {43,44,43} 44 is a "button" because it is surrounded by two 43's, which are each one off from 44. In the array {124,532,533,534,535,235,532} 533 and 534 are both "buttons". The array input parameter could be any length and contain any integers (including positive, negative, and zero values). You may want to use one or more helper methods. Look at the test data for examples. quiz2021_10_12_SLHL_buttons([21, 24, 25, 26, 39, 590, 421, 23, 50, 51, 52, 84, 235]) → 2 quiz2021_10_12_SLHL_buttons([5, -24]) → 0 quiz2021_10_12_SLHL_buttons([-21498]) → 0 ...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