Filter Values Above a Threshold (Set 5)

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

Example 1

filterGreaterThan()
Input
nums = [51, 7, 25, 29, 2, -21, 6, 10, -30, 42, 18, -13, 22, -3, 47, 42, -20, 56, 1, -28, -15, 40, 38, 10], limit = -15
Output
[51, 7, 25, 29, 2, 6, 10, 42, 18, -13, 22, -3, 47, 42, 56, 1, 40, 38, 10]

Why

`filterGreaterThan` returns `[51, 7, 25, 29, 2, 6, 10, 42, 18, -13, 22, -3, 47, 42, 56, 1, 40, 38, 10]` for this input.

Example 2

filterGreaterThan()
Input
nums = [8, -3, 4, -8, 20, -11, 44, 27, 55, -13, 10, -14, 15, 55, -9, 32, 21, 21, 2, 59, 2, 51, 52], limit = 31
Output
[44, 55, 55, 32, 59, 51, 52]

Why

`filterGreaterThan` returns `[44, 55, 55, 32, 59, 51, 52]` 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.