Tag: number theory
Given an integer n, return the number of trailing zeroes in Factorial N! Your solution should be in logarithmic time complexity. Naive/Bruteforce Solution It is easy to get the …
Question: Given an array and a element, remove all instances of that value in place and return the new length. The order of elements can be changed and it …
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 …
Source: http://oj.leetcode.com/problems/powx-n/ Implement Pow(x, n) which computes The given parameter x is a 64-bit double and n is a 32-bit integer. The quick solution may be so obvious, using bruteforce, iterate n times that multiplies x and gives a straightforward result. class Solution …
A Palindrome string is a string that mirrors itself, for example, ’12a21′ reverse is the same string and ‘abcde’ is not. A Palindrome number is a integer number that …