Filter Values Above a Threshold (Set 3)

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 3) — the data. This set runs 4 cases: nums holds arrays of 13–20 items, with values from -28 to 58; limit ranges over 5–33. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [8, 7, 28, 0, 12, 6, -8, 51, -14, 44, 39, -10, 47, -23, 36, 58, 18, 33, -3, -22], limit = 33
Output
[51, 44, 39, 47, 36, 58]

Why

`filterGreaterThan` returns `[51, 44, 39, 47, 36, 58]` for this input.

Example 2

filterGreaterThan()
Input
nums = [22, -25, -1, 0, 28, 31, -28, -20, 34, -5, 7, 3, -25, 48], limit = 21
Output
[22, 28, 31, 34, 48]

Why

`filterGreaterThan` returns `[22, 28, 31, 34, 48]` 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.