title: Logic Math Puzzle - Help me solving this - C++
body: <p>I have following C++ array: <code>int arr[20][20]</code> filled with numbers from 1 to 5</p>
  
  <p>A specific element, for example arr[5][8] is set as start point</p>
  
  <p>I have to find all elements in the array, that have the same value and that are "touching" (vert/horiz) the start point</p>
  
  <p>I could search through the array with three for loops, but this would result in 20*20+20*2=1600 deplacements through the array</p>
  
  <p>I hope I explained the problem well enough for you to understand</p>
  
  <p>i.stack.imgur.com/j3e0e.jpg</p>
  
  <p>All red marked elements should be found</p>