You are given a 2D grid representing a city map.Each cell contains one of the following characters: You are allowed to move in four directions:up, down, left, right You are given a list of query locations in:[row, col] format For each query location, return the minimum distance to the nearest DashMart.If the location is out…