上一页 1 2 3 4 5 6 7 8 ··· 27 下一页
摘要: Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary representation.(Recall that the number of set bits an integer ha... 阅读全文
posted @ 2018-01-15 22:41 xiejunzhao 阅读(327) 评论(0) 推荐(0)
摘要: Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find an index mapping P, from A to B. A mapping P[i] ... 阅读全文
posted @ 2018-01-10 22:58 xiejunzhao 阅读(324) 评论(0) 推荐(0)
摘要: Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1, a2, a3, ... ... 阅读全文
posted @ 2018-01-10 22:58 xiejunzhao 阅读(197) 评论(0) 推荐(0)
摘要: There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, th... 阅读全文
posted @ 2018-01-07 10:25 xiejunzhao 阅读(211) 评论(0) 推荐(0)
摘要: Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same length ... 阅读全文
posted @ 2018-01-07 10:25 xiejunzhao 阅读(141) 评论(0) 推荐(0)
摘要: Implement pow(x, n). // /**// * @param {number} x// * @param {number} n// * @return {number}// */// var myPow = function (x, n) {// return Math.pow(x, n);// };/** * @param {number} x * @param ... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(240) 评论(0) 推荐(0)
摘要: Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first ... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(209) 评论(0) 推荐(0)
摘要: In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an, followed by other, which c... 阅读全文
posted @ 2017-12-29 22:55 xiejunzhao 阅读(206) 评论(0) 推荐(0)
摘要: Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, c... 阅读全文
posted @ 2017-12-27 22:32 xiejunzhao 阅读(186) 评论(0) 推荐(0)
摘要: In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as every other number in the array. If it is, ret... 阅读全文
posted @ 2017-12-26 22:16 xiejunzhao 阅读(461) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 27 下一页