Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Remove Duplicates from Sorted Array II
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Remove duplicates from sorted array allowing at most two occurrences of each element.
Sample Input:
[1,1,1,2,2,3]
Sample Output:
5
Hints
Hint 1
Use two pointers: one for reading, one for writing
Hint 2
Allow element if count <= 2
Hint 3
Track count of current element
Code Editor
Reset
Run
Save
Loading...