摘要:
Source Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true; For n=5, return false; Challenge O(1) time 题解 咋看起来 阅读全文
摘要:
Source Given 2*n + 2 numbers, every numbers occurs twice except two, find them. Example Given [1,2,2,3,4,4,5,3] return 1 and 5 Challenge O(n) time, O( 阅读全文
摘要:
Source Given 3*n + 1 numbers, every numbers occurs triple times except one, find it. Example Given [1,1,2,3,3,3,2,2,4,1] return 4 Challenge One-pass, 阅读全文
摘要:
Problem 「找单数」系列题,技巧性较强,需要灵活运用位运算的特性。 Given 2*n + 1 numbers, every numbers occurs twice except one, find it. Example Given [1,2,2,1,3,4,3], return 4 Ch 阅读全文
摘要:
Problem Given n pieces of wood with length L[i] (integer array). Cut them into smallpieces to guarantee you could have equal or more than k pieces wit 阅读全文
摘要:
Problem There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. Example Given A=[1,2,3,4,5,6] and 阅读全文