Last active
October 24, 2019 16:33
-
-
Save abdellani/d977b890896f0b142c96dc157d86d577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_pairs(array, k) | |
# write your code here | |
result=[] | |
array.each_with_index do |element,index| | |
result<<[element,k-element] if array[index+1..-1].include?(k-element) | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment