Replace all Negative Numbers with Zero

In this lesson, we will learn how to recursively replace all negative numbers with 0 in an array.

What does “Replace all Negative Numbers with 0” Mean?

An array can contain negative numbers. Our task is to replace all instances of negative numbers with 00 starting from a given index of the array.

This process does not create a new array. Rather, we are modifying the same array.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.