title: MS paint code asked in an interview
body: <p>I had an interview today and was asked this question!</p>
  
  <p>code the MS Paint program. N*N pixels area. given pixel and color, change color in pixel to desired color and if adjacent pixels are of same color change them too.</p>
  
  <p>i approached it by saying i ll take a n* n array and would check for the pixel given and move to the  the adjacent. for example the pixel given is x,y i would first check for the color in x,y in the array and next look for (x+1,y+1),(x+1,y),(x,y+1),(x-1,y),(x-1,y-1)....</p>
  
  <p>but the interviewer was not happy can someone suggest me another way with a better algorithm.. which has better space and time complexity!</p>