remove-duplicates-from-sorted-array: wrong result on empty list
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
Open remove-duplicates-from-sorted-array/solution.py and inspect removeDuplicates, starting with its behavior when nums is empty. Add the empty-input handling described in the issue, then verify that an empty list returns 0 and existing sorted-list behavior is unchanged.
Written by the indexing model from the issue text.
Description
removeDuplicates starts k=1 with no empty-list guard, so an empty input returns 1 instead of 0 — a latent bug masked by LeetCode's 1 <= nums.length constraint.
File: remove-duplicates-from-sorted-array/solution.py
Suggested fix: Add 'if not nums: return 0' guard.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from benthomasson/leetcode-implementations
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
All issues in benthomasson/leetcode-implementations
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100