Most Beautiful Item for Each Query | Leetcode 2070