結果 : maximizing element with constraints hackerrank solution java