ReLU Activation

EasyMachine LearningArray

Description

Given an array nums, apply the ReLU activation (replace every negative value with 0) and return the resulting array.

Examples

Input:nums = [-1,2,-3,4]
Output:[0,2,0,4]
Explanation:

Clamping every negative entry to zero yields [0,2,0,4].

Input:nums = [0,0,0]
Output:[0,0,0]
Explanation:

Clamping every negative entry to zero yields [0,0,0].

Input:nums = [5,6]
Output:[5,6]
Explanation:

Clamping every negative entry to zero yields [5,6].

Constraints

  • 1 ≤ nums.length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.