diff --git a/.github/workflows/interview_prep.yml b/.github/workflows/interview_prep.yml index d7f2f4fa..b244b5a4 100644 --- a/.github/workflows/interview_prep.yml +++ b/.github/workflows/interview_prep.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Rust toolchain uses: actions-rs/toolchain@v1 with: @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python 3.x uses: actions/setup-python@v2 with: @@ -41,13 +41,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 with: - java-version: 17 - distribution: 'adopt' + java-version: 21 + distribution: 'corretto' - name: Build and test Java run: | - cd interview_prep/algorithm/java17 + cd interview_prep/algorithm/java ./mvnw test \ No newline at end of file diff --git a/interview_prep/algorithm/java17/.mvn/wrapper/maven-wrapper.properties b/interview_prep/algorithm/java/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from interview_prep/algorithm/java17/.mvn/wrapper/maven-wrapper.properties rename to interview_prep/algorithm/java/.mvn/wrapper/maven-wrapper.properties diff --git a/interview_prep/algorithm/java/.vscode/settings.json b/interview_prep/algorithm/java/.vscode/settings.json new file mode 100644 index 00000000..c995aa5c --- /dev/null +++ b/interview_prep/algorithm/java/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.debug.settings.onBuildFailureProceed": true +} \ No newline at end of file diff --git a/interview_prep/algorithm/java17/README.md b/interview_prep/algorithm/java/README.md similarity index 100% rename from interview_prep/algorithm/java17/README.md rename to interview_prep/algorithm/java/README.md diff --git a/interview_prep/algorithm/java17/mvnw b/interview_prep/algorithm/java/mvnw similarity index 100% rename from interview_prep/algorithm/java17/mvnw rename to interview_prep/algorithm/java/mvnw diff --git a/interview_prep/algorithm/java17/mvnw.cmd b/interview_prep/algorithm/java/mvnw.cmd similarity index 100% rename from interview_prep/algorithm/java17/mvnw.cmd rename to interview_prep/algorithm/java/mvnw.cmd diff --git a/interview_prep/algorithm/java17/pom.xml b/interview_prep/algorithm/java/pom.xml similarity index 96% rename from interview_prep/algorithm/java17/pom.xml rename to interview_prep/algorithm/java/pom.xml index f13c8621..accf2744 100644 --- a/interview_prep/algorithm/java17/pom.xml +++ b/interview_prep/algorithm/java/pom.xml @@ -14,8 +14,8 @@ UTF-8 - 17 - 17 + 21 + 21 diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/App.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/App.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/App.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/App.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ListNode.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ListNode.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ListNode.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ListNode.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Edge.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Edge.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Edge.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Edge.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Graph.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Graph.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Graph.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Graph.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Search.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Search.java similarity index 97% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Search.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Search.java index e4160a68..65ecde2a 100644 --- a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/Search.java +++ b/interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/Search.java @@ -126,11 +126,13 @@ public static Node bfs( while (!frontier.isEmpty()) { Node currentNode = frontier.poll(); T currentState = currentNode.state; + System.out.println("currentState: "+currentState); if (goalTest.test(currentState)) { return currentNode; } // check where we can go next and haven't explored for (T child : successors.apply(currentState)) { + System.out.println("child " +child+", visited:" + explored); if (explored.contains(child)) { continue; // skip children we already explored } diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/UndirectedGraph.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/UndirectedGraph.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/classic/graph/UndirectedGraph.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/classic/graph/UndirectedGraph.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/FindAllAnagramsInAString.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/FindAllAnagramsInAString.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/FindAllAnagramsInAString.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/FindAllAnagramsInAString.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/LongestCommonSubsequence.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/LongestCommonSubsequence.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/LongestCommonSubsequence.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/LongestCommonSubsequence.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/RegularExpressionMatching.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/RegularExpressionMatching.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/RegularExpressionMatching.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/RegularExpressionMatching.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/StrongPasswordChecker.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/StrongPasswordChecker.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/StrongPasswordChecker.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/StrongPasswordChecker.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/TrappingRainWater.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/TrappingRainWater.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/TrappingRainWater.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/TrappingRainWater.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/WildcardMatching.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/WildcardMatching.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/WildcardMatching.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/WildcardMatching.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/ZigzagConversion.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/ZigzagConversion.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/diff/ZigzagConversion.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/diff/ZigzagConversion.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/AddTwoNumbers.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/AddTwoNumbers.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/AddTwoNumbers.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/AddTwoNumbers.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/AppleAndOrange.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/AppleAndOrange.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/AppleAndOrange.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/AppleAndOrange.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/BinaryTree.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/BinaryTree.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/BinaryTree.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/BinaryTree.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/BirthdayBar.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/BirthdayBar.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/BirthdayBar.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/BirthdayBar.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/Fib.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/Fib.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/Fib.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/Fib.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/Knapsack01.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/Knapsack01.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/Knapsack01.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/Knapsack01.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/LongestPalindrome.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/LongestPalindrome.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/LongestPalindrome.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/LongestPalindrome.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/PartitionEqualSubSetSum.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/PartitionEqualSubSetSum.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/PartitionEqualSubSetSum.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/PartitionEqualSubSetSum.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/PerfectNumber.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/PerfectNumber.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/PerfectNumber.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/PerfectNumber.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/RepeatedSubstringPattern.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/RepeatedSubstringPattern.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/RepeatedSubstringPattern.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/RepeatedSubstringPattern.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/ReverseInteger.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/ReverseInteger.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/ReverseInteger.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/ReverseInteger.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/SearchInsertPosition.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/SearchInsertPosition.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/SearchInsertPosition.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/SearchInsertPosition.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/ShortestUnsortedSubArray.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/ShortestUnsortedSubArray.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/ShortestUnsortedSubArray.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/ShortestUnsortedSubArray.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/SubArrGivenSum.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/SubArrGivenSum.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/SubArrGivenSum.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/SubArrGivenSum.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TheTimeInWords.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TheTimeInWords.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TheTimeInWords.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TheTimeInWords.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TreeNode.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TreeNode.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TreeNode.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TreeNode.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TwoSum.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TwoSum.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/ez/TwoSum.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/ez/TwoSum.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/Constraint.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/med/Constraint.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/Constraint.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/med/Constraint.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/ConstraintSatisfactionProblem.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/med/ConstraintSatisfactionProblem.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/ConstraintSatisfactionProblem.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/med/ConstraintSatisfactionProblem.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/EightQueensProblem.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/med/EightQueensProblem.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/EightQueensProblem.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/med/EightQueensProblem.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/MapColoringProblem.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/med/MapColoringProblem.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/MapColoringProblem.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/med/MapColoringProblem.java diff --git a/interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/SimplifyPath.java b/interview_prep/algorithm/java/src/main/java/hoa/can/code/med/SimplifyPath.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/hoa/can/code/med/SimplifyPath.java rename to interview_prep/algorithm/java/src/main/java/hoa/can/code/med/SimplifyPath.java diff --git a/interview_prep/algorithm/java17/src/main/java/util/Array.java b/interview_prep/algorithm/java/src/main/java/util/Array.java similarity index 100% rename from interview_prep/algorithm/java17/src/main/java/util/Array.java rename to interview_prep/algorithm/java/src/main/java/util/Array.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/PartitionEqualSubSetSumTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/PartitionEqualSubSetSumTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/PartitionEqualSubSetSumTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/PartitionEqualSubSetSumTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/AddTwoNumbersTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/AddTwoNumbersTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/AddTwoNumbersTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/AddTwoNumbersTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/AppleAndOrangeTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/AppleAndOrangeTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/AppleAndOrangeTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/AppleAndOrangeTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/BinaryTreeTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/BinaryTreeTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/BinaryTreeTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/BinaryTreeTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/BirthdayBarTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/BirthdayBarTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/BirthdayBarTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/BirthdayBarTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/ConstraintSatisfactionProblemTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/ConstraintSatisfactionProblemTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/ConstraintSatisfactionProblemTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/ConstraintSatisfactionProblemTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/FibTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/FibTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/FibTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/FibTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/FindAllAnagramsInAStringTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/FindAllAnagramsInAStringTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/FindAllAnagramsInAStringTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/FindAllAnagramsInAStringTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/LongestPalindromeTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/LongestPalindromeTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/LongestPalindromeTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/LongestPalindromeTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/PerfectNumberTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/PerfectNumberTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/PerfectNumberTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/PerfectNumberTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/RegularExpressionMatchingTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/RegularExpressionMatchingTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/RegularExpressionMatchingTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/RegularExpressionMatchingTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/RepeatedSubstringPatternTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/RepeatedSubstringPatternTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/RepeatedSubstringPatternTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/RepeatedSubstringPatternTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/ReverseIntegerTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/ReverseIntegerTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/ReverseIntegerTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/ReverseIntegerTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/SearchInsertPositionTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/SearchInsertPositionTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/SearchInsertPositionTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/SearchInsertPositionTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/ShortestUnsortedSubArrayTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/ShortestUnsortedSubArrayTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/ShortestUnsortedSubArrayTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/ShortestUnsortedSubArrayTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/SimplifyPathTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/SimplifyPathTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/SimplifyPathTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/SimplifyPathTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/StrongPasswordCheckerTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/StrongPasswordCheckerTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/StrongPasswordCheckerTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/StrongPasswordCheckerTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/SubArrGivenSumTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/SubArrGivenSumTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/SubArrGivenSumTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/SubArrGivenSumTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/TheTimeInWordsTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/TheTimeInWordsTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/TheTimeInWordsTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/TheTimeInWordsTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/TrappingRainWaterTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/TrappingRainWaterTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/TrappingRainWaterTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/TrappingRainWaterTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/TwoSumTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/TwoSumTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/TwoSumTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/TwoSumTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/UndirectedGraphTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/UndirectedGraphTest.java similarity index 87% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/UndirectedGraphTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/UndirectedGraphTest.java index a74eddab..d2d67779 100644 --- a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/UndirectedGraphTest.java +++ b/interview_prep/algorithm/java/src/test/java/hoa/can/code/UndirectedGraphTest.java @@ -8,6 +8,7 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class UndirectedGraphTest { @Test @@ -18,9 +19,8 @@ public void test1() { "Seattle", v -> v.equals("Chicago"), g::neighbor); - List path = Search.nodeToPath(bfsResult); - assertEquals(List.of("Seattle","Chicago"), path); - + assertNotNull(bfsResult); + assertEquals(List.of("Seattle","Chicago"), Search.nodeToPath(bfsResult)); } @Test @@ -31,6 +31,7 @@ public void test2() { "Seattle", v -> v.equals("Riverside"), g::neighbor); + assertNotNull(bfsResult); List path = Search.nodeToPath(bfsResult); assertEquals("Seattle", path.get(0)); assertEquals("Riverside", path.get(path.size()-1)); @@ -45,21 +46,23 @@ public void test3() { "Chicago", v -> v.equals("Seattle"), g::neighbor); - List path = Search.nodeToPath(bfsResult); - assertEquals(List.of("Chicago","Seattle"), path); - + assertNotNull(bfsResult); + assertEquals(List.of("Chicago","Seattle"), Search.nodeToPath(bfsResult)); } @Test @DisplayName("UndirectedGraphTest4") public void test4() { UndirectedGraph g = cities(); - System.out.println(g); Search.Node bfsResult = Search.bfs( "Boston", v -> v.equals("Miami"), g::neighbor); + + assertNotNull(bfsResult); List path = Search.nodeToPath(bfsResult); + assertEquals("Boston", path.get(0)); + assertEquals("Miami", path.get(path.size()-1)); } private UndirectedGraph cities(){ diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/UtilTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/UtilTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/UtilTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/UtilTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/WildcardMatchingTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/WildcardMatchingTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/WildcardMatchingTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/WildcardMatchingTest.java diff --git a/interview_prep/algorithm/java17/src/test/java/hoa/can/code/ZigzagConversionTest.java b/interview_prep/algorithm/java/src/test/java/hoa/can/code/ZigzagConversionTest.java similarity index 100% rename from interview_prep/algorithm/java17/src/test/java/hoa/can/code/ZigzagConversionTest.java rename to interview_prep/algorithm/java/src/test/java/hoa/can/code/ZigzagConversionTest.java