Your question is Delete Number From Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
FlexTrade Systems Inc. processes fixed-size numeric buffers for market-data calculations. Given a static array of integers and a target value, remove every occurrence of the target in place, preserving the relative order of all remaining elements.
Implement remove_all(nums, target). The function receives nums, a mutable list of integers, and target, an integer. Compact the retained values into the beginning of nums, truncate the list to the new logical length, and return the resulting list. Do not create another list proportional to the input size.
If the target does not occur, leave the array unchanged. If every element equals the target, return an empty list.
def remove_all(nums, target):