Skip to content

Latest commit

 

History

History
executable file
·
7 lines (4 loc) · 390 Bytes

80.md

File metadata and controls

executable file
·
7 lines (4 loc) · 390 Bytes
  1. Remove Duplicates from Sorted Array II

Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

Maybe just scan and record the last one, and only permit the last one that show up twice.