Daily challenge for 2025-10-28
301. Remove Element
Given an integer array nums and an integer val, remove all occurrences of val in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.
Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things:
- Change the array nums such that the first k elements of nums contain the elements which are not equal to val.
- Return k.
Example:Input: nums = [3,2,2,3], val = 3Output: 2, nums = [2,2,_,_]
Run this challenge interactively in Python or JavaScript when the app loads.