(UVA) Playing with Wheels - Solution
Link to the problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1008 The problem asks us if it is possible to go from a state to another one without visiting states that are forbidden using the minimum number of operations. For this reason, the solution below used Breadth-First Search (BFS) to solve this problem. import java.io.*; import java.util.*; class Main { public int[][] forbidden; public int numForbidden; public int[] start; public int[] end; public int bfs(int s1, int s2, int s3, int s4) { Queue<State> queue = new ArrayDeque<>(); queue.add(new State(s1, s2, s3, s4, 0)); boolean[][][][] visited = new boolean...