Skip to content

Commit a5f2116

Browse files
committed
update readme
1 parent 02cff0f commit a5f2116

File tree

4 files changed

+5
-60
lines changed

4 files changed

+5
-60
lines changed

.github/test.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
3731-find-missing-elements python easy
2-
3732-maximum-product-of-three-elements-after-one-replacement python medium
3-
3733-minimum-time-to-complete-all-deliveries python medium
4-
3318-find-x-sum-of-all-k-long-subarrays-i python easy

1009-pancake-sorting/1009-pancake-sorting.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

Python/0969-pancake-sorting.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,12 @@
44

55

66
class Solution:
7-
def pancakeSort(self, arr: List[int]) -> List[int]:
8-
9-
def flip(sublist, k):
10-
i = 0
11-
while i < k / 2:
12-
sublist[i], sublist[k-i-1] = sublist[k-i-1], sublist[i]
13-
i += 1
7+
def pancakeSort(self, arr: List[int]):
148
result = []
15-
valueToSort = len(arr)
16-
while valueToSort > 0:
17-
index = arr.index(valueToSort)
18-
if index != valueToSort - 1:
19-
if index != 0:
20-
result.append(index+1)
21-
flip(arr, index+1)
22-
result.append(valueToSort)
23-
flip(arr, valueToSort)
24-
valueToSort -= 1
9+
for lastIdx in range(len(arr), 1, -1):
10+
currIdx = arr.index(lastIdx)
11+
result.extend([currIdx + 1, lastIdx])
12+
arr = arr[:currIdx:-1] + arr[:currIdx]
2513
return result
2614

2715

README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,23 +115,3 @@ It helps others discover the repo and keeps the project growing.
115115
---
116116

117117
Feedback / Questions → open an Issue or reach out on [LinkedIn](https://www.linkedin.com/in/hogan-l/)
118-
119-
<!---LeetCode Topics Start-->
120-
# LeetCode Topics
121-
## Array
122-
| |
123-
| ------- |
124-
| [1009-pancake-sorting](https://github.com/hogan-tech/leetcode-solution/tree/master/1009-pancake-sorting) |
125-
## Two Pointers
126-
| |
127-
| ------- |
128-
| [1009-pancake-sorting](https://github.com/hogan-tech/leetcode-solution/tree/master/1009-pancake-sorting) |
129-
## Greedy
130-
| |
131-
| ------- |
132-
| [1009-pancake-sorting](https://github.com/hogan-tech/leetcode-solution/tree/master/1009-pancake-sorting) |
133-
## Sorting
134-
| |
135-
| ------- |
136-
| [1009-pancake-sorting](https://github.com/hogan-tech/leetcode-solution/tree/master/1009-pancake-sorting) |
137-
<!---LeetCode Topics End-->

0 commit comments

Comments
 (0)