Category: math
The problem is from Timus Online Judge. Den only has two locks. He never uses the same lock two days in a row. Therefore, if the thief wants to …
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 …