Filter Values Above a Threshold (Set 4)

Easy

Given an array of integers nums and a limit, return the values that are strictly greater than limit, in their original order.

Filter Values Above a Threshold (Set 4) — the data. This set runs 4 cases: nums holds arrays of 16–32 items, with values from -30 to 60; limit ranges over -3–24. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [-8, 11, 54, 0, 33, 5, 53, -1, 44, 41, -11, -27, -13, -9, -29, -1, 49, 46], limit = -3
Output
[11, 54, 0, 33, 5, 53, -1, 44, 41, -1, 49, 46]

Why

`filterGreaterThan` returns `[11, 54, 0, 33, 5, 53, -1, 44, 41, -1, 49, 46]` for this input.

Example 2

filterGreaterThan()
Input
nums = [-19, -23, -26, 32, 48, 54, -17, -11, 50, -23, 29, -1, 32, 12, 47, 35], limit = 13
Output
[32, 48, 54, 50, 29, 32, 47, 35]

Why

`filterGreaterThan` returns `[32, 48, 54, 50, 29, 32, 47, 35]` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i], limit <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

Arrays

Implement filterGreaterThan in the editor and return the answer — printing it is never graded.