Missing Number

It is Friday and it has been a long week and I am feeling somewhat tired. My wife and I have been invited for dinner at one of her brother’s house. I am looking forward to decompress later today.

In this post I tackled problem 17.4 from the Cracking the Coding Interview book by Gayle Laakmann McDowell. As usual I read the problem a few times to get a good understanding of what is required. Given that I have to generate the test scaffolding I try to be even more careful not to waste time. Continue reading “Missing Number”

Bitwise AND of Numbers Range

What a humbling experience. Picked up at random a challenge at LeetCode (https://leetcode.com/problems/bitwise-and-of-numbers-range/)

The requirements are quite brief and one can easily determine what is required:

Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.

For example, given the range [5, 7], you should return 4”.

I got a piece of paper and jotted down the following: Continue reading “Bitwise AND of Numbers Range”