Codevita 1
Codevita 1
*;
This.foot1 = foot1;
This.foot2 = foot2;
This.moves = moves;
This.index = index;
If (!foot1.equals(foot2)) {
Queue.add(new State(foot1, foot2, 0, 0));
// BFS Loop
While (!queue.isEmpty()) {
If (current.index == N) {
Return current.moves;
If (!current.foot1.equals(target)) {
} else {
If (!current.foot2.equals(target)) {
nextStates.add(new State(current.foot1, target, current.moves + 1, current.index +
1));
} else {
If (!visited.contains(key)) {
Queue.add(nextState);
Visited.add(key);
Return -1; // This line will never be reached for valid inputs
// Input
Int N = scanner.nextInt();
Instructions[i] = scanner.nextLine();
// Output
System.out.println(minMoves(N, instructions));