Remove Duplicates from Sorted Array II Problem

Remove Duplicates from Sorted Array II Problem — ExecCode Medium DSA Practice

Solve the Remove Duplicates from Sorted Array II problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Remove Duplicates from Sorted Array II. Allow at most two copies. For Remove Duplicates from Sorted Array II, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input {"nums": [1, 1, 1, 2, 2, 3]}; Output 5

Constraints

1 ≤ n ≤ 10^5

Practice Remove Duplicates from Sorted Array II free on ExecCode. Browse DSA problems, topic map, and placement guides.