If current sum is smaller than minsum
Sum = j + Map [ list2 [ j ] ] NEW_LINE if ( Sum < minsum ) : NEW_LINE INDENT minsum = Sum NEW_LINE res . clear ( ) NEW_LINE res . append ( list2 [ j ] ) NEW_LINE DEDENT