- Quiz
- Test Cases
- Solution
- Solution 1
- Solution 2
Test Case 1
Input
node = 0 -> 1 -> 2 -> 3 -> 4 -> 5
Output
1 -> 0 -> 3 -> 2 -> 5 -> 4
Test Case 2
Input
node = 0 -> 1 -> 2 -> 3 -> 4
Output
1 -> 0 -> 3 -> 2 -> 4
Test Case 3
Input
node = 0
Output
0
Test Case 4
Input
node = 0 -> 1
Output
1 -> 0
Test Case 5
Input
node = 1 -> 0 -> 3 -> 2 -> 5 -> 4
Output
0 -> 1 -> 2 -> 3 -> 4 -> 5
- My Answer
- Lecture
- Output