Filter Values Above a Threshold (Set 8)

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 8) — the data. This set runs 4 cases: nums holds arrays of 32–46 items, with values from -30 to 59; limit ranges over -12–38. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [37, 54, 47, 55, 14, 6, 42, 3, -29, -4, -12, 15, 14, 5, 43, 33, 13, 24, -1, -6, -4, -9, 40, -28, -28, -30, 26, 51, 52, -11, 30, 32, 48, -21, -22, 42, 23], limit = -12
Output
[37, 54, 47, 55, 14, 6, 42, 3, -4, 15, 14, 5, 43, 33, 13, 24, -1, -6, -4, -9, 40, 26, 51, 52, -11, 30, 32, 48, 42, 23]

Why

`filterGreaterThan` returns `[37, 54, 47, 55, 14, 6, 42, 3, -4, 15, 14, 5, 43, 33, 13, 24, -1, -6, -4, -9, 40, 26, 51, 52, -11, 30, 32, 48, 42, 23]` for this input.

Example 2

filterGreaterThan()
Input
nums = [-2, 6, 30, -1, -21, 32, 6, -10, -28, -8, 41, 30, -17, -7, -9, 34, 24, -5, -23, -9, 47, 48, -10, 51, 7, 7, -7, 59, -21, -11, 7, 22], limit = -11
Output
[-2, 6, 30, -1, 32, 6, -10, -8, 41, 30, -7, -9, 34, 24, -5, -9, 47, 48, -10, 51, 7, 7, -7, 59, 7, 22]

Why

`filterGreaterThan` returns `[-2, 6, 30, -1, 32, 6, -10, -8, 41, 30, -7, -9, 34, 24, -5, -9, 47, 48, -10, 51, 7, 7, -7, 59, 7, 22]` 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.