Unofficial C Solution to Problem 1.6 in Cracking the Coding Interview (5th Edition)

22 Mar

This question asks us to rotate an N by N matrix. Each element in the matrix is a pixel of an image, and represented by 4 bytes. The question did not indicate the length of byte. And I assume the byte is 8-bits, which is right in most cases currently. Exception of the length of byte could be found here. Because each byte is 8 bits, and each pixel is 4 bytes, I use an int32_t to represent each pixel. Anyway, using a structure of chars will improve its portability.

Leave a Reply

Your email address will not be published. Required fields are marked *