Mockbit/#66
ML CodingeasyNumpy~10m

The Filter

Problem

You are cleaning a dataset for a machine learning pipeline. Some feature values are below a quality threshold and must be removed before training. Given a 1D array of integers and a threshold value, return a new array containing only the elements strictly greater than the threshold, preserving their original order.

Examples

Example 1

Input: ([5, 10, 5, 15, 5], 5)
Output: [10, 15]

Elements equal to threshold (5) are excluded — strictly greater than only.

Example 2

Input: ([-50, -20, -10, 0], -15)
Output: [-10, 0]

Negative threshold works correctly — -10 > -15 and 0 > -15.

Example 3

Input: ([100, -5, 50, 0, 75], 10)
Output: [100, 50, 75]

Original order preserved — 100 comes before 50 before 75.

Constraints
  • 1 <= len(arr) <= 10000
  • -1000 <= arr[i] <= 1000
  • -1000 <= threshold <= 1000
Reference solution

Reference solution available after you attempt the question.

Ready to solve it?

Start a session on Mockbit #66. Write your code, run it against hidden tests, and get graded with specific critique on each axis.

Related ML Coding questions
← Back homemockbit.io/q/66
PrivacyTerms© 2026 Mockbit