Skip to content

Commit bdbe007

Browse files
authored
Merge pull request #6 from SaykoMe/sayko-solutions
Sayko solutions
2 parents 7d9a9e7 + b129166 commit bdbe007

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Remove Duplicates from Sorted Array
2+
3+
class Solution(object):
4+
def removeDuplicates(self, nums):
5+
k = 1
6+
7+
for i in range(1, len(nums)):
8+
if nums[i] != nums[i - 1]:
9+
nums[k] = nums[i]
10+
k += 1
11+
12+
return k
13+
14+
solution = Solution()
15+
print(solution.removeDuplicates([1,1,2]))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
228228
- [Subarray Product Less Than K](Python/subarray_product_less_than_k.py)
229229
- [Valid Parentheses](Python/valid_parentheses.py)
230230
- [Remove Element](Python/remove_element.py)
231+
- [Remove Duplicates from Sorted Array](Python/remove_duplicates_from_sorted_array.py)

0 commit comments

Comments
 (0)