摘要:
还不知道Unicode 该怎么做 只有lowercase alphabets的做法无外乎sort, hashmap, array, bitmap之类的 Better: Unicode Follow up In Java, a Unicode could be represented by a sin 阅读全文
posted @ 2015-12-20 13:24
neverlandly
阅读(331)
评论(0)
推荐(0)
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i 阅读全文
posted @ 2015-12-20 12:42
neverlandly
阅读(248)
评论(0)
推荐(0)
摘要:
方法一:Heap时间 O(NlogK) 空间 O(K) maintain a maximum heap, notice PriorityQueue.remove(object o) can remove certain object from our heap. When writting Maxi 阅读全文
posted @ 2015-12-20 12:25
neverlandly
阅读(422)
评论(0)
推荐(0)
摘要:
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except ... 阅读全文
posted @ 2015-12-20 11:38
neverlandly
阅读(280)
评论(0)
推荐(0)
摘要:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2015-12-20 08:16
neverlandly
阅读(228)
评论(0)
推荐(0)
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest... 阅读全文
posted @ 2015-12-20 08:08
neverlandly
阅读(268)
评论(0)
推荐(0)
摘要:
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2015-12-20 08:06
neverlandly
阅读(286)
评论(0)
推荐(0)
摘要:
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?先分成大小相同(可能长度差1) 两部分, reverse一个list. ... 阅读全文
posted @ 2015-12-20 07:12
neverlandly
阅读(286)
评论(0)
推荐(0)
摘要:
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6... 阅读全文
posted @ 2015-12-20 05:21
neverlandly
阅读(259)
评论(0)
推荐(0)
摘要:
Best Solution 还是有一个地方不小心:Integer.MIN_VALUE, 应该是false,但是因为只有一个1,我曾经判断为true。事实上,所有negative value都应该是false 一旦符号位为1,就return false, 检查其他位只有1个1 做的时候遇到很多语法错误 阅读全文
posted @ 2015-12-20 04:28
neverlandly
阅读(217)
评论(0)
推荐(0)
摘要:
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o... 阅读全文
posted @ 2015-12-20 02:20
neverlandly
阅读(275)
评论(0)
推荐(0)
摘要:
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.Hin... 阅读全文
posted @ 2015-12-20 02:02
neverlandly
阅读(316)
评论(0)
推荐(0)
浙公网安备 33010602011771号