simple-exercises/ruby-exercises/easy-4.rb
# Panoramic Pairs
# ------------------------------------------------------------------------------
# You have a panoramic view in front of you, but you only can take a picture of
# two landmarks at a time (your camera is small).  You want to capture every
# pair of landmarks that are next to each other.
#
# Given an array of landmarks, return every adjacent pair from left to right.
# Assume the panorama wraps around.
Panoramic Pairs
You have a panoramic view in front of you, but you only can take a picture of
two landmarks at a time (your camera is small).  You want to capture every
pair of landmarks that are next to each other.

Given an array of landmarks, return every adjacent pair from left to right.
Assume the panorama wraps around.
Panoramic Pairs You have a panoramic view in front of you but you only can take a picture of two landmarks at a time ( your camera is small ) . You want to capture every pair of landmarks that are next to each other . Given an array of landmarks return every adjacent pair from left to right . Assume the panorama wraps around .
def panoramic_pairs(landmarks)
  n = landmarks.length - 1
  pairs = []
  (0...n).each do |i|
    pairs << [landmarks[i], landmarks[i + 1]]
  end
  pairs << [landmarks[-1], landmarks[0]]
  pairs
end
def panoramic_pairs ( landmarks ) n = landmarks . length - 1 pairs = [ ] ( 0 ... n ) . each do | i | pairs << [ landmarks [ i ] , landmarks [ i + 1 ] ] end pairs << [ landmarks [ - 1 ] , landmarks [ 0 ] ] pairs end
Panoramic Pairs
You have a panoramic view in front of you, but you only can take a picture of
two landmarks at a time (your camera is small).
Panoramic Pairs You have a panoramic view in front of you but you only can take a picture of two landmarks at a time ( your camera is small ) .
landmarks
<not_specific>