Tag: math
At the annual meeting of Board of Directors of Acme Inc, every one starts shaking hands with everyone else in the room. Given the fact that any two persons …
Question: Given an integer, write a function to determine if it is a power of three. Iterative If you divide the number (which is Power of Three) iteratively by …
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = sumRange(0, 2): 1 sumRange(2, 5): …
From this post, we know the non-deterministic approach to compute the approximation of math constant PI. The random algorithms e.g. such as xorshift need to be of high quality …
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, …