Filter Values Above a Threshold (Set 1)

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 1) — the data. This set runs 4 cases: nums holds arrays of 4–11 items, with values from -25 to 59; limit ranges over 5–18. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [58, 20, -4, 30, 21], limit = 5
Output
[58, 20, 30, 21]

Why

`filterGreaterThan` returns `[58, 20, 30, 21]` for this input.

Example 2

filterGreaterThan()
Input
nums = [32, -20, 46, 33], limit = 13
Output
[32, 46, 33]

Why

`filterGreaterThan` returns `[32, 46, 33]` 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.