Copy a rectangle within a 2D array in place
Given a 2D array, a rectangular block (top-left corner, height, width) and a destination for its top-left corner, copy the block to the destination with O(1) extra memory. The source and destination may overlap, so choose the copy direction (rows and columns, forward or backward) the way memmove does.
No answer yet. Write the first one; the best answer gets endorsed.