Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

The pair with average

Instructions

Given sorted array of integers and target average implement a function which determine if there is a pair of values in the list where their average equals target average.

Challenge | Solution

Examples

has_pair_average?([], 1.0) # false

has_pair_average?([3, 4, 7, 9], 6.5) # true

has_pair_average?([3, 4, 7, 9], 3.0) # false

has_pair_average?([3, 5, 9, 7, 11, 14], 8.0) # true

Hints

Hint 1 Use double pointer