Category: math
Remember a couple days ago, we discussed the O(n) and O(n^2) solutions to Single Number ? Question: Given an array of integers, every element appears three times except for one. Find …
Given an array of integers, every element appears twice except for one. Find that single one. Your algorithm should have a linear runtime complexity. Implement it without using extra …
Question: Given an integer (maximum 100), compute the number of distinct ways to split the number using non-negative integer numbers. For example, given 5, there are 7 ways to …
Question: Implement integer square root for int sqrt(int x) There are many ways to compute the integer square root. But if you don’t bother, you can always cheat the compilers …
Question: You are climbing stairs. It takes n steps to get to the top. Each time, you can take 1 step or 2 steps. How many distinct ways to get to …