id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com monroe > compress_numColorChanges
prev  |  next  |  chance

Given an integer array representing pixel colors in the format of RGBRGBRGB... return the number of color changes while scanning the array from first to last.


compress_numColorChanges([0, 0, 0, 0, 0, 0]) → 1
compress_numColorChanges([0, 0, 0, 1, 1, 1]) → 2
compress_numColorChanges([2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1, 1]) → 3

...Save, Compile, Run (ctrl-enter)

public int compress_numColorChanges(int[] colors) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy