Filter Greater Than

EasyData EngineeringArraySorting

Description

Given an array and a threshold, return only the values strictly greater than the threshold, preserving order.

Examples

Input:[1,5,3,8,2], 3
Output:[5,8]
Explanation:

Every value at or below the threshold is dropped and the rest stay in their original order.

Input:[1,2,3], 5
Output:[]
Explanation:

Every value at or below the threshold is dropped and the rest stay in their original order.

Input:[10,20,30], 0
Output:[10,20,30]
Explanation:

Every value at or below the threshold is dropped and the rest stay in their original order.

Constraints

  • 0 ≤ length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.