leetle

Daily challenge for 2025-10-16

289. Remove Element

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. Return the number of elements in nums which are not equal to val. The relative order of elements may be changed.

Example:
Input: nums = [3,2,2,3], val = 3
Output: 2
Explanation: nums becomes [2,2,_,_] and we return 2

Run this challenge interactively in Python or JavaScript when the app loads.