摘要:
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 阅读全文
摘要:
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans 阅读全文
摘要:
Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
摘要:
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 阅读全文
摘要:
Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: By calling next repeatedly until 阅读全文
摘要:
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. [分析]首先别忘了什么是factorial,就是 阅读全文
摘要:
这题真特么是太难了 解题思路 首先我们先把原数组全部异或起来,那么我们会得到一个数字,这个数字是两个不相同的数字异或的结果,我们取出其中任意一位为‘1’的位,为了方便起见,我们用 a &= -a 来取出最右端为‘1’的位。。。这道题的巧妙之处在于利用x1 ^ x2的结果对原数组进行了分组,进而将x1 阅读全文
摘要:
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. Credits:Speci 阅读全文
摘要:
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, 阅读全文
摘要:
Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 75] 阅读全文