結果 : maximum element with constraints hackerrank solution python