Filter Values Above a Threshold (Set 6)

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 6) — the data. This set runs 4 cases: nums holds arrays of 26–48 items, with values from -30 to 60; limit ranges over -16–17. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [-20, 46, 39, 0, -29, 17, 22, 1, 55, 54, -25, -8, 56, 0, 7, -10, 18, -4, 15, 45, -15, 42, 23, 35, 45, 38], limit = -16
Output
[46, 39, 0, 17, 22, 1, 55, 54, -8, 56, 0, 7, -10, 18, -4, 15, 45, -15, 42, 23, 35, 45, 38]

Why

`filterGreaterThan` returns `[46, 39, 0, 17, 22, 1, 55, 54, -8, 56, 0, 7, -10, 18, -4, 15, 45, -15, 42, 23, 35, 45, 38]` for this input.

Example 2

filterGreaterThan()
Input
nums = [-24, 54, -18, 48, 25, -3, 6, 48, 54, 54, -13, 8, -9, 25, 9, -1, 12, -24, 1, 45, -25, 49, -21, 13, -7, 21, 46, -1], limit = -13
Output
[54, 48, 25, -3, 6, 48, 54, 54, 8, -9, 25, 9, -1, 12, 1, 45, 49, 13, -7, 21, 46, -1]

Why

`filterGreaterThan` returns `[54, 48, 25, -3, 6, 48, 54, 54, 8, -9, 25, 9, -1, 12, 1, 45, 49, 13, -7, 21, 46, -1]` 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.