Month End Sale: Get Extra 10% OFF on Job-oriented Training! Offer Ending in
D
H
M
S
Get Now

Java: Two Elements whose Sum is Closest to Zero

Level : Intermediate
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:30:00

Lab Details

Difficulty Level: MEDIUM

Problem Statement:

An Array of integers is given, both +ve and -ve. You need to find the two elements such that their sum is closest to zero.

Input:

arr[] = {1, 80, -10, 70, -60, 65}

Output:

The two elements whose sum is minimum are -80 and 85


Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this