Remove Element
Easy · Arrays & Strings · about 10 minutes
Asked at Bloomberg, Google, Microsoft, Amazon, Meta.
Given an integer array nums and a value val, remove every occurrence of val in place and return k, the number of remaining elements. The first k positions must hold the remaining elements (in any order); only the returned count is checked here.