Solution to Remove Duplicates from Sorted Array II by LeetCode

20 Jun

Question: https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/

Question Name: Remove Duplicates from Sorted Array II

The second previous element might be overwritten in the last round.

Well, inspired by http://www.mitbbs.com/article_t/JobHunting/32770131.html, there is a better and more generic solution as:

With the parameter M in _removeDuplicatesHelper, we could solve all the problems, which allow the occurrence at most M times.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!