Skip to content

Commit c4b15d6

Browse files
committed
chore(array) : rename files
1 parent eeefe9a commit c4b15d6

13 files changed

Lines changed: 22 additions & 14 deletions

simple_array/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
## easy
44

5+
- Advance By Offsets
56
- [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/)
7+
- Increment Any Arbitrary Precision Integer
68
- [K-Diff Pairs in an Array](https://leetcode.com/problems/k-diff-pairs-in-an-array/)
9+
- Minimum Steps To End
710
- [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)
11+
- [Shortest Unsorted Continuous Subarray](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/)
12+
- [Third Maximum Number](https://leetcode.com/problems/third-maximum-number/)
813

914
## medium
1015

1116
- [kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/)
17+
- Multiply Two Arbitrary Precision Integers
1218
- [Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/)
1319

1420
## hard
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# Difficulty Level : Easy
44
# URL : https://leetcode.com/problems/shortest-unsorted-continuous-subarray/
55
############################################################################
6+
from typing import List
67

78

89
class ShortestSubArray:
910
# runtime - 76.59%, memory - 52.05%
10-
def findUnsortedSubarray(self, nums: [int]) -> (int, [int]):
11+
def findUnsortedSubarray(self, nums: List[int]) -> int:
1112
if not nums:
1213
return 0
1314

@@ -29,13 +30,13 @@ def findUnsortedSubarray(self, nums: [int]) -> (int, [int]):
2930
start = index if start == -1 else start
3031
end = index
3132

32-
return (end - start + 1 if start != -1 else 0, sarr[end:start])
33+
return end - start + 1 if start != -1 else 0
3334

34-
def findUnsortedSubarray_concise(self, nums: [int]) -> int:
35+
def findUnsortedSubarray_concise(self, nums: List[int]) -> int:
3536
res = [i for (i, (a, b)) in enumerate(zip(nums, sorted(nums))) if a != b]
3637
return 0 if not res else (res[-1] - res[0] + 1)
3738

38-
def findUnsortedSubarray_no_sort(self, nums: [int]) -> int:
39+
def findUnsortedSubarray_no_sort(self, nums: List[int]) -> int:
3940
start, end = 0, len(nums) - 1
4041

4142
""" 'start' is the first index position where a number
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# Difficulty Level : Easy
44
# URL : https://leetcode.com/problems/third-maximum-number/
55
############################################################
6+
from typing import List
67

78

89
class ThirdLargestNumber:
910
# runtime -> 97.90%, memory -> 83.47%
1011
# complexity -> time O(n), space O(1)
11-
def find(self, nums: [int]) -> int:
12+
def find(self, nums: List[int]) -> int:
1213
if len(nums) < 3:
1314
return max(nums)
1415

simple_array/tests/advance_by_offsets_test.py renamed to simple_array/tests/e_advance_by_offsets_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from simple_array.advance_by_offsets import AdvanceByOffsets
1+
from simple_array.e_advance_by_offsets import AdvanceByOffsets
22

33

44
class TestAdvanceByOffsets:

simple_array/tests/int_as_array_increment_test.py renamed to simple_array/tests/e_int_as_array_increment_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from simple_array.int_as_array_increment import IncrementArray
1+
from simple_array.e_int_as_array_increment import IncrementArray
22

33

44
class TestIncrementArray:

simple_array/tests/min_steps_to_end_test.py renamed to simple_array/tests/e_min_steps_to_end_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from simple_array.min_steps_to_end import MinimumStepsToEnd
1+
from simple_array.e_min_steps_to_end import MinimumStepsToEnd
22

33

44
class TestMinimumStepsToEnd:

0 commit comments

Comments
 (0)