Leetcode 2503. Maximum Number of Points From Grid Queries
For each query threshold, compute how many distinct cells you can reach from the top-left by moving 4-directionally through cells whose value is strictly less than the query. With up to 10^6 cells and many queries, this is typically solved by answering thresholds offline (e.g., sort queries and progressively include/union cells by increasing value) to avoid repeated searches.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.