Company: Walmart sparkplug
Difficulty: medium
Maze Escape with Limited Resources You are given a maze represented by a 2D character array of size rows × cols, where each cell represents: Empty space as '-' Wall as '#' Key as 'K' Starting position as 'S' (Sx, Sy) Ending position as 'E' (Ex, Ey) You are provided with a certain number of keys and torches. When encountering a wall ('#'), you need to use a torch to enter that cell. Your objective is to traverse from the starting position ('S') to the ending position ('E'), collecting the required number of keys and using only the given number of torches. Return the count of all valid paths from (Sx, Sy) to (Ex, Ey), or -1 if no valid path is found. Note: The valid moves within the 2D array are: UP, DOWN, LEFT, and RIGHT. Input Format First line: Two space-separated integers, rows and cols, indicating the number of rows and columns respectively. Second line: Two space-separated integers, Sx and Sy, representing the coordinates of the starting position. Third line: Two space-separated in