leetle

Daily challenge for 2025-06-21

172. Remove Elements from Array

Write a function solve that removes all instances of a given value from an array and returns the modified array.

Example:
Input: nums = [3, 2, 2, 3], val = 3
Output: [2, 2]

Example 2:
Input: nums = [0, 1, 2, 2, 3, 0, 4, 2], val = 2
Output: [0, 1, 3, 0, 4]

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