Wipro Elite NTH 2026 | Closest Element to Zero & Total Distance on a Coordinate Line

wipro · Question · Posted Jun 2026

Problem 1 - Find the Closest Element to Zero Problem Statement You are given an integer array arr of size N. Find the element whose value is closest to zero. If two elements are equally close to zero, return the positive element. Constraints Constraint 1 ≤ N ≤ 10000 -100000 ≤ arr[i] ≤ 100000 Test Cases Input Output Explanation N = 5, arr = [-4, -2, 1, 4, 8] 1 The absolute distances from zero are 4, 2, 1, 4, ...

The full answer & interview discussion are available to premium members.

Log in Create a free account