Optimal game strategy

can’t we it do it just like sort array and pick alternative elements from end it gives correct output