Skip to content

Commit fa29e41

Browse files
refactor 1182
1 parent 0c5a8ea commit fa29e41

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/main/java/com/fishercoder/solutions/_1182.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@
55
import java.util.List;
66
import java.util.Map;
77

8-
/**
9-
* 1182. Shortest Distance to Target Color
10-
*
11-
* You are given an array colors, in which there are three colors: 1, 2 and 3.
12-
* You are also given some queries. Each query consists of two integers i and c,
13-
* return the shortest distance between the given index i and the target color c. If there is no solution return -1.
14-
*
15-
* Example 1:
16-
* Input: colors = [1,1,2,1,3,2,2,3,3], queries = [[1,3],[2,2],[6,1]]
17-
* Output: [3,0,3]
18-
* Explanation:
19-
* The nearest 3 from index 1 is at index 4 (3 steps away).
20-
* The nearest 2 from index 2 is at index 2 itself (0 steps away).
21-
* The nearest 1 from index 6 is at index 3 (3 steps away).
22-
*
23-
* Example 2:
24-
* Input: colors = [1,2], queries = [[0,3]]
25-
* Output: [-1]
26-
* Explanation: There is no 3 in the array.
27-
*
28-
* Constraints:
29-
* 1 <= colors.length <= 5*10^4
30-
* 1 <= colors[i] <= 3
31-
* 1 <= queries.length <= 5*10^4
32-
* queries[i].length == 2
33-
* 0 <= queries[i][0] < colors.length
34-
* 1 <= queries[i][1] <= 3
35-
* */
368
public class _1182 {
379
public static class Solution1 {
3810
public List<Integer> shortestDistanceColor(int[] colors, int[][] queries) {

0 commit comments

Comments
 (0)