Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc0bfcc

Browse files
committed
update
1 parent 60dc7cf commit cc0bfcc

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

‎README.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,8 @@
2626
</p>
2727
<br>
2828

29-
30-
<!---Content--->
31-
## Index
32-
33-
* [Linked List](https://github.com/yuzhoujr/LeetCode#linked-list)
34-
35-
36-
37-
38-
39-
40-
41-
42-
4329
## Array Easy
44-
| # | Title | Solution | Time | Space | Video|
45-
| --- | ----- | -------- | ---- | ----- | ---- |
46-
|1| [Two Sum](https://leetcode.com/problems/two-sum/) | [Python](./array/1.py) | _O(n)_| _O(n)_ |[:tv:](https://www.youtube.com/watch?v=uajne4jeGaA)|
47-
48-
49-
30+
|624| [Maximum Distance in Arrays](https://leetcode.com/problems/maximum-distance-in-arrays/description/) | [Python](./array/624.py) | _O(n)_| _O(1)_ ||
5031

5132

5233
## Array Medium
@@ -55,12 +36,17 @@
5536
|3| [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/#/solutions) | [Python](./array/3.py) | _O(n)_| _O(n)_ ||
5637
|463| [Island Perimeter](https://leetcode.com/problems/island-perimeter/#/description) | [Python](./array/463.py) | _O(n^2)_| _O(1)_||
5738

39+
## Hash Table Easy
40+
| # | Title | Solution | Time | Space | Video|
41+
| --- | ----- | -------- | ---- | ----- | ---- |
42+
|1| [Two Sum](https://leetcode.com/problems/two-sum/) | [Python](./array/1.py) | _O(n)_| _O(n)_ |[:tv:](https://www.youtube.com/watch?v=uajne4jeGaA)|
43+
|242| [Valid Anagram](https://leetcode.com/problems/valid-anagram/description/) | [Python](./array/242.py) | _O(n)_| _O(n)_ ||
44+
45+
5846

5947

6048

6149

62-
## Linked List
63-
[Overview](http://www.cnblogs.com/Raising-Sun/p/5970662.html#3534606)
6450

6551
## Linked List Easy
6652
| # | Title | Solution | Time | Space | Video|

‎array/624.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution(object):
2+
def maxDistance(self, nums):
3+
"""
4+
:type arrays: List[List[int]]
5+
:rtype: int
6+
"""
7+
low = float('inf')
8+
high = float('-inf')
9+
res = 0
10+
for num in nums:
11+
# We can use num[0] && num[-1] only because these lists are sorted
12+
res = max(res, max(high - num[0], num[-1] - low))
13+
low = min(low, min(num))
14+
high = max(high, max(num))
15+
return res
16+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /