about | help | code help+videos | done | prefs |
apcsaArraysCountIncrements
Given an array of ints, return the number of times that one element is directly followed by another element with a value of one greater. Thus, if the element at index 3 has the value 40 and the element at index 4 has the value 41, that counts once toward the number you are building. HINTYou will need to compare two side-by-side elements using your loop control variable and either the variable plus one or minus one. Be careful about the edge cases at the beginning and end! apcsaArraysCountIncrements([3, 4, 5]) → 2 apcsaArraysCountIncrements([5, 4, 3]) → 0 apcsaArraysCountIncrements([3, 5, 6]) → 1 ...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