Skip to content

added my solution for problem 1 #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added my solution to 26
  • Loading branch information
BonKRrr committed May 6, 2025
commit 277ee6c0baad1bc7a369b7d92a58d9aa86acdda5
8 changes: 8 additions & 0 deletions Python/26_Remove_Duplicates_from_Sorted_Array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
i = 1
while i<len(nums): #traverse array
if nums[i] == nums[i-1]: #if the current element is same as previous, then remove
nums.pop(i)
else:
i += 1