摘要:
Determine the number of bits required to flip if you want to convert integer n to integer m. Example Given n = 31 (11111), m = 14 (01110), return 2. N 阅读全文
摘要:
Flatten a binary tree to a fake "linked list" in pre-order traversal. Here we use the right pointer in TreeNode as the nextpointer in ListNode. Exampl 阅读全文
摘要:
For a given sorted array (ascending order) and atarget number, find the first index of this number inO(log n) time complexity. If the target number do 阅读全文
摘要:
Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node. Example Given 1->2->3->4, and node 3. r 阅读全文
摘要:
The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read o 阅读全文
摘要:
Count how many 1 in binary representation of a 32-bit integer. Example Given 32, return 1 Given 5, return 2 Given 1023, return 9 Challenge If the inte 阅读全文
摘要:
Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them. The cos 阅读全文
摘要:
Given a sorted (increasing order) array, Convert it to create a binary tree with minimal height. Example Given [1,2,3,4,5,6,7], return 4 / \ 2 6 / \ / 阅读全文
摘要:
Compare two strings A and B, determine whether A contains all of the characters in B. The characters in string A and B are all Upper Case letters. Exa 阅读全文