Most Beautiful Item For Each Query Leetcode