Interview Questions

Vertically inverting an image (given an input array of pixels and an output array to write to)

Microsoft Interview Questions and Answers


(Continued from previous question...)

275. Vertically inverting an image (given an input array of pixels and an output array to write to)

Question:
Vertically inverting an image (given an input array of pixels and an output array to write to)


maybe an answer:


its basically swapping the first with the last element in the array, n-1 element with the second element etc until the middle.
Looking at it, its essentially moving the contents in 1st quadrant to 3rd, 2->4, 3->1 and 4->2 in a plane and if one represents it in an array, it ultimately boils down to swapping elements...


maybe an answer2:


multiply each point in UI with
| -1 0 |
| 0 -1 |

(Continued on next question...)

Other Interview Questions