Skip to content

Commit

Permalink
[Master] Update README and fix comments of Search 2D Matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Gu committed Dec 26, 2016
1 parent 143473b commit f1ca0da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* [Microsoft](#microsoft)

## Progress
[Problem Status](#problem-status) shows the latest progress to all 400+ questions. Currently we have 198 completed solutions. Note: questions with ♥ mark means that you have to **Subscript to premium membership** of LeetCode to unlock them. Thank you for great contributions from [CharleneJiang](https://github.com/CharleneJiang), [ReadmeCritic](https://github.com/ReadmeCritic), [demonkoo](https://github.com/demonkoo), [DaiYue](https://github.com/DaiYue), and [jindulys](https://github.com/jindulys).
[Problem Status](#problem-status) shows the latest progress to all 400+ questions. Currently we have 201 completed solutions. Note: questions with ♥ mark means that you have to **Subscript to premium membership** of LeetCode to unlock them. Thank you for great contributions from [CharleneJiang](https://github.com/CharleneJiang), [ReadmeCritic](https://github.com/ReadmeCritic), [demonkoo](https://github.com/demonkoo), [DaiYue](https://github.com/DaiYue), and [jindulys](https://github.com/jindulys).


## Array
Expand Down Expand Up @@ -235,6 +235,8 @@
[Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii/)| [Swift](./Search/SearchInRotatedSortedArrayII.swift)| Medium| O(logn)| O(1)|
[Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)| [Swift](./Search/FindMinimumRotatedSortedArray.swift)| Medium| O(logn)| O(1)|
[Find Minimum in Rotated Sorted Array II](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/)| [Swift](./Search/FindMinimumRotatedSortedArrayII.swift)| Hard| O(logn)| O(1)|
[Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/)| [Swift](./Search/Search2DMatrix.swift)| Medium| O(log(m + n))| O(1)|
[Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/)| [Swift](./Search/Search2DMatrixII.swift)| Medium| O(m + n)| O(1)|
[Search for a Range](https://leetcode.com/problems/search-for-a-range/)| [Swift](./Search/SearchForARange.swift)| Medium| O(logn)| O(1)|
[Search Insert Position](https://leetcode.com/problems/search-insert-position/)| [Swift](./Search/SearchForARange.swift)| Medium| O(logn)| O(1)|
[Find Peak Element](https://leetcode.com/problems/find-peak-element/)| [Swift](./Search/FindPeakElement.swift)| Medium| O(logn)| O(1)|
Expand All @@ -244,6 +246,7 @@
## Sort
| Title | Solution | Difficulty | Time | Space |
| ----- | -------- | ---------- | ---- | ----- |
[Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array/)| [Swift](./Sort/MergeSortedArray.swift)| Easy| O(n)| O(1)|
[Sort Colors](https://leetcode.com/problems/sort-colors/)| [Swift](./Sort/SortColors.swift)| Medium| O(n)| O(1)|
[Wiggle Sort](https://leetcode.com/problems/wiggle-sort/)| [Swift](./Sort/WiggleSort.swift)| Medium| O(n)| O(1)|
[Wiggle Sort II](https://leetcode.com/problems/wiggle-sort-ii/)| [Swift](./Sort/WiggleSortII.swift)| Medium| O(nlogn)| O(n)|
Expand Down Expand Up @@ -514,7 +517,7 @@
| [Swift](./String/ShortestWordDistance.swift) | 243 | [Shortest Word Distance](https://leetcode.com/problems/shortest-word-distance/) ♥ | Easy |
| [Swift](./String/ValidAnagram.swift) | 242 | [Valid Anagram](https://leetcode.com/problems/valid-anagram/) | Easy |
| | 241 | [Different Ways to Add Parentheses](https://leetcode.com/problems/different-ways-to-add-parentheses/) | Medium |
| | 240 | [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) | Medium |
| [Swift](./Search/Search2DMatrixII.swift) | 240 | [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) | Medium |
| [Swift](./Array/SlidingWindowMaximum.swift) | 239 | [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) | Hard |
| [Swift](./Array/ProductExceptSelf.swift) | 238 | [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) | Medium |
| | 237 | [Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/) | Easy |
Expand Down Expand Up @@ -650,7 +653,7 @@
| (./DP/DecodeWays.swift) | 91 | [Decode Ways](https://oj.leetcode.com/problems/decode-ways/) | Medium |
| [Swift](./DFS/SubsetsII.swift) | 90 | [Subsets II](https://oj.leetcode.com/problems/subsets-ii/) | Medium |
| | 89 | [Gray Code](https://oj.leetcode.com/problems/gray-code/) | Medium |
| | 88 | [Merge Sorted Array](https://oj.leetcode.com/problems/merge-sorted-array/) | Easy |
| [Swift](./Sort/MergeSortedArray.swift) | 88 | [Merge Sorted Array](https://oj.leetcode.com/problems/merge-sorted-array/) | Easy |
| | 87 | [Scramble String](https://oj.leetcode.com/problems/scramble-string/) | Hard |
| [Swift](./LinkedList/PartitionList.swift) | 86 | [Partition List](https://oj.leetcode.com/problems/partition-list/) | Medium |
| | 85 | [Maximal Rectangle](https://oj.leetcode.com/problems/maximal-rectangle/) | Hard |
Expand All @@ -664,7 +667,7 @@
| [Swift](./DFS/combinations.swift) | 77 | [Combinations](https://oj.leetcode.com/problems/combinations/) | Medium |
| [Swift](./Array/MinimumWindowSubstring.swift) | 76 | [Minimum Window Substring](https://oj.leetcode.com/problems/minimum-window-substring/) | Hard |
| [Swift](./Sort/SortColors.swift) | 75 | [Sort Colors](https://oj.leetcode.com/problems/sort-colors/) | Medium |
| | 74 | [Search a 2D Matrix](https://oj.leetcode.com/problems/search-a-2d-matrix/) | Medium |
| [Swift](./Search/Search2DMatrix.swift) | 74 | [Search a 2D Matrix](https://oj.leetcode.com/problems/search-a-2d-matrix/) | Medium |
| [Swift](./Array/SetMatrixZero.swift) | 73 | [Set Matrix Zeroes](https://oj.leetcode.com/problems/set-matrix-zeroes/) | Medium |
| [Swift](./DP/EditDistance.swift) | 72 | [Edit Distance](https://oj.leetcode.com/problems/edit-distance/) | Hard |
| [Swift](./Stack/SimplifyPath.swift) | 71 | [Simplify Path](https://oj.leetcode.com/problems/simplify-path/) | Medium |
Expand Down
4 changes: 2 additions & 2 deletions Search/Search2DMatrix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Question Link: https://leetcode.com/problems/search-a-2d-matrix/
* Primary idea: Search col and then binary search row
*
* Time Complexity: O(log(m + n), Space Complexity: O(1)
* Time Complexity: O(log(m + n)), Space Complexity: O(1)
*/

class Search2DMatrix {
Expand Down Expand Up @@ -48,4 +48,4 @@ class Search2DMatrix {

return false
}
}
}

0 comments on commit f1ca0da

Please sign in to comment.