# 查看完整版本 : LeetCode

darigold 2015-7-9 11:32 PM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-construct-binary-tree-from.html]LeetCode OJ - Construct Binary Tree from Preorder and Inorder Traversal[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-construct-binary-tree-from_9.html]LeetCode OJ - Construct Binary Tree from Inorder and Postorder Traversal[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-merge-sorted-array.html]LeetCode OJ - Merge Sorted Array[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-jump-game.html]LeetCode OJ - Jump Game[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-jump-game-ii.html]LeetCode OJ - Jump Game II[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-remove-duplicates-from.html]LeetCode OJ - Remove Duplicates from Sorted Array[/url]

[[i] 本帖最後由 darigold 於 2015-7-15 11:12 PM 編輯 [/i]]

darigold 2015-7-12 10:45 PM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-container-with-most-water.html]LeetCode OJ - Container With Most Water[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-lowest-common-ancestor-of.html]LeetCode OJ - Lowest Common Ancestor of a Binary Search Tree[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-lowest-common-ancestor-of_12.html]LeetCode OJ - Lowest Common Ancestor of a Binary Tree[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-integer-to-roman.html]LeetCode OJ - Integer to Roman[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-roman-to-integer.html]LeetCode OJ - Roman to Integer[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-longest-common-prefix.html]LeetCode OJ - Longest Common Prefix[/url]

[[i] 本帖最後由 darigold 於 2015-7-14 12:28 AM 編輯 [/i]]

darigold 2015-7-15 01:05 AM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-3sum.html]LeetCode OJ - 3Sum[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-product-of-array-except-self.html]LeetCode OJ - Product of Array Except Self[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-number-of-digit-one.html]LeetCode OJ - Number of Digit One[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-sliding-window-maximum.html]LeetCode OJ - Sliding Window Maximum[/url]

[[i] 本帖最後由 darigold 於 2015-7-19 12:57 AM 編輯 [/i]]

darigold 2015-7-19 07:26 AM

[url=https://leetcode.com/problems/min-stack/]LeetCode OJ - Min Stack[/url]
[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-power-of-two.html]LeetCode OJ - Power of Two[/url]

[[i] 本帖最後由 darigold 於 2015-7-19 08:02 AM 編輯 [/i]]

Susan﹏汪汪 2015-7-19 08:09 AM

Power of two汪汪係咁check

n & (n - 1) == 0

[url=http://www.discuss.com.hk/iphone][img=100,23]http://i.discuss.com.hk/d/images/r10/iphoneD.jpg[/img][/url]

darigold 2015-7-19 10:38 AM

[quote]原帖由 [i]Susan﹏汪汪[/i] 於 2015-7-19 08:09 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=421732845&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
Power of two汪汪係咁checkn & (n - 1) == 0
[/quote]

darigold 2015-7-19 10:40 AM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-kth-smallest-element-in-bst.html]Kth Smallest Element in a BST[/url]

Susan﹏汪汪 2015-7-19 11:02 AM

[quote]原帖由 [i]darigold[/i] 於 2015-7-19 10:38 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=421737771&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]

n - 1 = 25 (11001)
n & (n - 1) = 24 (11000)

n - 1 = 63 (111111)
n & (n - 1) = 0 (0)

darigold 2015-7-19 10:16 PM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-binary-search-tree-iterator.html]LeetCode OJ - Binary Search Tree Iterator[/url]

[[i] 本帖最後由 darigold 於 2015-7-19 10:18 PM 編輯 [/i]]

darigold 2015-7-19 10:23 PM

[quote]原帖由 [i]Susan﹏汪汪[/i] 於 2015-7-19 11:02 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=421738907&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]

n - 1 = 25 (11001)
n & (n - 1) = 24 (11000)

n - 1 = 63 (00111111)
n & (n - 1) = 0 (0) [/quote]

n - 1 = -1 (11111)
n & (n - 1) = 0 (00000)

n - 1 = int.Max (111111)
n & (n - 1) = 0 (0)加上n > 0 就 perfect。

darigold 2015-7-20 05:38 AM

darigold 2015-7-20 06:47 AM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-remove-duplicates-from_19.html]LeetCode OJ - Remove Duplicates from Sorted List[/url]

Susan﹏汪汪 2015-7-20 06:55 AM

[quote]原帖由 [i]darigold[/i] 於 2015-7-19 10:23 PM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=421777773&ptid=24497948][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]

n - 1 = -1 (11111)
n & (n - 1) = 0 (00000)

n - 1 = int.Max (111111)
n & (n - 1) = 0 (0)加上n > 0 就 perfect。 [/quote]

[url=http://www.discuss.com.hk/iphone][img=100,23]http://i.discuss.com.hk/d/images/r10/iphoneD.jpg[/img][/url]

darigold 2015-7-20 08:49 PM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-summary-ranges.html]LeetCode OJ - Summary Ranges[/url]

darigold 2015-7-21 09:26 PM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-remove-nth-node-from-end-of.html]LeetCode OJ - Remove Nth Node From End of List[/url]

darigold 2015-7-29 11:50 AM

[url=http://andrew-algorithm.blogspot.com/2015/07/leetcode-oj-search-2d-matrix-ii.html]Search a 2D Matrix II[/url]

[[i] 本帖最後由 darigold 於 2015-7-29 11:52 AM 編輯 [/i]]

darigold 2015-8-4 04:49 PM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-valid-anagram.html]LeetCode OJ - Valid Anagram[/url]

[[i] 本帖最後由 darigold 於 2015-8-4 04:53 PM 編輯 [/i]]

darigold 2015-8-4 06:04 PM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-implement-trie-prefix-tree.html]LeetCode OJ - Implement Trie (Prefix Tree)[/url]

darigold 2015-8-5 06:55 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-merge-two-sorted-lists.html]LeetCode OJ - Merge Two Sorted Lists[/url]

darigold 2015-8-5 08:24 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-contains-duplicate.html]LeetCode OJ - Contains Duplicate[/url]

darigold 2015-8-7 12:57 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-implement-stack-using-queues.html]LeetCode OJ - Implement Stack using Queues[/url]

darigold 2015-8-7 03:52 AM

darigold 2015-8-8 12:15 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-isomorphic-strings.html]LeetCode OJ - Isomorphic Strings[/url]

darigold 2015-8-9 09:12 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-pascals-triangle-ii.html]LeetCode OJ - Pascal's Triangle II[/url]

[[i] 本帖最後由 darigold 於 2015-8-9 09:13 AM 編輯 [/i]]

darigold 2015-8-11 12:51 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-contains-duplicate-ii.html]Contains Duplicate II[/url]

[[i] 本帖最後由 darigold 於 2015-8-11 12:52 AM 編輯 [/i]]

win10 上左架, 你唔係應該好忙整 sp1 既咩? 仲有心情 LeetCode :fst_002:

darigold 2015-8-11 07:30 AM

[quote]原帖由 [i]煙民母親生賤種[/i] 於 2015-8-11 01:25 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=423304892&ptid=24497948][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
win10 上左架, 你唔係應該好忙整 sp1 既咩? 仲有心情 LeetCode :fst_002:[/quote]

darigold 2015-8-13 12:46 AM

[url=http://andrew-algorithm.blogspot.com/2015/08/leetcode-oj-count-primes.html]LeetCode OJ - Count Primes[/url]

darigold 2015-8-13 02:12 AM