Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

You are given an array of integers nums and an array of indices query. For each index in query, consider the suffix of nums that starts at that index and continues to the end of the array, and determine how many times the largest value in that suffix occurs. Return an array of these counts, in the same order as query.

Test Cases
Input
Output
Expected