Filter Values Above a Threshold (Set 11)

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 11) — the data. This set runs 4 cases: nums holds arrays of 44–47 items, with values from -29 to 60; limit ranges over 10–37. The hidden cases are the largest of the set.

Example 1

filterGreaterThan()
Input
nums = [-27, 32, 22, 31, 55, 9, 7, 26, -6, 0, -15, 25, -16, 51, -12, 29, -8, 13, -15, -24, 4, -7, 59, -9, -27, 31, -21, 16, 51, 16, -14, -10, 14, 33, 40, 57, 41, 53, 5, 6, 3, 19, 41, -15], limit = 10
Output
[32, 22, 31, 55, 26, 25, 51, 29, 13, 59, 31, 16, 51, 16, 14, 33, 40, 57, 41, 53, 19, 41]

Why

`filterGreaterThan` returns `[32, 22, 31, 55, 26, 25, 51, 29, 13, 59, 31, 16, 51, 16, 14, 33, 40, 57, 41, 53, 19, 41]` for this input.

Example 2

filterGreaterThan()
Input
nums = [14, -3, 4, 0, 52, -27, 0, 24, 6, 59, 50, 58, 31, 21, -22, 45, 37, -5, -20, -9, 32, 48, 2, 45, -20, 29, 4, 39, -28, 13, 6, 39, 32, 52, 31, 22, 15, -20, 54, -27, -7, 57, 53, -9, 52, 15, -2], limit = 16
Output
[52, 24, 59, 50, 58, 31, 21, 45, 37, 32, 48, 45, 29, 39, 39, 32, 52, 31, 22, 54, 57, 53, 52]

Why

`filterGreaterThan` returns `[52, 24, 59, 50, 58, 31, 21, 45, 37, 32, 48, 45, 29, 39, 39, 32, 52, 31, 22, 54, 57, 53, 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.