Practice K Highest Ranked Items Within a Price Range
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
K Highest Ranked Items Within a Price Range
Problem Statement
In grid, 0 is an impassable wall, 1 is a passable empty cell, and values greater than 1 are passable item cells whose values are prices. Starting at start = [row,col], move between side-adjacent passable cells at one step per move. Return coordinates of up to k reachable items priced within pricing = [low,high] inclusive, ordered by shortest distance, then price, then row, then column, all ascending.
Source: K Highest Ranked Items Within a Price Range on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
grid = [[1,2,0,1],[1,3,0,1],[0,2,5,1]], pricing = [2,5], start = [0,0], k = 3
[[0,1],[1,1],[2,1]]
# Example 2
grid = [[1,2,0,1],[1,3,3,1],[0,2,5,1]], pricing = [2,3], start = [2,3], k = 2
[[2,1],[1,2]]
# Example 3
grid = [[1,1,1],[0,0,1],[2,3,4]], pricing = [2,3], start = [0,0], k = 3
[[2,1],[2,0]]
Constraints
Related LeetCode Problems
Practice more problems similar to K Highest Ranked Items Within a Price Range.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.