Author: ACMer
The sum of the squares of the first ten natural numbers is, 1^2+2^2+3^2+…10^2=385 The square of the sum of the first ten natural numbers is, (1+2+…+10)^2=55^2=3025 Hence the difference …
Given a number s in their binary representation. Return the number of steps to reduce it to 1 under the following rules: If the current number is even, you …
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path …
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome …
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? We can start prime number 2 and …