title: Identifying the nth inserted element of matrix which fills by inserting alternating upper and lower triangle elements
body: <p>I am trying to write a function that is able to map the nth inserted element into a matrix to its (i,j) position. It is known that the method filling this matrix, is doing so in the following way non-standard way.</p>
  
  <p>(0,0)...(0,1)...(1,0)...(0,2)...(2,0)...(n,0)...(0,n)...
  (1,1)....(1,2)...(2,1)...(n,1)...(1,n)
  .....(n,n)</p>
  
  <p>In other words it starts at the top left, and then after inserting the diagonal element, it inserts alternating elements into the upper and lower triangle all the way across the outter row &amp; column, then rinses and repeats as it steps one row / one column in.</p>
  
  <p>And what I am trying to achieve is a function </p>
  
  <pre><code>std::pair&lt;int,int&gt; getMatrixCoordinates (int nthElement)
  {
  
  return std::pair&lt;int,int&gt; (row, col) ;
  
  
  }
  </code></pre>