#!/bin/ruby def largestValue(a) for i in 0...a.length for j in i+1...a.length end end # Return the largest value of any of A's nonempty subarrays. end n = gets.strip.to_i a = gets.strip a = a.split(' ').map(&:to_i) result = largestValue(A) puts result