Category: math
Count the number of prime numbers less than a non-negative number, n. Submit your solution to: https://leetcode.com/problems/count-primes/ Naive Solution The first solution is straightforward, a prime number is a …
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, …
Given a non-negative integer number, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + …
Convert a non-negative integer to its English words representation. Given input is guaranteed to be less than 231 – 1. For example, 123 – “One Hundred Twenty Three” 12345 …
If you want to solve the following puzzle then it may be not so easy/intuitive at a glance. It is a square and 20 is the area with e.g. …