Skip to content

Commit a2f5598

Browse files
committed
reorganize arrays
1 parent 194500a commit a2f5598

16 files changed

+94
-58
lines changed

algorithms/arrays/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from .delete_nth import *
2+
from .flatten import *
3+
from .garage import *
4+
from .josephus import *
5+
from .longest_non_repeat import *
6+
from .merge_intervals import *
7+
from .missing_ranges import *
8+
from .move_zeros import *
9+
from .plus_one import *
10+
from .rotate import *
11+
from .summarize_ranges import *
12+
from .three_sum import *
13+
from .two_sum import *
File renamed without changes.

arrays/flatten.py renamed to algorithms/arrays/flatten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def flatten_iter(iterable):
2626
"""
2727
for element in iterable:
2828
if isinstance(element, Iterable):
29-
yield from flatten(element)
29+
yield from flatten_iter(element)
3030
else:
3131
yield element
File renamed without changes.
File renamed without changes.

arrays/longest_non_repeat.py renamed to algorithms/arrays/longest_non_repeat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212

13-
def longest_non_repeat(string):
13+
def longest_non_repeat_v1(string):
1414
"""
1515
Finds the length of the longest substring
1616
without repeating characters.
@@ -27,7 +27,7 @@ def longest_non_repeat(string):
2727
return max_len
2828

2929

30-
def longest_non_repeat_two(string):
30+
def longest_non_repeat_v2(string):
3131
"""
3232
Finds the length of the longest substring
3333
without repeating characters.

arrays/merge_intervals.py renamed to algorithms/arrays/merge_intervals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def print_intervals(intervals):
6464
print("".join(res))
6565

6666

67-
def merge_v2(intervals):
67+
def merge_intervals(intervals):
6868
""" Merges intervals in the form of list. """
6969
if intervals is None:
7070
return None
File renamed without changes.
File renamed without changes.

arrays/plus_one.py renamed to algorithms/arrays/plus_one.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99

10-
def plus_one(digits):
10+
def plus_one_v1(digits):
1111
"""
1212
:type digits: List[int]
1313
:rtype: List[int]

0 commit comments

Comments
 (0)