Year End Sale: Get Upto 40% OFF on Live 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
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ 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