随笔分类 -  Numbers & Digits

摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2016-08-01 23:23 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner as s 阅读全文
posted @ 2016-08-01 04:41 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要:Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: Given a column titl 阅读全文
posted @ 2016-08-01 03:34 北叶青藤 阅读(308) 评论(0) 推荐(0)
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2016-08-01 01:10 北叶青藤 阅读(166) 评论(0) 推荐(0)
摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur 阅读全文
posted @ 2016-07-31 11:50 北叶青藤 阅读(163) 评论(0) 推荐(0)
摘要:Count the number of prime numbers less than a non-negative number, n 阅读全文
posted @ 2016-07-31 11:27 北叶青藤 阅读(177) 评论(0) 推荐(0)
摘要:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. For example, 123 -> "One Hundre 阅读全文
posted @ 2016-07-28 05:27 北叶青藤 阅读(240) 评论(0) 推荐(0)
摘要:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2016-07-27 05:49 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2016-07-26 12:38 北叶青藤 阅读(172) 评论(0) 推荐(0)
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library functio 阅读全文
posted @ 2016-07-26 10:37 北叶青藤 阅读(150) 评论(0) 推荐(0)
摘要:Calculate the a^n % b where a, b and n are all 32bit integers. Calculate the a^n % b where a, b and n are all 32bit integers. Calculate the a^n % b wh 阅读全文
posted @ 2016-07-23 04:57 北叶青藤 阅读(259) 评论(0) 推荐(0)
摘要:Check Power of 2 Using O(1) time to check whether an integer n is a power of 2. Check Power of 2 Using O(1) time to check whether an integer n is a po 阅读全文
posted @ 2016-07-23 02:59 北叶青藤 阅读(208) 评论(0) 推荐(0)
摘要:Given a (decimal - e.g. 3.72) number that is passed in as a string, return the binary representation that is passed in as a string. If the fractional 阅读全文
posted @ 2016-07-21 13:29 北叶青藤 阅读(288) 评论(0) 推荐(0)
摘要:Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical o 阅读全文
posted @ 2016-07-19 00:43 北叶青藤 阅读(332) 评论(0) 推荐(0)
摘要:Given n and k, return the k-th permutation sequence. Notice n will be between 1 and 9 inclusive. Given n and k, return the k-th permutation sequence. 阅读全文
posted @ 2016-07-18 12:57 北叶青藤 阅读(245) 评论(0) 推荐(0)
摘要:Integer to Roman Given an integer, convert it to a roman numeral. The number is guaranteed to be within the range from 1 to 3999. Integer to Roman Giv 阅读全文
posted @ 2016-07-16 23:04 北叶青藤 阅读(232) 评论(0) 推荐(0)
摘要:Print numbers from 1 to the largest number with N digits by recursion. Notice It's pretty easy to do recursion like: recursion(i) { if i > largest num 阅读全文
posted @ 2016-07-16 01:37 北叶青藤 阅读(240) 评论(0) 推荐(0)
摘要:Next Permutation Given a list of integers, which denote a permutation. Find the next permutation in ascending order. Notice The list may contains dupl 阅读全文
posted @ 2016-07-15 11:52 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:Determine the number of bits required to flip if you want to convert integer n to integer m. Notice Both n and m are 32-bit integers. Determine the nu 阅读全文
posted @ 2016-07-15 05:31 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Count how many 1 in binary representation of a 32-bit integer. Count how many 1 in binary representation of a 32-bit integer. Count how many 1 in bina 阅读全文
posted @ 2016-07-14 08:30 北叶青藤 阅读(163) 评论(0) 推荐(0)