Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Sum zero

Instructions

Given sorted list of integers implement a function which finds the first pair where the sum equals to 0. Return an pair that includes both values that sum to zero or null if a pair does not exist.

Challenge | Solution

Examples

sumZero(listOf(1, 2)) // null

sumZero(listOf(-3, -2, 0, 1, 2)) // Pair(-2, 2)

Hints

Hint 1 Use double pointer