Question: RUBY ONLY Define a method max_2_sum(array) which takes an array of integers as an argument and returns the sum of its two largest elements. For
RUBY ONLY
Define a method max_2_sum(array) which takes an array of integers as an argument and returns the sum of its two largest elements. For an empty array it should return zero. For an array with just one element, it should return that element. Run associated tests via: $ rspec spec/part1_spec.rb:23
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
