<p>Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:</p> <pre> - Emergency 911 - Alice 97 625 999 - Bob 91 12 54 26 </pre&…

2020年1月17日 0条评论 1267点热度 1人点赞 code 阅读全文

A calendar is a system for measuring time, from hours and minutes, to months and days, and finally to years and centuries. The terms of hour, day, month, year and century are all units of time measurements of a calender system. According to the Gregorian calen…

2020年1月17日 0条评论 1380点热度 0人点赞 code 阅读全文

Mike is very lucky, as he has two beautiful numbers, 3 and 5. But he is so greedy that he wants infinite beautiful numbers. So he declares that any positive number which is dividable by 3 or 5 is beautiful number. Given you an integer N (1 <= N <= 100000…

2020年1月17日 0条评论 1092点热度 0人点赞 code 阅读全文

Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance, 2, 11, 67, 89 are prime numbers but 8, 20, 27 are not. Semi-Prime Number Definition An integer greater than o…

2020年1月17日 0条评论 1126点热度 0人点赞 code 阅读全文

<p>Given positive integers B and N, find an integer A such that A<sup>N</sup> is as close as possible to B. (The result A is an approximation to the N<sup>th</sup> root of B.) Note that A<sup>N</sup> may be less than, …

2020年1月17日 0条评论 1012点热度 0人点赞 code 阅读全文

In recreational mathematics, a magic square of n-degree is an arrangement of n2 numbers, distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. For example, the picture below shows a 3-deg…

2020年1月17日 0条评论 1307点热度 0人点赞 code 阅读全文