Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Sunday, August 10, 2014
Remove Duplicates from Sorted Array II
Problem
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
Idea
The idea is the same as Remove Duplicates from Sorted Array. We just use one parameter to record how many duplicates have happen.
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment