about | help | code help+videos | done | prefs |
A dataset was found to contain "bad" data. Write a method that finds out how many times 'bad' appears in the array 'nums', except it is OK to have 'bad' in the first or last position in the array, so those don't count towards the total number of 'bad' values. (NOTE: HL students MUST solve this recursively) Look at the test data for examples. Note that the array can be any length, including zero. todays_2021_11_01_APSLHL_countBad([7], 7) → 0 todays_2021_11_01_APSLHL_countBad([], 2) → 0 todays_2021_11_01_APSLHL_countBad([34, 32, 66, 234, 13, 5434, 4, 5, 4, 554, 335, 1, 5324, 46, 544, 352, 23, 55, 4, 45, 6, 4, 78, 6, 32, 53, 3, 4, 4, 5, 7, 4], 4) → 6 ...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