about | help | code help+videos | done | prefs |
apcsaArraysCountConsecutiveEquals
Given an array of String values, find and return the number of pairs of equal consecutive elements. HINTS: This is a "compare neighbors" algorithm, so you need to compare the element at index i with the element at index i+1 (or i-1, your choice). Be careful of off-by-one errors, which are a common issue with this type of algorithm. Also: how should you compare String values?apcsaArraysCountConsecutiveEquals(["hi", "hi", "ho", "ho", "ho", "ho", "hi"]) → 4 apcsaArraysCountConsecutiveEquals(["a", "b", "c"]) → 0 apcsaArraysCountConsecutiveEquals([]) → 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: 230
Copyright Nick Parlante 2017 - privacy