Categories
algorithms kotlin

Problem 5.3 from EPI -> Reverse bits

This one is similar to computing a parity, since we need to check every bit, we can build a cache of already solved parts and just return from cache a solution exists. The key to the solution is to think about what a reverse means, it is basically last two bits reversed will be the first two bits, and second last two bits reversed will be next two bits, etc. Check out the solution here.

Leave a Reply

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