Skip to main content

8.6 Exercises

Basic Difficulty​

168. Excel Sheet Column Title​

A variation of base-7 conversion, where the sequence starts from 1 instead of 0.


67. Add Binary​

A variation of string addition.


238. Product of Array Except Self​

Can you solve this problem without using division? A previously discussed problem like 135 might give you some ideas.


Advanced Difficulty​

462. Minimum Moves to Equal Array Elements II​

One of my favorite LeetCode problems. It requires reasoning about the optimal way to make moves and then considering how to implement the moves. You might need some algorithms we discussed earlier.


169. Majority Element​

If you can't come up with a simple solution, search for the Boyer-Moore Majority Vote algorithm.


470. Implement Rand10() Using Rand7()​

How can you generate one random number generator using another? You may need to utilize the original generator multiple times.


202. Happy Number​

You can solve this problem using a simple while loop, but is there a better way? If we think of each number as a node, can we transform this into a cycle detection problem?