This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://leetcode.com/problems/search-in-rotated-sorted-array/ | |
| // | |
| // Time: O(log n) | |
| // Space: O(1) | |
| // | |
| // n = number of elements in the array | |
| // .................... // | |
| func search(nums []int, target int) int { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://leetcode.com/problems/search-a-2d-matrix/ | |
| // | |
| // Time: O(log(m*n)) | |
| // Space: O(1) | |
| // | |
| // m = number of rows | |
| // n = number of columns | |
| // .................... // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://leetcode.com/problems/reverse-linked-list/ | |
| // | |
| // Time: O(N) | |
| // Space: O(1) | |
| // | |
| // N = number of nodes in the list | |
| // .................... // | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://leetcode.com/problems/add-two-numbers/ | |
| // | |
| // Time: O(N) | |
| // Space: O(N) | |
| // | |
| // N = number of nodes in the longer list | |
| // .................... // | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://leetcode.com/problems/merge-k-sorted-lists | |
| // | |
| // Time: O(N log k) | |
| // Space: O(k) | |
| // | |
| // k = len(lists) | |
| // N = total number of nodes across all lists | |
| // .................... // |
NewerOlder