diff --git a/build.gradle b/build.gradle index 1cac05d548..eb7adc8423 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java' id 'checkstyle' + id 'com.diffplug.spotless' version '6.25.0' } group = 'com.fishercoder' @@ -54,3 +55,18 @@ checkstyle { toolVersion = '6.17' config = rootProject.resources.text.fromFile('fishercoder_checkstyle.xml') } + +spotless { + java { + encoding 'UTF-8' + target fileTree(projectDir) { + include '**/src/**/*.java' + exclude '**/build/**' + } + importOrder '\\#', '', '*' + removeUnusedImports() + googleJavaFormat('1.22.0').aosp() + toggleOffOn() + endWithNewline() + } +} diff --git a/src/main/java/com/fishercoder/common/classes/Employee.java b/src/main/java/com/fishercoder/common/classes/Employee.java index ba4ff400c0..f5b7460830 100644 --- a/src/main/java/com/fishercoder/common/classes/Employee.java +++ b/src/main/java/com/fishercoder/common/classes/Employee.java @@ -3,16 +3,16 @@ import java.util.List; public class Employee { - /** + /* * It's the unique id of each node; * unique id of this employee */ public int id; - /** + /* * the importance value of this employee */ public int importance; - /** + /* * the id of direct subordinates */ public List subordinates; diff --git a/src/main/java/com/fishercoder/common/classes/Interval.java b/src/main/java/com/fishercoder/common/classes/Interval.java index b6b9e2baf5..c5c6a40cc0 100644 --- a/src/main/java/com/fishercoder/common/classes/Interval.java +++ b/src/main/java/com/fishercoder/common/classes/Interval.java @@ -1,6 +1,6 @@ package com.fishercoder.common.classes; -/** +/* * This is a class used by one OJ problem: MeetingRooms */ public class Interval implements Comparable { @@ -45,7 +45,7 @@ public Interval(int s, int e) { @Override public int compareTo(Interval o) { int compareStart = o.start; - //ascending order + // ascending order return this.start - compareStart; } diff --git a/src/main/java/com/fishercoder/common/classes/ListNode.java b/src/main/java/com/fishercoder/common/classes/ListNode.java index 7b840469d9..272b215205 100644 --- a/src/main/java/com/fishercoder/common/classes/ListNode.java +++ b/src/main/java/com/fishercoder/common/classes/ListNode.java @@ -1,10 +1,9 @@ package com.fishercoder.common.classes; import com.fishercoder.common.utils.CommonUtils; - import java.util.List; -/** +/* * Normally, both val and next should be private attributes and generate getter and setter for them, * but for the convenience of leetcode solutions, I set them as public. */ @@ -86,5 +85,4 @@ public int hashCode() { public String toString() { return "ListNode{" + "val=" + val + ", next=" + next + '}'; } - } diff --git a/src/main/java/com/fishercoder/common/classes/NestedInteger.java b/src/main/java/com/fishercoder/common/classes/NestedInteger.java index 4d592e2e50..dbd4c8e1e1 100644 --- a/src/main/java/com/fishercoder/common/classes/NestedInteger.java +++ b/src/main/java/com/fishercoder/common/classes/NestedInteger.java @@ -62,5 +62,4 @@ public static String printNi(NestedInteger thisNi, StringBuilder sb) { sb.append("]"); return sb.toString(); } - } diff --git a/src/main/java/com/fishercoder/common/classes/Node.java b/src/main/java/com/fishercoder/common/classes/Node.java index 61693c0a3c..da1f63b492 100644 --- a/src/main/java/com/fishercoder/common/classes/Node.java +++ b/src/main/java/com/fishercoder/common/classes/Node.java @@ -22,9 +22,9 @@ public Node(int val, List children) { this.children = children; } - //todo: implement this method + // todo: implement this method - /** + /* * return a N-ary tree based on the preorder values */ public static Node createNaryTree(List preorderValues) { diff --git a/src/main/java/com/fishercoder/common/classes/Point.java b/src/main/java/com/fishercoder/common/classes/Point.java index 0e853c8396..bbb211204b 100644 --- a/src/main/java/com/fishercoder/common/classes/Point.java +++ b/src/main/java/com/fishercoder/common/classes/Point.java @@ -1,6 +1,6 @@ package com.fishercoder.common.classes; -/** +/* * Created by fishercoder on 12/31/16. */ public class Point { diff --git a/src/main/java/com/fishercoder/common/classes/UndirectedGraphNode.java b/src/main/java/com/fishercoder/common/classes/UndirectedGraphNode.java index 46d0fbc43f..7199fe4e99 100644 --- a/src/main/java/com/fishercoder/common/classes/UndirectedGraphNode.java +++ b/src/main/java/com/fishercoder/common/classes/UndirectedGraphNode.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -/** +/* * Created by fishercoder1534 on 9/30/16. */ public class UndirectedGraphNode { diff --git a/src/main/java/com/fishercoder/common/utils/BTreePrinter.java b/src/main/java/com/fishercoder/common/utils/BTreePrinter.java index c0ed7be442..c09a4f060d 100644 --- a/src/main/java/com/fishercoder/common/utils/BTreePrinter.java +++ b/src/main/java/com/fishercoder/common/utils/BTreePrinter.java @@ -4,7 +4,7 @@ import java.util.Collections; import java.util.List; -/** +/* * Copied this class from * http://stackoverflow.com/questions/4965335/how-to-print-binary-tree-diagram * This is an awesome one! It prints out the tree in a very nice fashion. @@ -55,8 +55,7 @@ private static > void printNodeInternal( for (int j = 0; j < nodes.size(); j++) { BTreePrinter.printWhitespaces(firstSpaces - i); if (nodes.get(j) == null) { - BTreePrinter.printWhitespaces(endgeLines + endgeLines + i - + 1); + BTreePrinter.printWhitespaces(endgeLines + endgeLines + i + 1); continue; } @@ -94,8 +93,7 @@ private static > int maxLevel(Node node) { return 0; } - return Math.max(BTreePrinter.maxLevel(node.left), - BTreePrinter.maxLevel(node.right)) + 1; + return Math.max(BTreePrinter.maxLevel(node.left), BTreePrinter.maxLevel(node.right)) + 1; } private static boolean isAllElementsNull(List list) { @@ -171,7 +169,6 @@ private static Node test2() { return root; } - public static class Node> { Node left; Node right; @@ -181,5 +178,4 @@ public Node(T data) { this.data = data; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/common/utils/CommonUtils.java b/src/main/java/com/fishercoder/common/utils/CommonUtils.java index 2fe40db5aa..4a2b10ca09 100644 --- a/src/main/java/com/fishercoder/common/utils/CommonUtils.java +++ b/src/main/java/com/fishercoder/common/utils/CommonUtils.java @@ -2,7 +2,6 @@ import com.fishercoder.common.classes.Interval; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.Deque; import java.util.List; @@ -13,7 +12,7 @@ public class CommonUtils { private static final int DEFAULT_TREE_SIZE = 10; private static final int DEFAULT_UPPER_BOUND = 100; - //How to make a method generic: declare in its method signature + // How to make a method generic: declare in its method signature public static void printArray_generic_type(T[] nums) { for (T i : nums) { System.out.print(i + ", "); @@ -22,14 +21,19 @@ public static void printArray_generic_type(T[] nums) { } public static void main(String... strings) { - Integer[] nums = new Integer[]{1, 2, 3, 4, 5}; + Integer[] nums = new Integer[] {1, 2, 3, 4, 5}; printArray_generic_type(nums); - String input1 = "[\"zDkA\",\"GfAj\",\"lt\"],[\"GfAj\",\"rtupD\",\"og\",\"l\"],[\"rtupD\",\"IT\",\"jGcew\",\"ZwFqF\"],[\"og\",\"yVobt\",\"EjA\",\"piUyQ\"],[\"IT\",\"XFlc\",\"W\",\"rB\"],[\"l\",\"GwQg\",\"shco\",\"Dub\",\"KwgZq\"],[\"oXMG\",\"uqe\"],[\"sNyV\",\"WbrP\"]"; + String input1 = + "[\"zDkA\",\"GfAj\",\"lt\"],[\"GfAj\",\"rtupD\",\"og\",\"l\"],[\"rtupD\",\"IT\",\"jGcew\",\"ZwFqF\"],[\"og\",\"yVobt\",\"EjA\",\"piUyQ\"],[\"IT\",\"XFlc\",\"W\",\"rB\"],[\"l\",\"GwQg\",\"shco\",\"Dub\",\"KwgZq\"],[\"oXMG\",\"uqe\"],[\"sNyV\",\"WbrP\"]"; String input2 = "[\"A\",\"B\"],[\"C\"],[\"B\",\"C\"],[\"D\"]"; CommonUtils.printListList(convertLeetCode2DStringArrayInputIntoJavaArray(input1)); CommonUtils.printListList(convertLeetCode2DStringArrayInputIntoJavaArray(input2)); - CommonUtils.print(convertLeetCode1DStringArrayInputIntoJavaArray("[\"abcsi\",\"abyzjgj\",\"advz\",\"ag\",\"agkgdkob\",\"agpr\",\"ail\"]")); - CommonUtils.print2DIntArray(convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[448,931,123,345],[889],[214,962],[576,746,897]")); + CommonUtils.print( + convertLeetCode1DStringArrayInputIntoJavaArray( + "[\"abcsi\",\"abyzjgj\",\"advz\",\"ag\",\"agkgdkob\",\"agpr\",\"ail\"]")); + CommonUtils.print2DIntArray( + convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[448,931,123,345],[889],[214,962],[576,746,897]")); } public static void printArray(boolean[] booleans) { @@ -98,8 +102,8 @@ public static List randomIntArrayGenerator(int size) { // overloaded method to take no argument public static List randomIntArrayGenerator() { - return CommonUtils.randomIntArrayGenerator(CommonUtils.DEFAULT_TREE_SIZE, - DEFAULT_UPPER_BOUND); + return CommonUtils.randomIntArrayGenerator( + CommonUtils.DEFAULT_TREE_SIZE, DEFAULT_UPPER_BOUND); } // this one has two other overloaded methods as above @@ -126,7 +130,8 @@ public static List uniqueIntArrayGenerator(int size) { } // @Notes(context = - // "I'm assuing only classes in this PACKAGE will call the following two methods, so just leave the modifier as default, i.e. no public, private, or protected.") + // "I'm assuing only classes in this PACKAGE will call the following two methods, so just leave + // the modifier as default, i.e. no public, private, or protected.") public static void printWhitespaces(int count) { for (int i = 0; i < count; i++) { System.out.print(" "); @@ -143,7 +148,7 @@ public static boolean isAllElementsNull(List list) { return true; } - /** + /* * If you want to print the reversed list out, you need to return the reversed list's head, * which was the end node of the original node. using the following function. */ @@ -228,7 +233,6 @@ public static void printMatrixGeneric(boolean[][] matrix) { System.out.println(); } System.out.println("----------------------------------------------------"); - } public static void printListList(List> res) { @@ -268,11 +272,11 @@ public static void print2DCharArray(char[][] arrayArrays) { } public static char[][] convertLeetCodeRegular2DCharArrayInputIntoJavaArray(String input) { -/**LeetCode 2-d char array usually comes in like this: - * ["#"," ","#"],[" "," ","#"],["#","c"," "] which is wrapped in double quotes instead of single quotes which makes it not usable in Java code. - * This method helps with the conversion.*/ + /*LeetCode 2-d char array usually comes in like this: + * ["#"," ","#"],[" "," ","#"],["#","c"," "] which is wrapped in double quotes instead of single quotes which makes it not usable in Java code. + * This method helps with the conversion.*/ String[] arrays = input.split("],\\["); -// CommonUtils.printArray_generic_type(arrays); + // CommonUtils.printArray_generic_type(arrays); int m = arrays.length; int n = arrays[1].split(",").length; char[][] ans = new char[m][n]; @@ -300,7 +304,7 @@ public static char[][] convertLeetCodeRegular2DCharArrayInputIntoJavaArray(Strin } public static int[][] convertLeetCodeRegularRectangleArrayInputIntoJavaArray(String input) { - /** + /* * LeetCode 2-d array input usually comes like this: it's a REGULAR rectangle * [[448,931],[234,889],[214,962],[576,746]] * The expected input for this method is: "[448,931],[234,889],[214,962],[576,746]" @@ -308,7 +312,7 @@ public static int[][] convertLeetCodeRegularRectangleArrayInputIntoJavaArray(Str * The output of this method will be a standard Java 2-d array. * */ String[] arrays = input.split("],\\["); -// CommonUtils.printArray_generic_type(arrays); + // CommonUtils.printArray_generic_type(arrays); int size = arrays[1].split(",").length; int[][] output = new int[arrays.length][size]; for (int i = 0; i < arrays.length; i++) { @@ -331,12 +335,12 @@ public static int[][] convertLeetCodeRegularRectangleArrayInputIntoJavaArray(Str } } } -// CommonUtils.print2DIntArray(output); + // CommonUtils.print2DIntArray(output); return output; } public static int[][] convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray(String input) { - /** + /* * LeetCode 2-d array input usually comes like this: each row could have different length * [[448,931,123,345],[889],[214,962],[576,746,897]] * The expected input for this method is: "[448,931,123,345],[889],[214,962],[576,746,897]" @@ -388,7 +392,7 @@ public static int[][] convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray(S } public static List> convertLeetCode2DStringArrayInputIntoJavaArray(String input) { - /** + /* * How to copy LeetCode 2-d String array into this method: * 1. remove the beginning and ending quotes; * 2. put double quotes into this method parameter; @@ -423,7 +427,7 @@ public static List> convertLeetCode2DStringArrayInputIntoJavaArray( } public static List convertLeetCode1DStringArrayInputIntoJavaArray(String input) { - /** + /* * LeetCode 2-d array input usually comes like this: each row could have different length * ["A","B","C"] * The expected input for this method is: "[\"A\",\"B\",\"C\"]" diff --git a/src/main/java/com/fishercoder/common/utils/LinkedListUtils.java b/src/main/java/com/fishercoder/common/utils/LinkedListUtils.java index 44ed95c0b9..f8f57c7e8f 100644 --- a/src/main/java/com/fishercoder/common/utils/LinkedListUtils.java +++ b/src/main/java/com/fishercoder/common/utils/LinkedListUtils.java @@ -1,7 +1,6 @@ package com.fishercoder.common.utils; import com.fishercoder.common.classes.ListNode; - import java.util.List; public class LinkedListUtils { diff --git a/src/main/java/com/fishercoder/common/utils/Notes.java b/src/main/java/com/fishercoder/common/utils/Notes.java index f7527b5c6a..9d890b892e 100644 --- a/src/main/java/com/fishercoder/common/utils/Notes.java +++ b/src/main/java/com/fishercoder/common/utils/Notes.java @@ -13,10 +13,10 @@ String issue() default ""; String context() default ""; // this variable is used to state how I solved + // this problem, whether completely made it // myself, or copied it from online, or a // combination of both approaches. boolean needsReview() default true; - } diff --git a/src/main/java/com/fishercoder/common/utils/TreeUtils.java b/src/main/java/com/fishercoder/common/utils/TreeUtils.java index 458e030037..d2e75fb872 100644 --- a/src/main/java/com/fishercoder/common/utils/TreeUtils.java +++ b/src/main/java/com/fishercoder/common/utils/TreeUtils.java @@ -1,7 +1,6 @@ package com.fishercoder.common.utils; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -9,154 +8,153 @@ import java.util.List; import java.util.Queue; -/** +/* * This is a util class to contain all tree related methods. */ public class TreeUtils { -/** -* This method is to construct a normal binary tree. The input reads like -* this for [5, 3, 6, 2, 4, null, null, 1], i.e. preorder: - 5 - / \ - 3 6 - / \ / \ - 2 4 # # - / - 1 -*/ -@Notes(context = "This is usually how Leetcode OJ passes a binary tree into testing: " - + "https://leetcode.com/faq/#binary-tree, I wrote this function for my own ease of testing when copying" - + "the test case from Leetcode in the form of [1, null, 2, 3].") -public static TreeNode constructBinaryTree(List treeValues) { - TreeNode root = new TreeNode(treeValues.get(0)); - Queue queue = new LinkedList<>(); - queue.offer(root); - for (int i = 1; i < treeValues.size(); i++) { - TreeNode curr = queue.poll(); - if (treeValues.get(i) != null) { - curr.left = new TreeNode(treeValues.get(i)); - queue.offer(curr.left); - } - if (++i < treeValues.size() && treeValues.get(i) != null) { - curr.right = new TreeNode(treeValues.get(i)); - queue.offer(curr.right); - } - } - return root; -} - - public static void printBinaryTree(TreeNode root) { - CommonUtils.println("\nPrinting out the binary tree in a very visual manner as below:\n"); - - // imitating from BTreePrinter class - int maxLevel = TreeUtils.maxLevel(root); - - printNodeInternal(Collections.singletonList(root), 1, maxLevel); - } - - private static int maxLevel(TreeNode root) { - if (root == null) { - return 0; - } - - return Math.max(TreeUtils.maxLevel(root.left), - TreeUtils.maxLevel(root.right)) + 1; - } - - private static void printNodeInternal( - List list, int level, int maxLevel) { - if (list.isEmpty() || CommonUtils.isAllElementsNull(list)) { - return; - } - - int floor = maxLevel - level; - int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0))); - int firstSpaces = (int) Math.pow(2, (floor)) - 1; - int betweenSpaces = (int) Math.pow(2, (floor + 1)) - 1; - - CommonUtils.printWhitespaces(firstSpaces); - - List newNodes = new ArrayList<>(); - for (TreeNode node : list) { - if (node != null) { - System.out.print(node.val); - newNodes.add(node.left); - newNodes.add(node.right); - } else { - newNodes.add(null); - newNodes.add(null); - System.out.print(" "); - } - - CommonUtils.printWhitespaces(betweenSpaces); - } - System.out.println(""); - - for (int i = 1; i <= endgeLines; i++) { - for (int j = 0; j < list.size(); j++) { - CommonUtils.printWhitespaces(firstSpaces - i); - if (list.get(j) == null) { - CommonUtils.printWhitespaces(endgeLines + endgeLines + i - + 1); - continue; - } - - if (list.get(j).left != null) { - System.out.print("/"); - } else { - CommonUtils.printWhitespaces(1); - } - - CommonUtils.printWhitespaces(i + i - 1); - - if (list.get(j).right != null) { - System.out.print("\\"); - } else { - CommonUtils.printWhitespaces(1); - } - - CommonUtils.printWhitespaces(endgeLines + endgeLines - i); - } - - System.out.println(""); - } - - printNodeInternal(newNodes, level + 1, maxLevel); - } - - public static void inOrderTraversal(TreeNode root) { - inOrder(root); - } - - private static void inOrder(TreeNode root) { - if (root == null) { - return; - } - inOrder(root.left); - System.out.print(root.val + " "); - inOrder(root.right); - } - - public static void main(String... args) { - //test random int generator - List treeValues = CommonUtils.randomIntArrayGenerator(24); - - List treeValues2 = Arrays.asList(0, 1, 2, 3, 4, 5, 6); - - //test tree construction - // TreeNode root1 = bruteForceConstructBinaryTree(treeValues2); - // inOrderTraversal(root1); - // printBinaryTree(root1); - - // test tree construction - TreeNode root2 = constructBinaryTree(treeValues); - inOrderTraversal(root2); - printBinaryTree(root2); - - List treeVals = new ArrayList<>(Arrays.asList(1, null, 2, 3)); - CommonUtils.printList(treeVals); - root2 = constructBinaryTree(treeVals); - // inOrderTraversal(root2); - printBinaryTree(root2); - } + /* + * This method is to construct a normal binary tree. The input reads like + * this for [5, 3, 6, 2, 4, null, null, 1], i.e. preorder: + 5 + / \ + 3 6 + / \ / \ + 2 4 # # + / + 1 + */ + @Notes( + context = + "This is usually how Leetcode OJ passes a binary tree into testing: " + + "https://leetcode.com/faq/#binary-tree, I wrote this function for my own ease of testing when copying" + + "the test case from Leetcode in the form of [1, null, 2, 3].") + public static TreeNode constructBinaryTree(List treeValues) { + TreeNode root = new TreeNode(treeValues.get(0)); + Queue queue = new LinkedList<>(); + queue.offer(root); + for (int i = 1; i < treeValues.size(); i++) { + TreeNode curr = queue.poll(); + if (treeValues.get(i) != null) { + curr.left = new TreeNode(treeValues.get(i)); + queue.offer(curr.left); + } + if (++i < treeValues.size() && treeValues.get(i) != null) { + curr.right = new TreeNode(treeValues.get(i)); + queue.offer(curr.right); + } + } + return root; + } + + public static void printBinaryTree(TreeNode root) { + CommonUtils.println("\nPrinting out the binary tree in a very visual manner as below:\n"); + + // imitating from BTreePrinter class + int maxLevel = TreeUtils.maxLevel(root); + + printNodeInternal(Collections.singletonList(root), 1, maxLevel); + } + + private static int maxLevel(TreeNode root) { + if (root == null) { + return 0; + } + + return Math.max(TreeUtils.maxLevel(root.left), TreeUtils.maxLevel(root.right)) + 1; + } + + private static void printNodeInternal(List list, int level, int maxLevel) { + if (list.isEmpty() || CommonUtils.isAllElementsNull(list)) { + return; + } + + int floor = maxLevel - level; + int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0))); + int firstSpaces = (int) Math.pow(2, (floor)) - 1; + int betweenSpaces = (int) Math.pow(2, (floor + 1)) - 1; + + CommonUtils.printWhitespaces(firstSpaces); + + List newNodes = new ArrayList<>(); + for (TreeNode node : list) { + if (node != null) { + System.out.print(node.val); + newNodes.add(node.left); + newNodes.add(node.right); + } else { + newNodes.add(null); + newNodes.add(null); + System.out.print(" "); + } + + CommonUtils.printWhitespaces(betweenSpaces); + } + System.out.println(""); + + for (int i = 1; i <= endgeLines; i++) { + for (int j = 0; j < list.size(); j++) { + CommonUtils.printWhitespaces(firstSpaces - i); + if (list.get(j) == null) { + CommonUtils.printWhitespaces(endgeLines + endgeLines + i + 1); + continue; + } + + if (list.get(j).left != null) { + System.out.print("/"); + } else { + CommonUtils.printWhitespaces(1); + } + + CommonUtils.printWhitespaces(i + i - 1); + + if (list.get(j).right != null) { + System.out.print("\\"); + } else { + CommonUtils.printWhitespaces(1); + } + + CommonUtils.printWhitespaces(endgeLines + endgeLines - i); + } + + System.out.println(""); + } + + printNodeInternal(newNodes, level + 1, maxLevel); + } + + public static void inOrderTraversal(TreeNode root) { + inOrder(root); + } + + private static void inOrder(TreeNode root) { + if (root == null) { + return; + } + inOrder(root.left); + System.out.print(root.val + " "); + inOrder(root.right); + } + + public static void main(String... args) { + // test random int generator + List treeValues = CommonUtils.randomIntArrayGenerator(24); + + List treeValues2 = Arrays.asList(0, 1, 2, 3, 4, 5, 6); + + // test tree construction + // TreeNode root1 = bruteForceConstructBinaryTree(treeValues2); + // inOrderTraversal(root1); + // printBinaryTree(root1); + + // test tree construction + TreeNode root2 = constructBinaryTree(treeValues); + inOrderTraversal(root2); + printBinaryTree(root2); + + List treeVals = new ArrayList<>(Arrays.asList(1, null, 2, 3)); + CommonUtils.printList(treeVals); + root2 = constructBinaryTree(treeVals); + // inOrderTraversal(root2); + printBinaryTree(root2); + } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_1.java b/src/main/java/com/fishercoder/solutions/firstthousand/_1.java index 61a9baa36c..2d25899181 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_1.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_1.java @@ -10,13 +10,12 @@ public int[] twoSum(int[] nums, int target) { Map map = new HashMap(); for (int i = 0; i < nums.length; i++) { if (map.containsKey(target - nums[i])) { - return new int[]{map.get(target - nums[i]), i}; + return new int[] {map.get(target - nums[i]), i}; } else { map.put(nums[i], i); } } - return new int[]{-1, -1}; + return new int[] {-1, -1}; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_10.java b/src/main/java/com/fishercoder/solutions/firstthousand/_10.java index 8bc2e7ad35..fe293fd0fa 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_10.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_10.java @@ -9,9 +9,9 @@ public boolean isMatch(String s, String p) { } boolean[][] dp = new boolean[s.length() + 1][p.length() + 1]; dp[0][0] = true; - for (int i = 0; i < p.length(); i++) { //here's the p's length, not s's + for (int i = 0; i < p.length(); i++) { // here's the p's length, not s's if (p.charAt(i) == '*' && dp[0][i - 1]) { - dp[0][i + 1] = true; //here's y axis should be i+1 + dp[0][i + 1] = true; // here's y axis should be i+1 } } for (int i = 0; i < s.length(); i++) { @@ -31,5 +31,4 @@ public boolean isMatch(String s, String p) { return dp[s.length()][p.length()]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_100.java b/src/main/java/com/fishercoder/solutions/firstthousand/_100.java index 25317efb89..457b4168f7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_100.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_100.java @@ -1,14 +1,14 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -public class _100 { - public static class Solution1 { - public boolean isSameTree(TreeNode p, TreeNode q) { - if (p == null || q == null) { - return p == q; - } - return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right); - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; + +public class _100 { + public static class Solution1 { + public boolean isSameTree(TreeNode p, TreeNode q) { + if (p == null || q == null) { + return p == q; + } + return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right); + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_101.java b/src/main/java/com/fishercoder/solutions/firstthousand/_101.java index efb53d840e..1b27500f0d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_101.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_101.java @@ -1,46 +1,48 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -public class _101 { - public static class Solution1 { - public boolean isSymmetric(TreeNode root) { - if (root == null) { - return true; - } - return isSymmetric(root.left, root.right); - } - - private boolean isSymmetric(TreeNode left, TreeNode right) { - if (left == null || right == null) { - return left == right; - } - return left.val == right.val && isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left); - } - } - - public static class Solution2 { - /** - * The same as the above solution, just a bit more verbose. - */ - public boolean isSymmetric(TreeNode root) { - if (root == null) { - return true; - } - return isSymmetric(root.left, root.right); - } - - private boolean isSymmetric(TreeNode left, TreeNode right) { - if (left == null && right == null) { - return true; - } else if (left == null || right == null) { - return false; - } - if (left.val == right.val) { - return isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left); - } else { - return false; - } - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; + +public class _101 { + public static class Solution1 { + public boolean isSymmetric(TreeNode root) { + if (root == null) { + return true; + } + return isSymmetric(root.left, root.right); + } + + private boolean isSymmetric(TreeNode left, TreeNode right) { + if (left == null || right == null) { + return left == right; + } + return left.val == right.val + && isSymmetric(left.left, right.right) + && isSymmetric(left.right, right.left); + } + } + + public static class Solution2 { + /* + * The same as the above solution, just a bit more verbose. + */ + public boolean isSymmetric(TreeNode root) { + if (root == null) { + return true; + } + return isSymmetric(root.left, root.right); + } + + private boolean isSymmetric(TreeNode left, TreeNode right) { + if (left == null && right == null) { + return true; + } else if (left == null || right == null) { + return false; + } + if (left.val == right.val) { + return isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left); + } else { + return false; + } + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_102.java b/src/main/java/com/fishercoder/solutions/firstthousand/_102.java index 52d7fd05c9..f9d29eef2e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_102.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_102.java @@ -1,38 +1,37 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class _102 { - - public static class Solution1 { - public List> levelOrder(TreeNode root) { - List> result = new ArrayList<>(); - if (root == null) { - return result; - } - Queue queue = new LinkedList(); - queue.offer(root); - while (!queue.isEmpty()) { - List thisLevel = new ArrayList(); - int size = queue.size(); - for (int i = 0; i < size; i++) { - TreeNode curr = queue.poll(); - thisLevel.add(curr.val); - if (curr.left != null) { - queue.offer(curr.left); - } - if (curr.right != null) { - queue.offer(curr.right); - } - } - result.add(thisLevel); - } - return result; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +public class _102 { + + public static class Solution1 { + public List> levelOrder(TreeNode root) { + List> result = new ArrayList<>(); + if (root == null) { + return result; + } + Queue queue = new LinkedList(); + queue.offer(root); + while (!queue.isEmpty()) { + List thisLevel = new ArrayList(); + int size = queue.size(); + for (int i = 0; i < size; i++) { + TreeNode curr = queue.poll(); + thisLevel.add(curr.val); + if (curr.left != null) { + queue.offer(curr.left); + } + if (curr.right != null) { + queue.offer(curr.right); + } + } + result.add(thisLevel); + } + return result; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_103.java b/src/main/java/com/fishercoder/solutions/firstthousand/_103.java index d272eacd87..e3601e4d22 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_103.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_103.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_104.java b/src/main/java/com/fishercoder/solutions/firstthousand/_104.java index cbacdd15e2..c3e3d5db6b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_104.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_104.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; public class _104 { public static class Solution1 { - /** + /* * Recursive solution: * Time: O(n) * Space: O(n) @@ -21,7 +20,7 @@ public int maxDepth(TreeNode root) { } public static class Solution2 { - /** + /* * A more verbose recursive solution for easier understanding. */ public int maxDepth(TreeNode root) { @@ -35,7 +34,7 @@ public int maxDepth(TreeNode root) { } public static class Solution3 { - /** + /* * Iterative solution: * Time: O(n) * Space: O(n) @@ -64,5 +63,4 @@ public int maxDepth(TreeNode root) { return depth; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_105.java b/src/main/java/com/fishercoder/solutions/firstthousand/_105.java index d7c5ca24ee..55ab07bedf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_105.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_105.java @@ -1,14 +1,13 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; public class _105 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/29838/5ms-java-clean-solution-with-caching use * HashMap as the cache so that accessing inorder index becomes O(1) time Note: The first * element of preorder array is the root! @@ -23,29 +22,49 @@ public TreeNode buildTree(int[] preorder, int[] inorder) { inorderMap.put(inorder[i], i); } - /**At the beginning, both start from 0 to nums.length-1*/ + /*At the beginning, both start from 0 to nums.length-1*/ return buildTree(preorder, 0, preorder.length - 1, inorderMap, 0, inorder.length - 1); } - private TreeNode buildTree(int[] preorder, int preStart, int preEnd, Map inorderMap, int inStart, int inEnd) { + private TreeNode buildTree( + int[] preorder, + int preStart, + int preEnd, + Map inorderMap, + int inStart, + int inEnd) { if (preStart > preEnd || inStart > inEnd) { return null; } TreeNode root = new TreeNode(preorder[preStart]); int inRoot = inorderMap.get(preorder[preStart]); - //This line is the key to figure out how many nodes should be on the left subtree + // This line is the key to figure out how many nodes should be on the left subtree int numsLeft = inRoot - inStart; - /**It's easy to understand and remember: + /*It's easy to understand and remember: * for the indices of inorder array: * root.left should be inStart and inRoot-1 as new start and end indices * root.right should be inRoot+1 and inEnd as new start and end indices * * since inRoot is being used already in this recursion call, that's why we use inRoot-1 and inRoot+1 * this part is the same for both Leetcode 105 and Leetcode 106.*/ - root.left = buildTree(preorder, preStart + 1, preStart + numsLeft, inorderMap, inStart, inRoot - 1); - root.right = buildTree(preorder, preStart + numsLeft + 1, preEnd, inorderMap, inRoot + 1, inEnd); + root.left = + buildTree( + preorder, + preStart + 1, + preStart + numsLeft, + inorderMap, + inStart, + inRoot - 1); + root.right = + buildTree( + preorder, + preStart + numsLeft + 1, + preEnd, + inorderMap, + inRoot + 1, + inEnd); return root; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_106.java b/src/main/java/com/fishercoder/solutions/firstthousand/_106.java index 9167e28469..9df004e368 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_106.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_106.java @@ -1,14 +1,13 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; public class _106 { public static class Solution1 { - /** + /* * https://discuss.leetcode.com/topic/3296/my-recursive-java-code-with-o-n-time-and-o-n-space * Note: the last element of postorder array is the root! * The idea is to take the last element in postorder as the root; find the position of the root @@ -23,13 +22,18 @@ public TreeNode buildTree(int[] inorder, int[] postorder) { for (int i = 0; i < inorder.length; i++) { inorderMap.put(inorder[i], i); } - /**At the beginning, both start from 0 to nums.length-1*/ - return buildTreeRecursively(inorderMap, 0, inorder.length - 1, postorder, 0, - postorder.length - 1); + /*At the beginning, both start from 0 to nums.length-1*/ + return buildTreeRecursively( + inorderMap, 0, inorder.length - 1, postorder, 0, postorder.length - 1); } - private TreeNode buildTreeRecursively(Map inorderMap, int inorderStart, - int inorderEnd, int[] postorder, int postorderStart, int postorderEnd) { + private TreeNode buildTreeRecursively( + Map inorderMap, + int inorderStart, + int inorderEnd, + int[] postorder, + int postorderStart, + int postorderEnd) { if (postorderStart > postorderEnd || inorderStart > inorderEnd) { return null; } @@ -37,7 +41,7 @@ private TreeNode buildTreeRecursively(Map inorderMap, int inor int inRoot = inorderMap.get(postorder[postorderEnd]); int numsLeft = inRoot - inorderStart; - /**It's easy to understand and remember: + /*It's easy to understand and remember: * for the indices of inorder array: * inStart and inRoot-1 as new start and end indices * inRoot+1 and inEnd as new start and end indices @@ -51,14 +55,28 @@ private TreeNode buildTreeRecursively(Map inorderMap, int inor * this is also easy to understand and remember: * since the last one in postorder is the root and we have used it in this recursion call already, so the end is definitely postorderEnd-1; * then the postorderEnd for root.left is contiguous to the postorderStart of root.right, :)*/ - root.left = buildTreeRecursively(inorderMap, inorderStart, inRoot - 1, postorder, postorderStart, postorderStart + numsLeft - 1); - root.right = buildTreeRecursively(inorderMap, inRoot + 1, inorderEnd, postorder, postorderStart + numsLeft, postorderEnd - 1); + root.left = + buildTreeRecursively( + inorderMap, + inorderStart, + inRoot - 1, + postorder, + postorderStart, + postorderStart + numsLeft - 1); + root.right = + buildTreeRecursively( + inorderMap, + inRoot + 1, + inorderEnd, + postorder, + postorderStart + numsLeft, + postorderEnd - 1); return root; } } public static class Solution2 { - /** + /* * My own solution after inspiration from LeetCode 105. * I go from the right to the left for the postorder array, also, I build the tree by forming the right subtree first and then the left subtree. * A bit different from using numsLeft from LeetCode 106, I use numsRight, meaning the number of nodes needed to form the right subtree in the inorder array. @@ -68,18 +86,42 @@ public TreeNode buildTree(int[] inorder, int[] postorder) { for (int i = 0; i < inorder.length; i++) { inMap.put(inorder[i], i); } - return helper(postorder, inorder, inMap, postorder.length - 1, 0, 0, inorder.length - 1); + return helper( + postorder, inorder, inMap, postorder.length - 1, 0, 0, inorder.length - 1); } - private TreeNode helper(int[] postorder, int[] inorder, Map inMap, int postStart, int postEnd, int inStart, int inEnd) { + private TreeNode helper( + int[] postorder, + int[] inorder, + Map inMap, + int postStart, + int postEnd, + int inStart, + int inEnd) { if (postStart < postEnd) { return null; } int inRoot = inMap.get(postorder[postStart]); int numsRight = inEnd - inRoot; TreeNode node = new TreeNode(postorder[postStart]); - node.right = helper(postorder, inorder, inMap, postStart - 1, postStart - numsRight, inRoot + 1, inEnd); - node.left = helper(postorder, inorder, inMap, postStart - numsRight - 1, postEnd, inStart, inRoot - 1); + node.right = + helper( + postorder, + inorder, + inMap, + postStart - 1, + postStart - numsRight, + inRoot + 1, + inEnd); + node.left = + helper( + postorder, + inorder, + inMap, + postStart - numsRight - 1, + postEnd, + inStart, + inRoot - 1); return node; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_107.java b/src/main/java/com/fishercoder/solutions/firstthousand/_107.java index 7f97cc1d41..9b3df89fea 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_107.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_107.java @@ -1,39 +1,38 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class _107 { - public static class Solution1 { - public List> levelOrderBottom(TreeNode root) { - List> result = new ArrayList(); - if (root == null) { - return result; - } - Queue q = new LinkedList(); - q.offer(root); - while (!q.isEmpty()) { - List thisLevel = new ArrayList<>(); - int qSize = q.size(); - for (int i = 0; i < qSize; i++) { - TreeNode curr = q.poll(); - thisLevel.add(curr.val); - if (curr.left != null) { - q.offer(curr.left); - } - if (curr.right != null) { - q.offer(curr.right); - } - } - result.add(thisLevel); - } - Collections.reverse(result); - return result; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +public class _107 { + public static class Solution1 { + public List> levelOrderBottom(TreeNode root) { + List> result = new ArrayList(); + if (root == null) { + return result; + } + Queue q = new LinkedList(); + q.offer(root); + while (!q.isEmpty()) { + List thisLevel = new ArrayList<>(); + int qSize = q.size(); + for (int i = 0; i < qSize; i++) { + TreeNode curr = q.poll(); + thisLevel.add(curr.val); + if (curr.left != null) { + q.offer(curr.left); + } + if (curr.right != null) { + q.offer(curr.right); + } + } + result.add(thisLevel); + } + Collections.reverse(result); + return result; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_109.java b/src/main/java/com/fishercoder/solutions/firstthousand/_109.java index 57a4db4e1b..6797ba78a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_109.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_109.java @@ -15,7 +15,7 @@ public TreeNode toBstRecursively(ListNode start, ListNode end) { } else { ListNode slow = start; ListNode fast = start; - //here is the key: we check if fast != end, not fast != null + // here is the key: we check if fast != end, not fast != null while (fast != end && fast.next != end) { slow = slow.next; fast = fast.next.next; @@ -28,5 +28,4 @@ public TreeNode toBstRecursively(ListNode start, ListNode end) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_11.java b/src/main/java/com/fishercoder/solutions/firstthousand/_11.java index bf03967bb6..669d209382 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_11.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_11.java @@ -2,7 +2,7 @@ public class _11 { public static class Solution1 { - /** + /* * Time: O(n^2) * This brute force solution is NOT accepted on LeetCode due to TLE. */ @@ -19,7 +19,7 @@ public int maxArea(int[] height) { } public static class Solution2 { - /** + /* * Two pointer technique. * Well explained here: https://leetcode.com/problems/container-with-most-water/discuss/6100/Simple-and-clear-proofexplanation */ @@ -30,7 +30,7 @@ public int maxArea(int[] height) { while (left < right) { max = Math.max(Math.min(height[left], height[right]) * (right - left), max); if (height[left] <= height[right]) { - /**if this height is shorter, then we'll need to move it to the right to find a higher one so that it's possible to find a larger area.*/ + /*if this height is shorter, then we'll need to move it to the right to find a higher one so that it's possible to find a larger area.*/ left++; } else { right--; @@ -39,5 +39,4 @@ public int maxArea(int[] height) { return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_110.java b/src/main/java/com/fishercoder/solutions/firstthousand/_110.java index 9a0a42fcdf..3f0aef4316 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_110.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_110.java @@ -5,9 +5,11 @@ public class _110 { public static class Solution1 { - //recursively get the height of each subtree of each node, compare their difference, if greater than 1, then return false - //although this is working, but it's not efficient, since it repeatedly computes the heights of each node every time - //Its time complexity is O(n^2). + // recursively get the height of each subtree of each node, compare their difference, if + // greater than 1, then return false + // although this is working, but it's not efficient, since it repeatedly computes the + // heights of each node every time + // Its time complexity is O(n^2). public boolean isBalanced(TreeNode root) { if (root == null) { return true; @@ -21,7 +23,7 @@ public boolean isBalanced(TreeNode root) { private int getH(TreeNode root) { if (root == null) { - return 0;//base case + return 0; // base case } int leftH = getH(root.left); int rightH = getH(root.right); @@ -53,5 +55,4 @@ private int getH(TreeNode root) { return Math.max(leftH, rightH) + 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_111.java b/src/main/java/com/fishercoder/solutions/firstthousand/_111.java index a0a16353e9..2239535404 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_111.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_111.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; public class _111 { public static class Solution1 { - /** + /* * DFS */ public int minDepth(TreeNode root) { @@ -27,7 +26,7 @@ public int minDepth(TreeNode root) { } public static class Solution2 { - /** + /* * BFS */ public int minDepth(TreeNode root) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_112.java b/src/main/java/com/fishercoder/solutions/firstthousand/_112.java index c75ef8d8c3..d329d84099 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_112.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_112.java @@ -16,7 +16,7 @@ public boolean hasPathSum(TreeNode root, int sum) { } public static class Solution2 { - /** + /* * My completely original solution on 9/23/2021. */ public boolean hasPathSum(TreeNode root, int targetSum) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_113.java b/src/main/java/com/fishercoder/solutions/firstthousand/_113.java index 5f6ef6eb7e..e063bf6be0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_113.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_113.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -26,7 +25,7 @@ private void dfs(TreeNode root, List path, List> allPaths dfs(root.right, path, allPaths, sum - root.val); } if (root.left == null && root.right == null) { - /**Check if sum equals root.val, not sum equals zero!*/ + /*Check if sum equals root.val, not sum equals zero!*/ if (sum == root.val) { allPaths.add(new ArrayList(path)); } @@ -36,7 +35,7 @@ private void dfs(TreeNode root, List path, List> allPaths } public static class Solution2 { - /** + /* * My completely original solution on 10/27/2021. * A classic backtracking problem/solution. */ @@ -46,7 +45,12 @@ public List> pathSum(TreeNode root, int targetSum) { return ans; } - private void backtracking(TreeNode root, List path, int targetSum, int currentSum, List> ans) { + private void backtracking( + TreeNode root, + List path, + int targetSum, + int currentSum, + List> ans) { if (root == null) { return; } @@ -54,12 +58,12 @@ private void backtracking(TreeNode root, List path, int targetSum, int currentSum += root.val; if (currentSum == targetSum && root.left == null && root.right == null) { ans.add(new ArrayList<>(path)); - path.remove(path.size() - 1);//backtracking + path.remove(path.size() - 1); // backtracking return; } backtracking(root.left, path, targetSum, currentSum, ans); backtracking(root.right, path, targetSum, currentSum, ans); - path.remove(path.size() - 1);//backtracking + path.remove(path.size() - 1); // backtracking } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_114.java b/src/main/java/com/fishercoder/solutions/firstthousand/_114.java index 8464ee51dc..a21b1531a6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_114.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_114.java @@ -23,7 +23,7 @@ public void flatten(TreeNode root) { public static class Solution2 { - /** + /* * Credit: https://leetcode.com/problems/flatten-binary-tree-to-linked-list/solution/ */ public void flatten(TreeNode root) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_116.java b/src/main/java/com/fishercoder/solutions/firstthousand/_116.java index a8db8c24ea..53ce763257 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_116.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_116.java @@ -16,19 +16,19 @@ public Node(int x) { } public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/1106/o-1-space-o-n-complexity-iterative-solution * based on level order traversal */ public Node connect(Node root) { - Node head = null; //head of the next level - Node prev = null; //the leading node on the next level - Node curr = root; //current node of current level + Node head = null; // head of the next level + Node prev = null; // the leading node on the next level + Node curr = root; // current node of current level while (curr != null) { - while (curr != null) { //iterate on the current level - //left child + while (curr != null) { // iterate on the current level + // left child if (curr.left != null) { if (prev != null) { prev.next = curr.left; @@ -37,7 +37,7 @@ public Node connect(Node root) { } prev = curr.left; } - //right child + // right child if (curr.right != null) { if (prev != null) { prev.next = curr.right; @@ -46,10 +46,10 @@ public Node connect(Node root) { } prev = curr.right; } - //move to next node + // move to next node curr = curr.next; } - //move to next level + // move to next level curr = head; head = null; prev = null; @@ -59,7 +59,7 @@ public Node connect(Node root) { } public static class Solution2 { - /** + /* * My complete original solution on 10/10/2021, although with O(h) extra space. */ public Node connect(Node root) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_117.java b/src/main/java/com/fishercoder/solutions/firstthousand/_117.java index bfbb92f7af..050bac08c3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_117.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_117.java @@ -14,20 +14,20 @@ public Node(int x) { } public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/1106/o-1-space-o-n-complexity-iterative-solution * O(1) space, based on level order traversal */ public Node connect(Node root) { - Node head = null; //head of the next level - Node prev = null; //the leading node on the next level - Node cur = root; //current node of current level + Node head = null; // head of the next level + Node prev = null; // the leading node on the next level + Node cur = root; // current node of current level while (cur != null) { - while (cur != null) { //iterate on the current level - //left child + while (cur != null) { // iterate on the current level + // left child if (cur.left != null) { if (prev != null) { prev.next = cur.left; @@ -36,7 +36,7 @@ public Node connect(Node root) { } prev = cur.left; } - //right child + // right child if (cur.right != null) { if (prev != null) { prev.next = cur.right; @@ -45,11 +45,11 @@ public Node connect(Node root) { } prev = cur.right; } - //move to next node + // move to next node cur = cur.next; } - //move to next level + // move to next level cur = head; head = null; prev = null; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_118.java b/src/main/java/com/fishercoder/solutions/firstthousand/_118.java index 442584af34..63a37f7c9b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_118.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_118.java @@ -7,7 +7,7 @@ public class _118 { public static class Solution1 { - /** + /* * fill out values from left to right */ public List> generate(int numRows) { @@ -25,7 +25,7 @@ public List> generate(int numRows) { } public static class Solution2 { - /** + /* * fill out values from right to left * credit: https://leetcode.com/problems/pascals-triangle/discuss/38141/My-concise-solution-in-Java/36127 */ @@ -44,7 +44,7 @@ public List> generate(int numRows) { } public static class Solution3 { - /** + /* * my completely original solution on 9/15/2021 */ public List> generate(int numRows) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_119.java b/src/main/java/com/fishercoder/solutions/firstthousand/_119.java index 852d62ba24..5b422c088a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_119.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_119.java @@ -29,7 +29,7 @@ public List getRow(int rowIndex) { } public static class Solution2 { - /** + /* * O(k) space */ public List getRow(int rowIndex) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_12.java b/src/main/java/com/fishercoder/solutions/firstthousand/_12.java index 71af3d0534..083ec78b74 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_12.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_12.java @@ -4,12 +4,11 @@ public class _12 { public static class Solution1 { public String intToRoman(int num) { - String[] M = new String[]{"", "M", "MM", "MMM"}; + String[] M = new String[] {"", "M", "MM", "MMM"}; String[] C = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; String[] X = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; String[] I = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; return M[num / 1000] + C[(num % 1000) / 100] + X[(num % 100) / 10] + I[num % 10]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_120.java b/src/main/java/com/fishercoder/solutions/firstthousand/_120.java index 8bf1303208..57b88ac6d1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_120.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_120.java @@ -9,10 +9,11 @@ public int minimumTotal(List> triangle) { List cache = triangle.get(n - 1); for (int layer = n - 2; layer >= 0; layer--) { - //for each layer + // for each layer for (int i = 0; i <= layer; i++) { - //check its very node - int value = Math.min(cache.get(i), cache.get(i + 1)) + triangle.get(layer).get(i); + // check its very node + int value = + Math.min(cache.get(i), cache.get(i + 1)) + triangle.get(layer).get(i); cache.set(i, value); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_121.java b/src/main/java/com/fishercoder/solutions/firstthousand/_121.java index 55416d8bad..3d4814a788 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_121.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_121.java @@ -3,7 +3,7 @@ public class _121 { public static class Solution1 { - /** + /* * My very original but not super optimal solution. */ public int maxProfit(int[] prices) { @@ -28,7 +28,7 @@ public int maxProfit(int[] prices) { } public static class Solution2 { - /** + /* * The key here is that you'll have to buy first, before you can sell. That means, if the lower * price comes after a higher price, their combination won't work! Since you cannot sell first * before you buy it. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_122.java b/src/main/java/com/fishercoder/solutions/firstthousand/_122.java index a1c351ae6e..2d97438b07 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_122.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_122.java @@ -2,7 +2,7 @@ public class _122 { public static class Solution1 { - //peak and valley approach + // peak and valley approach public int maxProfit(int[] prices) { int pro = 0; int i = 0; @@ -22,9 +22,9 @@ public int maxProfit(int[] prices) { } public static class Solution2 { - //simple one pass approach: the above solution could be simplified as below + // simple one pass approach: the above solution could be simplified as below - /** + /* * Or this approach could be understood as: * We'll sell and buy on the same day as long as this day's stock price is higher than the previous day, a good example is this array: [1, 2, 3, 4, 5]. * As this problem states that:"you can buy it then immediately sell it on the same day". Likewise, we can buy it back immediately as we sell it on the same day. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_123.java b/src/main/java/com/fishercoder/solutions/firstthousand/_123.java index 6346bcf864..5887b854b0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_123.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_123.java @@ -3,7 +3,8 @@ public class _123 { public static class Solution1 { - //this is a very clear solution and very highly upvoted in Discuss, but not extensible to K solution. + // this is a very clear solution and very highly upvoted in Discuss, but not extensible to K + // solution. public int maxProfit(int[] prices) { int buy1 = Integer.MIN_VALUE; int buy2 = Integer.MIN_VALUE; @@ -18,4 +19,4 @@ public int maxProfit(int[] prices) { return sell2; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_124.java b/src/main/java/com/fishercoder/solutions/firstthousand/_124.java index 41f1d7d1df..98d18bcbfd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_124.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_124.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; @@ -30,7 +29,7 @@ private int dfs(TreeNode root) { } public static class Solution2 { - /** + /* * This one uses a map to cache, but surprisingly, it's 10% slower than all submissions compared * with solution1 */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_126.java b/src/main/java/com/fishercoder/solutions/firstthousand/_126.java index 3ce4546300..020cac75bc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_126.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_126.java @@ -8,39 +8,39 @@ import java.util.Map; import java.util.Queue; -/** - * 126. Word Ladder II - - Given two words (beginWord and endWord), and a dictionary's word list, - find all shortest transformation sequence(s) from beginWord to endWord, such that: - - Only one letter can be changed at a time - Each transformed word must exist in the word list. Note that beginWord is not a transformed word. - - For example, - Given: - beginWord = "hit" - endWord = "cog" - wordList = ["hot","dot","dog","lot","log","cog"] - - Return - [ - ["hit","hot","dot","dog","cog"], - ["hit","hot","lot","log","cog"] - ] - - Note: - Return an empty list if there is no such transformation sequence. - All words have the same length. - All words contain only lowercase alphabetic characters. - You may assume no duplicates in the word list. - You may assume beginWord and endWord are non-empty and are not the same. - */ +/* +* 126. Word Ladder II + +Given two words (beginWord and endWord), and a dictionary's word list, +find all shortest transformation sequence(s) from beginWord to endWord, such that: + +Only one letter can be changed at a time +Each transformed word must exist in the word list. Note that beginWord is not a transformed word. + +For example, +Given: +beginWord = "hit" +endWord = "cog" +wordList = ["hot","dot","dog","lot","log","cog"] + +Return +[ +["hit","hot","dot","dog","cog"], +["hit","hot","lot","log","cog"] +] + +Note: +Return an empty list if there is no such transformation sequence. +All words have the same length. +All words contain only lowercase alphabetic characters. +You may assume no duplicates in the word list. +You may assume beginWord and endWord are non-empty and are not the same. +*/ public class _126 { public static class Solution1 { - /** Reference: https://discuss.leetcode.com/topic/2857/share-two-similar-java-solution-that-accpted-by-oj */ + /* Reference: https://discuss.leetcode.com/topic/2857/share-two-similar-java-solution-that-accpted-by-oj */ Map> map; List> results; @@ -65,13 +65,15 @@ public List> findLadders(String start, String end, List dic ladder.put(start, 0); dict.add(end); - //BFS: Dijisktra search + // BFS: Dijisktra search while (!queue.isEmpty()) { String word = queue.poll(); - int step = ladder.get(word) - + 1;//'step' indicates how many steps are needed to travel to one word. + int step = + ladder.get(word) + + 1; // 'step' indicates how many steps are needed to travel to one + // word. if (step > min) { break; @@ -85,40 +87,42 @@ public List> findLadders(String start, String end, List dic if (ladder.containsKey(newWord)) { if (step > ladder.get(newWord)) { - //Check if it is the shortest path to one word. + // Check if it is the shortest path to one word. continue; } else if (step < ladder.get(newWord)) { queue.add(newWord); ladder.put(newWord, step); } else { // It is a KEY line. If one word already appeared in one ladder, - // Do not insert the same word inside the queue twice. Otherwise it gets TLE. + // Do not insert the same word inside the queue twice. Otherwise it + // gets TLE. } if (map.containsKey(newWord)) { - //Build adjacent Graph + // Build adjacent Graph map.get(newWord).add(word); } else { List list = new LinkedList(); list.add(word); map.put(newWord, list); - //It is possible to write three lines in one: - //map.put(new_word,new LinkedList(Arrays.asList(new String[]{word}))); - //Which one is better? + // It is possible to write three lines in one: + // map.put(new_word,new LinkedList(Arrays.asList(new + // String[]{word}))); + // Which one is better? } if (newWord.equals(end)) { min = step; } } - //End if dict contains new_word + // End if dict contains new_word } - //End:Iteration from 'a' to 'z' + // End:Iteration from 'a' to 'z' } - //End:Iteration from the first to the last + // End:Iteration from the first to the last } - //End While + // End While - //BackTracking + // BackTracking LinkedList result = new LinkedList<>(); backTrace(end, start, result); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_128.java b/src/main/java/com/fishercoder/solutions/firstthousand/_128.java index fca1efe035..3ff62dffd0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_128.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_128.java @@ -11,7 +11,7 @@ public class _128 { public static class Solution1 { public int longestConsecutive(int[] nums) { Map map = new HashMap(); - // + // UnionFind uf = new UnionFind(nums); for (int i = 0; i < nums.length; i++) { if (map.containsKey(nums[i])) { @@ -20,7 +20,8 @@ public int longestConsecutive(int[] nums) { map.put(nums[i], i); if (map.containsKey(nums[i] - 1)) { uf.union(i, map.get(nums[i] - 1)); - //note: we want to union this index and nums[i]-1's root index which we can get from the map + // note: we want to union this index and nums[i]-1's root index which we can get + // from the map } if (map.containsKey(nums[i] + 1)) { uf.union(i, map.get(nums[i] + 1)); @@ -58,7 +59,7 @@ public boolean connected(int i, int j) { } public int maxUnion() { - //this is O(n) + // this is O(n) int max = 0; int[] count = new int[ids.length]; for (int i = 0; i < ids.length; i++) { @@ -71,7 +72,8 @@ public int maxUnion() { } public static class Solution2 { - //inspired by this solution: https://discuss.leetcode.com/topic/25493/simple-fast-java-solution-using-set + // inspired by this solution: + // https://discuss.leetcode.com/topic/25493/simple-fast-java-solution-using-set public int longestConsecutive(int[] nums) { if (nums == null || nums.length == 0) { return 0; @@ -88,13 +90,15 @@ public int longestConsecutive(int[] nums) { int val = num; int count = 1; while (set.remove(val - 1)) { - val--;//we find all numbers that are smaller than num and remove them from the set + val--; // we find all numbers that are smaller than num and remove them from + // the set } count += num - val; val = num; while (set.remove(val + 1)) { - val++;//then we find all numbers that are bigger than num and also remove them from the set + val++; // then we find all numbers that are bigger than num and also remove + // them from the set } count += val - num; @@ -106,7 +110,7 @@ public int longestConsecutive(int[] nums) { } public static class Solution3 { - /** + /* * O(n) time complexity. */ public int longestConsecutive(int[] nums) { @@ -117,7 +121,8 @@ public int longestConsecutive(int[] nums) { int longestStreak = 0; for (int num : set) { - //we'll go through this set instead of nums, this makes a big difference in time complexity, esp. based on LeetCode test cases + // we'll go through this set instead of nums, this makes a big difference in time + // complexity, esp. based on LeetCode test cases if (!set.contains(num - 1)) { int currentNum = num; int currentStreak = 1; @@ -134,7 +139,7 @@ public int longestConsecutive(int[] nums) { } public static class Solution4 { - /** + /* * O(nlogn) time complexity */ public int longestConsecutive(int[] nums) { @@ -143,7 +148,7 @@ public int longestConsecutive(int[] nums) { } TreeSet treeSet = new TreeSet<>(); for (int i : nums) { - treeSet.add(i);//O(logn) time complexity for each add() call + treeSet.add(i); // O(logn) time complexity for each add() call } int ans = 1; Iterator it = treeSet.iterator(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_129.java b/src/main/java/com/fishercoder/solutions/firstthousand/_129.java index 03e589c0ec..da8f46235d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_129.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_129.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -27,8 +26,9 @@ private void dfs(TreeNode root, StringBuilder sb, List allNumbers) { if (root.left == null && root.right == null) { allNumbers.add(Integer.parseInt(sb.toString())); } - //this is to delete the last value. since it's guaranteed that the value is between [0,9], so only one char needs to be deleted. - //however if the value is >= 10 then this approach needs to be adjusted + // this is to delete the last value. since it's guaranteed that the value is between + // [0,9], so only one char needs to be deleted. + // however if the value is >= 10 then this approach needs to be adjusted sb.deleteCharAt(sb.length() - 1); } } @@ -50,5 +50,4 @@ private int dfs(TreeNode root, int sum) { return left + right; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_13.java b/src/main/java/com/fishercoder/solutions/firstthousand/_13.java index f7a2fef492..21c9fce9cd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_13.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_13.java @@ -6,7 +6,7 @@ public class _13 { public static class Solution1 { - /** + /* * This is the most concise/elegant version to solve this problem: * 1. use a map to hold the roman to numeric mappings; * 2. we always add the number (corresponding from the char) first, then once we find that a later char has a corresponding value that is bigger than the previous char, @@ -38,5 +38,4 @@ public int romanToInt(String s) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_130.java b/src/main/java/com/fishercoder/solutions/firstthousand/_130.java index 0e9348021e..a43a26a0a8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_130.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_130.java @@ -11,7 +11,7 @@ public class _130 { public static class Solution1 { - /** + /* * I won't call this problem hard, it's just confusing, you'll definitely want to clarify what * the problem means before coding. This problem actually means: any grid that is 'O' but on * the four edges, will never be marked to 'X'; furthermore, any grid that is 'O' and that is @@ -19,7 +19,7 @@ public static class Solution1 { * nodes that has any one direct neighbor that is an 'X' will be marked to 'X'. */ - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; public void solve(char[][] board) { if (board == null || board.length == 0 || board[0].length == 0) { @@ -28,28 +28,30 @@ public void solve(char[][] board) { int m = board.length; int n = board[0].length; Queue queue = new LinkedList(); - //check first row and last row and mark all those '0' on these two rows to be '+' to let them be different from other 'O', - //at the same time, we put them into the queue to get ready for a BFS to mark all those adjacent 'O' nodes to '+' as well + // check first row and last row and mark all those '0' on these two rows to be '+' to + // let them be different from other 'O', + // at the same time, we put them into the queue to get ready for a BFS to mark all those + // adjacent 'O' nodes to '+' as well for (int j = 0; j < n; j++) { if (board[0][j] == 'O') { board[0][j] = '+'; - queue.offer(new int[]{0, j}); + queue.offer(new int[] {0, j}); } if (board[m - 1][j] == 'O') { board[m - 1][j] = '+'; - queue.offer(new int[]{m - 1, j}); + queue.offer(new int[] {m - 1, j}); } } - //check first column and last column too + // check first column and last column too for (int i = 0; i < m; i++) { if (board[i][0] == 'O') { board[i][0] = '+'; - queue.offer(new int[]{i, 0}); + queue.offer(new int[] {i, 0}); } if (board[i][n - 1] == 'O') { board[i][n - 1] = '+'; - queue.offer(new int[]{i, n - 1}); + queue.offer(new int[] {i, n - 1}); } } @@ -60,12 +62,13 @@ public void solve(char[][] board) { int y = curr[1] + dirs[i + 1]; if (x >= 0 && x < m && y >= 0 && y < n && board[x][y] == 'O') { board[x][y] = '+'; - queue.offer(new int[]{x, y}); + queue.offer(new int[] {x, y}); } } } - //now we can safely mark all other 'O' to 'X', also remember to put those '+' back to 'O' + // now we can safely mark all other 'O' to 'X', also remember to put those '+' back to + // 'O' for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == 'O') { @@ -79,7 +82,7 @@ public void solve(char[][] board) { } public static class Solution2 { - /** + /* * My completely original solution on 11/1/2021, again, using a pen and paper to visualize my thought process and list out all key steps helps a lot! * 1. scan through this board; * 2. whenever we find an 'O', we'll do BFS to find all connected points and use the first 'O' as its head point for this entire connected region; @@ -116,16 +119,21 @@ private void capture(Map> headMap, char[][] board) { } } - private boolean bfs(int startI, int startJ, char[][] board, boolean[][] visited, Map> headMap) { + private boolean bfs( + int startI, + int startJ, + char[][] board, + boolean[][] visited, + Map> headMap) { boolean capturable = true; Queue queue = new LinkedList<>(); int m = board.length; int n = board[0].length; - queue.offer(new int[]{startI, startJ}); + queue.offer(new int[] {startI, startJ}); int head = startI * n + startJ; List list = headMap.getOrDefault(head, new ArrayList<>()); - list.add(new int[]{startI, startJ}); - int[] directions = new int[]{0, 1, 0, -1, 0}; + list.add(new int[] {startI, startJ}); + int[] directions = new int[] {0, 1, 0, -1, 0}; while (!queue.isEmpty()) { int size = queue.size(); for (int i = 0; i < size; i++) { @@ -137,10 +145,15 @@ private boolean bfs(int startI, int startJ, char[][] board, boolean[][] visited, for (int j = 0; j < directions.length - 1; j++) { int newx = directions[j] + curr[0]; int newy = directions[j + 1] + curr[1]; - if (newx >= 0 && newx < m && newy >= 0 && newy < n && !visited[newx][newy] && board[newx][newy] == 'O') { - queue.offer(new int[]{newx, newy}); + if (newx >= 0 + && newx < m + && newy >= 0 + && newy < n + && !visited[newx][newy] + && board[newx][newy] == 'O') { + queue.offer(new int[] {newx, newy}); visited[newx][newy] = true; - list.add(new int[]{newx, newy}); + list.add(new int[] {newx, newy}); } } } @@ -152,6 +165,5 @@ private boolean bfs(int startI, int startJ, char[][] board, boolean[][] visited, } return capturable; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_131.java b/src/main/java/com/fishercoder/solutions/firstthousand/_131.java index edd42a84d9..3be190c0fe 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_131.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_131.java @@ -6,7 +6,7 @@ public class _131 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/palindrome-partitioning/solution/ * DFS + backtracking */ @@ -47,8 +47,10 @@ public List> partition(String s) { for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { if (s.charAt(j) == s.charAt(i) && (j + 1 >= i - 1 || dp[j + 1][i - 1])) { - // j+1 >= i-1 means j and i are adjance to each other or only one char apart from each other - //dp[j+1][i-1] means its inner substring is a palindrome, so as long as s.charAt(j) == s.charAt(i), then dp[j][i] must be a palindrome. + // j+1 >= i-1 means j and i are adjance to each other or only one char apart + // from each other + // dp[j+1][i-1] means its inner substring is a palindrome, so as long as + // s.charAt(j) == s.charAt(i), then dp[j][i] must be a palindrome. dp[j][i] = true; } } @@ -67,8 +69,8 @@ public List> partition(String s) { return result; } - void backtracking(String s, int start, boolean[][] dp, List temp, - List> result) { + void backtracking( + String s, int start, boolean[][] dp, List temp, List> result) { if (start == s.length()) { List newTemp = new ArrayList(temp); result.add(newTemp); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_132.java b/src/main/java/com/fishercoder/solutions/firstthousand/_132.java index 9fb2b9dff3..0aa3265e9c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_132.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_132.java @@ -1,46 +1,48 @@ package com.fishercoder.solutions.firstthousand; -/** - * 132. Palindrome Partitioning II +/* +* 132. Palindrome Partitioning II - Given a string s, partition s such that every substring of the partition is a palindrome. +Given a string s, partition s such that every substring of the partition is a palindrome. - Return the minimum cuts needed for a palindrome partitioning of s. +Return the minimum cuts needed for a palindrome partitioning of s. - For example, given s = "aab", - Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut. +For example, given s = "aab", +Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut. - */ +*/ public class _132 { - /**This solution is cooler than Jiuzhang: https://discuss.leetcode.com/topic/32575/easiest-java-dp-solution-97-36*/ + /*This solution is cooler than Jiuzhang: https://discuss.leetcode.com/topic/32575/easiest-java-dp-solution-97-36*/ public static class Solution1 { - //cut[i] stands for the minimum number of cut needed to cut [0, i] into palindromes - //we initiazlie cut[i] with its max possible value which is i, this is because a single char is naturally a palindrome, so, we'll cut this string into all single-char substrings, which is the max cuts needed - - //dp[j][i] == true stands for s.substring(j,i) is a palindrome - public int minCut(String s) { - int n = s.length(); - char[] c = s.toCharArray(); - boolean[][] dp = new boolean[n][n]; - int[] cut = new int[n]; - - for (int i = 0; i < n; i++) { - cut[i] = i; - for (int j = 0; j <= i; j++) { - if (c[i] == c[j] && (j + 1 > i - 1 || dp[j + 1][i - 1])) { - dp[j][i] = true; - if (j == 0) { - cut[i] = 0; - } else { - cut[i] = (cut[i] < cut[j - 1] + 1) ? cut[i] : cut[j - 1] + 1; - } + // cut[i] stands for the minimum number of cut needed to cut [0, i] into palindromes + // we initiazlie cut[i] with its max possible value which is i, this is because a single + // char is naturally a palindrome, so, we'll cut this string into all single-char + // substrings, which is the max cuts needed + + // dp[j][i] == true stands for s.substring(j,i) is a palindrome + public int minCut(String s) { + int n = s.length(); + char[] c = s.toCharArray(); + boolean[][] dp = new boolean[n][n]; + int[] cut = new int[n]; + + for (int i = 0; i < n; i++) { + cut[i] = i; + for (int j = 0; j <= i; j++) { + if (c[i] == c[j] && (j + 1 > i - 1 || dp[j + 1][i - 1])) { + dp[j][i] = true; + if (j == 0) { + cut[i] = 0; + } else { + cut[i] = (cut[i] < cut[j - 1] + 1) ? cut[i] : cut[j - 1] + 1; + } + } + } } - } - } - return cut[n - 1]; - } + return cut[n - 1]; + } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_133.java b/src/main/java/com/fishercoder/solutions/firstthousand/_133.java index b769388a13..6a133ca435 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_133.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_133.java @@ -19,7 +19,8 @@ public Node cloneGraph(Node node) { Queue queue = new LinkedList(); Node root = new Node(node.val); map.put(root.val, root); - //remember to offer the original input node into the queue which contains all the information + // remember to offer the original input node into the queue which contains all the + // information queue.offer(node); while (!queue.isEmpty()) { Node curr = queue.poll(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_134.java b/src/main/java/com/fishercoder/solutions/firstthousand/_134.java index 6a74c07f6b..b0251bb93f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_134.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_134.java @@ -1,36 +1,35 @@ package com.fishercoder.solutions.firstthousand; -/** - * 134. Gas Station - * - * There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. - You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). - You begin the journey with an empty tank at one of the gas stations. +/* +* 134. Gas Station +* +* There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. +You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). +You begin the journey with an empty tank at one of the gas stations. - Return the starting gas station's index if you can travel around the circuit once, otherwise return -1. +Return the starting gas station's index if you can travel around the circuit once, otherwise return -1. - Note: - The solution is guaranteed to be unique. - */ +Note: +The solution is guaranteed to be unique. +*/ public class _134 { - public static class Solution1 { - /** Credit: https://discuss.leetcode.com/topic/5088/my-ac-is-o-1-space-o-n-running-time-solution-does-anybody-have-posted-this-solution */ - public int canCompleteCircuit(int[] gas, int[] cost) { - int start = gas.length - 1; - int end = 0; - int sum = gas[start] - cost[start]; - while (start > end) { - if (sum >= 0) { - sum += gas[end] - cost[end]; - end++; - } else { - start--; - sum += gas[start] - cost[start]; + public static class Solution1 { + /* Credit: https://discuss.leetcode.com/topic/5088/my-ac-is-o-1-space-o-n-running-time-solution-does-anybody-have-posted-this-solution */ + public int canCompleteCircuit(int[] gas, int[] cost) { + int start = gas.length - 1; + int end = 0; + int sum = gas[start] - cost[start]; + while (start > end) { + if (sum >= 0) { + sum += gas[end] - cost[end]; + end++; + } else { + start--; + sum += gas[start] - cost[start]; + } + } + return sum >= 0 ? start : -1; } - } - return sum >= 0 ? start : -1; } - } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_135.java b/src/main/java/com/fishercoder/solutions/firstthousand/_135.java index 0cd4e7abf5..d7440aefc0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_135.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_135.java @@ -1,43 +1,43 @@ package com.fishercoder.solutions.firstthousand; -/** - * 135. Candy +/* +* 135. Candy - There are N children standing in a line. Each child is assigned a rating value. +There are N children standing in a line. Each child is assigned a rating value. - You are giving candies to these children subjected to the following requirements: +You are giving candies to these children subjected to the following requirements: - Each child must have at least one candy. - Children with a higher rating get more candies than their neighbors. - What is the minimum candies you must give? - */ +Each child must have at least one candy. +Children with a higher rating get more candies than their neighbors. +What is the minimum candies you must give? +*/ public class _135 { - public static class Solution1 { - public int candy(int[] ratings) { - int[] candy = new int[ratings.length]; - for (int i = 0; i < ratings.length; i++) { - candy[i] = 1; - } - - for (int i = 0; i < ratings.length - 1; i++) { - if (ratings[i] < ratings[i + 1]) { - candy[i + 1] = candy[i] + 1; - } - } - - for (int i = ratings.length - 1; i > 0; i--) { - if (ratings[i] < ratings[i - 1]) { - candy[i - 1] = Math.max(candy[i - 1], candy[i] + 1); + public static class Solution1 { + public int candy(int[] ratings) { + int[] candy = new int[ratings.length]; + for (int i = 0; i < ratings.length; i++) { + candy[i] = 1; + } + + for (int i = 0; i < ratings.length - 1; i++) { + if (ratings[i] < ratings[i + 1]) { + candy[i + 1] = candy[i] + 1; + } + } + + for (int i = ratings.length - 1; i > 0; i--) { + if (ratings[i] < ratings[i - 1]) { + candy[i - 1] = Math.max(candy[i - 1], candy[i] + 1); + } + } + + int sum = 0; + for (int i : candy) { + sum += i; + } + + return sum; } - } - - int sum = 0; - for (int i : candy) { - sum += i; - } - - return sum; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_136.java b/src/main/java/com/fishercoder/solutions/firstthousand/_136.java index 48dca3bb3a..73a94ea90c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_136.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_136.java @@ -6,7 +6,7 @@ public class _136 { public static class Solution1 { - /** + /* * Approach 1: use set, since this problem explicitly states that every element appears twice * and only one appears once so, we could safely remove the ones that are already in the set, * O(n) time and O(n) space. HashTable approach works similarly like this one, but it could be @@ -24,7 +24,7 @@ public int singleNumber(int[] nums) { } public static class Solution2 { - /** + /* * Approach 2: bit manipulation, use exclusive or ^ to solve this problem: we're using the trick * here: every number ^ itself will become zero, so, the only remaining element will be the one * that appeared only once. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_137.java b/src/main/java/com/fishercoder/solutions/firstthousand/_137.java index 5b6e5444f9..29b535fecf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_137.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_137.java @@ -21,7 +21,7 @@ public int singleNumber(int[] nums) { } public static class Solution2 { - /** + /* * Credit: https://discuss.leetcode.com/topic/11877/detailed-explanation-and-generalization-of-the-bitwise-operation-method-for-single-numbers/2 */ public int singleNumber(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_138.java b/src/main/java/com/fishercoder/solutions/firstthousand/_138.java index 6f9136bd8f..9462f8a4f8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_138.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_138.java @@ -6,17 +6,17 @@ public class _138 { public static class Solution1 { public Node copyRandomList(Node head) { - /**Key is the original nodes, value is the new nodes we're deep copying to.*/ + /*Key is the original nodes, value is the new nodes we're deep copying to.*/ Map map = new HashMap(); Node node = head; - //loop for the first time: copy the node themselves with only labels + // loop for the first time: copy the node themselves with only labels while (node != null) { map.put(node, new Node(node.val)); node = node.next; } - //loop for the second time: copy random and next pointers + // loop for the second time: copy random and next pointers node = head; while (node != null) { map.get(node).next = map.get(node.next); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_139.java b/src/main/java/com/fishercoder/solutions/firstthousand/_139.java index b8b99b09ad..24bcb6d8db 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_139.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_139.java @@ -5,7 +5,7 @@ public class _139 { public static class Solution1 { - /** + /* * this solution takes between 7 and 8 ms to finish on LeetCode * beats around 38% to 48% submissions as of 6/27/2020 */ @@ -26,7 +26,7 @@ public boolean wordBreak(String s, List wordDict) { } public static class Solution2 { - /** + /* * Added pruning based on max word length. * this solution takes between 2 and 3 ms to finish on LeetCode * this beats 94.53% submissions as of 6/27/2020 @@ -56,7 +56,7 @@ public boolean wordBreak(String s, List wordDict) { } public static class Solution3 { - /** + /* * Added pruning, plus start from the end to check. * This solution takes 1 ms to finish on LeetCode * This beats 99.02% submissions as of 6/27/2020. @@ -71,8 +71,11 @@ public boolean wordBreak(String s, List wordDict) { boolean[] dp = new boolean[n + 1]; dp[0] = true; for (int i = 1; i <= n; i++) { - for (int lastWordLength = 1; lastWordLength <= i && lastWordLength <= maxLen; lastWordLength++) { - if (dp[i - lastWordLength] && wordDict.contains(s.substring(i - lastWordLength, i))) { + for (int lastWordLength = 1; + lastWordLength <= i && lastWordLength <= maxLen; + lastWordLength++) { + if (dp[i - lastWordLength] + && wordDict.contains(s.substring(i - lastWordLength, i))) { dp[i] = true; break; } @@ -81,5 +84,4 @@ public boolean wordBreak(String s, List wordDict) { return dp[n]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_14.java b/src/main/java/com/fishercoder/solutions/firstthousand/_14.java index 5c35837733..a1f98ac302 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_14.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_14.java @@ -3,7 +3,7 @@ public class _14 { public static class Solution1 { - //horizontal scan + // horizontal scan public String longestCommonPrefix(String[] strs) { if (strs.length == 0) { return ""; @@ -22,7 +22,7 @@ public String longestCommonPrefix(String[] strs) { } public static class Solution2 { - //vertical scan + // vertical scan public String longestCommonPrefix(String[] strs) { if (strs.length == 0) { return ""; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_141.java b/src/main/java/com/fishercoder/solutions/firstthousand/_141.java index fd5980726e..0ee479113a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_141.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_141.java @@ -1,37 +1,36 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.ListNode; - -import java.util.HashSet; -import java.util.Set; - -public class _141 { - - public static class Solution1 { - public boolean hasCycle(ListNode head) { - Set set = new HashSet(); - while (head != null) { - if (!set.add(head)) { - return true; - } - head = head.next; - } - return false; - } - } - - public static class Solution2 { - public boolean hasCycle(ListNode head) { - ListNode slow = head; - ListNode fast = head; - while (fast != null && fast.next != null) { - fast = fast.next.next; - slow = slow.next; - if (fast == slow) { - return true; - } - } - return false; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.ListNode; +import java.util.HashSet; +import java.util.Set; + +public class _141 { + + public static class Solution1 { + public boolean hasCycle(ListNode head) { + Set set = new HashSet(); + while (head != null) { + if (!set.add(head)) { + return true; + } + head = head.next; + } + return false; + } + } + + public static class Solution2 { + public boolean hasCycle(ListNode head) { + ListNode slow = head; + ListNode fast = head; + while (fast != null && fast.next != null) { + fast = fast.next.next; + slow = slow.next; + if (fast == slow) { + return true; + } + } + return false; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_142.java b/src/main/java/com/fishercoder/solutions/firstthousand/_142.java index 8b7339ab33..e3a1691cde 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_142.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_142.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.HashSet; import java.util.Set; @@ -21,7 +20,7 @@ public ListNode detectCycle(ListNode head) { } public static class Solution2 { - /** + /* * This comment explains it really well for this solution: * https://leetcode.com/problems/linked-list-cycle-ii/discuss/44774/Java-O(1)-space-solution-with-detailed-explanation./44281 * diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_143.java b/src/main/java/com/fishercoder/solutions/firstthousand/_143.java index c0e81b1b90..455f0e5bc2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_143.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_143.java @@ -36,7 +36,7 @@ public void reorderList(ListNode head) { cur = post; post = temp; } - head2 = cur;// the new head of the reversed sublist + head2 = cur; // the new head of the reversed sublist // merge the two sublists as required ListNode p = head1; @@ -53,7 +53,7 @@ public void reorderList(ListNode head) { } public static class Solution2 { - /** + /* * My completely original solution on 10/25/2021, although not super efficient in time complexity, * since I keep going through the rest of the list to the end at each iteration, it's accepted on LeetCode. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_144.java b/src/main/java/com/fishercoder/solutions/firstthousand/_144.java index 511f1a36de..16a1534e4e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_144.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_144.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; import java.util.Stack; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_145.java b/src/main/java/com/fishercoder/solutions/firstthousand/_145.java index 38fb15f8f0..999f8f934d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_145.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_145.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; @@ -10,7 +9,7 @@ public class _145 { public static class Solution1 { - /** + /* * A tricky/hacky one: Modify the code for pre-order traversal * so that it becomes root->right->left, * and then reverse the result to get left->right->root. @@ -38,7 +37,7 @@ public List postorderTraversal(TreeNode root) { } public static class Solution2 { - /** + /* * Or use a LinkedList and add values to the head, then no reverse is needed. * the linked list contents get added like this: *

@@ -68,7 +67,7 @@ public List postorderTraversal(TreeNode root) { } public static class Solution3 { - /** + /* * recursive solution is trivial. */ public List postorderTraversal(TreeNode root) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_146.java b/src/main/java/com/fishercoder/solutions/firstthousand/_146.java index 5c66ffa5bc..51d3e563a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_146.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_146.java @@ -7,7 +7,7 @@ public class _146 { public class Solution1 { public class LRUCache { - /** + /* * The shortest implementation is to use LinkedHashMap: * specify a size of the LinkedHashMap; * override the removeEldestEntry method when its size exceeds max size: @@ -22,11 +22,12 @@ public class LRUCache { public LRUCache(int capacity) { max = capacity; - cache = new LinkedHashMap(capacity, 1.0f, true) { - public boolean removeEldestEntry(Map.Entry eldest) { - return cache.size() > max; - } - }; + cache = + new LinkedHashMap(capacity, 1.0f, true) { + public boolean removeEldestEntry(Map.Entry eldest) { + return cache.size() > max; + } + }; } public int get(int key) { @@ -41,7 +42,7 @@ public void put(int key, int value) { public class Solution2 { public class LRUCache { - /** + /* * The more verbose solution is to implement a doubly linked list yourself plus a map. * It's very straightforward to implement this, key notes here: https://docs.google.com/spreadsheets/d/1anN6L5OLhUFd1ANtqDdYY6tz2Ao2H1GESfpDiCfeWyM/edit#gid=0 * (search for the URL of this problem to find it.) @@ -69,11 +70,15 @@ private class Node { private LRUCache.Node head; private LRUCache.Node tail; private Map map; - // ATTN: the value should be Node type! This is the whole point of having a class called Node! + + // ATTN: the value should be Node type! This is the whole point of having a class called + // Node! public LRUCache(int capacity) { this.capacity = capacity; - this.count = 0;// we need a count to keep track of the number of elements in the cache so + this.count = + 0; // we need a count to keep track of the number of elements in the cache + // so // that we know when to evict the LRU one from the cache this.map = new HashMap(); head = new LRUCache.Node(); @@ -88,7 +93,7 @@ public int get(int key) { if (node == null) { return -1; } else { - /**Do two operations: this makes the process more clear: + /*Do two operations: this makes the process more clear: * remove the old node first, and then * just add the node again. * This will guarantee that this node will be at the latest position: @@ -109,9 +114,9 @@ public void put(int key, int value) { count++; if (count > capacity) { - /** ATTN: It's tail.prev, not tail, because tail is always an invalid node, it - doesn't contain anything, it's always the tail.prev that is the last node in the - cache*/ + /* ATTN: It's tail.prev, not tail, because tail is always an invalid node, it + doesn't contain anything, it's always the tail.prev that is the last node in the + cache*/ LRUCache.Node toDelete = tail.prev; map.remove(toDelete.key); remove(toDelete); @@ -141,4 +146,4 @@ private void add(LRUCache.Node node) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_147.java b/src/main/java/com/fishercoder/solutions/firstthousand/_147.java index 92bd090e5d..87aed10285 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_147.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_147.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_148.java b/src/main/java/com/fishercoder/solutions/firstthousand/_148.java index 971422aaae..661a0178ab 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_148.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_148.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -9,7 +8,7 @@ public class _148 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/18100/java-merge-sort-solution * But this is not using constant space. */ @@ -18,7 +17,7 @@ public ListNode sortList(ListNode head) { return head; } - //Step 1: split the list into halves + // Step 1: split the list into halves ListNode prev = null; ListNode slow = head; ListNode fast = head; @@ -29,11 +28,11 @@ public ListNode sortList(ListNode head) { } prev.next = null; - //step 2: sort each half + // step 2: sort each half ListNode l1 = sortList(head); ListNode l2 = sortList(slow); - //step 3: merge the two halves + // step 3: merge the two halves return merge(l1, l2); } @@ -92,8 +91,10 @@ public ListNode sortList(ListNode head) { ListNode split(ListNode start, int size) { ListNode midPrev = start; ListNode end = start.next; - //use fast and slow approach to find middle and end of second linked list - for (int index = 1; index < size && (midPrev.next != null || end.next != null); index++) { + // use fast and slow approach to find middle and end of second linked list + for (int index = 1; + index < size && (midPrev.next != null || end.next != null); + index++) { if (end.next != null) { end = (end.next.next != null) ? end.next.next : end.next; } @@ -146,7 +147,7 @@ int getCount(ListNode head) { } public static class Solution3 { - /** + /* * Credit: https://leetcode.com/problems/sort-list/solution/ top down approach. */ public ListNode sortList(ListNode head) { @@ -181,7 +182,7 @@ private ListNode mergeList(ListNode left, ListNode right) { } private ListNode getMid(ListNode head) { - /**The key/trick is in this method: + /*The key/trick is in this method: * it directly uses this head to iterate, so that we could use this top down recursive approach. * If we assign head to slow and fast pointers, then this algorithm will run into StackOverflow exception. * @@ -192,13 +193,13 @@ private ListNode getMid(ListNode head) { head = head.next.next; } ListNode mid = midPrev.next; - midPrev.next = null;//this is the key, otherwise, StackOverflow exception will occur. + midPrev.next = null; // this is the key, otherwise, StackOverflow exception will occur. return mid; } } public static class Solution4 { - /**This is the most naive, using O(n) extra memory, O(nlogn) time.*/ + /*This is the most naive, using O(n) extra memory, O(nlogn) time.*/ public ListNode sortList(ListNode head) { if (head == null) { return head; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_149.java b/src/main/java/com/fishercoder/solutions/firstthousand/_149.java index d28a1f55f6..b97c6962e8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_149.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_149.java @@ -5,7 +5,7 @@ public class _149 { - /** + /* * credits: https://leetcode.com/problems/max-points-on-a-line/discuss/328269/A-Java-solution-with-my-understanding */ public static class Solution1 { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_15.java b/src/main/java/com/fishercoder/solutions/firstthousand/_15.java index 5113007dc2..11aa2e1e9e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_15.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_15.java @@ -28,7 +28,7 @@ public List> threeSum(int[] nums) { while (mid < right && nums[right] == nums[right - 1]) { right--; } - //these two lines are critical and easy to forget, if so, it'll TLE + // these two lines are critical and easy to forget, if so, it'll TLE mid++; right--; } else if (sum > 0) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_151.java b/src/main/java/com/fishercoder/solutions/firstthousand/_151.java index bbca69fc44..2e8e248d5a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_151.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_151.java @@ -45,7 +45,8 @@ public String reverseWords(String s) { } j = i + 1; - // index j keeps track of non-space characters and gives index of the first occurrence of space after a non-space character + // index j keeps track of non-space characters and gives index of the first + // occurrence of space after a non-space character while (j < len && s.charAt(j) != ' ') { j++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_153.java b/src/main/java/com/fishercoder/solutions/firstthousand/_153.java index 09521e97a2..952d9458ee 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_153.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_153.java @@ -2,7 +2,7 @@ public class _153 { public static class Solution1 { - /** + /* * My completely original solution on 10/23/2021. * Again, using a pen and paper to visualize your thought process, to draw out all the possible cases helps a lot! */ @@ -12,7 +12,7 @@ public int findMin(int[] nums) { while (left < right) { int mid = left + (right - left) / 2; if (mid == left || mid == right) { - //this is to avoid infinite loop + // this is to avoid infinite loop break; } if (nums[mid] > nums[left] && nums[mid] > nums[right]) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_154.java b/src/main/java/com/fishercoder/solutions/firstthousand/_154.java index 9f0687b8b9..71a04859b5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_154.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_154.java @@ -2,7 +2,7 @@ public class _154 { public static class Solution1 { - /** + /* * My completely original solution on 10/23/2021. * Again, using a pen and paper to visualize all possible cases helps a great deal! */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_155.java b/src/main/java/com/fishercoder/solutions/firstthousand/_155.java index 7356002322..5afab6579b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_155.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_155.java @@ -17,7 +17,7 @@ public MinStack() { public void push(int x) { if (x <= min) { - /**All the trick happens here, we push the second minimum number onto the stack before we push the newer one, + /*All the trick happens here, we push the second minimum number onto the stack before we push the newer one, * this way, when popping, we could always get the next minimum one in constant time.*/ stack.push(min); min = x; @@ -26,7 +26,7 @@ public void push(int x) { } public void pop() { - /**if the value on the top of the stack happens to be the current minimum, we'll pop twice and change + /*if the value on the top of the stack happens to be the current minimum, we'll pop twice and change * the current min value to be the last min value */ if (min == stack.pop()) { min = stack.pop(); @@ -44,7 +44,7 @@ public int getMin() { } public static class Solution2 { - /** + /* * We could store a pair onto the stack: the first element in the pair is the value itself, * the second element in the pair is the current minimum element so far seen on the stack. */ @@ -60,12 +60,12 @@ public void push(int val) { int[] last = stack.peekLast(); int currentMin = last[1]; if (val <= currentMin) { - stack.addLast(new int[]{val, val}); + stack.addLast(new int[] {val, val}); } else { - stack.addLast(new int[]{val, currentMin}); + stack.addLast(new int[] {val, currentMin}); } } else { - stack.addLast(new int[]{val, val}); + stack.addLast(new int[] {val, val}); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_156.java b/src/main/java/com/fishercoder/solutions/firstthousand/_156.java index bbeefa964e..36831b55c5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_156.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_156.java @@ -2,7 +2,7 @@ import com.fishercoder.common.classes.TreeNode; -/** +/* * 156. Binary Tree Upside Down * * Given a binary tree where all the right nodes are either leaf nodes with a sibling diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_157.java b/src/main/java/com/fishercoder/solutions/firstthousand/_157.java index 85c0ef1af8..6232504903 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_157.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_157.java @@ -15,7 +15,7 @@ public int read(char[] buf, int n) { } private int read4(char[] buffer) { - //this is a dummy method to make it compile + // this is a dummy method to make it compile return 0; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_158.java b/src/main/java/com/fishercoder/solutions/firstthousand/_158.java index 74516f07e0..f4809a998e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_158.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_158.java @@ -3,7 +3,7 @@ public class _158 { public static class Solution1 { - /** + /* * @param buf Destination buffer * @param n Maximum number of characters to read * @return The number of characters read @@ -31,7 +31,7 @@ public int read(char[] buf, int n) { return ptr; } - //This is a fake method to make IDE happy. + // This is a fake method to make IDE happy. private int read4(char[] buff) { return 1; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_159.java b/src/main/java/com/fishercoder/solutions/firstthousand/_159.java index f1c11a2947..e42da87b40 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_159.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_159.java @@ -35,7 +35,7 @@ public int lengthOfLongestSubstringTwoDistinct(String s) { } public static class Solution2 { - /** + /* * My completely original solution, classic sliding window problem: * use two pointers, one keeps moving towards the right to expand; * the other moves only when we are no longer meeting the requirement, i.e. shrinks. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_16.java b/src/main/java/com/fishercoder/solutions/firstthousand/_16.java index d3cacd26c4..c7f66e48f9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_16.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_16.java @@ -28,5 +28,4 @@ public int threeSumClosest(int[] nums, int target) { return sum; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_160.java b/src/main/java/com/fishercoder/solutions/firstthousand/_160.java index c00a709ed7..0f23f90f1b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_160.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_160.java @@ -1,21 +1,20 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.HashSet; import java.util.Set; public class _160 { public static class Solution1 { - /** + /* * Time: O(max(m, n)) * Space: O(1) */ public ListNode getIntersectionNode(ListNode headA, ListNode headB) { int lenA = findLen(headA); int lenB = findLen(headB); - /**align headA and headB to the same starting point and then move together until we find the intersection point*/ + /*align headA and headB to the same starting point and then move together until we find the intersection point*/ while (lenA < lenB) { headB = headB.next; lenB--; @@ -42,11 +41,10 @@ private int findLen(ListNode head) { } return len; } - } public static class Solution2 { - /** + /* * Most optimal solution: * O(m+n) time * O(1) space @@ -60,9 +58,9 @@ public ListNode getIntersectionNode(ListNode headA, ListNode headB) { ListNode a = headA; ListNode b = headB; - /**if a and b have different lengths, then it will stop the loop after second iteration*/ + /*if a and b have different lengths, then it will stop the loop after second iteration*/ while (a != b) { - /**for the first iteration, it'll just reset the pointer to the head of another linkedlist*/ + /*for the first iteration, it'll just reset the pointer to the head of another linkedlist*/ a = a == null ? headB : a.next; b = b == null ? headA : b.next; } @@ -71,7 +69,7 @@ public ListNode getIntersectionNode(ListNode headA, ListNode headB) { } public static class Solution3 { - /** + /* * O(m+n) time * O(Math.max(m, n)) space */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_161.java b/src/main/java/com/fishercoder/solutions/firstthousand/_161.java index e11f24d252..54244bacf6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_161.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_161.java @@ -23,7 +23,8 @@ public boolean isOneEditDistance(String s, String t) { } } return diffCnt == 1 || diffCnt == 0; - //it could be the last char of the longer is the different one, in that case, diffCnt remains to be zero + // it could be the last char of the longer is the different one, in that case, + // diffCnt remains to be zero } else if (s.length() == t.length()) { int diffCnt = 0; for (int i = 0; i < s.length(); i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_162.java b/src/main/java/com/fishercoder/solutions/firstthousand/_162.java index fe16f64293..f1f571cea3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_162.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_162.java @@ -3,7 +3,7 @@ public class _162 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/find-peak-element/solutions/1290642/intuition-behind-conditions-complete-explanation-diagram-binary-search/ * Time: O(logn) *

@@ -44,7 +44,7 @@ public int findPeakElement(int[] nums) { } public static class Solution2 { - /** + /* * My original O(n) solution. */ public int findPeakElement(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_163.java b/src/main/java/com/fishercoder/solutions/firstthousand/_163.java index c8cb0fe8b4..d8910747a9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_163.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_163.java @@ -12,18 +12,18 @@ public List> findMissingRanges(int[] nums, int lower, int upper) { missingRanges.add(Arrays.asList(lower, upper)); return missingRanges; } - //check for missing numbers between lower and nums[0] + // check for missing numbers between lower and nums[0] if (lower < nums[0]) { missingRanges.add(Arrays.asList(lower, nums[0] - 1)); } - //check for missing numbers between nums + // check for missing numbers between nums for (int i = 0; i < nums.length - 1; i++) { if (nums[i] + 1 == nums[i + 1]) { continue; } missingRanges.add(Arrays.asList(nums[i] + 1, nums[i + 1] - 1)); } - //check for any missing numbers between nums[n - 1] and upper + // check for any missing numbers between nums[n - 1] and upper if (nums[nums.length - 1] < upper) { missingRanges.add(Arrays.asList(nums[nums.length - 1] + 1, upper)); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_164.java b/src/main/java/com/fishercoder/solutions/firstthousand/_164.java index d49626e5b1..48c1abc19f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_164.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_164.java @@ -2,7 +2,7 @@ import java.util.Arrays; -/** +/* * 164. Maximum Gap * * Given an unsorted array, find the maximum difference between the successive elements in its sorted form. @@ -24,31 +24,31 @@ * Try to solve it in linear time/space. */ public class _164 { - public static class Solution1 { - /** brute force solution */ - public int maximumGap(int[] nums) { - if (nums.length < 2) { - return 0; - } + public static class Solution1 { + /* brute force solution */ + public int maximumGap(int[] nums) { + if (nums.length < 2) { + return 0; + } - Arrays.sort(nums); - int max = Integer.MIN_VALUE; - for (int i = 1; i < nums.length; ) { - while (i < nums.length && nums[i] == nums[i - 1]) { - i++; + Arrays.sort(nums); + int max = Integer.MIN_VALUE; + for (int i = 1; i < nums.length; ) { + while (i < nums.length && nums[i] == nums[i - 1]) { + i++; + } + if (i == nums.length) { + i--; + max = (nums[i] - nums[i - 1] > max) ? nums[i] - nums[i - 1] : max; + break; + } else { + max = (nums[i] - nums[i - 1] > max) ? nums[i] - nums[i - 1] : max; + } + if (nums[i] != nums[i - 1]) { + i++; + } + } + return max; } - if (i == nums.length) { - i--; - max = (nums[i] - nums[i - 1] > max) ? nums[i] - nums[i - 1] : max; - break; - } else { - max = (nums[i] - nums[i - 1] > max) ? nums[i] - nums[i - 1] : max; - } - if (nums[i] != nums[i - 1]) { - i++; - } - } - return max; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_165.java b/src/main/java/com/fishercoder/solutions/firstthousand/_165.java index 5dddbde8a4..f8814716a9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_165.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_165.java @@ -3,8 +3,10 @@ public class _165 { public static class Solution1 { public int compareVersion(String version1, String version2) { - String[] v1s = version1.split( - "\\.");//escaping it is very important! Otherwise, it's not going to work as expected! + String[] v1s = + version1.split( + "\\."); // escaping it is very important! Otherwise, it's not going to + // work as expected! String[] v2s = version2.split("\\."); int len = (v1s.length < v2s.length) ? v2s.length : v1s.length; for (int i = 0; i < len; i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_166.java b/src/main/java/com/fishercoder/solutions/firstthousand/_166.java index 6da7d2af70..6f688f81b9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_166.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_166.java @@ -3,56 +3,58 @@ import java.util.HashMap; import java.util.Map; -/** - * 166. Fraction to Recurring Decimal - * - * Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. +/* +* 166. Fraction to Recurring Decimal +* +* Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. - If the fractional part is repeating, enclose the repeating part in parentheses. +If the fractional part is repeating, enclose the repeating part in parentheses. - For example, +For example, - Given numerator = 1, denominator = 2, return "0.5". - Given numerator = 2, denominator = 1, return "2". - Given numerator = 2, denominator = 3, return "0.(6)". +Given numerator = 1, denominator = 2, return "0.5". +Given numerator = 2, denominator = 1, return "2". +Given numerator = 2, denominator = 3, return "0.(6)". - */ +*/ public class _166 { - public static class Solution1 { - /** credit: https://discuss.leetcode.com/topic/33311/simple-and-short-solution-in-java */ - public String fractionToDecimal(int numerator, int denominator) { - String sign = - (numerator >= 0 && denominator >= 0) || (numerator < 0 && denominator < 0) ? "" : "-"; - if (numerator == 0) { - return "0"; - } - long num = Math.abs((long) numerator); - long deno = Math.abs((long) denominator); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(sign); - long integral = Math.abs(num / deno); - stringBuilder.append(integral); - if (numerator % denominator == 0) { - return stringBuilder.toString(); - } else { - stringBuilder.append("."); - } - long remainder = num % deno; + public static class Solution1 { + /* credit: https://discuss.leetcode.com/topic/33311/simple-and-short-solution-in-java */ + public String fractionToDecimal(int numerator, int denominator) { + String sign = + (numerator >= 0 && denominator >= 0) || (numerator < 0 && denominator < 0) + ? "" + : "-"; + if (numerator == 0) { + return "0"; + } + long num = Math.abs((long) numerator); + long deno = Math.abs((long) denominator); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(sign); + long integral = Math.abs(num / deno); + stringBuilder.append(integral); + if (numerator % denominator == 0) { + return stringBuilder.toString(); + } else { + stringBuilder.append("."); + } + long remainder = num % deno; - Map map = new HashMap<>(); - while (!map.containsKey(remainder)) { - map.put(remainder, stringBuilder.length()); - long n = remainder * 10 / deno; - remainder = remainder * 10 % deno; - if (remainder != 0 || (remainder == 0 && !map.containsKey(remainder))) { - stringBuilder.append(n); + Map map = new HashMap<>(); + while (!map.containsKey(remainder)) { + map.put(remainder, stringBuilder.length()); + long n = remainder * 10 / deno; + remainder = remainder * 10 % deno; + if (remainder != 0 || (remainder == 0 && !map.containsKey(remainder))) { + stringBuilder.append(n); + } + } + if (remainder != 0) { + stringBuilder.insert(map.get(remainder), "("); + stringBuilder.append(")"); + } + return stringBuilder.toString(); } - } - if (remainder != 0) { - stringBuilder.insert(map.get(remainder), "("); - stringBuilder.append(")"); - } - return stringBuilder.toString(); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_167.java b/src/main/java/com/fishercoder/solutions/firstthousand/_167.java index b5c08b9712..192ce26899 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_167.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_167.java @@ -4,7 +4,7 @@ public class _167 { public static class Solution1 { - /** + /* * This is an amazing solution! * Time: O(logn) */ @@ -18,22 +18,25 @@ public int[] twoSum(int[] numbers, int target) { } else if (sum < target) { left++; } else { - return new int[]{left + 1, right + 1}; + return new int[] {left + 1, right + 1}; } } - return new int[]{-1, -1}; + return new int[] {-1, -1}; } } public static class Solution2 { - /** + /* * Time: O(nlogn) */ public int[] twoSum(int[] numbers, int target) { for (int i = 0; i < numbers.length - 1; i++) { - int index = exists(Arrays.copyOfRange(numbers, i + 1, numbers.length), target - numbers[i]); + int index = + exists( + Arrays.copyOfRange(numbers, i + 1, numbers.length), + target - numbers[i]); if (index >= 0) { - return new int[]{i + 1, index + 2 + i}; + return new int[] {i + 1, index + 2 + i}; } } return null; @@ -57,14 +60,17 @@ private int exists(int[] nums, int target) { } public static class Solution3 { - /** + /* * Time: O(nlogn) */ public int[] twoSum(int[] numbers, int target) { for (int i = 0; i < numbers.length - 1; i++) { int[] ans = new int[2]; ans[0] = i + 1; - int index = Arrays.binarySearch(Arrays.copyOfRange(numbers, i, numbers.length), target - numbers[i]); + int index = + Arrays.binarySearch( + Arrays.copyOfRange(numbers, i, numbers.length), + target - numbers[i]); if (index > 0) { ans[1] = index + 1 + i; return ans; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_168.java b/src/main/java/com/fishercoder/solutions/firstthousand/_168.java index 0dd3f75bd8..01fe68662b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_168.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_168.java @@ -1,48 +1,49 @@ package com.fishercoder.solutions.firstthousand; -/** - * - * 168. Excel Sheet Column Title - Given a positive integer, return its corresponding column title as appear in an Excel sheet. +/* +* +* 168. Excel Sheet Column Title - For example: +Given a positive integer, return its corresponding column title as appear in an Excel sheet. - 1 -> A - 2 -> B - 3 -> C - ... - 26 -> Z - 27 -> AA - 28 -> AB - ... +For example: - Example 1: +1 -> A +2 -> B +3 -> C +... +26 -> Z +27 -> AA +28 -> AB +... - Input: 1 - Output: "A" +Example 1: - Example 2: +Input: 1 +Output: "A" - Input: 28 - Output: "AB" +Example 2: - Example 3: +Input: 28 +Output: "AB" - Input: 701 - Output: "ZY" +Example 3: - */ +Input: 701 +Output: "ZY" + +*/ public class _168 { - public static class Solution1 { - public String convertToTitle(int n) { - /**Get the right most digit first, move to the left, e.g. when n = 28, we get 'B' first, then we get 'A'.*/ - StringBuilder sb = new StringBuilder(); - while (n != 0) { - int temp = (n - 1) % 26; - sb.append((char) (temp + 65)); - n = (n - 1) / 26; - } - return sb.reverse().toString(); + public static class Solution1 { + public String convertToTitle(int n) { + /*Get the right most digit first, move to the left, e.g. when n = 28, we get 'B' first, then we get 'A'.*/ + StringBuilder sb = new StringBuilder(); + while (n != 0) { + int temp = (n - 1) % 26; + sb.append((char) (temp + 65)); + n = (n - 1) / 26; + } + return sb.reverse().toString(); + } } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_169.java b/src/main/java/com/fishercoder/solutions/firstthousand/_169.java index aeb822d7a7..66e9a86fcb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_169.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_169.java @@ -2,7 +2,7 @@ public class _169 { public static class Solution1 { - /** + /* * Moore Voting Algorithm * How to understand this: * 1. For a number to qualify as a majority element, it needs to occur more than 1/2 times, which @@ -28,21 +28,25 @@ public int majorityElement(int[] nums) { } public static class Solution2 { - //bit manipulation + // bit manipulation public int majorityElement(int[] nums) { - int[] bit = new int[32];//because an integer is 32 bits, so we use an array of 32 long + int[] bit = new int[32]; // because an integer is 32 bits, so we use an array of 32 long for (int num : nums) { for (int i = 0; i < 32; i++) { if ((num >> (31 - i) & 1) == 1) { - bit[i]++;//this is to compute each number's ones frequency + bit[i]++; // this is to compute each number's ones frequency } } } int res = 0; - //this below for loop is to construct the majority element: since every bit of this element would have appeared more than n/2 times + // this below for loop is to construct the majority element: since every bit of this + // element would have appeared more than n/2 times for (int i = 0; i < 32; i++) { - bit[i] = bit[i] > nums.length / 2 ? 1 - : 0;//we get rid of those that bits that are not part of the majority number + bit[i] = + bit[i] > nums.length / 2 + ? 1 + : 0; // we get rid of those that bits that are not part of the + // majority number res += bit[i] * (1 << (31 - i)); } return res; @@ -50,7 +54,7 @@ public int majorityElement(int[] nums) { } public static class Solution3 { - /** + /* * I'm glad to have come up with this idea myself on 10/12/2021. */ public int majorityElement(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_17.java b/src/main/java/com/fishercoder/solutions/firstthousand/_17.java index 10c1a2af6c..cbd8bbc480 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_17.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_17.java @@ -12,9 +12,12 @@ public List letterCombinations(String digits) { return result; } - String[] digits2Letters = new String[]{"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; + String[] digits2Letters = + new String[] {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; - result.add("");//this line is important, otherwise result is empty and Java will default it to an empty String + result.add( + ""); // this line is important, otherwise result is empty and Java will default + // it to an empty String for (int i = 0; i < digits.length(); i++) { result = combine(digits2Letters[digits.charAt(i) - '0'], result); } @@ -26,7 +29,8 @@ List combine(String letters, List result) { List newResult = new ArrayList(); for (int i = 0; i < letters.length(); i++) { - //the order of the two for loops doesn't matter, you could swap them and it still works. + // the order of the two for loops doesn't matter, you could swap them and it still + // works. for (String str : result) { newResult.add(str + letters.charAt(i)); } @@ -36,7 +40,7 @@ List combine(String letters, List result) { } public static class Solution2 { - /** + /* * It's recommended to use recursion to solve this problem, I got this feedback from a Meta interviewer on 6/17/2024 during the mock interview. * My completely original solution on 10/11/2021, no backtracking involved. */ @@ -45,12 +49,14 @@ public List letterCombinations(String digits) { if (digits.length() == 0 || digits.equals("")) { return ans; } - String[] options = new String[]{"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; + String[] options = + new String[] {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; ans.add(""); return recursion(ans, options, digits, 0); } - private List recursion(List ans, String[] options, String digits, int index) { + private List recursion( + List ans, String[] options, String digits, int index) { if (index >= digits.length()) { return ans; } @@ -66,7 +72,7 @@ private List recursion(List ans, String[] options, String digits } public static class Solution3 { - /** + /* * My completely original solution on 5/9/2022, no backtracking involved or helper method involved. */ public List letterCombinations(String digits) { @@ -74,7 +80,8 @@ public List letterCombinations(String digits) { if (digits.equals("")) { return ans; } - String[] buttons = new String[]{"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; + String[] buttons = + new String[] {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; ans.add(""); for (char c : digits.toCharArray()) { String button = buttons[Integer.parseInt(c + "")]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_170.java b/src/main/java/com/fishercoder/solutions/firstthousand/_170.java index 3e6ea117bf..181d52adb9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_170.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_170.java @@ -12,7 +12,7 @@ class TwoSum { private Map map; private List list; - /** + /* * Initialize your data structure here. */ public TwoSum() { @@ -20,7 +20,6 @@ public TwoSum() { list = new ArrayList(); } - // Add the number to an internal data structure. public void add(int number) { list.add(number); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_171.java b/src/main/java/com/fishercoder/solutions/firstthousand/_171.java index 6e9bd812b3..93d8878d03 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_171.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_171.java @@ -8,7 +8,11 @@ public int titleToNumber(String s) { int result = 0; for (int i = s.length() - 1; i >= 0; i--) { result += - (c[i] - 64) * ((int) Math.pow(26, s.length() - i - 1));//The ASCII value of A is 65 + (c[i] - 64) + * ((int) + Math.pow( + 26, + s.length() - i - 1)); // The ASCII value of A is 65 } return result; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_172.java b/src/main/java/com/fishercoder/solutions/firstthousand/_172.java index 0ea13414c7..2b0af27ddc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_172.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_172.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.firstthousand; -/** +/* * 172. Factorial Trailing Zeroes * * Given an integer n, return the number of trailing zeroes in n!. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_173.java b/src/main/java/com/fishercoder/solutions/firstthousand/_173.java index 8f0165b1d2..128e5bcba4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_173.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_173.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.Deque; import java.util.LinkedList; import java.util.Queue; @@ -43,7 +42,7 @@ public int next() { public static class Solution2 { public static class BSTIterator { - /** + /* * This is a super cool/clever idea: use a stack to store all the current left nodes of the BST, when pop(), we * push all its right nodes into the stack if there are any. * This way, we use only O(h) memory for this iterator, this is a huge saving when the tree is huge @@ -77,7 +76,7 @@ public int next() { } public static class Solution3 { - /** + /* * credit: https://leetcode.com/problems/binary-search-tree-iterator/discuss/52647/Nice-Comparison-(and-short-Solution */ public static class BSTIterator { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_174.java b/src/main/java/com/fishercoder/solutions/firstthousand/_174.java index 16f79d7c81..3bde9a0cf8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_174.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_174.java @@ -5,7 +5,7 @@ public class _174 { public static class Solution1 { - /** + /* * This problem should fill the dp matrix from bottom right. */ public int calculateMinimumHP(int[][] dungeon) { @@ -19,13 +19,13 @@ public int calculateMinimumHP(int[][] dungeon) { dp[height - 1][width - 1] = (dungeon[height - 1][width - 1] > 0) ? 1 : 1 - dungeon[height - 1][width - 1]; - //fill the last column + // fill the last column for (int i = height - 2; i >= 0; i--) { int temp = dp[i + 1][width - 1] - dungeon[i][width - 1]; dp[i][width - 1] = Math.max(1, temp); } - //fill the last row + // fill the last row for (int j = width - 2; j >= 0; j--) { int temp = dp[height - 1][j + 1] - dungeon[height - 1][j]; dp[height - 1][j] = Math.max(temp, 1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_179.java b/src/main/java/com/fishercoder/solutions/firstthousand/_179.java index 7a897c61cd..a02fdcde75 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_179.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_179.java @@ -70,7 +70,7 @@ public int compare(String s1, String s2) { } public static class Solution2 { - /** + /* * My completely original solution on 11/29/2021: * we'll just sort these numbers as if they are strings. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_186.java b/src/main/java/com/fishercoder/solutions/firstthousand/_186.java index 51c208a48c..3673c4d900 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_186.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_186.java @@ -51,5 +51,4 @@ private void reverse(char[] chars, int start, int end) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_187.java b/src/main/java/com/fishercoder/solutions/firstthousand/_187.java index 344062096e..a2ab4a8db8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_187.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_187.java @@ -26,7 +26,7 @@ public List findRepeatedDnaSequences(String s) { } public static class Solution2 { - /** + /* * Use Rolling Hash/Rabin-Karp algorithm to significantly speed up the search. *

* Rolling Hash/Rabin-Karp algorithm: diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_188.java b/src/main/java/com/fishercoder/solutions/firstthousand/_188.java index 42cec33225..ba48f056b0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_188.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_188.java @@ -2,7 +2,7 @@ public class _188 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/8984/a-concise-dp-solution-in-java */ public int maxProfit(int k, int[] prices) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_189.java b/src/main/java/com/fishercoder/solutions/firstthousand/_189.java index 601899bf19..3bb28f59de 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_189.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_189.java @@ -3,7 +3,7 @@ public class _189 { public static class Solution1 { - /** + /* * O(n*k) time * O(1) space */ @@ -20,7 +20,7 @@ public void rotate(int[] nums, int k) { } public static class Solution2 { - /** + /* * using an extra array of the same size to copy it * O(n) time * O(n) space @@ -38,7 +38,7 @@ public void rotate(int[] nums, int k) { } public static class Solution3 { - /** + /* * reverse three times * O(n) time * O(1) space @@ -63,7 +63,7 @@ private void reverse(int[] nums, int start, int end) { } public static class Solution4 { - /** + /* * O(n) time * O(1) space * The most optimal, we can safely ignore all the above three solutions... :) @@ -86,4 +86,4 @@ public void rotate(int[] nums, int k) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_19.java b/src/main/java/com/fishercoder/solutions/firstthousand/_19.java index 885db176fb..0afc091a7e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_19.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_19.java @@ -5,7 +5,7 @@ public class _19 { public static class Solution1 { - /** + /* * Naive/most straightforward approach: * go through the list, find its total length, then go through the list a second time: * this time, pause at the delta point, then assign its next.next pointer to next. @@ -37,8 +37,10 @@ public ListNode removeNthFromEnd(ListNode head, int n) { public static class Solution2 { public ListNode removeNthFromEnd(ListNode head, int n) { - //this approach uses two pointers, fast moves first for n nodes, when fast reaches n, then we start to move slow - //then, when fast reaches null, slow reaches the point where the node should be deleted. + // this approach uses two pointers, fast moves first for n nodes, when fast reaches n, + // then we start to move slow + // then, when fast reaches null, slow reaches the point where the node should be + // deleted. ListNode dummy = new ListNode(-1); dummy.next = head; ListNode slow = head; @@ -50,15 +52,18 @@ public ListNode removeNthFromEnd(ListNode head, int n) { if (fast == null) { if (n > 0) { - // this is for cases like this: [1,2] 2 or [1,2,3,4] 4, namely, remove the head of + // this is for cases like this: [1,2] 2 or [1,2,3,4] 4, namely, remove the head + // of // the list and return the second node from the original list dummy.next = dummy.next.next; } return dummy.next; } - fast = fast.next;//we'll have to move fast pointer one node forward before moving the two together, this way, - //when fast reaches null, slow will be at the previous node to the node that should be deleted, thus, we can change the next pointer easily + fast = fast.next; // we'll have to move fast pointer one node forward before moving the + // two together, this way, + // when fast reaches null, slow will be at the previous node to the node that should be + // deleted, thus, we can change the next pointer easily while (fast != null) { fast = fast.next; @@ -73,10 +78,10 @@ public ListNode removeNthFromEnd(ListNode head, int n) { } public static class Solution3 { - //a more concise version using the same idea - //i.e. sliding window - //Time: O(n) - //Space: O(1) + // a more concise version using the same idea + // i.e. sliding window + // Time: O(n) + // Space: O(1) public ListNode removeNthFromEnd(ListNode head, int n) { ListNode pre = new ListNode(-1); pre.next = head; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_190.java b/src/main/java/com/fishercoder/solutions/firstthousand/_190.java index 1f13c48edf..06618ed5ae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_190.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_190.java @@ -1,14 +1,14 @@ package com.fishercoder.solutions.firstthousand; public class _190 { - /**delimiting the binary string into 4 bits array will make it easier to see/visualize: + /*delimiting the binary string into 4 bits array will make it easier to see/visualize: * original binary format: * 0000,0010,1001,0100,0001,1110,1001,1100, * after reversing, becomes: * 0011,1001,0111,1000,0010,1001,0100,0000 * The most right side digit shifted to the most left side, the 2nd right side digit shifted to the 2nd left side, so forth..*/ - /** + /* * This post: http://stackoverflow.com/questions/2811319/difference-between-and * gives a good explanation between logical right shift: ">>>" and arithmetic right shift: ">>". * Basically, ">>" preserves the most left bit and treats it as the sign for this number, @@ -24,11 +24,12 @@ public static class Solution1 { public int reverseBits(int n) { int res = 0; for (int i = 0; i < 32; i++) { - res += n & 1;//get the most right bit each time - n >>>= 1;//do UN-signed right shift by 1 each time - //n >>= 1;//this line works as well on LeetCode OJ, choosing either one works + res += n & 1; // get the most right bit each time + n >>>= 1; // do UN-signed right shift by 1 each time + // n >>= 1;//this line works as well on LeetCode OJ, choosing either one works if (i < 31) { - res <<= 1;//shift this number to the left by 1 each time, so that eventually, this number is reversed + res <<= 1; // shift this number to the left by 1 each time, so that eventually, + // this number is reversed } } return res; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_191.java b/src/main/java/com/fishercoder/solutions/firstthousand/_191.java index d15812e313..f20cf2a3fd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_191.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_191.java @@ -3,7 +3,7 @@ public class _191 { public static class Solution1 { - /** + /* * Doing bitwise AND operation between n and n-1 will always flip the least significant 1 bit in n to zero * example run for the above editorial solution: input 5, n will be 5&4 and becomes 4, * then in the next run, n will become 4&3 which is 0, thus exit the while loop. @@ -47,7 +47,7 @@ public int hammingWeight(int n) { if (n == 0) { return bits; } - /**must use unsigned right shift operator since the problem says this is an unsigned value*/ + /*must use unsigned right shift operator since the problem says this is an unsigned value*/ n >>>= 1; } return bits; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_198.java b/src/main/java/com/fishercoder/solutions/firstthousand/_198.java index d84086c82a..a7150aa09a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_198.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_198.java @@ -22,7 +22,7 @@ public int rob(int[] nums) { } public static class Solution2 { - /** + /* * recursion + memoization, basically the same as the above solution1 * credit: https://leetcode.com/problems/house-robber/solution/ */ @@ -41,7 +41,8 @@ private int robFrom(int start, int[] nums) { if (this.memo[start] != -1) { return this.memo[start]; } - this.memo[start] = Math.max(robFrom(start + 1, nums), robFrom(start + 2, nums) + nums[start]); + this.memo[start] = + Math.max(robFrom(start + 1, nums), robFrom(start + 2, nums) + nums[start]); return this.memo[start]; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_199.java b/src/main/java/com/fishercoder/solutions/firstthousand/_199.java index 8bd8377070..d97a41525b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_199.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_199.java @@ -1,65 +1,64 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class _199 { - - public static class Solution1 { - /** - * credit: https://leetcode.com/problems/binary-tree-right-side-view/discuss/56012/My-simple-accepted-solution(JAVA) - */ - public List rightSideView(TreeNode root) { - List result = new ArrayList<>(); - rightView(root, result, 0); - return result; - } - - void rightView(TreeNode curr, List result, int currDepth) { - if (curr == null) { - return; - } - if (currDepth == result.size()) { - result.add(curr.val); - } - //go through right side first as we want right side view, so as soon as we find it, then we won't use the one from left side - rightView(curr.right, result, currDepth + 1); - rightView(curr.left, result, currDepth + 1); - } - } - - public static class Solution2 { - /** - * BFS the tree - */ - public List rightSideView(TreeNode root) { - List result = new ArrayList<>(); - if (root == null) { - return result; - } - Queue q = new LinkedList<>(); - q.offer(root); - while (!q.isEmpty()) { - int size = q.size(); - for (int i = 0; i < size; i++) { - TreeNode curr = q.poll(); - if (i == size - 1) { - result.add(curr.val); - } - if (curr.left != null) { - q.offer(curr.left); - } - if (curr.right != null) { - q.offer(curr.right); - } - } - } - return result; - } - } - -} \ No newline at end of file +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +public class _199 { + + public static class Solution1 { + /* + * credit: https://leetcode.com/problems/binary-tree-right-side-view/discuss/56012/My-simple-accepted-solution(JAVA) + */ + public List rightSideView(TreeNode root) { + List result = new ArrayList<>(); + rightView(root, result, 0); + return result; + } + + void rightView(TreeNode curr, List result, int currDepth) { + if (curr == null) { + return; + } + if (currDepth == result.size()) { + result.add(curr.val); + } + // go through right side first as we want right side view, so as soon as we find it, + // then we won't use the one from left side + rightView(curr.right, result, currDepth + 1); + rightView(curr.left, result, currDepth + 1); + } + } + + public static class Solution2 { + /* + * BFS the tree + */ + public List rightSideView(TreeNode root) { + List result = new ArrayList<>(); + if (root == null) { + return result; + } + Queue q = new LinkedList<>(); + q.offer(root); + while (!q.isEmpty()) { + int size = q.size(); + for (int i = 0; i < size; i++) { + TreeNode curr = q.poll(); + if (i == size - 1) { + result.add(curr.val); + } + if (curr.left != null) { + q.offer(curr.left); + } + if (curr.right != null) { + q.offer(curr.right); + } + } + } + return result; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_2.java b/src/main/java/com/fishercoder/solutions/firstthousand/_2.java index dd074fb964..1729c9a9a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_2.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_2.java @@ -4,7 +4,7 @@ public class _2 { public static class Solution1 { - /** + /* * My completely original solution on 10/24/2021. */ public ListNode addTwoNumbers(ListNode l1, ListNode l2) { @@ -32,5 +32,4 @@ public ListNode addTwoNumbers(ListNode l1, ListNode l2) { return pre.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_20.java b/src/main/java/com/fishercoder/solutions/firstthousand/_20.java index 8fada0ddc1..da3f88feb4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_20.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_20.java @@ -29,7 +29,7 @@ public boolean isValid(String s) { } public static class Solution2 { - /** + /* * A more concise solution: * credit: https://leetcode.com/problems/valid-parentheses/discuss/9178/Short-java-solution * */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_200.java b/src/main/java/com/fishercoder/solutions/firstthousand/_200.java index 1ba0725820..5c867bfdc6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_200.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_200.java @@ -4,7 +4,7 @@ public class _200 { public static class Solution1 { - /** + /* * DFS solution, note: this modifies the input. */ public int numIslands(char[][] grid) { @@ -52,7 +52,9 @@ public UnionFind(char[][] grid) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == '1') { - //at initialization, we count each '1' as one island, later, during traversal, we'll union them during which we'll dedup the number of islands. + // at initialization, we count each '1' as one island, later, during + // traversal, we'll union them during which we'll dedup the number of + // islands. count++; } ids[i * n + j] = i * n + j; @@ -64,13 +66,14 @@ public void union(int i, int j) { int x = find(i); int y = find(j); if (x != y) { - /** + /* * This means when these two nodes should be unioned, however, so far, * they have not, i.e. they have different ids, * so we'll have to unify them by assigning one's ids to the other, or vice versa. * */ - ids[x] = y;//ids[y] = x; //also works - count--;//since now these two islands are unified/merged, we'll decrement the count by one + ids[x] = y; // ids[y] = x; //also works + count--; // since now these two islands are unified/merged, we'll decrement the + // count by one } } @@ -86,7 +89,7 @@ public int numIslands(char[][] grid) { if (grid == null || grid.length == 0 || grid[0].length == 0) { return 0; } - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; UnionFind uf = new UnionFind(grid); int m = grid.length; int n = grid[0].length; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_201.java b/src/main/java/com/fishercoder/solutions/firstthousand/_201.java index 5b857688bd..f28ce32145 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_201.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_201.java @@ -3,7 +3,7 @@ public class _201 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/28538/java-python-easy-solution-with-explanation * Bitwise AND operation within range actually turns out to be doing some operations with just these two boundary numbers: m and n * e.g. 5 and 7, in binary, they are 101 and 111, the result for [5,7] is 5&6&7 which is 101&110&111 diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_202.java b/src/main/java/com/fishercoder/solutions/firstthousand/_202.java index e526c3cd3d..d82a285f5d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_202.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_202.java @@ -3,7 +3,7 @@ import java.util.HashSet; import java.util.Set; -/** +/* * 202. Happy Number * * Write an algorithm to determine if a number is "happy". diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_203.java b/src/main/java/com/fishercoder/solutions/firstthousand/_203.java index 992cd54a3e..eabd53c7a9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_203.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_203.java @@ -1,35 +1,35 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.ListNode; - -public class _203 { - public static class Solution1 { - /** - * This is a very good question to test your understanding of pointers/memory/addresses, although it's marked as EASY. - * All the three nodes: dummy, curr and prev are indispensable. - *

- * 1. Eventually, we should return dummy.next as the final result. - * 2. we assign head to curr, dummy to prev - * 3. and then we use prev and curr to traverse through the list and do the work - * 4. each time, we only move one node forward, so we don't need another while loop inside the while loop - * 5. KEY: if(curr.val == val), then curr is the node we want to remove, so, we'll assign curr.next to prev.next, thus, prev won't have that node - * else, we'll keep moving prev forward, so, just do prev = prev.next - * but, for both cases, we'll also move curr forward, so we put curr = curr.next in the outside. - */ - public ListNode removeElements(ListNode head, int val) { - ListNode dummy = new ListNode(-1); - dummy.next = head; - ListNode curr = head; - ListNode prev = dummy; - while (curr != null) { - if (curr.val == val) { - prev.next = curr.next; - } else { - prev = prev.next; - } - curr = curr.next; - } - return dummy.next; - } - } -} \ No newline at end of file +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.ListNode; + +public class _203 { + public static class Solution1 { + /* + * This is a very good question to test your understanding of pointers/memory/addresses, although it's marked as EASY. + * All the three nodes: dummy, curr and prev are indispensable. + *

+ * 1. Eventually, we should return dummy.next as the final result. + * 2. we assign head to curr, dummy to prev + * 3. and then we use prev and curr to traverse through the list and do the work + * 4. each time, we only move one node forward, so we don't need another while loop inside the while loop + * 5. KEY: if(curr.val == val), then curr is the node we want to remove, so, we'll assign curr.next to prev.next, thus, prev won't have that node + * else, we'll keep moving prev forward, so, just do prev = prev.next + * but, for both cases, we'll also move curr forward, so we put curr = curr.next in the outside. + */ + public ListNode removeElements(ListNode head, int val) { + ListNode dummy = new ListNode(-1); + dummy.next = head; + ListNode curr = head; + ListNode prev = dummy; + while (curr != null) { + if (curr.val == val) { + prev.next = curr.next; + } else { + prev = prev.next; + } + curr = curr.next; + } + return dummy.next; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_204.java b/src/main/java/com/fishercoder/solutions/firstthousand/_204.java index db365c4585..840d4d6b76 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_204.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_204.java @@ -4,7 +4,7 @@ public class _204 { public static class Solution1 { - /** + /* * Reference: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes * This is an ancient algorithm to efficiently count the number of primes up to a given point: * it does so iteratively by marking composite (i.e. not prime) the multiples of each prime, diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_205.java b/src/main/java/com/fishercoder/solutions/firstthousand/_205.java index 6dae27b36d..f5edbf5e71 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_205.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_205.java @@ -4,7 +4,7 @@ import java.util.Map; public class _205 { - /** + /* * space should be O(1) since it only has alphabetic letters which are capped at 52. */ @@ -29,7 +29,7 @@ public boolean isIsomorphic(String s, String t) { } } else { if (map.containsValue(tchar[i])) { - return false;//this line is necessary for this case: ("ab", "aa") + return false; // this line is necessary for this case: ("ab", "aa") } map.put(schar[i], tchar[i]); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_206.java b/src/main/java/com/fishercoder/solutions/firstthousand/_206.java index 9f7d47c09e..2c53b7cc13 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_206.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_206.java @@ -36,7 +36,7 @@ ListNode reverse(ListNode head, ListNode newHead) { public static class Solution3 { - /** + /* * I feel like using the variable called prev makes more sense to me on 10/25/2021 * since it's literally a previous node when we start reversing from the head of the list. * Again, using a pen and paper to visualize the steps helps a lot to convert thoughts into code. @@ -52,5 +52,4 @@ public ListNode reverseList(ListNode head) { return prev; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_207.java b/src/main/java/com/fishercoder/solutions/firstthousand/_207.java index 7459d6025c..4d9d887ed6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_207.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_207.java @@ -8,7 +8,7 @@ import java.util.Queue; import java.util.Set; -/** +/* * 207. Course Schedule *

* There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. @@ -38,7 +38,7 @@ public class _207 { public static class Solution1 { - /** + /* * Kahn's algorithm for topological sorting */ public boolean canFinish(int numCourses, int[][] prerequisites) { @@ -80,7 +80,7 @@ public boolean canFinish(int numCourses, int[][] prerequisites) { } public static class Solution2 { - /** + /* * BFS */ public boolean canFinish(int numCourses, int[][] prerequisites) { @@ -118,7 +118,7 @@ public boolean canFinish(int numCourses, int[][] prerequisites) { } public static class Solution3 { - /** + /* * DFS, the fastest method in all, with the help of a cache and also converted edges into adjacency list, * although theoretically, all these three methods' time complexity are: O(V+E) */ @@ -131,7 +131,7 @@ public boolean canFinish(int numCourses, int[][] prerequisites) { courseList.get(pre[1]).add(pre[0]); } int[] visited = new int[numCourses]; - //visit each course using DFS + // visit each course using DFS for (int i = 0; i < numCourses; i++) { if (!dfs(i, courseList, visited)) { return false; @@ -141,7 +141,7 @@ public boolean canFinish(int numCourses, int[][] prerequisites) { } private boolean dfs(int course, List> courseList, int[] visited) { - visited[course] = 1;//mark as temporarily visited + visited[course] = 1; // mark as temporarily visited List coursesCanBeTaken = courseList.get(course); for (int i = 0; i < coursesCanBeTaken.size(); i++) { int courseToTake = coursesCanBeTaken.get(i); @@ -154,13 +154,13 @@ private boolean dfs(int course, List> courseList, int[] visited) { } } } - visited[course] = 2;//mark it as completely done. + visited[course] = 2; // mark it as completely done. return true; } } public static class Solution4 { - /** + /* * This is also Kahn's algorithm, but builds an adjacency list (unncessary for this problem) * which is often times very helpful in other graph problems, doing it here as a practice: * it's a very practical template: diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_208.java b/src/main/java/com/fishercoder/solutions/firstthousand/_208.java index c33f3c06d0..5b3e8b22a9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_208.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_208.java @@ -11,7 +11,8 @@ public static class Trie { private TrieNode root; public Trie() { - root = new TrieNode();//initialize root to be an empty char, this is a common practice as how Wiki defines Trie data structure as well + root = new TrieNode(); // initialize root to be an empty char, this is a common + // practice as how Wiki defines Trie data structure as well } // Inserts a word into the trie. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_209.java b/src/main/java/com/fishercoder/solutions/firstthousand/_209.java index 8fd1d9755b..74479f66bd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_209.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_209.java @@ -3,7 +3,7 @@ public class _209 { public static class Solution1 { - /** + /* * A classic sliding window problem/solution. */ public int minSubArrayLen(int target, int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_21.java b/src/main/java/com/fishercoder/solutions/firstthousand/_21.java index 40a5ec09a4..ac5c1c479c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_21.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_21.java @@ -4,7 +4,7 @@ public class _21 { public static class Solution1 { - /** + /* * recursive solution * Time: O(m+n) * Space: O(m+n) @@ -27,7 +27,7 @@ public ListNode mergeTwoLists(ListNode l1, ListNode l2) { } public static class Solution2 { - /** + /* * iterative solution * Time: O(m+n) * Space: O(1) @@ -51,5 +51,4 @@ public ListNode mergeTwoLists(ListNode l1, ListNode l2) { return pre.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_210.java b/src/main/java/com/fishercoder/solutions/firstthousand/_210.java index e8a35a8f09..a8c2ec28bb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_210.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_210.java @@ -1,6 +1,5 @@ package com.fishercoder.solutions.firstthousand; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -42,12 +41,12 @@ public int[] findOrder(int numCourses, int[][] prerequisites) { if (i == numCourses) { return order; } - return new int[]{}; + return new int[] {}; } } public static class Solution2 { - /** + /* * Instead of using a map, we can use an array of list type, it turned out to be even faster on LeetCode. */ public int[] findOrder(int numCourses, int[][] prerequisites) { @@ -71,7 +70,8 @@ public int[] findOrder(int numCourses, int[][] prerequisites) { while (!q.isEmpty()) { Integer curr = q.poll(); order[index++] = curr; - //NOTE: we only need to go through adjList[curr] here now, instead of going through all prerequisites again now. + // NOTE: we only need to go through adjList[curr] here now, instead of going through + // all prerequisites again now. for (int v : adjList[curr]) { indegree[v]--; if (indegree[v] == 0) { @@ -82,8 +82,7 @@ public int[] findOrder(int numCourses, int[][] prerequisites) { if (index == numCourses) { return order; } - return new int[]{}; + return new int[] {}; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_211.java b/src/main/java/com/fishercoder/solutions/firstthousand/_211.java index 4b5ae20155..1f2e92d36f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_211.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_211.java @@ -5,7 +5,7 @@ public static class Solution1 { public static class WordDictionary { WordNode root; - /** + /* * Initialize your data structure here. */ public WordDictionary() { @@ -36,7 +36,7 @@ public boolean search(String word) { return search(word.toCharArray(), 0, root); } - /** + /* * This is also a beautifully designed recursive function. */ private boolean search(char[] chars, int index, WordNode parent) { @@ -67,7 +67,7 @@ private boolean search(char[] chars, int index, WordNode parent) { return search(chars, ++index, node); } - /** + /* * This is a cool/standard design for a Trie node class. */ private class WordNode { @@ -76,7 +76,7 @@ private class WordNode { } } - /** + /* * Your WordDictionary object will be instantiated and called as such: * WordDictionary obj = new WordDictionary(); * obj.addWord(word); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_212.java b/src/main/java/com/fishercoder/solutions/firstthousand/_212.java index 96e54d9e23..313ba3c8b5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_212.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_212.java @@ -27,9 +27,9 @@ private void dfs(TrieNode root, char[][] board, int i, int j, List resul if (root.children[tmp - 'a'].word != null) { result.add(root.children[tmp - 'a'].word); - root.children[tmp - 'a'].word = null;//de-duplicate + root.children[tmp - 'a'].word = null; // de-duplicate } - board[i][j] = '#';//mark it as visited to avoid cycles + board[i][j] = '#'; // mark it as visited to avoid cycles if (i > 0) { dfs(root.children[tmp - 'a'], board, i - 1, j, result); } @@ -43,7 +43,7 @@ private void dfs(TrieNode root, char[][] board, int i, int j, List resul dfs(root.children[tmp - 'a'], board, i, j + 1, result); } - //backtracking + // backtracking board[i][j] = tmp; } @@ -93,17 +93,22 @@ private boolean search(char[][] board, int i, int j, int index, String word) { return true; } - if (i < 0 || i >= board.length || j < 0 || j >= board[0].length || board[i][j] != word.charAt(index)) { + if (i < 0 + || i >= board.length + || j < 0 + || j >= board[0].length + || board[i][j] != word.charAt(index)) { return false; } char temp = board[i][j]; board[i][j] = ' '; - boolean foundWord = search(board, i + 1, j, index + 1, word) - || search(board, i - 1, j, index + 1, word) - || search(board, i, j + 1, index + 1, word) - || search(board, i, j - 1, index + 1, word); + boolean foundWord = + search(board, i + 1, j, index + 1, word) + || search(board, i - 1, j, index + 1, word) + || search(board, i, j + 1, index + 1, word) + || search(board, i, j - 1, index + 1, word); board[i][j] = temp; return foundWord; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_213.java b/src/main/java/com/fishercoder/solutions/firstthousand/_213.java index 5ebe4fdb50..a5718957e7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_213.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_213.java @@ -2,7 +2,7 @@ public class _213 { public static class Solution1 { - /** + /* * Basically there are two ways to rob the houses: one is to rob from 0 to n - 1, the other is to rob from 1 to n, and then take the max from these two. * Time: O(n) * Space: O(n) @@ -29,7 +29,7 @@ private int rob(int[] nums, int start, int end) { } public static class Solution2 { - /** + /* * This solution is identical to the above solution 1, the only difference is that instead of using an extra array, we use only two extra variables here to reduce the space complexity to O(1). * Time: O(n) * Space: O(1) diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_214.java b/src/main/java/com/fishercoder/solutions/firstthousand/_214.java index 8c3732e8a5..7f59b1d07e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_214.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_214.java @@ -3,45 +3,48 @@ public class _214 { public static class Solution1 { - /**credit: https://discuss.leetcode.com/topic/27261/clean-kmp-solution-with-super-detailed-explanation*/ - /** + /*credit: https://discuss.leetcode.com/topic/27261/clean-kmp-solution-with-super-detailed-explanation*/ + /* * TODO: read it explanation and understand KMP completely. */ public String shortestPalindrome(String s) { String temp = s + "#" + new StringBuilder(s).reverse().toString(); int[] table = getTable(temp); - //get the maximum palin part in s starts from 0 + // get the maximum palin part in s starts from 0 return new StringBuilder(s.substring(table[table.length - 1])).reverse().toString() + s; } public int[] getTable(String s) { - //get lookup table + // get lookup table int[] table = new int[s.length()]; - //pointer that points to matched char in prefix part + // pointer that points to matched char in prefix part int index = 0; - //skip index 0, we will not match a string with itself + // skip index 0, we will not match a string with itself for (int i = 1; i < s.length(); i++) { if (s.charAt(index) == s.charAt(i)) { - //we can extend match in prefix and postfix + // we can extend match in prefix and postfix table[i] = table[i - 1] + 1; index++; } else { - //match failed, we try to match a shorter substring + // match failed, we try to match a shorter substring - //by assigning index to table[i-1], we will shorten the match string length, and jump to the - //prefix part that we used to match postfix ended at i - 1 + // by assigning index to table[i-1], we will shorten the match string length, + // and jump to the + // prefix part that we used to match postfix ended at i - 1 index = table[i - 1]; while (index > 0 && s.charAt(index) != s.charAt(i)) { - //we will try to shorten the match string length until we revert to the beginning of match (index 1) + // we will try to shorten the match string length until we revert to the + // beginning of match (index 1) index = table[index - 1]; } - //when we are here may either found a match char or we reach the boundary and still no luck - //so we need check char match + // when we are here may either found a match char or we reach the boundary and + // still no luck + // so we need check char match if (s.charAt(index) == s.charAt(i)) { - //if match, then extend one char + // if match, then extend one char index++; } table[i] = index; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_215.java b/src/main/java/com/fishercoder/solutions/firstthousand/_215.java index ecb5714bcc..81f19d9f0e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_215.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_215.java @@ -27,7 +27,7 @@ public int findKthLargest(int[] nums, int k) { } public static class Solution3 { - /** + /* * Quick Select algorithm * Time: O(n) in average, O(n^2) in worst case * Reference: https://discuss.leetcode.com/topic/14611/java-quick-select diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_216.java b/src/main/java/com/fishercoder/solutions/firstthousand/_216.java index 32a5414552..e136d0050f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_216.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_216.java @@ -8,12 +8,18 @@ public class _216 { public static class Solution1 { public List> combinationSum3(int k, int n) { List> result = new ArrayList(); - int[] nums = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9}; + int[] nums = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9}; backtracking(k, n, nums, 0, new ArrayList(), result); return result; } - void backtracking(int k, int n, int[] nums, int start, List curr, List> result) { + void backtracking( + int k, + int n, + int[] nums, + int start, + List curr, + List> result) { if (n > 0) { for (int i = start; i < nums.length; i++) { curr.add(nums[i]); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_217.java b/src/main/java/com/fishercoder/solutions/firstthousand/_217.java index b76e67a402..5b9281c9a3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_217.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_217.java @@ -18,5 +18,4 @@ public boolean containsDuplicate(int[] nums) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_218.java b/src/main/java/com/fishercoder/solutions/firstthousand/_218.java index 7a24633711..ab46e00ded 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_218.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_218.java @@ -48,7 +48,7 @@ public List> getSkyline(int[][] buildings) { bps[index++] = bp2; } - //this is one key step: + // this is one key step: Arrays.sort(bps); List> result = new ArrayList(); @@ -56,7 +56,7 @@ public List> getSkyline(int[][] buildings) { treeMap.put(0, 1); int prevMaxH = 0; for (BuildingPoint bp : bps) { - //if it's a starting point, we'll add it into the final result + // if it's a starting point, we'll add it into the final result if (bp.isStart) { if (treeMap.containsKey(bp.h)) { treeMap.put(bp.h, treeMap.get(bp.h) + 1); @@ -64,7 +64,7 @@ public List> getSkyline(int[][] buildings) { treeMap.put(bp.h, 1); } } else if (!bp.isStart) { - //if it's an ending point, we'll decrement/remove this entry + // if it's an ending point, we'll decrement/remove this entry if (treeMap.containsKey(bp.h) && treeMap.get(bp.h) > 1) { treeMap.put(bp.h, treeMap.get(bp.h) - 1); } else { @@ -77,7 +77,6 @@ public List> getSkyline(int[][] buildings) { result.add(Arrays.asList(bp.x, currMaxH)); prevMaxH = currMaxH; } - } return result; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_220.java b/src/main/java/com/fishercoder/solutions/firstthousand/_220.java index bf52923543..39194b7315 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_220.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_220.java @@ -5,14 +5,14 @@ public class _220 { public static class Solution1 { - /** + /* * TreeSet: per Java doc, is a NavigableSet implementation based on a TreeMap. The elements are ordered * using their natural ordering, or by a Comparator provided at set creation time, depending on * which constructor is used. This implementation provides guaranteed log(n) time cost for the * basic operations (add, remove and contains). */ - /** + /* * TreeSet turns out to be a super handy data structure for this problem. It implements Set * interface and keeps elements in sorted order, plus it has two very handy APIs: * https://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#ceiling(E): Returns the @@ -30,7 +30,7 @@ public static class Solution1 { */ public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) { - /**case to Long to avoid Integer overflow.*/ + /*case to Long to avoid Integer overflow.*/ TreeSet set = new TreeSet<>(); for (int i = 0; i < nums.length; ++i) { Long s = set.ceiling((long) nums[i]); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_221.java b/src/main/java/com/fishercoder/solutions/firstthousand/_221.java index b3e34c64cd..7cf4a9f14e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_221.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_221.java @@ -3,7 +3,7 @@ public class _221 { public static class Solution1 { - /** + /* * The idea is pretty straightforward: use a 2d dp table to store the intermediate results */ public int maximalSquare(char[][] matrix) { @@ -22,7 +22,9 @@ public int maximalSquare(char[][] matrix) { if (matrix[i][j] == '0') { dp[i][j] = 0; } else { - dp[i][j] = Math.min(dp[i - 1][j], Math.min(dp[i][j - 1], dp[i - 1][j - 1])) + 1; + dp[i][j] = + Math.min(dp[i - 1][j], Math.min(dp[i][j - 1], dp[i - 1][j - 1])) + + 1; } } max = (max < dp[i][j]) ? dp[i][j] : max; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_222.java b/src/main/java/com/fishercoder/solutions/firstthousand/_222.java index 238646a054..1e5a4c58a1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_222.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_222.java @@ -5,7 +5,7 @@ public class _222 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/21317/accepted-easy-understand-java-solution/2 */ public int countNodes(TreeNode root) { @@ -38,7 +38,7 @@ private int getLeftHeight(TreeNode root) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/count-complete-tree-nodes/solution/ */ public int countNodes(TreeNode root) { @@ -51,23 +51,26 @@ public int countNodes(TreeNode root) { } int left = 0; int right = (int) Math.pow(2, depth) - 1; - //here the condition needs to be not bigger than right, instead of the typical strictly smaller than right. + // here the condition needs to be not bigger than right, instead of the typical strictly + // smaller than right. while (left <= right) { int mid = left + (right - left) / 2; - //this is to suppose the elements on the last level are numbered from 1 to Math.pow(2, d) - 1, we are using - //binary search here to find the right-most number + // this is to suppose the elements on the last level are numbered from 1 to + // Math.pow(2, d) - 1, we are using + // binary search here to find the right-most number if (exists(root, mid, depth)) { left = mid + 1; } else { right = mid - 1; } } - //number of all nodes equals all nodes in the previous level + all the nodes on the last level indicated by variable "left" + // number of all nodes equals all nodes in the previous level + all the nodes on the + // last level indicated by variable "left" return (int) Math.pow(2, depth) - 1 + left; } private boolean exists(TreeNode root, int target, int depth) { - /**An example complete tree in this algorithm: + /*An example complete tree in this algorithm: * 1 * / \ * 2 3 @@ -101,5 +104,4 @@ private int getDepth(TreeNode root) { return depth; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_224.java b/src/main/java/com/fishercoder/solutions/firstthousand/_224.java index 1a1b69dd3f..0862376826 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_224.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_224.java @@ -6,7 +6,7 @@ public class _224 { public static class Solution1 { - /** + /* * My complete original solution on 12/23/2021 */ public int calculate(String s) { @@ -29,7 +29,9 @@ public int calculate(String s) { while (!stack.isEmpty() && !stack.peekLast().equals("(")) { String numStr = stack.pollLast(); int numInt = Integer.parseInt(numStr); - if (!stack.isEmpty() && (stack.peekLast().equals("-") || stack.peekLast().equals("+"))) { + if (!stack.isEmpty() + && (stack.peekLast().equals("-") + || stack.peekLast().equals("+"))) { String operator = stack.pollLast(); if (operator.equals("+")) { result += numInt; @@ -71,7 +73,7 @@ public int calculate(String s) { } public static class Solution2 { - /** + /* * Simple and clean recursion solution, credit: https://leetcode.com/problems/basic-calculator/solutions/2344042/java-2ms-100-recursion-easy-to-understand/ * Key points: * 1. it uses a global variable called index to control which char to iterate on; @@ -93,13 +95,13 @@ private int cal(String s) { if (c >= '0' && c <= '9') { num = num * 10 + c - '0'; } else if (c == '(') { - //this is the beginning of a new sub-problem, we let recursion do its job + // this is the beginning of a new sub-problem, we let recursion do its job num = cal(s); } else if (c == ')') { - //this is the end of a problem/sub-problem, so we return + // this is the end of a problem/sub-problem, so we return return result + sign * num; } else if (c == '+' || c == '-') { - //now we know we finished reading one number and a new number has begun + // now we know we finished reading one number and a new number has begun result += sign * num; num = 0; sign = c == '-' ? -1 : 1; @@ -110,7 +112,7 @@ private int cal(String s) { } public static class Solution3 { - /** + /* * A more elegant solution using stack and iterative approach, credit: https://leetcode.com/problems/basic-calculator/solutions/62361/iterative-java-solution-with-stack/ * Key points: * 1. use an integer to represent sign: 1 or -1, so it can be pushed onto a stack that's of Integer type; @@ -125,28 +127,29 @@ public int calculate(String s) { if (Character.isDigit(c)) { num = num * 10 + c - '0'; } else if (c == '(') { - //we push the result onto the stack first, then sign + // we push the result onto the stack first, then sign stack.addLast(result); stack.addLast(sign); - //reset them + // reset them sign = 1; num = 0; } else if (c == ')') { - //this means we reached the end of one parenthesis, so we compute result and reset num + // this means we reached the end of one parenthesis, so we compute result and + // reset num result += num * sign; num = 0; - result *= stack.pollLast();//this is the last sign we pushed onto the stack - result += stack.pollLast();//this is the last number on the stack + result *= stack.pollLast(); // this is the last sign we pushed onto the stack + result += stack.pollLast(); // this is the last number on the stack } else if (c == '+') { result += num * sign; - //reset below two variables + // reset below two variables num = 0; sign = 1; } else if (c == '-') { result -= num * sign; - //reset below two variables + // reset below two variables num = 0; sign = 1; } @@ -157,5 +160,4 @@ public int calculate(String s) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_226.java b/src/main/java/com/fishercoder/solutions/firstthousand/_226.java index 1065c72616..6c010501d6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_226.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_226.java @@ -1,67 +1,66 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.TreeNode; - -import java.util.LinkedList; -import java.util.Queue; - -public class _226 { - - public static class Solution1 { - /** - * An iterative solution - */ - public TreeNode invertTree(TreeNode root) { - if (root == null || (root.left == null && root.right == null)) { - return root; - } - Queue q = new LinkedList(); - q.offer(root); - while (!q.isEmpty()) { - TreeNode curr = q.poll(); - TreeNode temp = curr.left; - curr.left = curr.right; - curr.right = temp; - if (curr.left != null) { - q.offer(curr.left); - } - if (curr.right != null) { - q.offer(curr.right); - } - } - return root; - } - } - - public static class Solution2 { - /** - * A recursive solution - */ - public TreeNode invertTree(TreeNode root) { - if (root == null || (root.left == null && root.right == null)) { - return root; - } - TreeNode temp = root.left; - root.left = root.right; - root.right = temp; - invertTree(root.left); - invertTree(root.right); - return root; - } - } - - public static class Solution3 { - /** - * A more concise version - */ - public TreeNode invertTree(TreeNode root) { - if (root == null) { - return null; - } - TreeNode temp = root.left; - root.left = invertTree(root.right); - root.right = invertTree(temp); - return root; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.TreeNode; +import java.util.LinkedList; +import java.util.Queue; + +public class _226 { + + public static class Solution1 { + /* + * An iterative solution + */ + public TreeNode invertTree(TreeNode root) { + if (root == null || (root.left == null && root.right == null)) { + return root; + } + Queue q = new LinkedList(); + q.offer(root); + while (!q.isEmpty()) { + TreeNode curr = q.poll(); + TreeNode temp = curr.left; + curr.left = curr.right; + curr.right = temp; + if (curr.left != null) { + q.offer(curr.left); + } + if (curr.right != null) { + q.offer(curr.right); + } + } + return root; + } + } + + public static class Solution2 { + /* + * A recursive solution + */ + public TreeNode invertTree(TreeNode root) { + if (root == null || (root.left == null && root.right == null)) { + return root; + } + TreeNode temp = root.left; + root.left = root.right; + root.right = temp; + invertTree(root.left); + invertTree(root.right); + return root; + } + } + + public static class Solution3 { + /* + * A more concise version + */ + public TreeNode invertTree(TreeNode root) { + if (root == null) { + return null; + } + TreeNode temp = root.left; + root.left = invertTree(root.right); + root.right = invertTree(temp); + return root; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_227.java b/src/main/java/com/fishercoder/solutions/firstthousand/_227.java index c1d970bd6a..7e02d5bac7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_227.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_227.java @@ -29,7 +29,7 @@ public int calculate(String s) { stack.addLast(stack.pollLast() * num); } sign = s.charAt(i); - //reset num for the next integer + // reset num for the next integer num = 0; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_228.java b/src/main/java/com/fishercoder/solutions/firstthousand/_228.java index fa82cd1918..80f0fed86e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_228.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_228.java @@ -23,5 +23,4 @@ public List summaryRanges(int[] nums) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_229.java b/src/main/java/com/fishercoder/solutions/firstthousand/_229.java index f5c125de1b..fe1cf279de 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_229.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_229.java @@ -6,7 +6,7 @@ public class _229 { public static class Solution1 { - /** + /* * Moore Voting algorithm: * This is an extension of Majority Element I, instead of one one majority, there could be a max of two majority elements, * so we'll just use two counters to do the job. @@ -54,5 +54,4 @@ public List majorityElement(int[] nums) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_23.java b/src/main/java/com/fishercoder/solutions/firstthousand/_23.java index 74b3693f34..0b69bc0c02 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_23.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_23.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.PriorityQueue; public class _23 { @@ -28,5 +27,4 @@ public ListNode mergeKLists(ListNode[] lists) { return pre.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_230.java b/src/main/java/com/fishercoder/solutions/firstthousand/_230.java index 4c2e51b64b..af63111224 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_230.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_230.java @@ -1,14 +1,13 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; public class _230 { public static class Solution1 { - /** + /* * Inorder traversal gives the natural ordering of a BST, no need to sort. */ public int kthSmallest(TreeNode root, int k) { @@ -29,5 +28,4 @@ private void dfs(TreeNode root, List list, int k) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_231.java b/src/main/java/com/fishercoder/solutions/firstthousand/_231.java index 959f8acfab..124bb12760 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_231.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_231.java @@ -3,9 +3,11 @@ public class _231 { public static class Solution1 { public boolean isPowerOfTwo(int n) { - //after writing out the binary representation of some numbers: 1,2,4,8,16,32, you can easily figure out that - //every number that is power of two has only one bit that is 1 - //then we can apply that cool trick that we learned from {@link easy._191}: n&(n-1) which will clear the least significant bit in n to zero + // after writing out the binary representation of some numbers: 1,2,4,8,16,32, you can + // easily figure out that + // every number that is power of two has only one bit that is 1 + // then we can apply that cool trick that we learned from {@link easy._191}: n&(n-1) + // which will clear the least significant bit in n to zero return n > 0 && (n & (n - 1)) == 0; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_232.java b/src/main/java/com/fishercoder/solutions/firstthousand/_232.java index 1c0b02dc7f..bbcf4387f6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_232.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_232.java @@ -5,7 +5,7 @@ public class _232 { public static class Solution1 { - /** + /* * This is amortized O(1) time for each operation, explanation: https://leetcode.com/problems/implement-queue-using-stacks/solution/ */ class MyQueue { @@ -41,4 +41,3 @@ public boolean empty() { } } } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_234.java b/src/main/java/com/fishercoder/solutions/firstthousand/_234.java index f86d0418ce..f88ddfc416 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_234.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_234.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; public class _234 { public static class Solution1 { - /** + /* * O(n) time * O(1) space */ @@ -48,7 +47,7 @@ private ListNode reverse(ListNode head) { } public static class Solution2 { - /** + /* * O(n) time * O(n) space */ @@ -81,7 +80,7 @@ public boolean isPalindrome(ListNode head) { } public static class Solution3 { - /** + /* * O(n) time * O(n) space */ @@ -99,5 +98,4 @@ public boolean isPalindrome(ListNode head) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_235.java b/src/main/java/com/fishercoder/solutions/firstthousand/_235.java index 4f408f6cab..420212ae06 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_235.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_235.java @@ -17,5 +17,4 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { return root; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_236.java b/src/main/java/com/fishercoder/solutions/firstthousand/_236.java index 7c7472dfbf..8027147ec4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_236.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_236.java @@ -17,5 +17,4 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { return left != null ? left : right; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_237.java b/src/main/java/com/fishercoder/solutions/firstthousand/_237.java index 508760458b..3f5a34f760 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_237.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_237.java @@ -1,13 +1,13 @@ -package com.fishercoder.solutions.firstthousand; - -import com.fishercoder.common.classes.ListNode; - -public class _237 { - - public static class Solution1 { - public void deleteNode(ListNode node) { - node.val = node.next.val; - node.next = node.next.next; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import com.fishercoder.common.classes.ListNode; + +public class _237 { + + public static class Solution1 { + public void deleteNode(ListNode node) { + node.val = node.next.val; + node.next = node.next.next; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_238.java b/src/main/java/com/fishercoder/solutions/firstthousand/_238.java index 54b03133bf..cbac38fce5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_238.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_238.java @@ -3,7 +3,7 @@ public class _238 { public static class Solution1 { - /** + /* * Very straightforward idea: iterate through the array twice: * first time: get res[i] = res[i-1]*nums[i-1] * second time: have a variable called right, which means all the numbers product to its right, then do diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_24.java b/src/main/java/com/fishercoder/solutions/firstthousand/_24.java index 46484bcb04..723a68ac35 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_24.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_24.java @@ -4,7 +4,7 @@ public class _24 { public static class Solution1 { - /** + /* * Recursive solution. */ public ListNode swapPairs(ListNode head) { @@ -20,7 +20,7 @@ public ListNode swapPairs(ListNode head) { } public static class Solution2 { - /** + /* * Iterative approach: * My completely original on 10/24/2021. */ @@ -46,5 +46,4 @@ public ListNode swapPairs(ListNode head) { return pre.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_240.java b/src/main/java/com/fishercoder/solutions/firstthousand/_240.java index da6f942ef2..8f13bde0db 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_240.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_240.java @@ -23,5 +23,4 @@ public boolean searchMatrix(int[][] matrix, int target) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_241.java b/src/main/java/com/fishercoder/solutions/firstthousand/_241.java index 060e1bfe7f..d879706d2b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_241.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_241.java @@ -5,22 +5,20 @@ public class _241 { public static class Solution1 { - /**Time: O(n * 4^n / n^(3/2)) ~= n * Catalan numbers = n * (C(2n, n) - C(2n, n - 1)), - due to the size of the results is Catalan numbers, - and every way of evaluation is the length of the string, - so the time complexity is at most n * Catalan numbers. - Space: O(n * 4^n / n^(3/2)), the cache size of lookup is at most n * Catalan numbers.*/ + /*Time: O(n * 4^n / n^(3/2)) ~= n * Catalan numbers = n * (C(2n, n) - C(2n, n - 1)), + due to the size of the results is Catalan numbers, + and every way of evaluation is the length of the string, + so the time complexity is at most n * Catalan numbers. + Space: O(n * 4^n / n^(3/2)), the cache size of lookup is at most n * Catalan numbers.*/ - /** + /* * Credit: https://discuss.leetcode.com/topic/19901/a-recursive-java-solution-284-ms */ public List diffWaysToCompute(String input) { List answer = new LinkedList<>(); int len = input.length(); for (int i = 0; i < len; i++) { - if (input.charAt(i) == '+' - || input.charAt(i) == '-' - || input.charAt(i) == '*') { + if (input.charAt(i) == '+' || input.charAt(i) == '-' || input.charAt(i) == '*') { String part1 = input.substring(0, i); String part2 = input.substring(i + 1); List answer1 = diffWaysToCompute(part1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_242.java b/src/main/java/com/fishercoder/solutions/firstthousand/_242.java index a439e93113..a4951e468b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_242.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_242.java @@ -36,7 +36,7 @@ public boolean isAnagram(String s, String t) { } public static class Solution3 { - //to deal with unicode characters + // to deal with unicode characters public boolean isAnagram(String s, String t) { Map map = new HashMap<>(); for (int i = 0; i < s.length(); i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_243.java b/src/main/java/com/fishercoder/solutions/firstthousand/_243.java index 221f3ecf51..261d49abc0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_243.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_243.java @@ -19,7 +19,6 @@ public int shortestDistance(String[] words, String word1, String word2) { } } return min; - } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_246.java b/src/main/java/com/fishercoder/solutions/firstthousand/_246.java index 43fb42572b..93e0371ae4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_246.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_246.java @@ -35,7 +35,6 @@ public boolean isStrobogrammatic(String num) { } } - public static class Solution2 { public boolean isStrobogrammatic(String num) { Set set = new HashSet(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_248.java b/src/main/java/com/fishercoder/solutions/firstthousand/_248.java index a83b2f2a48..13793a9bb9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_248.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_248.java @@ -6,14 +6,16 @@ public class _248 { public static class Solution1 { - /**Credit: https://discuss.leetcode.com/topic/31386/concise-java-solution - * - Construct char arrays from low.length() to high.length() - Add stro pairs from outside - When left > right, add eligible count - */ + /*Credit: https://discuss.leetcode.com/topic/31386/concise-java-solution + * + Construct char arrays from low.length() to high.length() + Add stro pairs from outside + When left > right, add eligible count + */ - private static final char[][] pairs = {{'0', '0'}, {'1', '1'}, {'6', '9'}, {'8', '8'}, {'9', '6'}}; + private static final char[][] pairs = { + {'0', '0'}, {'1', '1'}, {'6', '9'}, {'8', '8'}, {'9', '6'} + }; public int strobogrammaticInRange(String low, String high) { int[] count = {0}; @@ -24,7 +26,7 @@ public int strobogrammaticInRange(String low, String high) { return count[0]; } - public void dfs(String low, String high , char[] c, int left, int right, int[] count) { + public void dfs(String low, String high, char[] c, int left, int right, int[] count) { if (left > right) { String s = new String(c); if ((s.length() == low.length() && s.compareTo(low) < 0) diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_249.java b/src/main/java/com/fishercoder/solutions/firstthousand/_249.java index f8e5618832..a9e8fdce11 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_249.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_249.java @@ -14,8 +14,9 @@ public List> groupStrings(String[] strings) { Map> map = new HashMap<>(); for (String word : strings) { - //calculate the representative/key that's unique for the entire group - //i.e. if the two string belong to the same group, after shifting n times, they all will end up having the same key + // calculate the representative/key that's unique for the entire group + // i.e. if the two string belong to the same group, after shifting n times, they all + // will end up having the same key // abc -> "2021" // xyz -> "2021" // acef -> "212324" @@ -40,5 +41,4 @@ public List> groupStrings(String[] strings) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_25.java b/src/main/java/com/fishercoder/solutions/firstthousand/_25.java index 0fbbfc89f4..3851463211 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_25.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_25.java @@ -4,7 +4,7 @@ public class _25 { - /** + /* * We use recursion to go all the way until the end: when the number of nodes are smaller than k; * then we start to reverse each group of k nodes from the end towards the start. */ @@ -13,13 +13,13 @@ public ListNode reverseKGroup(ListNode head, int k) { ListNode curr = head; int count = 0; while (curr != null && count != k) { - //find the k+1 node + // find the k+1 node curr = curr.next; count++; } if (count == k) { - /**after this below recursive call finishes, it'll return head; + /*after this below recursive call finishes, it'll return head; * then this returned "head" will become "curr", while the head * in its previous callstack is the real head after this call. * Setting up a break point will make all of this crystal clear.*/ @@ -33,7 +33,8 @@ public ListNode reverseKGroup(ListNode head, int k) { } head = curr; } - return head;//we run out of nodes before we hit count == k, so we'll just directly return head in this case as well + return head; // we run out of nodes before we hit count == k, so we'll just directly + // return head in this case as well } } @@ -85,7 +86,7 @@ public ListNode reverseKGroup(ListNode head, int k) { } public static class Solution3 { - /** + /* * My completely original solution on 10/25/2021. Beats 100% submissions on LeetCode in runtime. * Again, using a pen and paper to visualize the process helps a lot! * My helper function returns two nodes: reversed node head and the starting node for the next reversal. @@ -95,7 +96,7 @@ public ListNode reverseKGroup(ListNode head, int k) { pre.next = head; ListNode tmp = pre; ListNode curr = head; - ListNode[] result = new ListNode[]{null, curr}; + ListNode[] result = new ListNode[] {null, curr}; do { result = reverseKGroupHelper(result[1], k); if (result[0] == result[1]) { @@ -118,7 +119,7 @@ private ListNode[] reverseKGroupHelper(ListNode head, int k) { k--; } if (k > 0) { - return new ListNode[]{head, head}; + return new ListNode[] {head, head}; } else { tmp = head; k = originalK; @@ -130,7 +131,7 @@ private ListNode[] reverseKGroupHelper(ListNode head, int k) { tmp = next; k--; if (k == 0) { - return new ListNode[]{prev, tmp}; + return new ListNode[] {prev, tmp}; } } return null; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_251.java b/src/main/java/com/fishercoder/solutions/firstthousand/_251.java index 0599153ee8..f6daebc749 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_251.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_251.java @@ -35,4 +35,4 @@ public boolean hasNext() { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_253.java b/src/main/java/com/fishercoder/solutions/firstthousand/_253.java index cfb5fa3378..fe6647a680 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_253.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_253.java @@ -9,9 +9,13 @@ public int minMeetingRooms(int[][] intervals) { if (intervals == null || intervals.length == 0) { return 0; } - Arrays.sort(intervals, (a, b) -> a[0] - b[0]);// Sort the intervals by start time - PriorityQueue heap = new PriorityQueue<>(intervals.length, (a, b) -> a[1] - b[1]);// Use a min heap to track the minimum end time of merged intervals - heap.offer(intervals[0]);// start with the first meeting, put it to a meeting room + Arrays.sort(intervals, (a, b) -> a[0] - b[0]); // Sort the intervals by start time + PriorityQueue heap = + new PriorityQueue<>( + intervals.length, + (a, b) -> a[1] - b[1]); // Use a min heap to track the minimum end + // time of merged intervals + heap.offer(intervals[0]); // start with the first meeting, put it to a meeting room for (int i = 1; i < intervals.length; i++) { // get the meeting room that finishes earliest int[] last = heap.poll(); @@ -31,4 +35,3 @@ public int minMeetingRooms(int[][] intervals) { } } } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_255.java b/src/main/java/com/fishercoder/solutions/firstthousand/_255.java index 6dc97756fb..039ea386e9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_255.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_255.java @@ -20,5 +20,4 @@ public boolean verifyPreorder(int[] preorder) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_257.java b/src/main/java/com/fishercoder/solutions/firstthousand/_257.java index ea35edf52a..c264d2b10c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_257.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_257.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; public class _257 { public static class Solution1 { - //a very typical/good question to test your recursion/dfs understanding. + // a very typical/good question to test your recursion/dfs understanding. public List binaryTreePaths_more_concise(TreeNode root) { List paths = new ArrayList<>(); if (root == null) { @@ -31,7 +30,7 @@ private void dfs(TreeNode root, List paths, String path) { } } } - + public static class Solution2 { public List binaryTreePaths(TreeNode root) { List paths = new ArrayList<>(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_258.java b/src/main/java/com/fishercoder/solutions/firstthousand/_258.java index e957b166a4..efa175e622 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_258.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_258.java @@ -3,7 +3,7 @@ public class _258 { public static class Solution1 { - //only three cases as the code shows + // only three cases as the code shows public int addDigits(int num) { if (num == 0) { return 0; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_259.java b/src/main/java/com/fishercoder/solutions/firstthousand/_259.java index 109fb19c4e..ff7feeb769 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_259.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_259.java @@ -5,7 +5,7 @@ public class _259 { public static class Solution1 { - /** + /* * Basically, very similar to 3Sum, but the key is that you'll have to add result by (right-left), not just increment result by 1! */ public int threeSumSmaller(int[] nums, int target) { @@ -20,8 +20,8 @@ public int threeSumSmaller(int[] nums, int target) { while (left < right) { int sum = nums[i] + nums[left] + nums[right]; if (sum < target) { - result += right - left;//this line is key! - left++;//then increment left to continue to see all possibilities + result += right - left; // this line is key! + left++; // then increment left to continue to see all possibilities } else { right--; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_26.java b/src/main/java/com/fishercoder/solutions/firstthousand/_26.java index 5e772f4e7c..2750d8d869 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_26.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_26.java @@ -5,7 +5,7 @@ public class _26 { public static class Solution1 { - /** + /* * Key: It doesn't matter what you leave beyond the returned length. */ public int removeDuplicates(int[] nums) { @@ -21,7 +21,7 @@ public int removeDuplicates(int[] nums) { } public static class Solution2 { - /** + /* * My completely original solution on 2/2/2022. */ public int removeDuplicates(int[] nums) { @@ -39,5 +39,4 @@ public int removeDuplicates(int[] nums) { return left + 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_260.java b/src/main/java/com/fishercoder/solutions/firstthousand/_260.java index b8d0299158..76fe815199 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_260.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_260.java @@ -27,7 +27,7 @@ public int[] singleNumber(int[] nums) { } public static class Solution2 { - /**Credit: https://discuss.leetcode.com/topic/21605/accepted-c-java-o-n-time-o-1-space-easy-solution-with-detail-explanations/2 + /*Credit: https://discuss.leetcode.com/topic/21605/accepted-c-java-o-n-time-o-1-space-easy-solution-with-detail-explanations/2 * * some more explanation about this algorithm: * two's complement: one number's two's complement number is computed as below: @@ -45,7 +45,7 @@ public int[] singleNumber(int[] nums) { diff ^= num; } - //get least significant set bit + // get least significant set bit diff &= -diff; int[] result = new int[2]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_261.java b/src/main/java/com/fishercoder/solutions/firstthousand/_261.java index e57b441cc8..a07f4f3e3e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_261.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_261.java @@ -17,7 +17,7 @@ public boolean validTree(int n, int[][] edges) { return false; } - //union + // union nums[x] = y; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_263.java b/src/main/java/com/fishercoder/solutions/firstthousand/_263.java index eb8af30bf3..15bebef291 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_263.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_263.java @@ -7,7 +7,7 @@ public boolean isUgly(int num) { if (num == 0) { return false; } - int[] divisors = new int[]{5, 3, 2}; + int[] divisors = new int[] {5, 3, 2}; for (int divisor : divisors) { while (num % divisor == 0) { num /= divisor; @@ -16,5 +16,4 @@ public boolean isUgly(int num) { return num == 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_264.java b/src/main/java/com/fishercoder/solutions/firstthousand/_264.java index 6cc82edecb..af2cb4b553 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_264.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_264.java @@ -5,7 +5,7 @@ public class _264 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/21791/o-n-java-solution */ public int nthUglyNumber(int n) { @@ -35,7 +35,7 @@ public int nthUglyNumber(int n) { } public static class Solution2 { - /** + /* * My completely original solution on 11/7/2021. * Although not super robust, as the input increases, I'll have to increase the times (variable n) on line 61 as some smaller numbers might appear later. */ @@ -44,7 +44,7 @@ public int nthUglyNumber(int n) { treeSet.add(1L); int count = 1; int polled = 0; - int[] primes = new int[]{2, 3, 5}; + int[] primes = new int[] {2, 3, 5}; while (!treeSet.isEmpty()) { int size = treeSet.size(); for (int i = 0; i < size; i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_265.java b/src/main/java/com/fishercoder/solutions/firstthousand/_265.java index 501fdf5137..bea7c69485 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_265.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_265.java @@ -41,5 +41,4 @@ public int minCostII(int[][] costs) { return costs[n - 1][min1]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_266.java b/src/main/java/com/fishercoder/solutions/firstthousand/_266.java index fee36f82c6..863babe750 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_266.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_266.java @@ -29,5 +29,4 @@ public boolean canPermutePalindrome(String s) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_267.java b/src/main/java/com/fishercoder/solutions/firstthousand/_267.java index 6e238bb923..8109ded20e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_267.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_267.java @@ -48,8 +48,12 @@ public List generatePalindromes(String s) { } // generate all unique permutation from list - void getPerm(List list, String mid, boolean[] used, StringBuilder sb, - List res) { + void getPerm( + List list, + String mid, + boolean[] used, + StringBuilder sb, + List res) { if (sb.length() == list.size()) { // form the palindromic string res.add(sb.toString() + mid + sb.reverse().toString()); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_268.java b/src/main/java/com/fishercoder/solutions/firstthousand/_268.java index ad10aafd23..1c1939a04b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_268.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_268.java @@ -3,7 +3,7 @@ public class _268 { public static class Solution1 { - /** + /* * we could take advantage of the array indices * then a number xor with itself is zero, so after we xor the entire array with all of its indices, the missing number will show up. */ @@ -20,12 +20,12 @@ public int missingNumber(int[] nums) { public static class Solution2 { public int missingNumber(int[] nums) { int n = nums.length; - long sum = n + (n * n - n) / 2;//this is the formula to compute the sum for arithmetic sequence + long sum = n + (n * n - n) / 2; // this is the formula to compute the sum for arithmetic + // sequence for (int i = 0; i < nums.length; i++) { sum -= nums[i]; } return (int) sum; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_269.java b/src/main/java/com/fishercoder/solutions/firstthousand/_269.java index 1da3212344..e2234867be 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_269.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_269.java @@ -9,20 +9,25 @@ public class _269 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/28308/java-ac-solution-using-bfs */ public String alienOrder(String[] words) { - Map> charToSmallerCharsMap = new HashMap<>();//this map means all chars in the value set are after the char in the key - Map indegreeMap = new HashMap<>();//this map means how many chars are before this given char + Map> charToSmallerCharsMap = + new HashMap<>(); // this map means all chars in the value set are after the char + // in the key + Map indegreeMap = + new HashMap<>(); // this map means how many chars are before this given char StringBuilder result = new StringBuilder(); if (words == null || words.length == 0) { return result.toString(); } for (String s : words) { for (char c : s.toCharArray()) { - //we go through each word, nothing to compare, so each char's degree should be zero - //only when we compare words[i] with words[i+1], we know the order of different chars + // we go through each word, nothing to compare, so each char's degree should be + // zero + // only when we compare words[i] with words[i+1], we know the order of different + // chars indegreeMap.put(c, 0); } } @@ -36,14 +41,17 @@ public String alienOrder(String[] words) { char c1 = curr.charAt(j); char c2 = next.charAt(j); if (c1 != c2) { - Set set = charToSmallerCharsMap.getOrDefault(c1, new HashSet<>()); + Set set = + charToSmallerCharsMap.getOrDefault(c1, new HashSet<>()); if (!set.contains(c2)) { set.add(c2); charToSmallerCharsMap.put(c1, set); indegreeMap.put(c2, indegreeMap.get(c2) + 1); } - //no longer need to continue iterating through either one of these two words and should not to, - //because the first two chars at the same position of these two words that differ decides the order + // no longer need to continue iterating through either one of these two + // words and should not to, + // because the first two chars at the same position of these two words that + // differ decides the order break; } } @@ -51,7 +59,8 @@ public String alienOrder(String[] words) { Queue queue = new LinkedList<>(); for (char c : indegreeMap.keySet()) { if (indegreeMap.get(c) == 0) { - //this means no chars come before this char, so they should be at the head of this alien dictionary + // this means no chars come before this char, so they should be at the head of + // this alien dictionary queue.offer(c); } } @@ -73,5 +82,4 @@ public String alienOrder(String[] words) { return result.toString(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_27.java b/src/main/java/com/fishercoder/solutions/firstthousand/_27.java index e01eb1a707..a67f580fd6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_27.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_27.java @@ -1,16 +1,16 @@ -package com.fishercoder.solutions.firstthousand; - -public class _27 { - - public static class Solution1 { - public int removeElement(int[] nums, int val) { - int i = 0; - for (int j = 0; j < nums.length; j++) { - if (nums[j] != val) { - nums[i++] = nums[j]; - } - } - return i; - } - } -} +package com.fishercoder.solutions.firstthousand; + +public class _27 { + + public static class Solution1 { + public int removeElement(int[] nums, int val) { + int i = 0; + for (int j = 0; j < nums.length; j++) { + if (nums[j] != val) { + nums[i++] = nums[j]; + } + } + return i; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_270.java b/src/main/java/com/fishercoder/solutions/firstthousand/_270.java index 961acb43e1..505f10746f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_270.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_270.java @@ -10,7 +10,12 @@ public int closestValue(TreeNode root, double target) { int closest = root.val; while (root != null) { val = root.val; - closest = Math.abs(val - target) < Math.abs(closest - target) || (Math.abs(val - target) == Math.abs(closest - target) && val < closest) ? val : closest; + closest = + Math.abs(val - target) < Math.abs(closest - target) + || (Math.abs(val - target) == Math.abs(closest - target) + && val < closest) + ? val + : closest; root = target < root.val ? root.left : root.right; } return closest; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_272.java b/src/main/java/com/fishercoder/solutions/firstthousand/_272.java index b6257cc383..96e65b56d1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_272.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_272.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; import java.util.Stack; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_273.java b/src/main/java/com/fishercoder/solutions/firstthousand/_273.java index b26ad12451..c4c57f6e4e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_273.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_273.java @@ -3,10 +3,28 @@ public class _273 { public static class Solution1 { - private String[] belowTen = new String[]{"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; - private String[] belowTwenty = new String[]{"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"}; - private String[] belowHundred = new String[]{"Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"}; - private String[] overThousand = new String[]{"Thousand", "Million", "Billion"}; + private String[] belowTen = + new String[] { + "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" + }; + private String[] belowTwenty = + new String[] { + "Ten", + "Eleven", + "Twelve", + "Thirteen", + "Fourteen", + "Fifteen", + "Sixteen", + "Seventeen", + "Eighteen", + "Nineteen" + }; + private String[] belowHundred = + new String[] { + "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" + }; + private String[] overThousand = new String[] {"Thousand", "Million", "Billion"}; public String numberToWords(int num) { String result; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_276.java b/src/main/java/com/fishercoder/solutions/firstthousand/_276.java index 1dc2db262e..b37cd86389 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_276.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_276.java @@ -2,7 +2,7 @@ public class _276 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/paint-fence/editorial/ * 1. base case: dp[0] = k; dp[1] = k * k; * 2. recurrence: dp[i] = dp[i - 1] * (k - 1) + dp[i - 2] * (k - 1) @@ -21,7 +21,7 @@ public int numWays(int n, int k) { } public static class Solution2 { - /** + /* * The above solution could be further optimized to use O(1) space. */ public int numWays(int n, int k) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_277.java b/src/main/java/com/fishercoder/solutions/firstthousand/_277.java index e6227f706e..2631eebf8f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_277.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_277.java @@ -3,7 +3,7 @@ public class _277 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/find-the-celebrity/solution/ approach 2 * 1. we narrow down the possible celebrity candidate to only one person * 2. we check to make sure that every other person knows @@ -16,8 +16,9 @@ public int findCelebrity(int n) { int candidate = 0; for (int i = 1; i < n; i++) { if (knows(candidate, i)) { - //this rules out the possibility that candidiate is a celebrity since he/she knows i - //so we update candidate to be i, because at least i doesn't know anybody yet. + // this rules out the possibility that candidiate is a celebrity since he/she + // knows i + // so we update candidate to be i, because at least i doesn't know anybody yet. candidate = i; } } @@ -29,21 +30,21 @@ public int findCelebrity(int n) { return candidate; } - //this is a mock-up method to make IDE happy.s + // this is a mock-up method to make IDE happy.s boolean knows(int i, int candidate) { return false; } } public static class Solution2 { - /** + /* * My completely original solution on 10/21/2021, which turns out to match https://leetcode.com/problems/find-the-celebrity/solution/ Solution 1. * Time: O(n^2) * Space: O(1) */ public int findCelebrity(int n) { for (int i = 0; i < n; i++) { - //check if i is the celebrity + // check if i is the celebrity int j = 0; for (; j < n; j++) { if (i != j) { @@ -62,7 +63,7 @@ public int findCelebrity(int n) { return -1; } - //this is a mock-up method to make IDE happy.s + // this is a mock-up method to make IDE happy.s boolean knows(int i, int candidate) { return false; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_278.java b/src/main/java/com/fishercoder/solutions/firstthousand/_278.java index d7dcbdc738..0c031ef2a0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_278.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_278.java @@ -18,7 +18,7 @@ public int firstBadVersion(int n) { } private boolean isBadVersion(int left) { - //this is a fake method to make Eclipse happy + // this is a fake method to make Eclipse happy return false; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_279.java b/src/main/java/com/fishercoder/solutions/firstthousand/_279.java index f5883bfa25..56e12c51fd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_279.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_279.java @@ -18,7 +18,7 @@ public int numSquares(int n) { } public static class Solution2 { - //DP solution + // DP solution public int numSquares(int n) { int[] dp = new int[n + 1]; Arrays.fill(dp, Integer.MAX_VALUE); @@ -38,7 +38,7 @@ public int numSquares(int n) { } public static class Solution3 { - /** + /* * My completely original DP solution on 10/14/2021. *

* Again, once you use a pen and paper to visualize your thought process, the idea flows out very quickly. @@ -67,5 +67,4 @@ public int numSquares(int n) { return dp[n]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_28.java b/src/main/java/com/fishercoder/solutions/firstthousand/_28.java index 0780380368..f5b5c58cde 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_28.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_28.java @@ -2,19 +2,18 @@ public class _28 { - public static class Solution1 { - public int strStr(String haystack, String needle) { - if (haystack == null || needle == null || haystack.length() < needle.length()) { - return -1; - } + public static class Solution1 { + public int strStr(String haystack, String needle) { + if (haystack == null || needle == null || haystack.length() < needle.length()) { + return -1; + } - for (int i = 0; i <= haystack.length() - needle.length(); i++) { - if (haystack.substring(i, i + needle.length()).equals(needle)) { - return i; + for (int i = 0; i <= haystack.length() - needle.length(); i++) { + if (haystack.substring(i, i + needle.length()).equals(needle)) { + return i; + } + } + return -1; } - } - return -1; } - } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_280.java b/src/main/java/com/fishercoder/solutions/firstthousand/_280.java index 42b078999a..941cee003b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_280.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_280.java @@ -4,7 +4,8 @@ public class _280 { public static class Solution1 { public void wiggleSort(int[] nums) { for (int i = 1; i < nums.length; i++) { - if ((i % 2 == 0 && nums[i] > nums[i - 1]) || (i % 2 == 1 && nums[i] < nums[i - 1])) { + if ((i % 2 == 0 && nums[i] > nums[i - 1]) + || (i % 2 == 1 && nums[i] < nums[i - 1])) { swap(nums, i); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_282.java b/src/main/java/com/fishercoder/solutions/firstthousand/_282.java index 7152bb7b3d..96e7712825 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_282.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_282.java @@ -11,10 +11,16 @@ public List addOperators(String num, int target) { StringBuilder sb = new StringBuilder(); dfs(res, sb, num, 0, target, 0, 0); return res; - } - private void dfs(List res, StringBuilder sb, String num, int pos, int target, long prev, long multi) { + private void dfs( + List res, + StringBuilder sb, + String num, + int pos, + int target, + long prev, + long multi) { if (pos == num.length()) { if (target == prev) { res.add(sb.toString()); @@ -37,11 +43,17 @@ private void dfs(List res, StringBuilder sb, String num, int pos, int ta dfs(res, sb.append("-").append(curr), num, i + 1, target, prev - curr, -curr); sb.setLength(len); - dfs(res, sb.append("*").append(curr), num, i + 1, target, prev - multi + multi * curr, multi * curr); + dfs( + res, + sb.append("*").append(curr), + num, + i + 1, + target, + prev - multi + multi * curr, + multi * curr); sb.setLength(len); } } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_283.java b/src/main/java/com/fishercoder/solutions/firstthousand/_283.java index 078cbd4eba..adb93161de 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_283.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_283.java @@ -3,7 +3,8 @@ public class _283 { public static class Solution1 { public void moveZeroes(int[] nums) { - //keep the last non-zero index and keep overwriting it, then append zeroes to fill the end + // keep the last non-zero index and keep overwriting it, then append zeroes to fill the + // end int j = 0; int i = 0; for (; j < nums.length; j++) { @@ -19,8 +20,8 @@ public void moveZeroes(int[] nums) { public static class Solution2 { public void moveZeroes(int[] nums) { - //this solution is the most optimal since it minimizes the number of operations - //the idea is to swap the non-zero element to the first zero number position + // this solution is the most optimal since it minimizes the number of operations + // the idea is to swap the non-zero element to the first zero number position for (int i = 0, j = 0; i < nums.length && j < nums.length; j++) { if (nums[j] != 0) { int temp = nums[i]; @@ -31,9 +32,10 @@ public void moveZeroes(int[] nums) { } } - //then I came up with this solution and got it AC'ed! Cheers! - //basically, find the next non-zero number and swap it with the current zero number - //Apparently it's not the most optimal, since this is basically an O(n^2) solution, then I turned to Editorial solutions + // then I came up with this solution and got it AC'ed! Cheers! + // basically, find the next non-zero number and swap it with the current zero number + // Apparently it's not the most optimal, since this is basically an O(n^2) solution, then I + // turned to Editorial solutions public static class Solution3 { public void moveZeroes(int[] nums) { for (int i = 0; i < nums.length - 1; i++) { @@ -55,12 +57,12 @@ public void moveZeroes(int[] nums) { } public static class Solution4 { - /** + /* * I'm glad that I finally figured this one out completely on my own, this O(n) time, O(1) space solution. */ public void moveZeroes(int[] nums) { - int i = 0;//zero index - int j = 0;//non zero index + int i = 0; // zero index + int j = 0; // non zero index while (i < nums.length && j < nums.length) { if (nums[j] != 0) { if (i < j) { @@ -75,5 +77,4 @@ public void moveZeroes(int[] nums) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_284.java b/src/main/java/com/fishercoder/solutions/firstthousand/_284.java index ae4969b751..c8ad71832e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_284.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_284.java @@ -36,4 +36,4 @@ public boolean hasNext() { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_285.java b/src/main/java/com/fishercoder/solutions/firstthousand/_285.java index 18dddf9962..7ccd0be6ae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_285.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_285.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -11,7 +10,7 @@ public class _285 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/25698/java-python-solution-o-h-time-and-o-1-space-iterative * The inorder traversal of a BST is the nodes in ascending order. * To find a successor, you just need to find the smallest one that is larger than the given value since there are no duplicate values in a BST. @@ -92,5 +91,4 @@ private List dfs(TreeNode root, List inorder) { return inorder; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_286.java b/src/main/java/com/fishercoder/solutions/firstthousand/_286.java index f5b620e4ad..7728765f48 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_286.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_286.java @@ -6,7 +6,7 @@ public class _286 { public static class Solution1 { - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; public void wallsAndGates(int[][] rooms) { if (rooms == null || rooms.length == 0 || rooms[0].length == 0) { @@ -33,13 +33,15 @@ void bfs(int[][] rooms, int i, int j, int m, int n) { } } } - } public static class Solution2 { - //push all gates into the queue first, and then put all its neighbours into the queue with one distance to the gate, then continue to push the rest of the nodes into the queue, and put all their neighbours into the queue with the nodes' value plus one until the queue is empty - int[] dirs = new int[]{0, 1, 0, -1, 0}; + // push all gates into the queue first, and then put all its neighbours into the queue with + // one distance to the gate, then continue to push the rest of the nodes into the queue, and + // put all their neighbours into the queue with the nodes' value plus one until the queue is + // empty + int[] dirs = new int[] {0, 1, 0, -1, 0}; public void wallsAndGates(int[][] rooms) { if (rooms == null || rooms.length == 0 || rooms[0].length == 0) { @@ -51,7 +53,7 @@ public void wallsAndGates(int[][] rooms) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (rooms[i][j] == 0) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); } } } @@ -63,11 +65,10 @@ public void wallsAndGates(int[][] rooms) { int y = curr[1] + dirs[k + 1]; if (x >= 0 && x < m && y >= 0 && y < n && rooms[x][y] == Integer.MAX_VALUE) { rooms[x][y] = rooms[curr[0]][curr[1]] + 1; - queue.offer(new int[]{x, y}); + queue.offer(new int[] {x, y}); } } } } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_287.java b/src/main/java/com/fishercoder/solutions/firstthousand/_287.java index 6110fb5adb..449352bfde 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_287.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_287.java @@ -6,7 +6,7 @@ public class _287 { public static class Solution1 { - /** + /* * no-brainer, used O(n) space */ public int findDuplicate(int[] nums) { @@ -23,7 +23,7 @@ public int findDuplicate(int[] nums) { } public static class Solution2 { - /** + /* * O(1) space */ public int findDuplicate(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_288.java b/src/main/java/com/fishercoder/solutions/firstthousand/_288.java index ff4f4a3c35..32d8201841 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_288.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_288.java @@ -15,7 +15,12 @@ public class ValidWordAbbr { public ValidWordAbbr(String[] dictionary) { dict = new HashMap(); for (String word : dictionary) { - String key = word.length() <= 2 ? word : (word.charAt(0) + String.valueOf(word.length() - 2) + word.charAt(word.length() - 1)); + String key = + word.length() <= 2 + ? word + : (word.charAt(0) + + String.valueOf(word.length() - 2) + + word.charAt(word.length() - 1)); if (dict.containsKey(key) && !dict.get(key).equals(word)) { dict.put(key, ""); } else { @@ -25,7 +30,12 @@ public ValidWordAbbr(String[] dictionary) { } public boolean isUnique(String word) { - String key = word.length() <= 2 ? word : (word.charAt(0) + String.valueOf(word.length() - 2) + word.charAt(word.length() - 1)); + String key = + word.length() <= 2 + ? word + : (word.charAt(0) + + String.valueOf(word.length() - 2) + + word.charAt(word.length() - 1)); if (!dict.containsKey(key)) { return true; } else { @@ -43,7 +53,12 @@ public class ValidWordAbbr { public ValidWordAbbr(String[] dictionary) { dict = new HashMap(); for (String word : dictionary) { - String key = word.length() <= 2 ? word : (word.charAt(0) + String.valueOf(word.length() - 2) + word.charAt(word.length() - 1)); + String key = + word.length() <= 2 + ? word + : (word.charAt(0) + + String.valueOf(word.length() - 2) + + word.charAt(word.length() - 1)); if (dict.containsKey(key)) { Set set = dict.get(key); set.add(word); @@ -57,7 +72,12 @@ public ValidWordAbbr(String[] dictionary) { } public boolean isUnique(String word) { - String key = word.length() <= 2 ? word : (word.charAt(0) + String.valueOf(word.length() - 2) + word.charAt(word.length() - 1)); + String key = + word.length() <= 2 + ? word + : (word.charAt(0) + + String.valueOf(word.length() - 2) + + word.charAt(word.length() - 1)); if (!dict.containsKey(key)) { return true; } else { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_289.java b/src/main/java/com/fishercoder/solutions/firstthousand/_289.java index a84a66a8dc..6f3b581502 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_289.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_289.java @@ -2,7 +2,7 @@ public class _289 { public static class Solution1 { - /** + /* * Time: O(m*n) * Space: O(m*n) */ @@ -10,12 +10,14 @@ public void gameOfLife(int[][] board) { int height = board.length; int width = board[0].length; int[][] next = new int[height][width]; - int[][] directions = {{-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}}; + int[][] directions = { + {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1} + }; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { int liveCellsCount = 0; - //count all its live cells + // count all its live cells for (int[] dir : directions) { int x = i + dir[0]; @@ -46,7 +48,7 @@ public void gameOfLife(int[][] board) { } public static class Solution2 { - /** + /* * Time: O(m*n) * Space: O(1) *

@@ -81,7 +83,9 @@ public void gameOfLife(int[][] board) { // Check the validity of the neighboring cell. // and whether it was originally a live cell. - if ((r < rows && r >= 0) && (c < cols && c >= 0) && (Math.abs(board[r][c]) == 1)) { + if ((r < rows && r >= 0) + && (c < cols && c >= 0) + && (Math.abs(board[r][c]) == 1)) { liveNeighbors += 1; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_29.java b/src/main/java/com/fishercoder/solutions/firstthousand/_29.java index 37235eec90..10a7e677cc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_29.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_29.java @@ -3,7 +3,7 @@ public class _29 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/divide-two-integers/solution/ solution 1 *

* Key notes: @@ -44,7 +44,7 @@ public int divide(int dividend, int divisor) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/divide-two-integers/solution/ solution 2 *

* 1. exponetial growth to check to speed up diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_290.java b/src/main/java/com/fishercoder/solutions/firstthousand/_290.java index 0b16627cd6..db46f8df94 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_290.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_290.java @@ -20,7 +20,7 @@ public boolean wordPattern(String pattern, String str) { } } else { if (map.containsValue(words[i])) { - return false;//this is for this case: "abba", "dog dog dog dog" + return false; // this is for this case: "abba", "dog dog dog dog" } map.put(patterns[i], words[i]); } @@ -28,5 +28,4 @@ public boolean wordPattern(String pattern, String str) { return true; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_291.java b/src/main/java/com/fishercoder/solutions/firstthousand/_291.java index e60fa71039..53659c35bd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_291.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_291.java @@ -8,7 +8,7 @@ public class _291 { public static class Solution1 { - /** + /* * We can try recursively: * say pattern is "abab", str is "redblueredblue" * first we try if "a" matches with "r", "b" matches with "e", we find it's not, so we try to see if "b" matches "ed", and so on ... @@ -23,8 +23,14 @@ public boolean wordPatternMatch(String pattern, String str) { return isMatch(str, 0, pattern, 0, map, set); } - private boolean isMatch(String str, int i, String pattern, int j, Map map, Set set) { - //base case + private boolean isMatch( + String str, + int i, + String pattern, + int j, + Map map, + Set set) { + // base case if (i == str.length() && j == pattern.length()) { return true; } @@ -37,12 +43,12 @@ private boolean isMatch(String str, int i, String pattern, int j, Map * 1. always keep one queue one element more than the other if the number is odd, offer into that one @@ -46,7 +46,7 @@ public double findMedian() { public static class Solution2 { public static class MedianFinder { - /** + /* * credit: https://discuss.leetcode.com/topic/27521/short-simple-java-c-python-o-log-n-o-1 * The idea is for sure to use two heaps, one is max heap, one is min heap, we always let the max heap have one more element * than min heap if the total number of elements is not even. @@ -58,7 +58,7 @@ public static class MedianFinder { private Queue large; private Queue small; - /** + /* * initialize your data structure here. */ public MedianFinder() { @@ -82,20 +82,19 @@ public double findMedian() { } return (large.peek() - small.peek()) / 2.0; } - } } public static class Solution3 { public static class MedianFinder { - /** + /* * The same as Solution2, but not using negation for minHeap. */ private Queue maxHeap; private Queue minHeap; - /** + /* * initialize your data structure here. */ public MedianFinder() { @@ -119,7 +118,6 @@ public double findMedian() { } return (maxHeap.peek() + minHeap.peek()) / 2.0; } - } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_296.java b/src/main/java/com/fishercoder/solutions/firstthousand/_296.java index 379b7ce967..dd059f3ddd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_296.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_296.java @@ -6,7 +6,7 @@ public class _296 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/best-meeting-point/solution/ Approach 3 */ public int minTotalDistance(int[][] grid) { @@ -35,6 +35,5 @@ private int minDistance1D(List points, int median) { } return distance; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_297.java b/src/main/java/com/fishercoder/solutions/firstthousand/_297.java index a76aa2e5b7..e6ac2232a4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_297.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_297.java @@ -1,14 +1,13 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; public class _297 { public static class Solution1 { - /** + /* * The idea is very straightforward: * use "#" as the terminator, do BFS, level order traversal to store all nodes values into a StringBuilder. * When deserializing, also use a queue: pop the root into the queue first, then use a for loop to construct each node, diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_298.java b/src/main/java/com/fishercoder/solutions/firstthousand/_298.java index 7d99127127..d37498501d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_298.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_298.java @@ -31,7 +31,7 @@ private void dfs(TreeNode root, int curr, int target) { } public static class Solution2 { - /** + /* * This is a better solution since it doesn't involve a global variable. */ public int longestConsecutive(TreeNode root) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_299.java b/src/main/java/com/fishercoder/solutions/firstthousand/_299.java index 9997029e0a..6eaf8c6b87 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_299.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_299.java @@ -26,7 +26,7 @@ public String getHint(String secret, String guess) { } public static class Solution2 { - /** + /* * My completely original solution on 12/24/2021. */ public String getHint(String secret, String guess) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_3.java b/src/main/java/com/fishercoder/solutions/firstthousand/_3.java index 0491ea51e0..0fe50a228a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_3.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_3.java @@ -12,7 +12,8 @@ public int lengthOfLongestSubstring(String s) { int result = 0; Map map = new HashMap(); for (int i = 0, j = i; j < s.length(); ) { - if (!map.containsKey(s.charAt(j)) || (map.containsKey(s.charAt(j)) && map.get(s.charAt(j)) == 0)) { + if (!map.containsKey(s.charAt(j)) + || (map.containsKey(s.charAt(j)) && map.get(s.charAt(j)) == 0)) { map.put(s.charAt(j), 1); result = Math.max(j - i + 1, result); j++; @@ -26,7 +27,7 @@ public int lengthOfLongestSubstring(String s) { } public static class Solution2 { - /** + /* * Sliding Window * O(n) time * O(min(m,n)) or O(k) space @@ -38,7 +39,7 @@ public int lengthOfLongestSubstring(String s) { int i = 0; int j = 0; while (i < n && j < n) { - /**Try to extend the range i, j*/ + /*Try to extend the range i, j*/ if (!set.contains(s.charAt(j))) { set.add(s.charAt(j++)); result = Math.max(result, j - i); @@ -51,7 +52,7 @@ public int lengthOfLongestSubstring(String s) { } public static class Solution3 { - /** + /* * Sliding Window * O(n) time * O(n) space @@ -62,7 +63,7 @@ public int lengthOfLongestSubstring(String s) { } int max = 0; Map map = new HashMap<>(); - /**Try to extend the range (i, j)*/ + /*Try to extend the range (i, j)*/ for (int i = 0, j = 0; i < s.length(); i++) { if (map.containsKey(s.charAt(i))) { j = Math.max(j, map.get(s.charAt(i)) + 1); @@ -75,7 +76,7 @@ public int lengthOfLongestSubstring(String s) { } public static class Solution4 { - /** + /* * Sliding Window Optimized * O(n) time * O(n) space @@ -86,7 +87,7 @@ public int lengthOfLongestSubstring(String s) { } int max = 0; int[] index = new int[128]; - /**Try to extend the range (i, j)*/ + /*Try to extend the range (i, j)*/ for (int i = 0, j = 0; j < s.length(); j++) { i = Math.max(index[s.charAt(j)], i); max = Math.max(max, j - i + 1); @@ -97,7 +98,7 @@ public int lengthOfLongestSubstring(String s) { } public static class Solution5 { - /** + /* * Sliding Window, my completely original idea on 9/17/2021. * Basically, keep moving the left boundary towards the right and keep updating the result along the way. * O(n) time @@ -122,7 +123,7 @@ public int lengthOfLongestSubstring(String s) { } public static class Solution6 { - /** + /* * Sliding Window, my completely original idea on 10/20/2021. Although less efficient then Solution5, it follows a generic template without any manipulation. * Basically, keep moving the left boundary towards the right and keep updating the result along the way. * O(n) time diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_30.java b/src/main/java/com/fishercoder/solutions/firstthousand/_30.java index a3742b7532..83d08aee31 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_30.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_30.java @@ -7,44 +7,43 @@ public class _30 { - public static class Solution1 { - /**TODO: this one is not AC'ed. fix this one.*/ - public List findSubstring(String s, String[] words) { - Map map = new HashMap<>(); - for (String word : words) { - map.put(word, 1); - } - List result = new ArrayList<>(); - int startIndex = 0; - int wordLen = words.length; - for (int i = 0; i < s.length(); i++) { - startIndex = i; - Map clone = new HashMap<>(map); - int matchedWord = 0; - for (int j = i + 1; j < s.length(); j++) { - String word = s.substring(i, j); - if (clone.containsKey(word) && clone.get(word) == 1) { - clone.put(word, 0); - i = j; - matchedWord++; - } - if (matchedWord == wordLen) { - boolean all = true; - for (String key : clone.keySet()) { - if (clone.get(key) != 0) { - all = false; - break; - } + public static class Solution1 { + /*TODO: this one is not AC'ed. fix this one.*/ + public List findSubstring(String s, String[] words) { + Map map = new HashMap<>(); + for (String word : words) { + map.put(word, 1); } - if (all) { - result.add(startIndex); + List result = new ArrayList<>(); + int startIndex = 0; + int wordLen = words.length; + for (int i = 0; i < s.length(); i++) { + startIndex = i; + Map clone = new HashMap<>(map); + int matchedWord = 0; + for (int j = i + 1; j < s.length(); j++) { + String word = s.substring(i, j); + if (clone.containsKey(word) && clone.get(word) == 1) { + clone.put(word, 0); + i = j; + matchedWord++; + } + if (matchedWord == wordLen) { + boolean all = true; + for (String key : clone.keySet()) { + if (clone.get(key) != 0) { + all = false; + break; + } + } + if (all) { + result.add(startIndex); + } + matchedWord = 0; + } + } } - matchedWord = 0; - } + return result; } - } - return result; } - } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_300.java b/src/main/java/com/fishercoder/solutions/firstthousand/_300.java index ae2353cdda..99ec8e614f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_300.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_300.java @@ -5,7 +5,7 @@ public class _300 { public static class Solution1 { - /** + /* * brute force: * Time: O(2^n), size of recursion tree will be: 2^n * Space: O(n^2) @@ -32,7 +32,7 @@ private int recursion(int[] nums, int prev, int curr) { } public static class Solution2 { - /** + /* * This is an iteration on the previous solution, we use a 2-d array to memoize the previously calculated result * Time: O(n^2) * Space: O(n^2) @@ -51,7 +51,7 @@ private int recusionWithMemo(int[] nums, int prevIndex, int currIndex, int[][] m return 0; } if (memo[prevIndex + 1][currIndex] >= 0) { - //because we initialize all elements in memo to be -1, + // because we initialize all elements in memo to be -1, // so if it's not -1, then it means we have computed this value before, // we'll just return it and this way it avoid duplicate recursion return memo[prevIndex + 1][currIndex]; @@ -67,7 +67,7 @@ private int recusionWithMemo(int[] nums, int prevIndex, int currIndex, int[][] m } public static class Solution3 { - /** + /* * DP solution, credit: https://leetcode.com/problems/longest-increasing-subsequence/editorial/ * Time: O(n^2) * Space: O(n) @@ -94,7 +94,7 @@ public int lengthOfLIS(int[] nums) { } public static class Solution4 { - /** + /* * use binary search. * Time: O(nlogn) * Space: O(n) diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_301.java b/src/main/java/com/fishercoder/solutions/firstthousand/_301.java index bf60f85d76..850bc07f41 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_301.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_301.java @@ -33,12 +33,13 @@ public List removeInvalidParentheses(String s) { } if (found) { - continue;//this means if the initial input is already a valid one, we'll just directly return it and there's actually only one valid result + continue; // this means if the initial input is already a valid one, we'll just + // directly return it and there's actually only one valid result } for (int i = 0; i < curr.length(); i++) { if (curr.charAt(i) != '(' && curr.charAt(i) != ')') { - continue;//this is to rule out those non-parentheses characters + continue; // this is to rule out those non-parentheses characters } String next = curr.substring(0, i) + curr.substring(i + 1); @@ -47,7 +48,6 @@ public List removeInvalidParentheses(String s) { visited.add(next); } } - } return result; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_303.java b/src/main/java/com/fishercoder/solutions/firstthousand/_303.java index fb7c303e12..a570cbe995 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_303.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_303.java @@ -22,4 +22,4 @@ public int sumRange(int i, int j) { return sums[j] - sums[i - 1]; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_304.java b/src/main/java/com/fishercoder/solutions/firstthousand/_304.java index e4611144ce..b4a2922bc8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_304.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_304.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.firstthousand; -/** +/* * 304. Range Sum Query 2D - Immutable * Given a 2D matrix matrix, handle multiple queries of the following type: *

@@ -44,27 +44,32 @@ public NumMatrix(int[][] matrix) { return; } - /**The dimensions of this total matrix is actually 1 bigger than the given matrix to make the index mapping easier*/ + /*The dimensions of this total matrix is actually 1 bigger than the given matrix to make the index mapping easier*/ int m = matrix.length; int n = matrix[0].length; total = new int[m + 1][n + 1]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { - total[i + 1][j + 1] = matrix[i][j] + total[i + 1][j] + total[i][j + 1] - total[i][j]; + total[i + 1][j + 1] = + matrix[i][j] + total[i + 1][j] + total[i][j + 1] - total[i][j]; } } } public int sumRegion(int row1, int col1, int row2, int col2) { - //since we deduct both total[row2 + 1][col1] and total[row1][col2 + 1], this means we deducted their shared area twice + // since we deduct both total[row2 + 1][col1] and total[row1][col2 + 1], this means + // we deducted their shared area twice // which is total[row1][col1] - return total[row2 + 1][col2 + 1] - total[row2 + 1][col1] - total[row1][col2 + 1] + total[row1][col1]; + return total[row2 + 1][col2 + 1] + - total[row2 + 1][col1] + - total[row1][col2 + 1] + + total[row1][col1]; } } } -/** - * Your NumMatrix object will be instantiated and called as such: - * NumMatrix obj = new NumMatrix(matrix); - * int param_1 = obj.sumRegion(row1,col1,row2,col2); - */ + /* + * Your NumMatrix object will be instantiated and called as such: + * NumMatrix obj = new NumMatrix(matrix); + * int param_1 = obj.sumRegion(row1,col1,row2,col2); + */ } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_306.java b/src/main/java/com/fishercoder/solutions/firstthousand/_306.java index d316720837..99cfae52d5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_306.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_306.java @@ -2,7 +2,7 @@ public class _306 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/29856/java-recursive-and-iterative-solutions/2 */ public boolean isAdditiveNumber(String num) { @@ -38,5 +38,4 @@ private boolean isValid(int i, int j, String num) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_307.java b/src/main/java/com/fishercoder/solutions/firstthousand/_307.java index dbe4f27902..4e4459566b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_307.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_307.java @@ -82,4 +82,3 @@ int sumRange(SegmentTreeNode root, int start, int end) { } } } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_308.java b/src/main/java/com/fishercoder/solutions/firstthousand/_308.java index 9aac345cdd..53ec2ab1f0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_308.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_308.java @@ -31,7 +31,7 @@ public void update(int rowIndex, int colIndex, int newVal) { nums[rowIndex][colIndex] = newVal; for (int i = rowIndex + 1; i <= height; i += i & (-i)) { for (int j = colIndex + 1; j <= width; j += j & (-j)) { - tree[i][j] += delta;//just use its previous value plus delta is good + tree[i][j] += delta; // just use its previous value plus delta is good } } } @@ -40,8 +40,10 @@ public int sumRegion(int row1, int col1, int row2, int col2) { if (height == 0 || width == 0) { return 0; } - return sum(row2 + 1, col2 + 1) + sum(row1, col1) - sum(row1, col2 + 1) - sum( - row2 + 1, col1); + return sum(row2 + 1, col2 + 1) + + sum(row1, col1) + - sum(row1, col2 + 1) + - sum(row2 + 1, col1); } private int sum(int row, int col) { @@ -55,7 +57,7 @@ private int sum(int row, int col) { } } - /** + /* * Your NumMatrix object will be instantiated and called as such: * NumMatrix obj = new NumMatrix(matrix); * obj.update(row,col,val); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_309.java b/src/main/java/com/fishercoder/solutions/firstthousand/_309.java index 807a02c667..162e7e3588 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_309.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_309.java @@ -2,7 +2,7 @@ public class _309 { public static class Solution1 { - /** + /* * The series of problems are typical dp. The key for dp is to find the variables to * represent the states and deduce the transition function. * @@ -66,8 +66,8 @@ public int maxProfit(int[] prices) { } public static class Solution2 { - /**Surprisingly, this solution is even much faster than the one above provided by the author.*/ - /** + /*Surprisingly, this solution is even much faster than the one above provided by the author.*/ + /* * Here I share my no brainer weapon when it comes to this kind of problems. * * 1. Define States diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_31.java b/src/main/java/com/fishercoder/solutions/firstthousand/_31.java index b218d523a1..efcf24d1be 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_31.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_31.java @@ -2,7 +2,7 @@ public class _31 { public static class Solution1 { - /** + /* * Leetcode has a very good article to illustrate this problem and with animation: * https://leetcode.com/articles/next-permutation/ * 1. if the array is already in decrementing order, then there's no next larger permutation possible. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_312.java b/src/main/java/com/fishercoder/solutions/firstthousand/_312.java index 050e556f2e..5ad6ee1b8d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_312.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_312.java @@ -3,7 +3,7 @@ public class _312 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/burst-balloons/discuss/76228/Share-some-analysis-and-explanations *

* Divide and conquer with memoization @@ -32,7 +32,12 @@ private int burst(int[][] memo, int[] nums, int left, int right) { } int ans = 0; for (int i = left + 1; i < right; i++) { - ans = Math.max(ans, nums[left] * nums[i] * nums[right] + burst(memo, nums, left, i) + burst(memo, nums, i, right)); + ans = + Math.max( + ans, + nums[left] * nums[i] * nums[right] + + burst(memo, nums, left, i) + + burst(memo, nums, i, right)); } memo[left][right] = ans; return ans; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_313.java b/src/main/java/com/fishercoder/solutions/firstthousand/_313.java index a29baa8ed9..37b1551649 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_313.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_313.java @@ -25,5 +25,4 @@ public int nthSuperUglyNumber(int n, int[] primes) { return ret[n - 1]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_314.java b/src/main/java/com/fishercoder/solutions/firstthousand/_314.java index f8e56cb9e6..d30ea0ea48 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_314.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_314.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -21,7 +20,7 @@ public List> verticalOrder(TreeNode root) { TreeMap> map = new TreeMap(); bfsQ.offer(root); indexQ.offer( - 0);//we set the root as index 0, left will be negative, right will be positive + 0); // we set the root as index 0, left will be negative, right will be positive while (!bfsQ.isEmpty()) { int qSize = bfsQ.size(); for (int i = 0; i < qSize; i++) { @@ -62,7 +61,7 @@ public List> verticalOrder(TreeNode root) { HashMap> map = new HashMap(); bfsQ.offer(root); indexQ.offer( - 0);//we set the root as index 0, left will be negative, right will be positive + 0); // we set the root as index 0, left will be negative, right will be positive int min = 0; int max = 0; while (!bfsQ.isEmpty()) { @@ -108,14 +107,19 @@ public List> verticalOrder(TreeNode root) { int size = queue.size(); for (int i = 0; i < size; i++) { NodeWithIndex nodeWithIndex = queue.poll(); - List thisList = map.getOrDefault(nodeWithIndex.index, new ArrayList<>()); + List thisList = + map.getOrDefault(nodeWithIndex.index, new ArrayList<>()); thisList.add(nodeWithIndex.node.val); map.put(nodeWithIndex.index, thisList); if (nodeWithIndex.node.left != null) { - queue.offer(new NodeWithIndex(nodeWithIndex.node.left, nodeWithIndex.index - 1)); + queue.offer( + new NodeWithIndex( + nodeWithIndex.node.left, nodeWithIndex.index - 1)); } if (nodeWithIndex.node.right != null) { - queue.offer(new NodeWithIndex(nodeWithIndex.node.right, nodeWithIndex.index + 1)); + queue.offer( + new NodeWithIndex( + nodeWithIndex.node.right, nodeWithIndex.index + 1)); } } } @@ -136,5 +140,4 @@ public NodeWithIndex(TreeNode node, int index) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_316.java b/src/main/java/com/fishercoder/solutions/firstthousand/_316.java index df2246aa0d..7942e9d313 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_316.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_316.java @@ -5,37 +5,42 @@ public class _316 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/32259/java-solution-using-stack-with-comments/2 */ public String removeDuplicateLetters(String s) { - int[] res = new int[26]; //will contain number of occurences of character (i+'a') + int[] res = new int[26]; // will contain number of occurences of character (i+'a') boolean[] visited = - new boolean[26]; //will contain if character (i+'a') is present in current result Stack + new boolean + [26]; // will contain if character (i+'a') is present in current result + // Stack char[] ch = s.toCharArray(); - for (char c : ch) { //count number of occurences of character + for (char c : ch) { // count number of occurences of character res[c - 'a']++; } Deque st = new ArrayDeque<>(); // answer stack int index; for (char c : ch) { index = c - 'a'; - res[index]--; //decrement number of characters remaining in the string to be analysed + res[index]--; // decrement number of characters remaining in the string to be + // analysed if (visited[index]) { - //if character is already present in stack, dont bother + // if character is already present in stack, dont bother continue; } - //if current character is smaller than last character in stack which occurs later in the string again - //it can be removed and added later e.g stack = bc remaining string abc then a can pop b and then c + // if current character is smaller than last character in stack which occurs later + // in the string again + // it can be removed and added later e.g stack = bc remaining string abc then a can + // pop b and then c while (!st.isEmpty() && c < st.peek() && res[st.peek() - 'a'] != 0) { visited[st.pop() - 'a'] = false; } - st.push(c); //add current character and mark it as visited + st.push(c); // add current character and mark it as visited visited[index] = true; } StringBuilder sb = new StringBuilder(); - //pop character from stack and build answer string from back + // pop character from stack and build answer string from back while (!st.isEmpty()) { sb.insert(0, st.pop()); } @@ -44,7 +49,7 @@ public String removeDuplicateLetters(String s) { } public static class Solution2 { - /** + /* * Credit: https://discuss.leetcode.com/topic/31404/a-short-o-n-recursive-greedy-solution */ public String removeDuplicateLetters(String s) { @@ -62,8 +67,11 @@ public String removeDuplicateLetters(String s) { break; } } - return s.length() == 0 ? "" : s.charAt(pos) + removeDuplicateLetters( - s.substring(pos + 1).replaceAll("" + s.charAt(pos), "")); + return s.length() == 0 + ? "" + : s.charAt(pos) + + removeDuplicateLetters( + s.substring(pos + 1).replaceAll("" + s.charAt(pos), "")); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_317.java b/src/main/java/com/fishercoder/solutions/firstthousand/_317.java index bf05e2dcfd..9f7aa20a87 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_317.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_317.java @@ -13,8 +13,11 @@ public int shortestDistance(int[][] grid) { int n = grid[0].length; int[][] reach = new int[m][n]; int[][] distance = new int[m][n]; - int[] shift = new int[]{0, 1, 0, -1, - 0};//how these five elements is ordered is important since it denotes the neighbor of the current node + int[] shift = + new int[] { + 0, 1, 0, -1, 0 + }; // how these five elements is ordered is important since it denotes the + // neighbor of the current node int numBuilding = 0; for (int i = 0; i < m; i++) { @@ -25,7 +28,7 @@ public int shortestDistance(int[][] grid) { boolean[][] visited = new boolean[m][n]; Queue q = new LinkedList(); - q.offer(new int[]{i, j}); + q.offer(new int[] {i, j}); while (!q.isEmpty()) { int size = q.size(); for (int l = 0; l < size; l++) { @@ -42,7 +45,7 @@ public int shortestDistance(int[][] grid) { distance[nextRow][nextCol] += dist; visited[nextRow][nextCol] = true; reach[nextRow][nextCol]++; - q.offer(new int[]{nextRow, nextCol}); + q.offer(new int[] {nextRow, nextCol}); } } } @@ -63,5 +66,4 @@ public int shortestDistance(int[][] grid) { return result == Integer.MAX_VALUE ? -1 : result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_318.java b/src/main/java/com/fishercoder/solutions/firstthousand/_318.java index 3c5eac2ab4..b94057f94b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_318.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_318.java @@ -2,10 +2,12 @@ public class _318 { public static class Solution1 { - //Inspired by this awesome post: https://discuss.leetcode.com/topic/35539/java-easy-version-to-understand - //Idea: this question states that all words consisted of lower case (total only 26 unique chars), - //this is a big hint that we could use integer (total 32 bits) to represent each char - //values[i] means how many unique characters this string words[i] has + // Inspired by this awesome post: + // https://discuss.leetcode.com/topic/35539/java-easy-version-to-understand + // Idea: this question states that all words consisted of lower case (total only 26 unique + // chars), + // this is a big hint that we could use integer (total 32 bits) to represent each char + // values[i] means how many unique characters this string words[i] has public int maxProduct(String[] words) { if (words == null || words.length == 0) { return 0; @@ -15,14 +17,18 @@ public int maxProduct(String[] words) { for (int i = 0; i < words.length; i++) { String word = words[i]; for (int j = 0; j < words[i].length(); j++) { - values[i] |= 1 << (word.charAt(j) - - 'a');//the reason for left shift by this number "word.charAt(j) -'a'" is for 'a', otherwise 'a' - 'a' will be zero and 'a' will be missed out. + values[i] |= + 1 << (word.charAt(j) - 'a'); // the reason for left shift by this number + // "word.charAt(j) -'a'" is for 'a', otherwise + // 'a' - 'a' will be zero and 'a' will be missed + // out. } } int maxProduct = 0; for (int i = 0; i < words.length; i++) { for (int j = 0; j < words.length; j++) { - //check if values[i] AND values[j] equals to zero, this means they share NO common chars + // check if values[i] AND values[j] equals to zero, this means they share NO + // common chars if ((values[i] & values[j]) == 0 && words[i].length() * words[j].length() > maxProduct) { maxProduct = words[i].length() * words[j].length(); @@ -35,13 +41,14 @@ public int maxProduct(String[] words) { public static void main(String... strings) { _318 test = new _318(); - String[] words = new String[]{"abcw", "baz", "foo", "bar", "xtfn", "abcdef"}; + String[] words = new String[] {"abcw", "baz", "foo", "bar", "xtfn", "abcdef"}; - //The following is to understand what does left shift by 1 mean: - //the tricky part is to understand how it's written for me: + // The following is to understand what does left shift by 1 mean: + // the tricky part is to understand how it's written for me: // "x << y" means left shift x by y bits - //left shift is equivalent to multiplication of powers of 2, so "4 << 1" equals to " 4 * 2^1" - //similarly, "4 << 3" equals to "4 * 2^3" which equals "4 * 8" + // left shift is equivalent to multiplication of powers of 2, so "4 << 1" equals to " 4 * + // 2^1" + // similarly, "4 << 3" equals to "4 * 2^3" which equals "4 * 8" String sample = "f"; int bits = 0; int shiftLeftByHowMany = 0; @@ -50,15 +57,25 @@ public static void main(String... strings) { shiftLeftByHowMany = sample.charAt(j) - 'a'; shiftLeftResult = 1 << shiftLeftByHowMany; bits |= 1 << (sample.charAt(j) - 'a'); - //this means shift left 1 by "sample.charAt(j) -'a'" bits - System.out.println("nonShiftLeft = " + shiftLeftByHowMany + "\tnonShiftLeft binary form is: " + Integer.toBinaryString(shiftLeftByHowMany) - + "\nshiftLeft = " + shiftLeftResult + "\tshiftLeft binary form is: " + Integer.toBinaryString(shiftLeftResult) - + "\nbits = " + bits + "\tbits binary form is: " + Integer.toBinaryString(bits)); + // this means shift left 1 by "sample.charAt(j) -'a'" bits + System.out.println( + "nonShiftLeft = " + + shiftLeftByHowMany + + "\tnonShiftLeft binary form is: " + + Integer.toBinaryString(shiftLeftByHowMany) + + "\nshiftLeft = " + + shiftLeftResult + + "\tshiftLeft binary form is: " + + Integer.toBinaryString(shiftLeftResult) + + "\nbits = " + + bits + + "\tbits binary form is: " + + Integer.toBinaryString(bits)); System.out.println(shiftLeftResult == (1 * Math.pow(2, shiftLeftByHowMany))); } - //similarly, right shift is written like this: "x >> y", means shift x by y bits - //4 >> 3 equals 4 * 2^3, see below: + // similarly, right shift is written like this: "x >> y", means shift x by y bits + // 4 >> 3 equals 4 * 2^3, see below: System.out.println(4 * 8 == (4 * Math.pow(2, 3))); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_319.java b/src/main/java/com/fishercoder/solutions/firstthousand/_319.java index c624130b6b..9f46873bae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_319.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_319.java @@ -10,5 +10,4 @@ public int bulbSwitch(int n) { return (int) Math.sqrt(n); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_32.java b/src/main/java/com/fishercoder/solutions/firstthousand/_32.java index 47b29184cb..a6a851171a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_32.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_32.java @@ -25,7 +25,7 @@ public int longestValidParentheses(String s) { } public static class Solution2 { - /** + /* * my lengthy but original solution on 4/5/2021, the idea is to convert the valid parenthesis pairs into numbers and push them onto a stack. */ public int longestValidParentheses(String s) { @@ -47,7 +47,7 @@ public int longestValidParentheses(String s) { sum += Integer.parseInt(stack.pop()); } if (!stack.isEmpty()) { - stack.pop();//pop off the open paren + stack.pop(); // pop off the open paren sum += 2; stack.push("" + sum); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_320.java b/src/main/java/com/fishercoder/solutions/firstthousand/_320.java index 5d07690309..995e13b1ca 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_320.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_320.java @@ -12,8 +12,8 @@ public List generateAbbreviations(String word) { return result; } - private void backtrack(String word, List result, int position, String current, - int count) { + private void backtrack( + String word, List result, int position, String current, int count) { if (position == word.length()) { if (count > 0) { current += count; @@ -21,10 +21,13 @@ private void backtrack(String word, List result, int position, String cu result.add(current); } else { backtrack(word, result, position + 1, current, count + 1); - backtrack(word, result, position + 1, - current + (count > 0 ? count : "") + word.charAt(position), 0); + backtrack( + word, + result, + position + 1, + current + (count > 0 ? count : "") + word.charAt(position), + 0); } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_321.java b/src/main/java/com/fishercoder/solutions/firstthousand/_321.java index 0cf9c6bbce..f1d78fbd5e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_321.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_321.java @@ -7,7 +7,7 @@ public int[] maxNumber(int[] nums1, int[] nums2, int k) { int m = nums2.length; int[] ans = new int[k]; for (int i = Math.max(0, k - m); i <= k && i <= n; ++i) { - //what is this and why? + // what is this and why? int[] candidate = merge(maxArray(nums1, i), maxArray(nums2, k - i), k); if (greater(candidate, 0, ans, 0)) { ans = candidate; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_322.java b/src/main/java/com/fishercoder/solutions/firstthousand/_322.java index c8d5ff938d..d5573e7365 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_322.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_322.java @@ -3,7 +3,7 @@ public class _322 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/coin-change-2/discuss/99212/Knapsack-problem-Java-solution-with-thinking-process-O(nm)-Time-and-O(m)-Space */ public int coinChange(int[] coins, int amount) { @@ -34,5 +34,4 @@ private int coinChange(int[] coins, int rem, int[] count) { return count[rem - 1]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_323.java b/src/main/java/com/fishercoder/solutions/firstthousand/_323.java index 1e9419f764..6adc6e7562 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_323.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_323.java @@ -52,5 +52,4 @@ public int countComponents(int n, int[][] edges) { return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_324.java b/src/main/java/com/fishercoder/solutions/firstthousand/_324.java index 3bbd7d7a68..063e556d40 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_324.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_324.java @@ -6,7 +6,7 @@ public class _324 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/41464/step-by-step-explanation-of-index-mapping-in-java */ public void wiggleSort(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_325.java b/src/main/java/com/fishercoder/solutions/firstthousand/_325.java index eb146b4609..20d8210f4f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_325.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_325.java @@ -6,7 +6,7 @@ public class _325 { public static class Solution1 { - /** + /* * 1. This is a beautiful and classic solution that combines prefix sum and hashmap for quick search; * 2. This actually covers all possible cases and could find the maximum array size */ @@ -28,5 +28,4 @@ public int maxSubArrayLen(int[] nums, int k) { return max; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_326.java b/src/main/java/com/fishercoder/solutions/firstthousand/_326.java index 445773fb58..adb1731eab 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_326.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_326.java @@ -2,7 +2,7 @@ public class _326 { public static class Solution1 { - //regular method that has a loop + // regular method that has a loop public boolean isPowerOfThree(int n) { if (n < 3 && n != 1) { return false; @@ -18,20 +18,22 @@ public boolean isPowerOfThree(int n) { } public static class Solution2 { - //find the max possible integer that is a power of 3, then do modulor with this number + // find the max possible integer that is a power of 3, then do modulor with this number public boolean isPowerOfThree(int n) { return (n > 0 && 1162261467 % n == 0); } } public static class Solution3 { - //Editorial solution: it's pretty elegant to use base conversion which can be easily extended to any radix k - //Idea: for a number in base 10, if it's power of 10, then it must be in this format: 10, 100, 1000... with a leading one and all trailing zeros - //similarly, if a number is power of 3, then in its base 3 format, it must be in this format as well: 10, 100, 1000, 1000... - //some Java built-in function could help us along the way: + // Editorial solution: it's pretty elegant to use base conversion which can be easily + // extended to any radix k + // Idea: for a number in base 10, if it's power of 10, then it must be in this format: 10, + // 100, 1000... with a leading one and all trailing zeros + // similarly, if a number is power of 3, then in its base 3 format, it must be in this + // format as well: 10, 100, 1000, 1000... + // some Java built-in function could help us along the way: public boolean isPowerOfThree(int n) { return Integer.toString(n, 3).matches("^10*$"); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_327.java b/src/main/java/com/fishercoder/solutions/firstthousand/_327.java index b1e30127ab..bc468af68f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_327.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_327.java @@ -3,7 +3,7 @@ public class _327 { public static class Solution1 { - /** + /* * Time: O(n^2) * This results in TLE on Leetcode by the last test case. */ @@ -47,7 +47,9 @@ private int countWhileMergeSort(long[] sums, int start, int end, int lower, int return 0; } int mid = (start + end) / 2; - int count = countWhileMergeSort(sums, start, mid, lower, upper) + countWhileMergeSort(sums, mid, end, lower, upper); + int count = + countWhileMergeSort(sums, start, mid, lower, upper) + + countWhileMergeSort(sums, mid, end, lower, upper); int j = mid; int k = mid; int t = mid; @@ -69,5 +71,4 @@ private int countWhileMergeSort(long[] sums, int start, int end, int lower, int return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_329.java b/src/main/java/com/fishercoder/solutions/firstthousand/_329.java index fff931b287..0a9faa305a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_329.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_329.java @@ -3,7 +3,7 @@ public class _329 { public static class Solution1 { - final int[] dirs = new int[]{0, 1, 0, -1, 0}; + final int[] dirs = new int[] {0, 1, 0, -1, 0}; public int longestIncreasingPath(int[][] matrix) { int m = matrix.length; @@ -27,7 +27,11 @@ int dfs(int[][] matrix, int row, int col, int[][] cache) { for (int i = 0; i < dirs.length - 1; i++) { int nextRow = row + dirs[i]; int nextCol = col + dirs[i + 1]; - if (nextRow < 0 || nextRow >= matrix.length || nextCol < 0 || nextCol >= matrix[0].length || matrix[nextRow][nextCol] <= matrix[row][col]) { + if (nextRow < 0 + || nextRow >= matrix.length + || nextCol < 0 + || nextCol >= matrix[0].length + || matrix[nextRow][nextCol] <= matrix[row][col]) { continue; } int len = 1 + dfs(matrix, nextRow, nextCol, cache); @@ -37,5 +41,4 @@ int dfs(int[][] matrix, int row, int col, int[][] cache) { return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_33.java b/src/main/java/com/fishercoder/solutions/firstthousand/_33.java index 48ec6d6b1a..596798e13b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_33.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_33.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.firstthousand; -/** +/* * 33. Search in Rotated Sorted Array *

* There is an integer array nums sorted in ascending order (with distinct values). @@ -33,7 +33,7 @@ public class _33 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/search-in-rotated-sorted-array/editorial/ * Approach 3 says it very well. */ @@ -50,19 +50,20 @@ public int search(int[] nums, int target) { } if (nums[left] <= nums[mid]) { - //this is for this case: [4, 5, 6, 7, 0, 1, 2], target = 4 - //this means that the left sub-array is sorted + // this is for this case: [4, 5, 6, 7, 0, 1, 2], target = 4 + // this means that the left sub-array is sorted if (target >= nums[left] && target < nums[mid]) { - //in this case, if target exists, in must be in this left sorted sub-array + // in this case, if target exists, in must be in this left sorted sub-array right = mid - 1; } else { - //otherwise, it's in the other half - //e.g. this case: [4, 5, 6, 7, 0, 1, 2], target = 2 + // otherwise, it's in the other half + // e.g. this case: [4, 5, 6, 7, 0, 1, 2], target = 2 left = mid + 1; } } else { - //this is for this case: [8, 9, 2, 3, 4], target = 9 - //this means the right sub-array is sorted and the left sub-array is rotated at some pivot + // this is for this case: [8, 9, 2, 3, 4], target = 9 + // this means the right sub-array is sorted and the left sub-array is rotated at + // some pivot if (target > nums[mid] && target <= nums[right]) { left = mid + 1; } else { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_330.java b/src/main/java/com/fishercoder/solutions/firstthousand/_330.java index c755950586..6006d08e77 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_330.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_330.java @@ -6,7 +6,7 @@ public class _330 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/patching-array/ and https://discuss.leetcode.com/topic/35494/solution-explanation/2 *

* Let miss be the smallest sum in [0,n] that we might be missing. Meaning we already know we @@ -26,34 +26,33 @@ public static class Solution1 { */ public int minPatches(int[] nums, int n) { - long misses = 1;//use long to avoid integer addition overflow + long misses = 1; // use long to avoid integer addition overflow int patches = 0; int i = 0; while (misses <= n) { - if (i < nums.length && nums[i] <= misses) { //miss is covered + if (i < nums.length && nums[i] <= misses) { // miss is covered misses += nums[i++]; - } else { //patch miss to the array + } else { // patch miss to the array misses += misses; - patches++;//increase the answer + patches++; // increase the answer } } return patches; } public List findPatches(int[] nums, int n) { - long misses = 1;//use long to avoid integer addition overflow + long misses = 1; // use long to avoid integer addition overflow List patches = new ArrayList<>(); int i = 0; while (misses <= n) { - if (i < nums.length && nums[i] <= misses) { //miss is covered + if (i < nums.length && nums[i] <= misses) { // miss is covered misses += nums[i++]; - } else { //patch miss to the array - patches.add((int) misses);//increase the answer + } else { // patch miss to the array + patches.add((int) misses); // increase the answer misses += misses; } } return patches; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_331.java b/src/main/java/com/fishercoder/solutions/firstthousand/_331.java index 5ec74639f0..f97d83a085 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_331.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_331.java @@ -7,7 +7,7 @@ public class _331 { public static class Solution1 { public boolean isValidSerialization(String preorder) { - /**Idea: we keep inserting the string into the stack, if it's a number, we just push it onto the stack; + /*Idea: we keep inserting the string into the stack, if it's a number, we just push it onto the stack; * if it's a "#", we see if the top of the stack is a "#" or not, * 1. if it's a "#", we pop it and keep popping numbers from the stack, * 2. if it's not a "#", we push the "#" onto the stack*/ @@ -29,5 +29,4 @@ public boolean isValidSerialization(String preorder) { return stack.size() == 1 && stack.peekLast().equals("#"); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_332.java b/src/main/java/com/fishercoder/solutions/firstthousand/_332.java index 18c4284ceb..e3874890ec 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_332.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_332.java @@ -9,7 +9,7 @@ public class _332 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/36383/share-my-solution */ public List findItinerary(List> tickets) { @@ -23,8 +23,8 @@ public List findItinerary(List> tickets) { return path; } - public void dfs(String departure, Map> flights, - LinkedList path) { + public void dfs( + String departure, Map> flights, LinkedList path) { PriorityQueue arrivals = flights.get(departure); while (arrivals != null && !arrivals.isEmpty()) { dfs(arrivals.poll(), flights, path); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_333.java b/src/main/java/com/fishercoder/solutions/firstthousand/_333.java index 4268924c04..90d11f8632 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_333.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_333.java @@ -4,10 +4,11 @@ public class _333 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/36995/share-my-o-n-java-code-with-brief-explanation-and-comments */ - class Result { // (size, rangeLower, rangeUpper) -- size of current tree, range of current tree [rangeLower, rangeUpper] + class Result { // (size, rangeLower, rangeUpper) -- size of current tree, range of current + // tree [rangeLower, rangeUpper] int size; int lower; int upper; @@ -35,12 +36,16 @@ private Result traverse(TreeNode root) { } Result left = traverse(root.left); Result right = traverse(root.right); - if (left.size == -1 || right.size == -1 || root.val <= left.upper || root.val >= right.lower) { + if (left.size == -1 + || right.size == -1 + || root.val <= left.upper + || root.val >= right.lower) { return new Result(-1, 0, 0); } int size = left.size + 1 + right.size; max = Math.max(size, max); - return new Result(size, Math.min(left.lower, root.val), Math.max(right.upper, root.val)); + return new Result( + size, Math.min(left.lower, root.val), Math.max(right.upper, root.val)); } } @@ -91,5 +96,4 @@ boolean dfs(TreeNode root, long min, long max) { } return dfs(root.left, min, root.val) && dfs(root.right, root.val, max); } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_334.java b/src/main/java/com/fishercoder/solutions/firstthousand/_334.java index ac5aaff0da..b2f96cfd88 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_334.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_334.java @@ -2,7 +2,7 @@ public class _334 { public static class Solution1 { - /** + /* * Time: O(n^2) * Space: O(1) */ @@ -28,7 +28,7 @@ public boolean increasingTriplet(int[] nums) { } public static class Solution2 { - /** + /* * Time: O(n) * Space: O(1) * @@ -51,5 +51,4 @@ public boolean increasingTriplet(int[] nums) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_335.java b/src/main/java/com/fishercoder/solutions/firstthousand/_335.java index a05b027604..318e0410dc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_335.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_335.java @@ -2,7 +2,7 @@ public class _335 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/38014/java-oms-with-explanation/2 */ public boolean isSelfCrossing(int[] x) { @@ -13,7 +13,7 @@ public boolean isSelfCrossing(int[] x) { for (int i = 3; i < l; i++) { if (x[i] >= x[i - 2] && x[i - 1] <= x[i - 3]) { - return true; //Fourth line crosses first line and onward + return true; // Fourth line crosses first line and onward } if (i >= 4) { if (x[i - 1] == x[i - 3] && x[i] + x[i - 4] >= x[i - 2]) { @@ -25,7 +25,7 @@ public boolean isSelfCrossing(int[] x) { && x[i] >= x[i - 2] - x[i - 4] && x[i - 1] >= x[i - 3] - x[i - 5] && x[i - 1] <= x[i - 3]) { - return true; // Sixth line crosses first line and onward + return true; // Sixth line crosses first line and onward } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_336.java b/src/main/java/com/fishercoder/solutions/firstthousand/_336.java index 59e9094407..6a792d41e4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_336.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_336.java @@ -22,10 +22,14 @@ public List> palindromePairs(String[] words) { while (l <= r) { String s = words[i].substring(l, r); Integer j = map.get(new StringBuilder(s).reverse().toString()); - if (j != null && j != i && isPalindrome( - words[i].substring(l == 0 ? r : 0, l == 0 ? words[i].length() : l))) { + if (j != null + && j != i + && isPalindrome( + words[i].substring( + l == 0 ? r : 0, l == 0 ? words[i].length() : l))) { pairs.add( - Arrays.asList(l == 0 ? new Integer[]{i, j} : new Integer[]{j, i})); + Arrays.asList( + l == 0 ? new Integer[] {i, j} : new Integer[] {j, i})); } if (r < words[i].length()) { r++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_337.java b/src/main/java/com/fishercoder/solutions/firstthousand/_337.java index b70d1ff1f1..29d4fe666a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_337.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_337.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; public class _337 { public static class Solution1 { - //simple recursion without caching: 1189 ms + // simple recursion without caching: 1189 ms public int rob(TreeNode root) { if (root == null) { return 0; @@ -26,7 +25,7 @@ public int rob(TreeNode root) { } public static class Solution2 { - //same idea, but with caching via a hashmap: 8 ms + // same idea, but with caching via a hashmap: 8 ms public int rob(TreeNode root) { Map map = new HashMap<>(); return getMaxValue(root, map); @@ -47,11 +46,12 @@ private int getMaxValue(TreeNode root, Map map) { if (root.right != null) { val += getMaxValue(root.right.left, map) + getMaxValue(root.right.right, map); } - int max = Math.max(root.val + val, - getMaxValue(root.left, map) + getMaxValue(root.right, map)); + int max = + Math.max( + root.val + val, + getMaxValue(root.left, map) + getMaxValue(root.right, map)); map.put(root, max); return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_338.java b/src/main/java/com/fishercoder/solutions/firstthousand/_338.java index 2b6ed0556c..aa540153f3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_338.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_338.java @@ -2,7 +2,7 @@ public class _338 { public static class Solution1 { - //use the most regular method to get it AC'ed first + // use the most regular method to get it AC'ed first public int[] countBits(int num) { int[] ones = new int[num + 1]; for (int i = 0; i <= num; i++) { @@ -22,7 +22,7 @@ private int countOnes(int i) { } private class Solution2 { - /** + /* * lixx2100's post is cool:https://discuss.leetcode.com/topic/40162/three-line-java-solution * An easy recurrence for this problem is f[i] = f[i / 2] + i % 2 * and then we'll use bit manipulation to express the above recursion function diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_339.java b/src/main/java/com/fishercoder/solutions/firstthousand/_339.java index c945fdb77f..96eb673606 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_339.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_339.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.NestedInteger; - import java.util.List; public class _339 { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_34.java b/src/main/java/com/fishercoder/solutions/firstthousand/_34.java index 220008068a..0bf13ea76f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_34.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_34.java @@ -52,7 +52,7 @@ public int[] searchRange(int[] nums, int target) { public static class Solution2 { public int[] searchRange(int[] nums, int target) { - int[] result = new int[]{-1, -1}; + int[] result = new int[] {-1, -1}; if (nums == null || nums.length == 0) { return result; } @@ -87,13 +87,13 @@ public int[] searchRange(int[] nums, int target) { } public static class Solution3 { - /** + /* * My completely original solution on 1/15/2022. A great practice to solidify binary search basics. */ public int[] searchRange(int[] nums, int target) { int left = 0; int right = nums.length - 1; - int[] ans = new int[]{-1, -1}; + int[] ans = new int[] {-1, -1}; while (left < right) { int mid = left + (right - left) / 2; if (nums[mid] > target) { @@ -106,7 +106,12 @@ public int[] searchRange(int[] nums, int target) { ans[1] = mid; } } - if (left < nums.length && nums[left] != target && right > 0 && nums[right] != target && right + 1 < nums.length && nums[right + 1] != target) { + if (left < nums.length + && nums[left] != target + && right > 0 + && nums[right] != target + && right + 1 < nums.length + && nums[right + 1] != target) { return ans; } if (left < nums.length && nums[left] == target) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_340.java b/src/main/java/com/fishercoder/solutions/firstthousand/_340.java index e941ba8718..efb5f11dde 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_340.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_340.java @@ -6,7 +6,7 @@ public class _340 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/41671/15-lines-java-solution-using-slide-window */ public int lengthOfLongestSubstringKDistinct(String s, int k) { @@ -19,8 +19,7 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) { num++; } if (num > k) { - while (--count[s.charAt(left++)] > 0) { - } + while (--count[s.charAt(left++)] > 0) {} num--; } result = Math.max(result, right - left + 1); @@ -30,7 +29,7 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) { } public static class Solution2 { - /** + /* * This is a more generic solution for any characters, not limited to ASCII characters. */ public int lengthOfLongestSubstringKDistinct(String s, int k) { @@ -57,7 +56,7 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) { } public static class Solution3 { - /** + /* * My original solution on 10/20/2021, a very generic sliding window template. */ public int lengthOfLongestSubstringKDistinct(String s, int k) { @@ -86,5 +85,4 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) { return ans; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_341.java b/src/main/java/com/fishercoder/solutions/firstthousand/_341.java index f3dc545c73..7136735920 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_341.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_341.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.NestedInteger; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -40,5 +39,4 @@ public boolean hasNext() { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_342.java b/src/main/java/com/fishercoder/solutions/firstthousand/_342.java index 48383e9bea..844df59828 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_342.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_342.java @@ -2,12 +2,14 @@ public class _342 { public static class Solution1 { - //Just dive a little bit deeper, you can realize that another important feature of a number - //that is power of four is that its only single one bit must appear on the odd position, and power of two won't meet this requirement - //decimal number 8 has binary format: 0000-0000-0000-0000-0000-0000-0000-1000 - //decimal number 16 has binary format: 0000-0000-0000-0000-0000-0000-0001-0000 - //hex number 0x55555555 has binary format: 1010-1010-1010-1010-1010-1010-1010-1010 - //thus, doing AND with 0x55555 will check if the only one bit is located on the odd position, thus ruling out those that are power of 2 but not power of 4 + // Just dive a little bit deeper, you can realize that another important feature of a number + // that is power of four is that its only single one bit must appear on the odd position, + // and power of two won't meet this requirement + // decimal number 8 has binary format: 0000-0000-0000-0000-0000-0000-0000-1000 + // decimal number 16 has binary format: 0000-0000-0000-0000-0000-0000-0001-0000 + // hex number 0x55555555 has binary format: 1010-1010-1010-1010-1010-1010-1010-1010 + // thus, doing AND with 0x55555 will check if the only one bit is located on the odd + // position, thus ruling out those that are power of 2 but not power of 4 public boolean isPowerOfFour(int num) { return (num > 0 && 1073741824 % num == 0 && (num & 0x55555555) != 0); } @@ -15,15 +17,15 @@ public boolean isPowerOfFour(int num) { public static class Solution2 { public boolean isPowerOfFour(int num) { - //^ means to match the beginning of a line - //$ means to match the end of a line - //* means zero or more of the preceding character + // ^ means to match the beginning of a line + // $ means to match the end of a line + // * means zero or more of the preceding character return Integer.toString(num, 4).matches("^10*$"); } } public static class Solution3 { - //a regular loop method to make it AC'ed + // a regular loop method to make it AC'ed public boolean isPowerOfFour(int num) { if (num < 4 && num != 1) { return false; @@ -37,5 +39,4 @@ public boolean isPowerOfFour(int num) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_345.java b/src/main/java/com/fishercoder/solutions/firstthousand/_345.java index 219043858f..906c3956fa 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_345.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_345.java @@ -1,35 +1,36 @@ -package com.fishercoder.solutions.firstthousand; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class _345 { - public static class Solution1 { - public String reverseVowels(String s) { - StringBuilder sb = new StringBuilder(s); - Set vowels = new HashSet(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); - //use two pointers approach would be the fastest - int i = 0; - int j = s.length() - 1; - while (i < j) { - char left = s.charAt(i); - char right = s.charAt(j); - while (i < j && !vowels.contains(left)) { - i++; - left = s.charAt(i); - } - while (i < j && !vowels.contains(right)) { - j--; - right = s.charAt(j); - } - char temp = left; - sb.setCharAt(i, right); - sb.setCharAt(j, temp); - i++; - j--; - } - return sb.toString(); - } - } -} +package com.fishercoder.solutions.firstthousand; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +public class _345 { + public static class Solution1 { + public String reverseVowels(String s) { + StringBuilder sb = new StringBuilder(s); + Set vowels = + new HashSet(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); + // use two pointers approach would be the fastest + int i = 0; + int j = s.length() - 1; + while (i < j) { + char left = s.charAt(i); + char right = s.charAt(j); + while (i < j && !vowels.contains(left)) { + i++; + left = s.charAt(i); + } + while (i < j && !vowels.contains(right)) { + j--; + right = s.charAt(j); + } + char temp = left; + sb.setCharAt(i, right); + sb.setCharAt(j, temp); + i++; + j--; + } + return sb.toString(); + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_346.java b/src/main/java/com/fishercoder/solutions/firstthousand/_346.java index 584aff37eb..595f00d4a4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_346.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_346.java @@ -12,7 +12,7 @@ class MovingAverage { private Long sum; private int max; - /** + /* * Initialize your data structure here. */ public MovingAverage(int size) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_347.java b/src/main/java/com/fishercoder/solutions/firstthousand/_347.java index a3fecaab84..3253ac6563 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_347.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_347.java @@ -1,77 +1,80 @@ -package com.fishercoder.solutions.firstthousand; - -import java.util.*; -import java.util.Map.Entry; - -public class _347 { - - public static class Solution1 { - /** - * Bucket sort: - * Use buckets to hold numbers of the same frequency, some buckets might be empty while the rest might have more than one element. - * This editorial explains it well enough: https://leetcode.com/problems/top-k-frequent-elements/editorial/ starting from 08'55". - *

- * This is the most optimal solution. - * Time: O(n) - * Space: O(n) - */ - public int[] topKFrequent(int[] nums, int k) { - Map map = new HashMap(); - for (int num : nums) { - map.put(num, map.getOrDefault(num, 0) + 1); - } - //use nums.length + 1, so that we can directly use the frequency as the index for this array - //how this buckets look like is: buckets[1] holds numbers that have frequency one, buckets[2] holds numbers that have frequency two, etc. - //so, the numbers that have the highest frequencies are on the right-most side. - List[] bucket = new ArrayList[nums.length + 1]; - for (Entry entry : map.entrySet()) { - int freq = entry.getValue(); - if (bucket[freq] == null) { - bucket[freq] = new ArrayList(); - } - bucket[freq].add(entry.getKey()); - } - int[] result = new int[k]; - for (int i = bucket.length - 1, l = 0; i >= 0 && l < k; i--) { - if (bucket[i] != null) { - for (int j = 0; j < bucket[i].size(); j++) { - result[l++] = (int) bucket[i].get(j); - } - } - } - return result; - } - } - - public static class Solution2 { - /** - * Use hashtable and heap. - * Time: O(nlogn) - * Space: O(n) - */ - public int[] topKFrequent(int[] nums, int k) { - // construct the frequency map first, and then iterate through the map - // and put them into the heap, this is O(n) - Map map = new HashMap(); - for (int num : nums) { - map.put(num, map.getOrDefault(num, 0) + 1); - } - - // build heap, this is O(nlogn) - Queue> heap = new PriorityQueue<>((o1, o2) -> o2.getValue() - o1.getValue()); - for (Entry entry : map.entrySet()) { - heap.offer(entry); - } - - List result = new ArrayList(); - while (k-- > 0) { - result.add(heap.poll().getKey()); - } - int[] arr = new int[result.size()]; - for (int i = 0; i < arr.length; i++) { - arr[i] = result.get(i); - } - return arr; - } - } -} +package com.fishercoder.solutions.firstthousand; + +import java.util.*; +import java.util.Map.Entry; + +public class _347 { + + public static class Solution1 { + /* + * Bucket sort: + * Use buckets to hold numbers of the same frequency, some buckets might be empty while the rest might have more than one element. + * This editorial explains it well enough: https://leetcode.com/problems/top-k-frequent-elements/editorial/ starting from 08'55". + *

+ * This is the most optimal solution. + * Time: O(n) + * Space: O(n) + */ + public int[] topKFrequent(int[] nums, int k) { + Map map = new HashMap(); + for (int num : nums) { + map.put(num, map.getOrDefault(num, 0) + 1); + } + // use nums.length + 1, so that we can directly use the frequency as the index for this + // array + // how this buckets look like is: buckets[1] holds numbers that have frequency one, + // buckets[2] holds numbers that have frequency two, etc. + // so, the numbers that have the highest frequencies are on the right-most side. + List[] bucket = new ArrayList[nums.length + 1]; + for (Entry entry : map.entrySet()) { + int freq = entry.getValue(); + if (bucket[freq] == null) { + bucket[freq] = new ArrayList(); + } + bucket[freq].add(entry.getKey()); + } + int[] result = new int[k]; + for (int i = bucket.length - 1, l = 0; i >= 0 && l < k; i--) { + if (bucket[i] != null) { + for (int j = 0; j < bucket[i].size(); j++) { + result[l++] = (int) bucket[i].get(j); + } + } + } + return result; + } + } + + public static class Solution2 { + /* + * Use hashtable and heap. + * Time: O(nlogn) + * Space: O(n) + */ + public int[] topKFrequent(int[] nums, int k) { + // construct the frequency map first, and then iterate through the map + // and put them into the heap, this is O(n) + Map map = new HashMap(); + for (int num : nums) { + map.put(num, map.getOrDefault(num, 0) + 1); + } + + // build heap, this is O(nlogn) + Queue> heap = + new PriorityQueue<>((o1, o2) -> o2.getValue() - o1.getValue()); + for (Entry entry : map.entrySet()) { + heap.offer(entry); + } + + List result = new ArrayList(); + while (k-- > 0) { + result.add(heap.poll().getKey()); + } + int[] arr = new int[result.size()]; + for (int i = 0; i < arr.length; i++) { + arr[i] = result.get(i); + } + return arr; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_348.java b/src/main/java/com/fishercoder/solutions/firstthousand/_348.java index 6a4cc8ac51..dc348b2e78 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_348.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_348.java @@ -2,7 +2,7 @@ public class _348 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/44548/java-o-1-solution-easy-to-understand *

* Key: in order to win a TicTacToe, you must have the entire row or column, thus, we don't need @@ -14,7 +14,7 @@ public static class Solution1 { public static class TicTacToe { private int diagonal; - /** + /* * This is diagonal: * |X| | | * | |X| | @@ -24,7 +24,7 @@ public static class TicTacToe { */ private int antidiagonal; - /** + /* * This is antidiagonal: * | | |X| * | |X| | @@ -35,7 +35,7 @@ public static class TicTacToe { private int[] rows; private int[] cols; - /** + /* * Initialize your data structure here. */ public TicTacToe(int n) { @@ -43,7 +43,7 @@ public TicTacToe(int n) { cols = new int[n]; } - /** + /* * Player {player} makes a move at ({row}, {col}). * * @param row The row of the board. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_349.java b/src/main/java/com/fishercoder/solutions/firstthousand/_349.java index c77a48e82a..3c231f3def 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_349.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_349.java @@ -8,9 +8,9 @@ public class _349 { public static class Solution1 { - //credit: https://leetcode.com/articles/intersection-of-two-arrays/ - //Time: O(m+n) on average, O(m*n) in worse case - //Space: O(m+n) + // credit: https://leetcode.com/articles/intersection-of-two-arrays/ + // Time: O(m+n) on average, O(m*n) in worse case + // Space: O(m+n) public int[] intersection(int[] nums1, int[] nums2) { Set set1 = Arrays.stream(nums1).boxed().collect(Collectors.toSet()); Set set2 = Arrays.stream(nums2).boxed().collect(Collectors.toSet()); @@ -25,7 +25,7 @@ public int[] intersection(int[] nums1, int[] nums2) { } public static class Solution2 { - //Time: O(nlgn) + // Time: O(nlgn) public int[] intersection(int[] nums1, int[] nums2) { Arrays.sort(nums2); Set intersect = new HashSet(); @@ -60,8 +60,9 @@ private boolean binarySearch(int i, int[] nums) { } public static class Solution3 { - //use two pointers - //credit: https://leetcode.com/problems/intersection-of-two-arrays/discuss/81969/Three-Java-Solutions + // use two pointers + // credit: + // https://leetcode.com/problems/intersection-of-two-arrays/discuss/81969/Three-Java-Solutions public int[] intersection(int[] nums1, int[] nums2) { Arrays.sort(nums1); Arrays.sort(nums2); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_35.java b/src/main/java/com/fishercoder/solutions/firstthousand/_35.java index a2e2c0626c..c1571735ca 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_35.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_35.java @@ -19,5 +19,4 @@ public int searchInsert(int[] nums, int target) { return nums[left] >= target ? left : left + 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_350.java b/src/main/java/com/fishercoder/solutions/firstthousand/_350.java index 866ffc3216..963116cb5e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_350.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_350.java @@ -1,10 +1,10 @@ package com.fishercoder.solutions.firstthousand; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Arrays; public class _350 { public static class Solution1 { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_351.java b/src/main/java/com/fishercoder/solutions/firstthousand/_351.java index 7aecef52a5..5f2e31c99f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_351.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_351.java @@ -17,10 +17,14 @@ public int numberOfPatterns(int m, int n) { jumps[3][7] = jumps[7][3] = 5; visited = new boolean[10]; int count = 0; - count += dfs(1, 1, 0, m, n) - * 4;//1,3,7,9 are symmetric, so we only need to use 1 to do it once and then multiply the result by 4 - count += dfs(2, 1, 0, m, n) - * 4;//2,4,6,8 are symmetric, so we only need to use 1 to do it once and then multiply the result by 4 + count += + dfs(1, 1, 0, m, n) + * 4; // 1,3,7,9 are symmetric, so we only need to use 1 to do it once + // and then multiply the result by 4 + count += + dfs(2, 1, 0, m, n) + * 4; // 2,4,6,8 are symmetric, so we only need to use 1 to do it once + // and then multiply the result by 4 count += dfs(5, 1, 0, m, n); return count; } @@ -40,7 +44,7 @@ private int dfs(int num, int len, int count, int m, int n) { count = dfs(next, len, count, m, n); } } - visited[num] = false;//backtracking + visited[num] = false; // backtracking return count; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_352.java b/src/main/java/com/fishercoder/solutions/firstthousand/_352.java index 0c48646aa0..7af3e74ce9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_352.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_352.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Interval; - import java.util.ArrayList; import java.util.List; import java.util.TreeMap; @@ -11,12 +10,12 @@ public class _352 { public static class Solution1 { public static class SummaryRanges { - /** + /* * Use treemap, key is the start of the interval. */ TreeMap treeMap; - /** + /* * Initialize your data structure here. */ public SummaryRanges() { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_353.java b/src/main/java/com/fishercoder/solutions/firstthousand/_353.java index 8e9bcc02ea..cc3b8f5441 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_353.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_353.java @@ -7,15 +7,19 @@ public class _353 { public class SnakeGame { - private Set set;//Use a set to hold all occupied points for the snake body, this is for easy access for the case of eating its own body - private Deque body;//use a queue to hold all occupied points for the snake body as well, this is for easy access to update the tail + private Set + set; // Use a set to hold all occupied points for the snake body, this is for easy + // access for the case of eating its own body + private Deque + body; // use a queue to hold all occupied points for the snake body as well, this is + // for easy access to update the tail int[][] food; int score; int foodIndex; int width; int height; - /** + /* * Initialize your data structure here. * * @param width - screen width @@ -25,7 +29,7 @@ public class SnakeGame { */ public SnakeGame(int width, int height, int[][] food) { this.set = new HashSet(); - set.add(0);//initially at [0][0] + set.add(0); // initially at [0][0] this.body = new LinkedList(); body.offerLast(0); this.food = food; @@ -33,7 +37,7 @@ public SnakeGame(int width, int height, int[][] food) { this.height = height; } - /** + /* * Moves the snake. * * @param direction - 'U' = Up, 'L' = Left, 'R' = Right, 'D' = Down @@ -45,7 +49,7 @@ public int move(String direction) { return -1; } - //compute head + // compute head int rowHead = body.peekFirst() / width; int colHead = body.peekFirst() % width; switch (direction) { @@ -63,34 +67,40 @@ public int move(String direction) { } int newHead = rowHead * width + colHead; - set.remove(body.peekLast());//we'll remove the tail from set for now to see if it hits its tail - //if it hits the boundary - if (set.contains(newHead) || rowHead < 0 || colHead < 0 || rowHead >= height || colHead >= width) { + set.remove(body.peekLast()); // we'll remove the tail from set for now to see if it + // hits its tail + // if it hits the boundary + if (set.contains(newHead) + || rowHead < 0 + || colHead < 0 + || rowHead >= height + || colHead >= width) { return score = -1; } - //add head for the following two normal cases: + // add head for the following two normal cases: set.add(newHead); body.offerFirst(newHead); - //normal eat case: keep tail, add head - if (foodIndex < food.length && rowHead == food[foodIndex][0] && colHead == food[foodIndex][1]) { - set.add(body.peekLast());//old tail does not change, so add it back to set since we removed it earlier + // normal eat case: keep tail, add head + if (foodIndex < food.length + && rowHead == food[foodIndex][0] + && colHead == food[foodIndex][1]) { + set.add(body.peekLast()); // old tail does not change, so add it back to set + // since we removed it earlier foodIndex++; return ++score; } - - //normal move case without eating: move head and remove tail + // normal move case without eating: move head and remove tail body.pollLast(); return score; - } } -/** - * Your SnakeGame object will be instantiated and called as such: - * SnakeGame obj = new SnakeGame(width, height, food); - * int param_1 = obj.move(direction); - */ + /* + * Your SnakeGame object will be instantiated and called as such: + * SnakeGame obj = new SnakeGame(width, height, food); + * int param_1 = obj.move(direction); + */ } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_354.java b/src/main/java/com/fishercoder/solutions/firstthousand/_354.java index c00b87e008..351d67e8d1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_354.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_354.java @@ -4,21 +4,25 @@ public class _354 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/47469/java-nlogn-solution-with-explanation */ public int maxEnvelopes(int[][] envelopes) { - if (envelopes == null || envelopes.length == 0 || envelopes[0].length == 0 || envelopes[0].length != 2) { + if (envelopes == null + || envelopes.length == 0 + || envelopes[0].length == 0 + || envelopes[0].length != 2) { return 0; } - Arrays.sort(envelopes, (int[] a, int[] b) -> { + Arrays.sort( + envelopes, + (int[] a, int[] b) -> { if (a[0] == b[0]) { return b[1] - a[1]; } else { return a[0] - b[0]; } - } - ); + }); int[] dp = new int[envelopes.length]; int len = 0; for (int[] envelope : envelopes) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_355.java b/src/main/java/com/fishercoder/solutions/firstthousand/_355.java index 0b1f4f689d..a3b032e659 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_355.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_355.java @@ -11,7 +11,7 @@ public class _355 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/48100/java-oo-design-with-most-efficient-function-getnewsfeed */ public static class Twitter { @@ -24,7 +24,7 @@ class Tweet { public int id; public Tweet next; - /** + /* * have a pointer, * so we could be more memory efficient when retrieving tweets, * think about merging k sorted lists @@ -37,7 +37,7 @@ public Tweet(int id) { } } - /** + /* * the meat part of this OO design problem, * have a User object itself, * have follow() and unfollow() method embedded inside it @@ -50,7 +50,7 @@ class User { public User(int id) { this.id = id; followed = new HashSet<>(); - followed.add(id);//follow oneself first + followed.add(id); // follow oneself first this.tweetHead = null; } @@ -63,25 +63,25 @@ public void unfollow(int followeeId) { } public void postTweet(int tweetId) { - //every time we post, we prepend it to the head of the tweet + // every time we post, we prepend it to the head of the tweet Tweet head = new Tweet(tweetId); head.next = tweetHead; - tweetHead = head;//don't forget to overwrite tweetHead with the new head + tweetHead = head; // don't forget to overwrite tweetHead with the new head } } - /** + /* * Initialize your data structure here. */ public Twitter() { map = new HashMap(); } - /** + /* * Compose a new tweet. */ public void postTweet(int userId, int tweetId) { - /**update oneself newsFeed first and also all of his followers' newsFeed*/ + /*update oneself newsFeed first and also all of his followers' newsFeed*/ if (!map.containsKey(userId)) { User user = new User(userId); map.put(userId, user); @@ -89,7 +89,7 @@ public void postTweet(int userId, int tweetId) { map.get(userId).postTweet(tweetId); } - /** + /* * Retrieve the 10 most recent tweet ids in the user's news feed. Each item in the news feed must be posted by users who the user followed or by the user herself. Tweets must be ordered from most recent to least recent. */ public List getNewsFeed(int userId) { @@ -98,10 +98,11 @@ public List getNewsFeed(int userId) { return newsFeed; } Set users = map.get(userId).followed; - PriorityQueue heap = new PriorityQueue<>(users.size(), (a, b) -> b.time - a.time); + PriorityQueue heap = + new PriorityQueue<>(users.size(), (a, b) -> b.time - a.time); for (int user : users) { Tweet tweet = map.get(user).tweetHead; - //it's super important to check null before putting into the heap + // it's super important to check null before putting into the heap if (tweet != null) { heap.offer(tweet); } @@ -120,7 +121,7 @@ public List getNewsFeed(int userId) { return newsFeed; } - /** + /* * Follower follows a followee. If the operation is invalid, it should be a no-op. */ public void follow(int followerId, int followeeId) { @@ -137,7 +138,7 @@ public void follow(int followerId, int followeeId) { map.get(followerId).follow(followeeId); } - /** + /* * Follower unfollows a followee. If the operation is invalid, it should be a no-op. */ public void unfollow(int followerId, int followeeId) { @@ -146,7 +147,7 @@ public void unfollow(int followerId, int followeeId) { } map.get(followerId).unfollow(followeeId); } - /** + /* * Your Twitter object will be instantiated and called as such: * Twitter obj = new Twitter(); * obj.postTweet(userId,tweetId); @@ -188,7 +189,6 @@ public void follow(int followeeId) { public void unfollow(int followeeId) { followed.remove(followeeId); } - } private class Tweet { @@ -203,7 +203,7 @@ public Tweet(int id) { } } - /** + /* * Initialize your data structure here. */ public Twitter() { @@ -211,7 +211,7 @@ public Twitter() { timestamp = 0; } - /** + /* * Compose a new tweet. */ public void postTweet(int userId, int tweetId) { @@ -222,7 +222,7 @@ public void postTweet(int userId, int tweetId) { map.get(userId).postTweet(tweetId); } - /** + /* * Retrieve the 10 most recent tweet ids in the user's news feed. Each item in the news feed must be posted by users who the user followed or by the user herself. Tweets must be ordered from most recent to least recent. */ public List getNewsFeed(int userId) { @@ -254,7 +254,7 @@ public List getNewsFeed(int userId) { return result; } - /** + /* * Follower follows a followee. If the operation is invalid, it should be a no-op. */ public void follow(int followerId, int followeeId) { @@ -267,7 +267,7 @@ public void follow(int followerId, int followeeId) { map.get(followerId).follow(followeeId); } - /** + /* * Follower unfollows a followee. If the operation is invalid, it should be a no-op. */ public void unfollow(int followerId, int followeeId) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_356.java b/src/main/java/com/fishercoder/solutions/firstthousand/_356.java index e9e91f595c..400f57c9bf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_356.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_356.java @@ -5,7 +5,7 @@ public class _356 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/48172/simple-java-hashset-solution */ public boolean isReflected(int[][] points) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_357.java b/src/main/java/com/fishercoder/solutions/firstthousand/_357.java index 388b24ded3..beabbbc11d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_357.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_357.java @@ -3,7 +3,7 @@ public class _357 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/47983/java-dp-o-1-solution Following the hint. * Let f(n) = count of number with unique digits of length n. f(1) = 10. (0, 1, 2, 3, ...., 9) * f(2) = 9 * 9. Because for each number i from 1, ..., 9, we can pick j to form a 2-digit @@ -31,5 +31,4 @@ public int countNumbersWithUniqueDigits(int n) { return res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_358.java b/src/main/java/com/fishercoder/solutions/firstthousand/_358.java index 3f8637c642..e7dfc22107 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_358.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_358.java @@ -28,7 +28,7 @@ public String rearrangeString(String s, int k) { entry.setValue(entry.getValue() - 1); waitQueue.offer(entry); if (waitQueue.size() < k) { - continue; //there's only k-1 chars in the waitHeap, not full yet + continue; // there's only k-1 chars in the waitHeap, not full yet } Map.Entry front = waitQueue.poll(); if (front.getValue() > 0) { @@ -39,5 +39,4 @@ public String rearrangeString(String s, int k) { return stringBuilder.length() == s.length() ? stringBuilder.toString() : ""; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_360.java b/src/main/java/com/fishercoder/solutions/firstthousand/_360.java index 1ade530e19..dd5400eab2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_360.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_360.java @@ -5,8 +5,9 @@ public class _360 { public static class Solution1 { - //credit: https://discuss.leetcode.com/topic/48424/java-o-n-incredibly-short-yet-easy-to-understand-ac-solution - //in sum, only two cases: when a >= 0 or when a < 0, this simplifies logic + // credit: + // https://discuss.leetcode.com/topic/48424/java-o-n-incredibly-short-yet-easy-to-understand-ac-solution + // in sum, only two cases: when a >= 0 or when a < 0, this simplifies logic public int[] sortTransformedArray(int[] nums, int a, int b, int c) { int n = nums.length; int[] sorted = new int[n]; @@ -16,12 +17,14 @@ public int[] sortTransformedArray(int[] nums, int a, int b, int c) { while (i <= j) { if (a >= 0) { sorted[index--] = - function(nums[i], a, b, c) >= function(nums[j], a, b, c) ? function( - nums[i++], a, b, c) : function(nums[j--], a, b, c); + function(nums[i], a, b, c) >= function(nums[j], a, b, c) + ? function(nums[i++], a, b, c) + : function(nums[j--], a, b, c); } else { sorted[index++] = - function(nums[i], a, b, c) >= function(nums[j], a, b, c) ? function( - nums[j--], a, b, c) : function(nums[i++], a, b, c); + function(nums[i], a, b, c) >= function(nums[j], a, b, c) + ? function(nums[j--], a, b, c) + : function(nums[i++], a, b, c); } } return sorted; @@ -46,5 +49,4 @@ private int function(int num, int a, int b, int c) { return a * (num * num) + b * num + c; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_361.java b/src/main/java/com/fishercoder/solutions/firstthousand/_361.java index b032fae2a3..8486415d5d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_361.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_361.java @@ -18,7 +18,7 @@ public int maxKilledEnemies(char[][] grid) { if (grid[i][j] == '0') { int count = 0; - //count all possible hits in its upward direction + // count all possible hits in its upward direction for (int k = j - 1; k >= 0; k--) { if (grid[i][k] == 'E') { count++; @@ -27,7 +27,7 @@ public int maxKilledEnemies(char[][] grid) { } } - //count all possible hits in its downward direction + // count all possible hits in its downward direction for (int k = j + 1; k < n; k++) { if (grid[i][k] == 'E') { count++; @@ -36,7 +36,7 @@ public int maxKilledEnemies(char[][] grid) { } } - //count all possible hits in its right direction + // count all possible hits in its right direction for (int k = i + 1; k < m; k++) { if (grid[k][j] == 'E') { count++; @@ -45,7 +45,7 @@ public int maxKilledEnemies(char[][] grid) { } } - //count all possible hits in its left direction + // count all possible hits in its left direction for (int k = i - 1; k >= 0; k--) { if (grid[k][j] == 'E') { count++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_362.java b/src/main/java/com/fishercoder/solutions/firstthousand/_362.java index cdf44daf50..21655e4e18 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_362.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_362.java @@ -4,7 +4,7 @@ public class _362 { public static class Solution1 { public static class HitCounter { - /** + /* * Reference: https://discuss.leetcode.com/topic/48758/super-easy-design-o-1-hit-o-s-gethits-no-fancy-data-structure-is-needed, * I added one more field k to make it more generic. * It basically maintains a window of size 300, use modular to update the index. @@ -40,4 +40,4 @@ public int getHits(int timestamp) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_363.java b/src/main/java/com/fishercoder/solutions/firstthousand/_363.java index c86d4d5f3e..19c96723cf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_363.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_363.java @@ -4,7 +4,7 @@ public class _363 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/48854/java-binary-search-solution-time-complexity-min-m-n-2-max-m-n-log-max-m-n */ public int maxSumSubmatrix(int[][] matrix, int k) { @@ -15,7 +15,7 @@ public int maxSumSubmatrix(int[][] matrix, int k) { int col = matrix[0].length; int m = Math.min(row, col); int n = Math.max(row, col); - //indicating sum up in every row or every column + // indicating sum up in every row or every column boolean colIsBig = col > row; int res = Integer.MIN_VALUE; for (int i = 0; i < m; i++) { @@ -25,11 +25,11 @@ public int maxSumSubmatrix(int[][] matrix, int k) { int val = 0; TreeSet set = new TreeSet<>(); set.add(0); - //traverse every column/row and sum up + // traverse every column/row and sum up for (int p = 0; p < n; p++) { array[p] = array[p] + (colIsBig ? matrix[j][p] : matrix[p][j]); val = val + array[p]; - //use TreeMap to binary search previous sum to get possible result + // use TreeMap to binary search previous sum to get possible result Integer subres = set.ceiling(val - k); if (null != subres) { res = Math.max(res, val - subres); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_364.java b/src/main/java/com/fishercoder/solutions/firstthousand/_364.java index d42a355006..3e93854efb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_364.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_364.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.NestedInteger; - import java.util.LinkedList; import java.util.List; import java.util.Queue; @@ -37,5 +36,4 @@ public int depthSumInverse(List nestedList) { return total; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_366.java b/src/main/java/com/fishercoder/solutions/firstthousand/_366.java index 17bbe1ea77..778b8d1d05 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_366.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_366.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_368.java b/src/main/java/com/fishercoder/solutions/firstthousand/_368.java index de34cd7e8a..8807cf16ae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_368.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_368.java @@ -7,7 +7,7 @@ public class _368 { public static class Solution1 { - /** + /* * DP solution, credit: https://leetcode.com/problems/largest-divisible-subset/solution/ Solution 1 */ public List largestDivisibleSubset(int[] nums) { @@ -42,7 +42,7 @@ public List largestDivisibleSubset(int[] nums) { } public static class Solution2 { - /** + /* * Credit: https://discuss.leetcode.com/topic/49652/classic-dp-solution-similar-to-lis-o-n-2 */ public List largestDivisibleSubset(int[] nums) { @@ -76,5 +76,4 @@ public List largestDivisibleSubset(int[] nums) { return res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_369.java b/src/main/java/com/fishercoder/solutions/firstthousand/_369.java index 51b38672d1..7b472fb55d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_369.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_369.java @@ -6,7 +6,8 @@ public class _369 { public static class Solution1 { public ListNode plusOne(ListNode head) { - //get the length of the list and take out the value of each node and store them into an array + // get the length of the list and take out the value of each node and store them into an + // array ListNode temp = head; int len = 0; while (temp != null) { @@ -22,7 +23,7 @@ public ListNode plusOne(ListNode head) { temp = temp.next; } - //plus one into this array: nums + // plus one into this array: nums for (int i = len - 1; i >= 0; i--) { if (nums[i] != 9) { nums[i]++; @@ -32,10 +33,12 @@ public ListNode plusOne(ListNode head) { } } - //still assuming the first value in the list should not be zero as it's representing a valid number, although it's in a list + // still assuming the first value in the list should not be zero as it's representing a + // valid number, although it's in a list ListNode pre = new ListNode(-1); if (nums[0] == 0) { - //in this case, let's just construct a new linked list and return: only first node value is 1, all the rest is 0 + // in this case, let's just construct a new linked list and return: only first node + // value is 1, all the rest is 0 ListNode newHead = new ListNode(1); ListNode result = newHead; int count = 0; @@ -83,5 +86,4 @@ public ListNode plusOne(ListNode head) { return dummyNode.val != 0 ? dummyNode : dummyNode.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_37.java b/src/main/java/com/fishercoder/solutions/firstthousand/_37.java index 9c5dc4d028..8eaeb80caa 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_37.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_37.java @@ -15,14 +15,14 @@ private boolean solve(char[][] board) { for (int j = 0; j < board[0].length; j++) { if (board[i][j] == '.') { for (char c = '1'; c <= '9'; c++) { - //try 1 to 9 + // try 1 to 9 if (isValid(board, i, j, c)) { board[i][j] = c; if (solve(board)) { return true; } else { - board[i][j] = '.';//recover it to be '.' + board[i][j] = '.'; // recover it to be '.' } } } @@ -36,17 +36,17 @@ private boolean solve(char[][] board) { private boolean isValid(char[][] board, int row, int col, char c) { for (int i = 0; i < 9; i++) { if (board[i][col] != '.' && board[i][col] == c) { - return false;//check row + return false; // check row } if (board[row][i] != '.' && board[row][i] == c) { - return false;//check column + return false; // check column } - if (board[3 * (row / 3) + i / 3][3 * (col / 3) + i % 3] != '.' && board[3 * (row / 3) + i / 3][3 * (col / 3) + i % 3] == c) { - return false; //check 3*3 block + if (board[3 * (row / 3) + i / 3][3 * (col / 3) + i % 3] != '.' + && board[3 * (row / 3) + i / 3][3 * (col / 3) + i % 3] == c) { + return false; // check 3*3 block } } return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_371.java b/src/main/java/com/fishercoder/solutions/firstthousand/_371.java index 0a0c313ff5..6e2ce1600a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_371.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_371.java @@ -3,7 +3,7 @@ public class _371 { public static class Solution1 { - /** + /* * reference: http://stackoverflow.com/questions/9070937/adding-two-numbers-without-operator-clarification */ public int getSum(int a, int b) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_373.java b/src/main/java/com/fishercoder/solutions/firstthousand/_373.java index 2a1912c2c6..b55fbe297f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_373.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_373.java @@ -23,11 +23,13 @@ public List> kSmallestPairs(int[] nums1, int[] nums2, int k) { boolean[][] visited = new boolean[nums1.length][nums2.length]; // Min Heap - PriorityQueue pq = new PriorityQueue<>((a, b) -> { - return (a[0] + a[1]) - (b[0] + b[1]); - }); + PriorityQueue pq = + new PriorityQueue<>( + (a, b) -> { + return (a[0] + a[1]) - (b[0] + b[1]); + }); - int[] temp = new int[]{nums1[0], nums2[0], 0, 0}; + int[] temp = new int[] {nums1[0], nums2[0], 0, 0}; pq.add(temp); visited[0][0] = true; @@ -47,8 +49,12 @@ public List> kSmallestPairs(int[] nums1, int[] nums2, int k) { for (int[] dir : dirs) { int dx = i + dir[0]; int dy = j + dir[1]; - if (dx >= 0 && dx < nums1.length && dy >= 0 && dy < nums2.length && !visited[dx][dy]) { - pq.add(new int[]{nums1[dx], nums2[dy], dx, dy}); + if (dx >= 0 + && dx < nums1.length + && dy >= 0 + && dy < nums2.length + && !visited[dx][dy]) { + pq.add(new int[] {nums1[dx], nums2[dy], dx, dy}); visited[dx][dy] = true; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_374.java b/src/main/java/com/fishercoder/solutions/firstthousand/_374.java index 912bcd402f..145a33428f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_374.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_374.java @@ -2,7 +2,7 @@ public class _374 { public static class Solution1 { - /** + /* * The core problem/trouble to solve this problem is to figure out the problem description: this * API: guess(int num) means to take your guess num and let you know if your guessed num is * bigger or smaller than the answer. That's why if num > target, it returns -1 which means the @@ -26,7 +26,7 @@ public int guessNumber(int n) { return guess(left) == 0 ? left : right; } - /** + /* * This is a fake guess method that I wrote just to make the compiler happy, * 7 is just a completely random value. */ @@ -40,5 +40,4 @@ private int guess(int num) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_375.java b/src/main/java/com/fishercoder/solutions/firstthousand/_375.java index f14ee6a7f5..8cf66b388b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_375.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_375.java @@ -35,7 +35,13 @@ public int getMoneyAmount(int n) { int j = i + x; dp[i][j] = Integer.MAX_VALUE; for (int k = i; k <= j; k++) { - dp[i][j] = Math.min(dp[i][j], k + Math.max(k - 1 >= i ? dp[i][k - 1] : 0, j >= k + 1 ? dp[k + 1][j] : 0)); + dp[i][j] = + Math.min( + dp[i][j], + k + + Math.max( + k - 1 >= i ? dp[i][k - 1] : 0, + j >= k + 1 ? dp[k + 1][j] : 0)); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_376.java b/src/main/java/com/fishercoder/solutions/firstthousand/_376.java index a7bfec631a..f93fa4ad0f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_376.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_376.java @@ -3,7 +3,7 @@ public class _376 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/wiggle-subsequence/discuss/84843/Easy-understanding-DP-solution-with-O(n)-Java-version *

* For every position in the array, there are only three possible statuses for it. @@ -47,7 +47,7 @@ public int wiggleMaxLength(int[] nums) { int count = (prevDiff != 0) ? 2 : 1; for (int i = 2; i < nums.length; i++) { int diff = nums[i] - nums[i - 1]; - /**ATTN: prevDiff could be zero. e.g. [3,3,3,2,5] + /*ATTN: prevDiff could be zero. e.g. [3,3,3,2,5] * but diff needs to be exactly greater than zero*/ if ((prevDiff <= 0 && diff > 0) || (prevDiff >= 0) && diff < 0) { count++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_377.java b/src/main/java/com/fishercoder/solutions/firstthousand/_377.java index eb2f6fb112..868b724c9e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_377.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_377.java @@ -9,7 +9,7 @@ public class _377 { public static class Solution1 { - /** + /* * this normal backtracking recursive solution will end up in MLE by this testcase: [4,2,1], 32 */ public int combinationSum4(int[] nums, int target) { @@ -19,8 +19,8 @@ public int combinationSum4(int[] nums, int target) { return result.size(); } - private void backtracking(int[] nums, int target, List list, - List> result) { + private void backtracking( + int[] nums, int target, List list, List> result) { if (target == 0) { result.add(new ArrayList(list)); } else if (target > 0) { @@ -34,7 +34,7 @@ private void backtracking(int[] nums, int target, List list, } public static class Solution2 { - /** + /* * Since we don't need to get all of the combinations, instead, * we only need to get the possible count, I can use only a count instead of "List> result" * However, it also ended up in TLE by this testcase: [1,2,3], 32 @@ -61,7 +61,7 @@ private void backtracking(int[] nums, int target, List list) { } public static class Solution3 { - /** + /* * Time: O(n^2) * Space: O(n) *

@@ -95,7 +95,7 @@ public int combinationSum4(int[] nums, int target) { } public static class Solution4 { - /** + /* * Time: O(n) * Space: O(n) *

diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_378.java b/src/main/java/com/fishercoder/solutions/firstthousand/_378.java index 4d2bd873d0..03191f2373 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_378.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_378.java @@ -7,7 +7,7 @@ public class _378 { public static class Solution1 { - /** + /* * brute force made it AC'ed, extreme test case needed for OJ */ public int kthSmallest(int[][] matrix, int k) { @@ -23,21 +23,20 @@ public int kthSmallest(int[][] matrix, int k) { } } - public static class Solution2 { - /** + /* * use heap data structure */ public int kthSmallest(int[][] matrix, int k) { PriorityQueue heap = new PriorityQueue<>((a, b) -> Integer.compare(a[0], b[0])); for (int i = 0; i < Math.min(matrix.length, k); i++) { - //we store value, rowIndex, colIndex as an array into this heap - heap.offer(new int[]{matrix[i][0], i, 0}); + // we store value, rowIndex, colIndex as an array into this heap + heap.offer(new int[] {matrix[i][0], i, 0}); } while (k-- > 1) { int[] min = heap.poll(); if (min[2] + 1 < matrix[min[1]].length) { - heap.offer(new int[]{matrix[min[1]][min[2] + 1], min[1], min[2] + 1}); + heap.offer(new int[] {matrix[min[1]][min[2] + 1], min[1], min[2] + 1}); } } return heap.poll()[0]; @@ -45,7 +44,7 @@ public int kthSmallest(int[][] matrix, int k) { } public static class Solution3 { - /** + /* * Binary Search : The idea is to pick a mid number, then compare it with the elements in each row, we start form * end of row util we find the element is less than the mid, the left side element is all less than mid; keep tracking elements * that less than mid and compare with k, then update the k. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_379.java b/src/main/java/com/fishercoder/solutions/firstthousand/_379.java index f81775c70f..1ee4fbf714 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_379.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_379.java @@ -12,7 +12,7 @@ private class PhoneDirectory { private Queue phoneDir; private Set used; - /** + /* * Initialize your data structure here * * @param maxNumbers - The maximum numbers that can be stored in the phone directory. @@ -26,7 +26,7 @@ public PhoneDirectory(int maxNumbers) { used = new HashSet(); } - /** + /* * Provide a number which is not assigned to anyone. * * @return - Return an available number. Return -1 if none is available. @@ -40,14 +40,14 @@ public int get() { return newNumber; } - /** + /* * Check if a number is available or not. */ public boolean check(int number) { return !used.contains(number); } - /** + /* * Recycle or release a number. */ public void release(int number) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_38.java b/src/main/java/com/fishercoder/solutions/firstthousand/_38.java index 998ad4e340..b5b38923ed 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_38.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_38.java @@ -27,5 +27,4 @@ public String countAndSay(int n) { return curr.toString(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_380.java b/src/main/java/com/fishercoder/solutions/firstthousand/_380.java index 9a9ffef69d..307273fdf3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_380.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_380.java @@ -1,15 +1,15 @@ package com.fishercoder.solutions.firstthousand; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.ArrayList; import java.util.Map; import java.util.Random; public class _380 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/insert-delete-getrandom-o1/discuss/85401/Java-solution-using-a-HashMap-and-an-ArrayList-along-with-a-follow-up.-(131-ms) * 1. use an arraylist and a hashmap; * 2. you always insert at the end of the arraylist and put the index/position of this new item into the map; @@ -41,10 +41,13 @@ public boolean remove(int val) { } else { int removeIndex = map.get(val); if (removeIndex != list.size() - 1) { - //if it's not the last element, then we need to swap it with the last element so that this operation is also O(1) + // if it's not the last element, then we need to swap it with the last + // element so that this operation is also O(1) int lastElement = list.get(list.size() - 1); // using set() API is another key here which gives us O(1), - // using add() is not only wrong, i.e. it adds an element at this position and shifts all elements on the right of this element to the right, so leading to O(n) time + // using add() is not only wrong, i.e. it adds an element at this position + // and shifts all elements on the right of this element to the right, so + // leading to O(n) time list.set(removeIndex, lastElement); map.put(lastElement, removeIndex); } @@ -59,5 +62,4 @@ public int getRandom() { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_381.java b/src/main/java/com/fishercoder/solutions/firstthousand/_381.java index 18824a76c8..f97b0aeada 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_381.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_381.java @@ -10,7 +10,7 @@ public class _381 { public static class Solution1 { - /** + /* * This is a natural extension to the solution from https://leetcode.com/problems/insert-delete-getrandom-o1 * You only need to change the value type of the hashmap to be a set instead of Integer to hold all indexes for this value ever inserted. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_382.java b/src/main/java/com/fishercoder/solutions/firstthousand/_382.java index f6772718f1..cf05f98660 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_382.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_382.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.HashMap; import java.util.Map; import java.util.Random; @@ -12,7 +11,7 @@ public static class Solution { private Map map; private Random rand; - /** + /* * @param head The linked list's head. Note that the head is guanranteed to be not null, so it contains at least one node. */ public Solution(ListNode head) { @@ -25,7 +24,7 @@ public Solution(ListNode head) { } } - /** + /* * Returns a random node's value. */ public int getRandom() { @@ -33,4 +32,3 @@ public int getRandom() { } } } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_383.java b/src/main/java/com/fishercoder/solutions/firstthousand/_383.java index ff017a388d..242f64872a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_383.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_383.java @@ -20,5 +20,4 @@ public boolean canConstruct(String ransomNote, String magazine) { return true; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_384.java b/src/main/java/com/fishercoder/solutions/firstthousand/_384.java index c504a630da..6ea0748551 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_384.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_384.java @@ -9,8 +9,9 @@ public class _384 { public static class Solution1 { - //Note as of 7/20/2021: This solution ends in TLE on LeetCode now. - //Note: the problem states that this is a set without duplicates which makes building all combinations easier + // Note as of 7/20/2021: This solution ends in TLE on LeetCode now. + // Note: the problem states that this is a set without duplicates which makes building all + // combinations easier private List> combinations; private int[] original; @@ -22,8 +23,9 @@ public Solution1(int[] nums) { combinations = buildAllComb(nums); } - //insert next value into all possible positions, I wrote this method myself, of course it could be simplified to not use a queue - //but it just naturally came into my mind that I used a queue + // insert next value into all possible positions, I wrote this method myself, of course it + // could be simplified to not use a queue + // but it just naturally came into my mind that I used a queue private List> buildAllComb(int[] nums) { List> result = new ArrayList(); if (nums == null || nums.length == 0) { @@ -51,14 +53,14 @@ private List> buildAllComb(int[] nums) { return result; } - /** + /* * Resets the array to its original configuration and return it. */ public int[] reset() { return original; } - /** + /* * Returns a random shuffling of the array. */ public int[] shuffle() { @@ -76,7 +78,7 @@ public int[] shuffle() { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/shuffle-an-array/discuss/85958/First-Accepted-Solution-Java */ private int[] nums; @@ -87,14 +89,14 @@ public Solution2(int[] nums) { this.random = new Random(); } - /** + /* * Resets the array to its original configuration and return it. */ public int[] reset() { return this.nums; } - /** + /* * Returns a random shuffling of the array. */ public int[] shuffle() { @@ -113,4 +115,3 @@ private void swap(int[] shuffled, int i, int j) { } } } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_385.java b/src/main/java/com/fishercoder/solutions/firstthousand/_385.java index 2873d5089c..f89d71fe28 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_385.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_385.java @@ -1,20 +1,22 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.NestedInteger; - import java.util.Stack; public class _385 { public static class Solution1 { - //Lessons: ask the interviewer to clarify the input, for this question, the input could be "324", "[324]", they are different - //the former should return a nested integer with one single integer, the latter should return a nested integer with a list + // Lessons: ask the interviewer to clarify the input, for this question, the input could be + // "324", "[324]", they are different + // the former should return a nested integer with one single integer, the latter should + // return a nested integer with a list - //Idea: - //if it's '[', we just construct a new nested integer and push it onto the stack - //if it's a number, we parse the whole number and add to the previous nested integer object - //if it's ',', we'll just continue; - //if it's ']', we'll just pop one nested integer from the working stack and assign it to the result + // Idea: + // if it's '[', we just construct a new nested integer and push it onto the stack + // if it's a number, we parse the whole number and add to the previous nested integer object + // if it's ',', we'll just continue; + // if it's ']', we'll just pop one nested integer from the working stack and assign it to + // the result public NestedInteger deserialize(String s) { if (s == null || s.isEmpty() || s.length() == 0) { @@ -24,18 +26,21 @@ public NestedInteger deserialize(String s) { NestedInteger result = null; StringBuilder sb = new StringBuilder(); int i = 0; - //if it's just a single number, then we'll just return a nested integer with one integer + // if it's just a single number, then we'll just return a nested integer with one + // integer if (s.charAt(i) != '[') { sb.setLength(0); - while (i < s.length() && ((Character.getNumericValue(s.charAt(i)) < 10 - && Character.getNumericValue(s.charAt(i)) >= 0) || s.charAt(i) == '-')) { + while (i < s.length() + && ((Character.getNumericValue(s.charAt(i)) < 10 + && Character.getNumericValue(s.charAt(i)) >= 0) + || s.charAt(i) == '-')) { sb.append(s.charAt(i)); i++; } int num = Integer.parseInt(sb.toString()); return new NestedInteger(num); } else { - //all other cases, we'll return a nested integer with a list + // all other cases, we'll return a nested integer with a list while (i < s.length()) { if (s.charAt(i) == '[') { NestedInteger ni = new NestedInteger(); @@ -43,7 +48,7 @@ public NestedInteger deserialize(String s) { if (!workStack.isEmpty()) { NestedInteger lastNi = workStack.pop(); lastNi.add(ni); - workStack.push(lastNi);// then push it back + workStack.push(lastNi); // then push it back } workStack.push(ni); i++; @@ -57,8 +62,9 @@ public NestedInteger deserialize(String s) { // then it must be a number sb.setLength(0); while (i < s.length() - && ((Character.getNumericValue(s.charAt(i)) < 10 && Character - .getNumericValue(s.charAt(i)) >= 0) || s.charAt(i) == '-')) { + && ((Character.getNumericValue(s.charAt(i)) < 10 + && Character.getNumericValue(s.charAt(i)) >= 0) + || s.charAt(i) == '-')) { sb.append(s.charAt(i)); i++; } @@ -87,7 +93,8 @@ public NestedInteger deserialize(String s) { } workStack.push(ni); if (i == s.length()) { - return ni;// this is for test cases like this: "324", there's no '[' or ']' + return ni; // this is for test cases like this: "324", there's no '[' or + // ']' } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_386.java b/src/main/java/com/fishercoder/solutions/firstthousand/_386.java index 601b4981c4..2a39fb174e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_386.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_386.java @@ -5,9 +5,10 @@ public class _386 { public static class Solution1 { - //Radix sort doesn't apply here! Don't confuse yourself! + // Radix sort doesn't apply here! Don't confuse yourself! - //rewrote their solution from Python to Java:https://discuss.leetcode.com/topic/54986/python-memory-limit-exceeded-for-problem-386/17 + // rewrote their solution from Python to + // Java:https://discuss.leetcode.com/topic/54986/python-memory-limit-exceeded-for-problem-386/17 public List lexicalOrder(int n) { List result = new ArrayList(); int i = 1; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_388.java b/src/main/java/com/fishercoder/solutions/firstthousand/_388.java index 83ac689a3f..4f13b0c000 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_388.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_388.java @@ -17,8 +17,10 @@ public int lengthLongestPath(String input) { while (i < input.length()) { currLevel = nextLevel; int currStrLen = 0; - while (i < input.length() && (Character.isLetterOrDigit(input.charAt(i)) - || period.equals(input.charAt(i)) || space.equals(input.charAt(i)))) { + while (i < input.length() + && (Character.isLetterOrDigit(input.charAt(i)) + || period.equals(input.charAt(i)) + || space.equals(input.charAt(i)))) { if (period.equals(input.charAt(i))) { isFile = true; } @@ -33,7 +35,7 @@ public int lengthLongestPath(String input) { } nextLevel = 0; - i = i + 1;//increment one to let it pass "\n" and start from "\t" + i = i + 1; // increment one to let it pass "\n" and start from "\t" while (i < input.length() - 1 && input.substring(i, i + 1).equals("\t")) { nextLevel++; i = i + 1; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_39.java b/src/main/java/com/fishercoder/solutions/firstthousand/_39.java index d8e0addd96..c203a41c2d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_39.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_39.java @@ -14,11 +14,16 @@ public List> combinationSum(int[] candidates, int target) { return result; } - void backtracking(int[] candidates, int target, int start, List curr, List> result) { + void backtracking( + int[] candidates, + int target, + int start, + List curr, + List> result) { if (target > 0) { for (int i = start; i < candidates.length; i++) { if (candidates[i] > target) { - break;//pruning + break; // pruning } curr.add(candidates[i]); backtracking(candidates, target - candidates[i], i, curr, result); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_390.java b/src/main/java/com/fishercoder/solutions/firstthousand/_390.java index 0fd2231bef..092c653703 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_390.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_390.java @@ -3,7 +3,7 @@ public class _390 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/55870/share-my-solutions-for-contest-2 instead of * literally removing half of the elements in each scan, this solution is just moving the * pointer to point to next start position So brilliant! diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_391.java b/src/main/java/com/fishercoder/solutions/firstthousand/_391.java index d836ddb852..e70d696201 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_391.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_391.java @@ -5,7 +5,7 @@ public class _391 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/56052/really-easy-understanding-solution-o-n-java */ public boolean isRectangleCover(int[][] rectangles) { @@ -48,8 +48,11 @@ public boolean isRectangleCover(int[][] rectangles) { } } - if (!set.contains(x1 + " " + y1) || !set.contains(x1 + " " + y2) || !set.contains( - x2 + " " + y1) || !set.contains(x2 + " " + y2) || set.size() != 4) { + if (!set.contains(x1 + " " + y1) + || !set.contains(x1 + " " + y2) + || !set.contains(x2 + " " + y1) + || !set.contains(x2 + " " + y2) + || set.size() != 4) { return false; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_393.java b/src/main/java/com/fishercoder/solutions/firstthousand/_393.java index fcb0762743..e3932ae76a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_393.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_393.java @@ -3,7 +3,7 @@ public class _393 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/58338/bit-manipulation-java-6ms/4 */ public boolean validUtf8(int[] data) { @@ -30,5 +30,4 @@ public boolean validUtf8(int[] data) { return count == 0; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_395.java b/src/main/java/com/fishercoder/solutions/firstthousand/_395.java index c6f49b6bf9..c4496c045a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_395.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_395.java @@ -2,7 +2,7 @@ public class _395 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/57372/java-divide-and-conquer-recursion-solution */ public int longestSubstring(String s, int k) { @@ -10,7 +10,7 @@ public int longestSubstring(String s, int k) { } int findLongestSubstring(char[] chars, int start, int end, int k) { - /**Base case 1 of 2*/ + /*Base case 1 of 2*/ if (end - start < k) { return 0; } @@ -20,7 +20,7 @@ int findLongestSubstring(char[] chars, int start, int end, int k) { count[index]++; } - /**For every character in the above frequency table*/ + /*For every character in the above frequency table*/ for (int i = 0; i < 26; i++) { if (count[i] < k && count[i] > 0) { for (int j = start; j < end; j++) { @@ -32,14 +32,14 @@ int findLongestSubstring(char[] chars, int start, int end, int k) { } } } - /**Base case 2 of 2: + /*Base case 2 of 2: * when any characters in this substring has repeated at least k times, then this entire substring is a valid answer*/ return end - start; } } public static class Solution2 { - /** + /* * classic sliding window approach. * credit: https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/170010/Java-O(n)-Solution-with-Detailed-Explanation-Sliding-Window/774350 */ @@ -62,24 +62,27 @@ private int slidingWindowHelper(String s, int k, int numUniqueTarget) { while (end < s.length()) { char c1 = s.charAt(end); if (map[c1 - 'a'] == 0) { - //we increment this when we include a new letter into our sliding window + // we increment this when we include a new letter into our sliding window uniqueLetterCount++; } map[c1 - 'a']++; if (map[c1 - 'a'] == k) { - //we increment this number when we find a letter's frequency reaches k + // we increment this number when we find a letter's frequency reaches k numNoLessThanK++; } end++; while (uniqueLetterCount > numUniqueTarget) { - //as long as the counter (the number of qualified letters) is greater than our target number, - //we can move the left pointer to the right, - //this keeps the interval within our sliding window always valid + // as long as the counter (the number of qualified letters) is greater than our + // target number, + // we can move the left pointer to the right, + // this keeps the interval within our sliding window always valid char c2 = s.charAt(start); if (map[c2 - 'a'] == k) { - //we decrement this numNoLessThanK when we find this letter's frequency equals - //to k because we'll move past this letter, i.e. our sliding window no longer includes it + // we decrement this numNoLessThanK when we find this letter's frequency + // equals + // to k because we'll move past this letter, i.e. our sliding window no + // longer includes it numNoLessThanK--; } map[c2 - 'a']--; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_396.java b/src/main/java/com/fishercoder/solutions/firstthousand/_396.java index 2af37e0826..d7c2e3a217 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_396.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_396.java @@ -2,7 +2,7 @@ public class _396 { public static class Solution1 { - /** + /* * F(k) = 0 * Bk[0] + 1 * Bk[1] + ... + (n-1) * Bk[n-1] */ public int maxRotateFunction(int[] A) { @@ -39,7 +39,7 @@ private int[] rotate(int[] a) { } public static class Solution2 { - /** + /* * Reference: https://discuss.leetcode.com/topic/58459/java-o-n-solution-with-explanation */ public int maxRotateFunction(int[] A) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_397.java b/src/main/java/com/fishercoder/solutions/firstthousand/_397.java index c878755153..e4d89ee8e1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_397.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_397.java @@ -13,7 +13,7 @@ public int integerReplacement(int n) { long min = Long.MAX_VALUE; Set set = new HashSet(); Queue q = new LinkedList(); - long[] pair = new long[]{n, 0}; + long[] pair = new long[] {n, 0}; q.offer(pair); while (!q.isEmpty()) { int size = q.size(); @@ -49,5 +49,4 @@ public int integerReplacement(int n) { return (int) min; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_398.java b/src/main/java/com/fishercoder/solutions/firstthousand/_398.java index 1baedd0972..5c9bdaca09 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_398.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_398.java @@ -4,8 +4,8 @@ public class _398 { - //TODO: use reservoir sampling to solve it again - //reservoir sampling: the size of the dataset is unknow before hand + // TODO: use reservoir sampling to solve it again + // reservoir sampling: the size of the dataset is unknow before hand public static class Solution { Map> map; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_399.java b/src/main/java/com/fishercoder/solutions/firstthousand/_399.java index 229037c289..54b9896e04 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_399.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_399.java @@ -7,13 +7,14 @@ public class _399 { public static class Solution1 { - /** + /* * Credit: https://medium.com/@null00/leetcode-evaluate-division-52a0158488c1 */ private Map root; private Map rate; - public double[] calcEquation(List> equations, double[] values, List> queries) { + public double[] calcEquation( + List> equations, double[] values, List> queries) { root = new HashMap<>(); rate = new HashMap<>(); int n = equations.size(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_4.java b/src/main/java/com/fishercoder/solutions/firstthousand/_4.java index 9eaaf9cedd..0486009667 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_4.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_4.java @@ -6,15 +6,15 @@ public class _4 { public static class Solution1 { - /**credit: https://discuss.leetcode.com/topic/28602/concise-java-solution-based-on-binary-search - * - * The key point of this problem is to ignore half part of A and B each step recursively by comparing the median of remaining A and B: + /*credit: https://discuss.leetcode.com/topic/28602/concise-java-solution-based-on-binary-search + * + * The key point of this problem is to ignore half part of A and B each step recursively by comparing the median of remaining A and B: - if (aMid < bMid) Keep [aRight + bLeft] - else Keep [bRight + aLeft] + if (aMid < bMid) Keep [aRight + bLeft] + else Keep [bRight + aLeft] - As the following: time=O(log(m + n)) - */ + As the following: time=O(log(m + n)) + */ public double findMedianSortedArrays(int[] A, int[] B) { int m = A.length; int n = B.length; @@ -44,15 +44,15 @@ public double getkth(int[] A, int aStart, int[] B, int bStart, int k) { } if (aMid < bMid) { - return getkth(A, aStart + k / 2, B, bStart, k - k / 2);// Check: aRight + bLeft + return getkth(A, aStart + k / 2, B, bStart, k - k / 2); // Check: aRight + bLeft } else { - return getkth(A, aStart, B, bStart + k / 2, k - k / 2);// Check: bRight + aLeft + return getkth(A, aStart, B, bStart + k / 2, k - k / 2); // Check: bRight + aLeft } } } public static class Solution2 { - /** + /* * Reference: https://leetcode.com/discuss/28843/my-accepted-java-solution: * Basic Idea is very similar to K-selection. it's easier to understand if you imagine this to be chopping off the last K elements from a total of len(A) + len(B) elements, * where K = (len(A) + len(B))/2. @@ -62,7 +62,9 @@ public static class Solution2 { public double findMedianSortedArrays(int[] nums1, int[] nums2) { int K = nums1.length + nums2.length; if (K % 2 == 0) { - return (findMedianSortedArrays(nums1, nums2, (K - K / 2)) + findMedianSortedArrays(nums1, nums2, (K - (K / 2 + 1)))) / 2; + return (findMedianSortedArrays(nums1, nums2, (K - K / 2)) + + findMedianSortedArrays(nums1, nums2, (K - (K / 2 + 1)))) + / 2; } else { return findMedianSortedArrays(nums1, nums2, K - (K / 2 + 1)); } @@ -83,7 +85,10 @@ public double findMedianSortedArrays(int[] A, int[] B, int K) { midA = highA - chopA; midB = highB - chopB; - if (A[midA] < B[midB]) { // here A[0 .. midA] < B[midB], and we know that B[0 .. midB-1] < B[midB], so B[midB..highB] can not possibly be within the first (len(A) + len(B) - K) elements, and can be safely removed. + if (A[midA] < B[midB]) { // here A[0 .. midA] < B[midB], and we know that B[0 .. + // midB-1] < B[midB], so B[midB..highB] can not possibly be + // within the first (len(A) + len(B) - K) elements, and can + // be safely removed. highB = midB; K = K - chopB; } else { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_40.java b/src/main/java/com/fishercoder/solutions/firstthousand/_40.java index acbaf50511..ae96c3b145 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_40.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_40.java @@ -14,11 +14,16 @@ public List> combinationSum2(int[] candidates, int target) { return result; } - void backtracking(int[] candidates, int start, List> result, int target, - List curr) { + void backtracking( + int[] candidates, + int start, + List> result, + int target, + List curr) { if (target > 0) { for (int i = start; i < candidates.length; i++) { - if (candidates[i] > target || (i > start && candidates[i - 1] == candidates[i])) { + if (candidates[i] > target + || (i > start && candidates[i - 1] == candidates[i])) { continue; } curr.add(candidates[i]); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_400.java b/src/main/java/com/fishercoder/solutions/firstthousand/_400.java index 5d819de28e..0a6a3ea3f8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_400.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_400.java @@ -3,7 +3,7 @@ public class _400 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/59314/java-solution: *

* 1. find the length of the number where the nth digit is from 2. find the actual number where diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_401.java b/src/main/java/com/fishercoder/solutions/firstthousand/_401.java index 47cabae92b..f64b8e3efd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_401.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_401.java @@ -11,8 +11,11 @@ public List readBinaryWatch(int num) { for (int h = 0; h < 12; h++) { for (int m = 0; m < 60; m++) { if (Integer.bitCount(h * 64 + m) == num) { - times.add(String.format("%d:%02d", h, - m));//%02 means to pad this two-digit decimal number on the left with zeroes + times.add( + String.format( + "%d:%02d", + h, m)); // %02 means to pad this two-digit decimal number on + // the left with zeroes } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_402.java b/src/main/java/com/fishercoder/solutions/firstthousand/_402.java index 3842592d19..4b82189126 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_402.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_402.java @@ -3,7 +3,7 @@ public class _402 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/59412/a-greedy-method-using-stack-o-n-time-and-o-n-space */ public String removeKdigits(String num, int k) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_403.java b/src/main/java/com/fishercoder/solutions/firstthousand/_403.java index f28985f3f7..4ab6a71c27 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_403.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_403.java @@ -8,7 +8,7 @@ public class _403 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/59903/very-easy-to-understand-java-solution-with-explanations/2 * and https://leetcode.com/articles/frog-jump/#approach-5-using-dynamic-programmingaccepted */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_404.java b/src/main/java/com/fishercoder/solutions/firstthousand/_404.java index c3f4d1dbb7..82379ea59b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_404.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_404.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; @@ -56,7 +55,7 @@ public int sumOfLeftLeaves(TreeNode root) { } public static class Solution3 { - /** + /* * My completely original solution on 11/4/2021. */ public int sumOfLeftLeaves(TreeNode root) { @@ -76,7 +75,6 @@ public int sumOfLeftLeaves(TreeNode root) { } queue.offer(curr.left); queue.offer(curr.right); - } level++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_405.java b/src/main/java/com/fishercoder/solutions/firstthousand/_405.java index e54c499ac0..b4828f5a38 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_405.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_405.java @@ -5,8 +5,10 @@ public class _405 { public static class Solution1 { public String toHex(int num) { char[] hexChars = - new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', - 'e', 'f'}; + new char[] { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', + 'f' + }; String result = ""; while (num != 0) { result = hexChars[(num & 15)] + result; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_406.java b/src/main/java/com/fishercoder/solutions/firstthousand/_406.java index b66524f747..6c07d50e5a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_406.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_406.java @@ -8,16 +8,19 @@ public class _406 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/60437/java-solution-using-priorityqueue-and-linkedlist */ public int[][] reconstructQueue(int[][] people) { - Arrays.sort(people, new Comparator() { - public int compare(int[] p1, int[] p2) { - return p1[0] != p2[0] ? Integer.compare(p2[0], p1[0]) - : Integer.compare(p1[1], p2[1]); - } - }); + Arrays.sort( + people, + new Comparator() { + public int compare(int[] p1, int[] p2) { + return p1[0] != p2[0] + ? Integer.compare(p2[0], p1[0]) + : Integer.compare(p1[1], p2[1]); + } + }); List list = new LinkedList(); for (int[] ppl : people) { list.add(ppl[1], ppl); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_407.java b/src/main/java/com/fishercoder/solutions/firstthousand/_407.java index 71960d4db0..56bef30b84 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_407.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_407.java @@ -4,7 +4,7 @@ public class _407 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/60418/java-solution-using-priorityqueue */ public class Cell { @@ -46,9 +46,10 @@ public int trapRainWater(int[][] heights) { } // from the borders, pick the shortest cell visited and check its neighbors: - // if the neighbor is shorter, collect the water it can trap and update its height as its height plus the water trapped + // if the neighbor is shorter, collect the water it can trap and update its height as + // its height plus the water trapped // add all its neighbors to the queue. - int[][] dirs = new int[][]{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; + int[][] dirs = new int[][] {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; int res = 0; while (!queue.isEmpty()) { Cell cell = queue.poll(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_408.java b/src/main/java/com/fishercoder/solutions/firstthousand/_408.java index dc73200975..9608f28278 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_408.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_408.java @@ -44,8 +44,8 @@ public boolean validWordAbbreviation(String word, String abbr) { j += number; stringBuilder.setLength(0); } - if ((i >= abbrChars.length && j < wordChars.length) || (i < abbrChars.length - && j >= wordChars.length)) { + if ((i >= abbrChars.length && j < wordChars.length) + || (i < abbrChars.length && j >= wordChars.length)) { return false; } if (i < abbrChars.length @@ -80,12 +80,14 @@ public boolean validWordAbbreviation(String word, String abbr) { continue; } - //now the two chars don't match, then the char in abbr should be a valid digit: 0 < x <= 9 + // now the two chars don't match, then the char in abbr should be a valid digit: 0 < + // x <= 9 if (abbr.charAt(j) == '0' || !Character.isDigit(abbr.charAt(j))) { return false; } - //now we count the number of letters that are abbreviated, i.e. get the number from abbr before next letter shows up in abbr + // now we count the number of letters that are abbreviated, i.e. get the number from + // abbr before next letter shows up in abbr int num = 0; while (j < aLen && Character.isDigit(abbr.charAt(j))) { num = num * 10 + (abbr.charAt(j) - '0'); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_409.java b/src/main/java/com/fishercoder/solutions/firstthousand/_409.java index eca6ec894c..07316ec1dd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_409.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_409.java @@ -31,7 +31,7 @@ public int longestPalindrome(String s) { } public static class Solution2 { - /** + /* * My completely original solution on 10/14/2021. */ public int longestPalindrome(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_41.java b/src/main/java/com/fishercoder/solutions/firstthousand/_41.java index 814933276d..e0851220ee 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_41.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_41.java @@ -3,15 +3,17 @@ public class _41 { public static class Solution1 { - /** + /* * Time: O(n) Space: O(1) * Idea: put every number in its right position, e.g. put 5 in nums[4]. */ public int firstMissingPositive(int[] nums) { int i = 0; while (i < nums.length) { - if (nums[i] > 0 && nums[i] != i + 1 && nums[i] - 1 < nums.length && nums[i] != nums[nums[i] - - 1]) { + if (nums[i] > 0 + && nums[i] != i + 1 + && nums[i] - 1 < nums.length + && nums[i] != nums[nums[i] - 1]) { swap(nums, i, nums[i] - 1); } else { i++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_410.java b/src/main/java/com/fishercoder/solutions/firstthousand/_410.java index 5461f12f76..e1ff2241f8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_410.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_410.java @@ -3,7 +3,7 @@ public class _410 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/61324/clear-explanation-8ms-binary-search-java *

* The answer is between maximum value of input array numbers and sum of those numbers. Use @@ -33,7 +33,7 @@ public int splitArray(int[] nums, int m) { if (m == 1) { return (int) sum; } - //binary search + // binary search long l = max; long r = sum; while (l <= r) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_411.java b/src/main/java/com/fishercoder/solutions/firstthousand/_411.java index a4f82520cf..a4260110d9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_411.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_411.java @@ -5,7 +5,7 @@ public class _411 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/61346/trie-bruteforce */ class Trie { @@ -90,10 +90,13 @@ public void abbrGenerator(String target, int i, String tmp, int abbr, int num) { return; } char cur = target.charAt(i); - abbrGenerator(target, i + 1, abbr == 0 ? tmp + cur : tmp + abbr + cur, 0, + abbrGenerator( + target, + i + 1, + abbr == 0 ? tmp + cur : tmp + abbr + cur, + 0, abbr == 0 ? num - 1 : num - 2); abbrGenerator(target, i + 1, tmp, abbr + 1, num); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_413.java b/src/main/java/com/fishercoder/solutions/firstthousand/_413.java index 8b301c9602..2ccd4b5a9f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_413.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_413.java @@ -3,7 +3,7 @@ public class _413 { public static class Solution1 { - //credit: https://discuss.leetcode.com/topic/62884/2ms-java-o-n-time-o-1-space-solution + // credit: https://discuss.leetcode.com/topic/62884/2ms-java-o-n-time-o-1-space-solution public int numberOfArithmeticSlices(int[] A) { int sum = 0; int len = 2; @@ -14,7 +14,7 @@ public int numberOfArithmeticSlices(int[] A) { if (len > 2) { sum += calculateSlices(len); } - len = 2;//reset it to 2 + len = 2; // reset it to 2 } } if (len > 2) { @@ -29,7 +29,7 @@ int calculateSlices(int len) { } class Solution2 { - //credit: https://discuss.leetcode.com/topic/63302/simple-java-solution-9-lines-2ms + // credit: https://discuss.leetcode.com/topic/63302/simple-java-solution-9-lines-2ms public int numberOfArithmeticSlices(int[] A) { int sum = 0; int curr = 0; @@ -44,5 +44,4 @@ public int numberOfArithmeticSlices(int[] A) { return sum; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_415.java b/src/main/java/com/fishercoder/solutions/firstthousand/_415.java index d1e2574307..d7a49e4bf2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_415.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_415.java @@ -3,7 +3,7 @@ public class _415 { public static class Solution1 { - /** + /* * My completely original solution on 10/14/2021. */ public String addStrings(String num1, String num2) { @@ -32,7 +32,7 @@ public String addStrings(String num1, String num2) { } public static class Solution2 { - /** + /* * This is an optimized version of Solution1, on LeetCode, this version beats 100% while Solution1 beats only 67%. */ public String addStrings(String num1, String num2) { @@ -56,5 +56,4 @@ public String addStrings(String num1, String num2) { return sb.reverse().toString(); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_416.java b/src/main/java/com/fishercoder/solutions/firstthousand/_416.java index aea4244c78..20fe577d8e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_416.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_416.java @@ -4,7 +4,7 @@ public class _416 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/67539/0-1-knapsack-detailed-explanation */ public boolean canPartition(int[] nums) { @@ -47,5 +47,4 @@ public boolean canPartition(int[] nums) { return dp[n][sum]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_417.java b/src/main/java/com/fishercoder/solutions/firstthousand/_417.java index 74fbb83212..4902a0c165 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_417.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_417.java @@ -8,7 +8,7 @@ public class _417 { public static class Solution1 { - /** + /* * Credit: looked at this post: https://discuss.leetcode.com/topic/62379/java-bfs-dfs-from-ocean *

* One typical trick to work on 2d grid problems is to go through the border and put proper ones into a queue if using BFS. @@ -38,7 +38,7 @@ public List pacificAtlantic(int[][] matrix) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (pacific[i][j] && atlantic[i][j]) { - result.add(new int[]{i, j}); + result.add(new int[] {i, j}); } } } @@ -61,7 +61,7 @@ void dfs(int[][] matrix, boolean[][] visited, int height, int x, int y) { } public static class Solution2 { - /**This is my original solution on 3/25/2021, although brute force, it works.*/ + /*This is my original solution on 3/25/2021, although brute force, it works.*/ public List> pacificAtlantic(int[][] matrix) { List> result = new ArrayList<>(); if (matrix == null || matrix.length == 0 || matrix[0].length == 0) { @@ -76,7 +76,7 @@ public List> pacificAtlantic(int[][] matrix) { Queue queue = new LinkedList<>(); boolean[][] visited = new boolean[m][n]; visited[i][j] = true; - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); if (bfs(matrix, m, n, touchesPacificAndAtlantic, queue, visited)) { result.add(new ArrayList<>(Arrays.asList(i, j))); } @@ -94,11 +94,17 @@ private void update(int i, int j, int m, int n, boolean[] touchesPacificAndAtlan } } - private boolean bfs(int[][] matrix, int m, int n, boolean[] touchesPacificAndAtlantic, Queue queue, boolean[][] visited) { + private boolean bfs( + int[][] matrix, + int m, + int n, + boolean[] touchesPacificAndAtlantic, + Queue queue, + boolean[][] visited) { if (touchesPacificAndAtlantic[0] && touchesPacificAndAtlantic[1]) { return true; } - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; while (!queue.isEmpty()) { int size = queue.size(); for (int k = 0; k < size; k++) { @@ -106,9 +112,14 @@ private boolean bfs(int[][] matrix, int m, int n, boolean[] touchesPacificAndAtl for (int p = 0; p < directions.length - 1; p++) { int newx = curr[0] + directions[p]; int newy = curr[1] + directions[p + 1]; - if (newx >= 0 && newx < m && newy >= 0 && newy < n && matrix[newx][newy] <= matrix[curr[0]][curr[1]] && !visited[newx][newy]) { + if (newx >= 0 + && newx < m + && newy >= 0 + && newy < n + && matrix[newx][newy] <= matrix[curr[0]][curr[1]] + && !visited[newx][newy]) { visited[newx][newy] = true; - queue.offer(new int[]{newx, newy}); + queue.offer(new int[] {newx, newy}); update(newx, newy, m, n, touchesPacificAndAtlantic); if (touchesPacificAndAtlantic[0] && touchesPacificAndAtlantic[1]) { return true; @@ -120,5 +131,4 @@ private boolean bfs(int[][] matrix, int m, int n, boolean[] touchesPacificAndAtl return false; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_418.java b/src/main/java/com/fishercoder/solutions/firstthousand/_418.java index ed0c96a75d..53fccb0b61 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_418.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_418.java @@ -3,7 +3,7 @@ public class _418 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/62455/21ms-18-lines-java-solution *

* 1. String s = String.join(" ", sentence) + " " ;. This line gives us a formatted sentence to be put to our screen. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_419.java b/src/main/java/com/fishercoder/solutions/firstthousand/_419.java index 5a2275a09d..5a1f8bb1e4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_419.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_419.java @@ -3,7 +3,7 @@ public class _419 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/62970/simple-java-solution, *

* This solution does NOT modify original input. @@ -21,13 +21,13 @@ public int countBattleships(char[][] board) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == '.') { - continue;//if it can pass this line, then board[i][j] must be 'X' + continue; // if it can pass this line, then board[i][j] must be 'X' } if (j > 0 && board[i][j - 1] == 'X') { - continue;//then we check if its left is 'X' + continue; // then we check if its left is 'X' } if (i > 0 && board[i - 1][j] == 'X') { - continue;//also check if its top is 'X' + continue; // also check if its top is 'X' } count++; } @@ -37,7 +37,7 @@ public int countBattleships(char[][] board) { } public static class Solution2 { - /** + /* * My original solution, actually modified the input. I just undo it at the end. */ public int countBattleships(char[][] board) { @@ -79,5 +79,4 @@ private void dfs(char[][] board, int x, int y, int m, int n) { dfs(board, x, y - 1, m, n); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_42.java b/src/main/java/com/fishercoder/solutions/firstthousand/_42.java index 43829222f8..d759c0f263 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_42.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_42.java @@ -3,7 +3,7 @@ public class _42 { public static class Solution1 { - /** + /* * O(n) time and O(1) space, awesome! * * 1. first scan to find the max height index @@ -50,4 +50,4 @@ public int trap(int[] height) { return water; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_420.java b/src/main/java/com/fishercoder/solutions/firstthousand/_420.java index 20e49e275c..cdf837a719 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_420.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_420.java @@ -2,7 +2,7 @@ public class _420 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/63854/o-n-java-solution-by-analyzing-changes-allowed-to-fix-each-condition */ public int strongPasswordChecker(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_421.java b/src/main/java/com/fishercoder/solutions/firstthousand/_421.java index a5d7f94b4d..8b5ac84b61 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_421.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_421.java @@ -6,7 +6,7 @@ public class _421 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/63213/java-o-n-solution-using-bit-manipulation-and-hashmap/7 *

* Note: comment out those system.out.println statements before submitting on LeetCode, otherwise TLE. @@ -15,7 +15,9 @@ public int findMaximumXOR(int[] nums) { int max = 0; int mask = 0; for (int i = 31; i >= 0; i--) { - mask |= (1 << i);//the mask will grow like this: 100...000, 110...000, 111...000 to 111...111, each time, we only get the most left part of all numbers in the given array + mask |= (1 << i); // the mask will grow like this: 100...000, 110...000, + // 111...000 to 111...111, each time, we only get the most + // left part of all numbers in the given array System.out.println("mask = " + Integer.toBinaryString(mask)); Set set = new HashSet<>(); for (int num : nums) { @@ -26,10 +28,11 @@ public int findMaximumXOR(int[] nums) { int candidate = max | (1 << i); System.out.println("candidate = " + Integer.toBinaryString(candidate)); - /**Reason behind this: if a ^ prefix = candidate, then a ^ candidate = prefix, also prefix ^ candidate = a + /*Reason behind this: if a ^ prefix = candidate, then a ^ candidate = prefix, also prefix ^ candidate = a * in this below code: we use this one: prefix ^ candidate = a*/ for (int prefix : set) { - System.out.println("candidate ^ prefix = " + Integer.toBinaryString(candidate ^ prefix)); + System.out.println( + "candidate ^ prefix = " + Integer.toBinaryString(candidate ^ prefix)); if (set.contains(candidate ^ prefix)) { max = candidate; } @@ -41,5 +44,4 @@ public int findMaximumXOR(int[] nums) { return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_423.java b/src/main/java/com/fishercoder/solutions/firstthousand/_423.java index 74037353fc..d7b5e4701e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_423.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_423.java @@ -4,7 +4,7 @@ public class _423 { public static class Solution1 { public String originalDigits(String s) { - /**we can use one char as a representative to uniquely stand for one number, + /*we can use one char as a representative to uniquely stand for one number, * for some numbers that we cannot find a unique representive, we can dedup. * e.g. for number one, if we use 'o' as its representive, then 'o' also exists in numbers 2, 4 and 0, so * we need to dedupe the 'o' in those numbers. @@ -13,31 +13,31 @@ public String originalDigits(String s) { int[] counts = new int[10]; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'o') { - counts[1]++;//2,4,0 + counts[1]++; // 2,4,0 } if (s.charAt(i) == 'w') { counts[2]++; } if (s.charAt(i) == 'h') { - counts[3]++;//8 + counts[3]++; // 8 } if (s.charAt(i) == 'u') { counts[4]++; } if (s.charAt(i) == 'f') { - counts[5]++;//4 + counts[5]++; // 4 } if (s.charAt(i) == 'x') { counts[6]++; } if (s.charAt(i) == 'v') { - counts[7]++;//5 + counts[7]++; // 5 } if (s.charAt(i) == 'g') { counts[8]++; } if (s.charAt(i) == 'i') { - counts[9]++;//5,6,8 + counts[9]++; // 5,6,8 } if (s.charAt(i) == 'z') { counts[0]++; @@ -61,21 +61,20 @@ public String originalDigits(String s) { } public static class Solution2 { - /**My original idea on 3/28/2021, similar to the above idea in Solution1: - * - * we can use signal characters to sort these unsorted characters out - 1. z must be mapping to zero; 0 - 2. x -> six; 6 - 3. w -> two; 2 - 4. u -> four; 4 - 5. g -> eight; 8 - 6. only two digits have f: five and four, four is represented by the letter u, so the remaining f must form five; 5 - 7. only two digits have v: seven and five, five is done based on rule 6, so the remaining v must form seven; 7 - 8. only two digits have h: three and eight, eight is done based on rule 5, so the remaining h must form three; 3 - 9. four digits could have o: zero, one, two and four, since all the latter 3 digits have been done already, so the remaining o must form one; 1 - 10. all the rest of the unmapped characters must be able to form a multiple of nine; 9 - 11. then all 10 digits are sorted out - */ + /*My original idea on 3/28/2021, similar to the above idea in Solution1: + * + * we can use signal characters to sort these unsorted characters out + 1. z must be mapping to zero; 0 + 2. x -> six; 6 + 3. w -> two; 2 + 4. u -> four; 4 + 5. g -> eight; 8 + 6. only two digits have f: five and four, four is represented by the letter u, so the remaining f must form five; 5 + 7. only two digits have v: seven and five, five is done based on rule 6, so the remaining v must form seven; 7 + 8. only two digits have h: three and eight, eight is done based on rule 5, so the remaining h must form three; 3 + 9. four digits could have o: zero, one, two and four, since all the latter 3 digits have been done already, so the remaining o must form one; 1 + 10. all the rest of the unmapped characters must be able to form a multiple of nine; 9 + 11. then all 10 digits are sorted out + */ } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_424.java b/src/main/java/com/fishercoder/solutions/firstthousand/_424.java index 87e2e77613..67f06907b8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_424.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_424.java @@ -6,7 +6,8 @@ public class _424 { public static class Solution1 { - //credit: https://discuss.leetcode.com/topic/63494/java-12-lines-o-n-sliding-window-solution-with-explanation + // credit: + // https://discuss.leetcode.com/topic/63494/java-12-lines-o-n-sliding-window-solution-with-explanation public int characterReplacement(String s, int k) { int len = s.length(); int[] count = new int[26]; @@ -26,7 +27,7 @@ public int characterReplacement(String s, int k) { } public static class Solution2 { - /** + /* * My original solution using Sliding Window technique: * I try to use each character as the possible candidate to find all solutions and compare. */ @@ -66,4 +67,4 @@ private int slidingWindow(char c, String s, int k) { return ans; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_425.java b/src/main/java/com/fishercoder/solutions/firstthousand/_425.java index 02aec6764e..519ab61bc8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_425.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_425.java @@ -6,7 +6,7 @@ public class _425 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/63516/explained-my-java-solution-using-trie-126ms-16-16/2 */ @@ -71,8 +71,7 @@ public List> wordSquares(String[] words) { return ans; } - private void search(int len, Trie trie, List> ans, - List ansBuilder) { + private void search(int len, Trie trie, List> ans, List ansBuilder) { if (ansBuilder.size() == len) { ans.add(new ArrayList<>(ansBuilder)); return; @@ -91,6 +90,4 @@ private void search(int len, Trie trie, List> ans, } } } - } - diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_426.java b/src/main/java/com/fishercoder/solutions/firstthousand/_426.java index 87328e03a5..706a319465 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_426.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_426.java @@ -3,7 +3,7 @@ public class _426 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list/solutions/1494821/simplest-java-solution-with-explanation-inorder-traversal-in-place-no-dummy-node-needed/ */ Node head; @@ -23,19 +23,21 @@ private void dfs(Node node) { if (node == null) { return; } - //we traverse all the way to the most bottom left leaf node first + // we traverse all the way to the most bottom left leaf node first dfs(node.left); - //we only need to assign head once, i.e. when it's not assigned, we'll assign the most bottom left leaf node to head + // we only need to assign head once, i.e. when it's not assigned, we'll assign the most + // bottom left leaf node to head if (head == null) { head = node; } - //if the tail is already assigned, which should be all of the cases except when it's just finding the most bottom left leaf + // if the tail is already assigned, which should be all of the cases except when it's + // just finding the most bottom left leaf // attach current node to tail's right, assign tail to current node's left if (tail != null) { tail.right = node; node.left = tail; } - //then always assign the current node to be the new tail + // then always assign the current node to be the new tail tail = node; dfs(node.right); } @@ -46,8 +48,7 @@ public static class Node { public Node left; public Node right; - public Node() { - } + public Node() {} public Node(int val) { this.val = val; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_427.java b/src/main/java/com/fishercoder/solutions/firstthousand/_427.java index 38d1d61040..f18963e61a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_427.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_427.java @@ -9,7 +9,6 @@ static class Node { public Node bottomLeft; public Node bottomRight; - public Node() { this.val = false; this.isLeaf = false; @@ -28,7 +27,13 @@ public Node(boolean val, boolean isLeaf) { this.bottomRight = null; } - public Node(boolean val, boolean isLeaf, Node topLeft, Node topRight, Node bottomLeft, Node bottomRight) { + public Node( + boolean val, + boolean isLeaf, + Node topLeft, + Node topRight, + Node bottomLeft, + Node bottomRight) { this.val = val; this.isLeaf = isLeaf; this.topLeft = topLeft; @@ -48,13 +53,13 @@ private Node recurse(int[][] grid, int row, int col, int limit) { return new Node(grid[row][col] == 1, true); } else { Node root = new Node(false, false); - //top left + // top left root.topLeft = recurse(grid, row, col, limit / 2); - //top right + // top right root.topRight = recurse(grid, row, col + limit / 2, limit / 2); - //bottom left + // bottom left root.bottomLeft = recurse(grid, row + limit / 2, col, limit / 2); - //bottom right + // bottom right root.bottomRight = recurse(grid, row + limit / 2, col + limit / 2, limit / 2); return root; } @@ -86,7 +91,13 @@ private Node recurse(int[][] grid, int row, int col, int limit) { Node topRgith = recurse(grid, row, col + limit / 2, limit / 2); Node bottomLeft = recurse(grid, row + limit / 2, col, limit / 2); Node bottomRight = recurse(grid, row + limit / 2, col + limit / 2, limit / 2); - if (topLeft.isLeaf && topRgith.isLeaf && bottomLeft.isLeaf && bottomRight.isLeaf && topLeft.val == topRgith.val && topLeft.val == bottomLeft.val && topLeft.val == bottomRight.val) { + if (topLeft.isLeaf + && topRgith.isLeaf + && bottomLeft.isLeaf + && bottomRight.isLeaf + && topLeft.val == topRgith.val + && topLeft.val == bottomLeft.val + && topLeft.val == bottomRight.val) { return new Node(topLeft.val, true); } Node root = new Node(grid[row][col] == 1, false); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_429.java b/src/main/java/com/fishercoder/solutions/firstthousand/_429.java index a09cecf45a..d35ccdd81a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_429.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_429.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Node; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_43.java b/src/main/java/com/fishercoder/solutions/firstthousand/_43.java index 828a1f2922..60430fc020 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_43.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_43.java @@ -3,7 +3,7 @@ public class _43 { public static class Solution1 { - /** + /* * Inspired by https://discuss.leetcode.com/topic/30508/easiest-java-solution-with-graph-explanation * Basically, the rule we can find is that products of each two digits will land in this position in the final product: * i+j and i+j+1 @@ -18,7 +18,9 @@ public String multiply(String num1, String num2) { for (int i = a1.length - 1; i >= 0; i--) { for (int j = a2.length - 1; j >= 0; j--) { - int thisProduct = Character.getNumericValue(num1.charAt(i)) * Character.getNumericValue(num2.charAt(j)); + int thisProduct = + Character.getNumericValue(num1.charAt(i)) + * Character.getNumericValue(num2.charAt(j)); product[i + j + 1] += thisProduct % 10; if (product[i + j + 1] >= 10) { product[i + j + 1] %= 10; @@ -42,7 +44,6 @@ public String multiply(String num1, String num2) { return stringBuilder.toString(); } - private boolean isZero(String num) { for (char c : num.toCharArray()) { if (c != '0') { @@ -54,7 +55,7 @@ private boolean isZero(String num) { } public static class Solution2 { - /** + /* * My completely original solution on 10/14/2021. * * Gist: just use string instead of integers for times variable, otherwise guaranteed to overflow/underflow! @@ -64,7 +65,8 @@ public String multiply(String num1, String num2) { String previous = ""; String j = ""; for (int i = num2.length() - 1; i >= 0; i--, j += "0") { - String intermediate = multiplyBySingleDigit(num1, Character.getNumericValue(num2.charAt(i)), j); + String intermediate = + multiplyBySingleDigit(num1, Character.getNumericValue(num2.charAt(i)), j); String result = add(intermediate, previous); previous = result; } @@ -120,5 +122,4 @@ private String multiplyBySingleDigit(String num, int multiplier, String times) { return sb.reverse() + times; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_430.java b/src/main/java/com/fishercoder/solutions/firstthousand/_430.java index e58a102046..54f0069125 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_430.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_430.java @@ -2,7 +2,7 @@ public class _430 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/solution/ */ public Node flatten(Node head) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_432.java b/src/main/java/com/fishercoder/solutions/firstthousand/_432.java index 04b86e43c2..93f56c038e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_432.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_432.java @@ -9,7 +9,7 @@ public class _432 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/65634/java-ac-all-strict-o-1-not-average-o-1-easy-to-read/2 */ class AllOne { @@ -34,7 +34,7 @@ public Bucket(int cnt) { } } - /** + /* * Initialize your data structure here. */ public AllOne() { @@ -46,7 +46,7 @@ public AllOne() { keyCountMap = new HashMap<>(); } - /** + /* * Inserts a new key with value 1. Or increments an existing key by 1. */ public void inc(String key) { @@ -62,7 +62,7 @@ public void inc(String key) { } } - /** + /* * Decrements an existing key by 1. If Key's value is 1, remove it from the data structure. */ public void dec(String key) { @@ -77,14 +77,14 @@ public void dec(String key) { } } - /** + /* * Returns one of the keys with maximal value. */ public String getMaxKey() { return tail.pre == head ? "" : (String) tail.pre.keySet.iterator().next(); } - /** + /* * Returns one of the keys with Minimal value. */ public String getMinKey() { @@ -136,7 +136,7 @@ private void addBucketAfter(Bucket newBucket, Bucket preBucket) { } } -/** +/* * Your AllOne object will be instantiated and called as such: * AllOne obj = new AllOne(); * obj.inc(key); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_433.java b/src/main/java/com/fishercoder/solutions/firstthousand/_433.java index ce78eb2760..d6ceb35505 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_433.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_433.java @@ -7,7 +7,7 @@ public class _433 { public static class Solution1 { - /** + /* * My completely original solution, BFS. */ public int minMutation(String startGene, String endGene, String[] bank) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_435.java b/src/main/java/com/fishercoder/solutions/firstthousand/_435.java index b43f41fda4..1f19e078b7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_435.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_435.java @@ -5,7 +5,7 @@ public class _435 { public static class Solution1 { - /** + /* * credit:: https://discuss.leetcode.com/topic/65828/java-solution-with-clear-explain * and https://discuss.leetcode.com/topic/65594/java-least-is-most * Sort the intervals by their end time, if equal, then sort by their start time. @@ -30,7 +30,7 @@ public int eraseOverlapIntervals(int[][] intervals) { } public static class Solution2 { - /** + /* * This is sorting my starting time, the key here is that we'll want to update end time when an erasure is needed: * we use the smaller end time instead of the bigger one which is more likely to overlap with others. */ @@ -49,4 +49,4 @@ public int eraseOverlapIntervals(int[][] intervals) { return erasures; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_436.java b/src/main/java/com/fishercoder/solutions/firstthousand/_436.java index b2ca9e7325..6c4f22a4f1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_436.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_436.java @@ -18,5 +18,4 @@ public int[] findRightInterval(int[][] intervals) { return res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_437.java b/src/main/java/com/fishercoder/solutions/firstthousand/_437.java index 8ef3307599..98cd7a9919 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_437.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_437.java @@ -16,8 +16,9 @@ private int pathSumFrom(TreeNode root, int sum) { if (root == null) { return 0; } - return (root.val == sum ? 1 : 0) + pathSumFrom(root.left, sum - root.val) + pathSumFrom(root.right, sum - root.val); + return (root.val == sum ? 1 : 0) + + pathSumFrom(root.left, sum - root.val) + + pathSumFrom(root.right, sum - root.val); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_438.java b/src/main/java/com/fishercoder/solutions/firstthousand/_438.java index 8ef5b1ba6c..fa5f407d99 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_438.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_438.java @@ -6,7 +6,7 @@ public class _438 { public static class Solution1 { - /** + /* * Sliding Window */ public List findAnagrams(String s, String p) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_439.java b/src/main/java/com/fishercoder/solutions/firstthousand/_439.java index 595cc50a5a..c3a14d82a4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_439.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_439.java @@ -6,7 +6,7 @@ public class _439 { public static class Solution1 { - /** + /* * Below is my original solution, but looking at Discuss, a more concise way is to use just one * stack, process it from right to left, example: https://discuss.leetcode.com/topic/64409/very-easy-1-pass-stack-solution-in-java-no-string-concat */ @@ -22,9 +22,9 @@ public String parseTernary(String expression) { tmpStack.addFirst(stack.pollFirst()); } else { char char1 = tmpStack.removeFirst(); - tmpStack.removeFirst();//remove ':' + tmpStack.removeFirst(); // remove ':' char char2 = tmpStack.removeFirst(); - stack.removeFirst();//remove '?' + stack.removeFirst(); // remove '?' char judge = stack.removeFirst(); tmpStack.addFirst(judge == 'T' ? char1 : char2); while (!tmpStack.isEmpty()) { @@ -38,5 +38,4 @@ public String parseTernary(String expression) { return Character.toString(stack.removeFirst()); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_440.java b/src/main/java/com/fishercoder/solutions/firstthousand/_440.java index 173b5a6a9d..606a5460e3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_440.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_440.java @@ -3,7 +3,7 @@ public class _440 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/64624/concise-easy-to-understand-java-5ms-solution-with-explaination/2 */ public int findKthNumber(int n, int k) { @@ -22,7 +22,7 @@ public int findKthNumber(int n, int k) { return curr; } - //use long in case of overflow + // use long in case of overflow public int calSteps(int n, long n1, long n2) { int steps = 0; while (n1 <= n) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_441.java b/src/main/java/com/fishercoder/solutions/firstthousand/_441.java index eeac26915a..431cbbbbd1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_441.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_441.java @@ -21,5 +21,4 @@ public int arrangeCoins(int n) { return count - 1; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_442.java b/src/main/java/com/fishercoder/solutions/firstthousand/_442.java index 2d6e19c026..87c5df7992 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_442.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_442.java @@ -8,8 +8,8 @@ public class _442 { public static class Solution1 { - //O(n) space - //O(n) time + // O(n) space + // O(n) time public List findDuplicates(int[] nums) { Set set = new HashSet(); List result = new ArrayList(); @@ -23,7 +23,7 @@ public List findDuplicates(int[] nums) { } public static class Solution2 { - /** + /* * O(1) space * O(n) time *

@@ -49,5 +49,4 @@ public List findDuplicates(int[] nums) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_443.java b/src/main/java/com/fishercoder/solutions/firstthousand/_443.java index a5158d1d75..8b2b487f44 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_443.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_443.java @@ -2,7 +2,7 @@ public class _443 { public static class Solution1 { - /** + /* * This is breaking the rules, it's not in-place. */ public int compress(char[] chars) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_444.java b/src/main/java/com/fishercoder/solutions/firstthousand/_444.java index 70d1656c5d..d6b83b2722 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_444.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_444.java @@ -10,7 +10,7 @@ public class _444 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/65948/java-solution-using-bfs-topological-sort */ public boolean sequenceReconstruction(int[] org, List> seqs) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_445.java b/src/main/java/com/fishercoder/solutions/firstthousand/_445.java index a3d8d98ac5..87e6d89745 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_445.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_445.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayDeque; import java.util.Deque; import java.util.Stack; @@ -42,7 +41,6 @@ private Deque popIntoStack(ListNode head) { } } - public static class Solution2 { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { Stack stack1 = popOntoStack(l1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_446.java b/src/main/java/com/fishercoder/solutions/firstthousand/_446.java index 2767e66965..43b20633db 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_446.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_446.java @@ -5,7 +5,7 @@ public class _446 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/67413/detailed-explanation-for-java-o-n-2-solution */ public int numberOfArithmeticSlices(int[] A) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_447.java b/src/main/java/com/fishercoder/solutions/firstthousand/_447.java index 8c8796ee60..1623024160 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_447.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_447.java @@ -6,7 +6,7 @@ public class _447 { public static class Solution1 { - /** + /* * Looked at these two posts: https://discuss.leetcode.com/topic/66587/clean-java-solution-o-n-2-166ms and * https://discuss.leetcode.com/topic/66521/share-my-straightforward-solution-with-hashmap-o-n-2, basically, * have a HashMap, key is the distance, value is the number of points that are this distance apart to this point. @@ -46,5 +46,4 @@ private long calcDistance(int[] p1, int[] p2) { return x * x + y * y; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_448.java b/src/main/java/com/fishercoder/solutions/firstthousand/_448.java index 2965faacf0..d685712a31 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_448.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_448.java @@ -8,7 +8,7 @@ public class _448 { public static class Solution1 { - /** + /* * O(n) space * O(n) time */ @@ -44,7 +44,7 @@ public List findDisappearedNumbers(int[] nums) { } public static class Solution2 { - /** + /* * O(1) space * O(n) time */ @@ -66,5 +66,4 @@ public List findDisappearedNumbers(int[] nums) { return result; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_449.java b/src/main/java/com/fishercoder/solutions/firstthousand/_449.java index 65644640f2..6124dec31f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_449.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_449.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; @@ -9,7 +8,7 @@ public class _449 { public static class Solution1 { - /** + /* * Preorder * Reference: https://discuss.leetcode.com/topic/97922/pre-or-post-order-with-only-keeping-one-bound-beat-98-and-95 */ @@ -39,7 +38,8 @@ public TreeNode deserialize(String data) { return null; } String[] values = data.split(" "); - int[] index = new int[]{0};/**TODO: Why must use an int array, instead of just an int?*/ + int[] index = + new int[] {0}; /*TODO: Why must use an int array, instead of just an int?*/ return deserialize(values, index, Integer.MAX_VALUE); } @@ -55,7 +55,7 @@ private TreeNode deserialize(String[] values, int[] index, int maxValue) { } public static class Solution2 { - /** + /* * Postorder * Reference: https://discuss.leetcode.com/topic/97922/pre-or-post-order-with-only-keeping-one-bound-beat-98-and-95 */ @@ -84,7 +84,10 @@ public TreeNode deserialize(String data) { return null; } String[] values = data.split(" "); - int[] index = new int[]{values.length - 1};/**TODO: This is not just one element any more like in the preorder solution above*/ + int[] index = + new int[] { + values.length - 1 + }; /*TODO: This is not just one element any more like in the preorder solution above*/ return deserialize(values, index, Integer.MIN_VALUE); } @@ -100,7 +103,7 @@ private TreeNode deserialize(String[] values, int[] index, int minValue) { } public static class Solution3 { - /** + /* * This is a generic solution that applies to both BT and BST. And also the easiest to follow. */ @@ -176,7 +179,6 @@ public TreeNode deserialize(String data) { Queue nodesLeftToSerialize = new LinkedList<>(); nodesLeftToSerialize.addAll(Arrays.asList(data.split(DELIMITER))); return deserializeHelper(nodesLeftToSerialize); - } private TreeNode deserializeHelper(Queue nodesLeft) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_450.java b/src/main/java/com/fishercoder/solutions/firstthousand/_450.java index c04c427e15..3a7f667849 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_450.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_450.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; public class _450 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/65792/recursive-easy-to-understand-java-solution * Steps: * 1. Recursively find the node that has the same value as the key, while setting the left/right nodes equal to the returned subtree @@ -48,7 +47,7 @@ private TreeNode getMin(TreeNode node) { } public static class Solution2 { - /** + /* * My original, but brute force solution, time complexity: O(n) instead of O(h) */ public TreeNode deleteNode(TreeNode root, int key) { @@ -82,7 +81,7 @@ private List dfs(TreeNode root, int key, List list) { } public static class Solution3 { - /** + /* * credit: https://leetcode.com/problems/delete-node-in-a-bst/solution/ * * Again, using a pen and paper to visualize helps a lot. @@ -101,25 +100,34 @@ public TreeNode deleteNode(TreeNode root, int key) { return null; } if (root.val < key) { - //delete from the right subtree + // delete from the right subtree root.right = deleteNode(root.right, key); } else if (root.val > key) { - //delete from the left subtree + // delete from the left subtree root.left = deleteNode(root.left, key); } else { - //delete this current node, three cases: + // delete this current node, three cases: if (root.left == null && root.right == null) { - //case 1: if this is a leaf + // case 1: if this is a leaf root = null; } else if (root.right != null) { - //case 2: has a right child, regardless whether it has left children or not, - //this is because we want to traverse the tree only once, so we'll want to keep going down the tree - root.val = findSuccessor(root);//we find the value of the successor and assign it to current root.val - root.right = deleteNode(root.right, root.val);//and then we delete this successor's value in the right subtree as it's been moved up + // case 2: has a right child, regardless whether it has left children or not, + // this is because we want to traverse the tree only once, so we'll want to keep + // going down the tree + root.val = + findSuccessor( + root); // we find the value of the successor and assign it to + // current root.val + root.right = + deleteNode( + root.right, + root.val); // and then we delete this successor's value in the + // right subtree as it's been moved up } else if (root.left != null) { - //case 3: this node is not a leaf and no right child, but has a left child - //That means that its successor is somewhere upper in the tree but we don't want to go back. - //Let's use the predecessor here which is somewhere lower in the left subtree. + // case 3: this node is not a leaf and no right child, but has a left child + // That means that its successor is somewhere upper in the tree but we don't + // want to go back. + // Let's use the predecessor here which is somewhere lower in the left subtree. root.val = findPredecessor(root); root.left = deleteNode(root.left, root.val); } @@ -143,5 +151,4 @@ private int findSuccessor(TreeNode root) { return root.val; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_451.java b/src/main/java/com/fishercoder/solutions/firstthousand/_451.java index 54f3dab453..03354eba8a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_451.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_451.java @@ -33,7 +33,8 @@ public String frequencySort(String s) { for (char c : s.toCharArray()) { map.put(c, map.getOrDefault(c, 0) + 1); } - TreeMap> reverseMap = new TreeMap<>(Collections.reverseOrder()); + TreeMap> reverseMap = + new TreeMap<>(Collections.reverseOrder()); for (char c : map.keySet()) { int freq = map.get(c); if (!reverseMap.containsKey(freq)) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_452.java b/src/main/java/com/fishercoder/solutions/firstthousand/_452.java index 68a2f90255..95a60e5835 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_452.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_452.java @@ -5,7 +5,7 @@ public class _452 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/66579/java-greedy-soution/6 */ public int findMinArrowShots(int[][] points) { @@ -18,7 +18,8 @@ public int findMinArrowShots(int[][] points) { int count = 1; for (int[] p : points) { // if the point starts after currentEnd, it means this balloons not been burst. - // Then we shot the balloon in its end point. Otherwise, means this balloon has been burst, then ignore it. + // Then we shot the balloon in its end point. Otherwise, means this balloon has been + // burst, then ignore it. if (p[0] > currentEnd) { count++; currentEnd = p[1]; @@ -31,7 +32,7 @@ public int findMinArrowShots(int[][] points) { } public static class Solution2 { - /** + /* * I'm glad to have come up with this solution on my own on 10/13/2021: * we'll have to sort the balloons by its ending points, a counter case to this is below: * {{0, 6}, {0, 9}, {7, 8}} @@ -56,7 +57,7 @@ public int findMinArrowShots(int[][] points) { } public static class Solution3 { - /** + /* * Another approach of mine: completely original. * 1. Sort the points by start first, if tie, sort by end, both ascendingly. * 2. While checking, we'll keep updating the ending to be the smaller one so that we don't possibly miss to burst a balloon. See test case 4 for this class. @@ -64,7 +65,12 @@ public static class Solution3 { public int findMinArrowShots(int[][] points) { int arrowShots = 0; - Arrays.sort(points, (a, b) -> a[0] != b[0] ? Integer.compare(a[0], b[0]) : Integer.compare(a[1], b[1])); + Arrays.sort( + points, + (a, b) -> + a[0] != b[0] + ? Integer.compare(a[0], b[0]) + : Integer.compare(a[1], b[1])); for (int i = 0; i < points.length; ) { int end = points[i][1]; int j = i + 1; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_453.java b/src/main/java/com/fishercoder/solutions/firstthousand/_453.java index 7bd8d49909..2c73cc1819 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_453.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_453.java @@ -2,7 +2,7 @@ public class _453 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/66557/java-o-n-solution-short * i.e. Add 1 to n-1 elements basically equals to subtracting 1 from one element. So the easiest way * to make all elements in this array equal is to make all of them equal to the minimum element. @@ -22,5 +22,4 @@ public int minMoves(int[] nums) { return res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_455.java b/src/main/java/com/fishercoder/solutions/firstthousand/_455.java index 6a027de946..3cb560a65c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_455.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_455.java @@ -20,5 +20,4 @@ public int findContentChildren(int[] g, int[] s) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_456.java b/src/main/java/com/fishercoder/solutions/firstthousand/_456.java index da8765aed3..8c1e42dae7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_456.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_456.java @@ -6,7 +6,7 @@ public class _456 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/67881/single-pass-c-o-n-space-and-time-solution-8-lines-with-detailed-explanation * It scans only once, this is the power of using correct data structure. * It goes from the right to the left. @@ -31,5 +31,4 @@ public boolean find132pattern(int[] nums) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_457.java b/src/main/java/com/fishercoder/solutions/firstthousand/_457.java index 4d970351c2..484c82bc61 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_457.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_457.java @@ -2,7 +2,7 @@ public class _457 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/66894/java-slow-fast-pointer-solution */ public boolean circularArrayLoop(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_458.java b/src/main/java/com/fishercoder/solutions/firstthousand/_458.java index c21a42ed73..c7ef33dc88 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_458.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_458.java @@ -16,5 +16,4 @@ public int poorPigs(int buckets, int minutesToDie, int minutesToTest) { return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_459.java b/src/main/java/com/fishercoder/solutions/firstthousand/_459.java index 9e0e9b76f0..750e0feb66 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_459.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_459.java @@ -27,11 +27,11 @@ private String formStringByCopying(String pattern, int k) { } public static class Solution2 { - /** + /* * credit: https://discuss.leetcode.com/topic/68089/repeated-substring-pattern-simple-java-solution-using-kmp */ public static boolean repeatedSubstringPattern(String str) { - //build the KMP pattern. + // build the KMP pattern. int n = str.length(); int cur = 0; int j = 1; @@ -45,7 +45,7 @@ public static boolean repeatedSubstringPattern(String str) { if (cur == 0) { pattern[j++] = 0; } else { - cur = pattern[cur - 1];//start from beginning of current matching pattern. + cur = pattern[cur - 1]; // start from beginning of current matching pattern. } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_46.java b/src/main/java/com/fishercoder/solutions/firstthousand/_46.java index 2a80cde288..f2c22bb05f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_46.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_46.java @@ -30,7 +30,7 @@ private List> recurse(int[] nums, int index, List> r } public static class Solution2 { - /** + /* * My completely original solution on 10/11/2021, although a little verbose and super as efficient as the above one. * Basically, insert the next unused number into all possible positions in the currently formed list, * as soon as the size of this list equals nums.length, add this new permutation into the result; @@ -47,7 +47,8 @@ public List> permute(int[] nums) { return result; } - private void backtracking(List list, int[] nums, Set> ans, boolean[] used) { + private void backtracking( + List list, int[] nums, Set> ans, boolean[] used) { if (list.size() == nums.length) { ans.add(new ArrayList<>(list)); return; @@ -67,7 +68,7 @@ private void backtracking(List list, int[] nums, Set> ans } public static class Solution3 { - /** + /* * A more efficient version of backtracking. */ public List> permute(int[] nums) { @@ -76,7 +77,8 @@ public List> permute(int[] nums) { return backtracking(ans, used, new ArrayList<>(), nums); } - private List> backtracking(List> ans, boolean[] used, List list, int[] nums) { + private List> backtracking( + List> ans, boolean[] used, List list, int[] nums) { if (list.size() == nums.length) { ans.add(new ArrayList<>(list)); return ans; @@ -94,5 +96,4 @@ private List> backtracking(List> ans, boolean[] used return ans; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_460.java b/src/main/java/com/fishercoder/solutions/firstthousand/_460.java index 1be1b03ca7..bf0331925d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_460.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_460.java @@ -5,7 +5,7 @@ public class _460 { public static class Solution1 { - /** + /* * Wikipedia: The simplest method to employ an LFU algorithm is to assign a counter to every * block that is loaded into the cache. Each time a reference is made to that block the counter * is increased by one. When the cache reaches capacity and has a new block waiting to be @@ -15,20 +15,20 @@ public static class Solution1 { */ public static class LFUCache { - /** + /* * credit: https://discuss.leetcode.com/topic/69737/java-o-1-very-easy-solution-using-3-hashmaps-and-linkedhashset/2 */ HashMap keyToValue; - /** + /* * key is the key, value is the value */ HashMap keyToCount; - /** + /* * key is the key, value if the count of the key/value pair */ HashMap> countToLRUKeys; - /** + /* * key is count, value is a set of keys that have the same key, but keeps insertion order */ int cap; @@ -52,7 +52,7 @@ public int get(int key) { countToLRUKeys.get(count).remove(key); if (count == minimumCount && countToLRUKeys.get(count).size() == 0) { - /**This means this key's count equals to current minimumCount + /*This means this key's count equals to current minimumCount * AND * this count doesn't have any entries in the cache. * So, we'll increment minimumCount by 1 to get the next LFU cache entry @@ -74,14 +74,14 @@ public void put(int key, int value) { } if (keyToValue.containsKey(key)) { - /**If the key is already in the cache, we can simply overwrite this entry; + /*If the key is already in the cache, we can simply overwrite this entry; * then call get(key) which will do the update work.*/ keyToValue.put(key, value); get(key); return; } - /**If the key is not in the cache, we'll check the size first, evict the LFU entry first, + /*If the key is not in the cache, we'll check the size first, evict the LFU entry first, * then insert this one into cache.*/ if (keyToValue.size() >= cap) { int evit = countToLRUKeys.get(minimumCount).iterator().next(); @@ -90,10 +90,12 @@ public void put(int key, int value) { } keyToValue.put(key, value); keyToCount.put(key, 1); - countToLRUKeys.get(1).add(key);/**Because we put this key/value into cache for the first time, so its count is 1*/ - minimumCount = 1;/**For the same above reason, minimumCount is of course 1*/ + countToLRUKeys + .get(1) + .add( + key); /*Because we put this key/value into cache for the first time, so its count is 1*/ + minimumCount = 1; /*For the same above reason, minimumCount is of course 1*/ } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_462.java b/src/main/java/com/fishercoder/solutions/firstthousand/_462.java index b48455580c..04bb806629 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_462.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_462.java @@ -6,7 +6,7 @@ public class _462 { public static class Solution1 { public int minMoves2(int[] nums) { - /**sort this array, find the median of this array as the pivot*/ + /*sort this array, find the median of this array as the pivot*/ Arrays.sort(nums); int result = 0; int result1 = 0; @@ -31,5 +31,4 @@ public int minMoves2(int[] nums) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_463.java b/src/main/java/com/fishercoder/solutions/firstthousand/_463.java index 180ce26601..76fc04d526 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_463.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_463.java @@ -6,7 +6,7 @@ public class _463 { public static class Solution1 { - /** + /* * Inspired by this post: https://discuss.leetcode.com/topic/68983/java-9-line-solution-add-4-for-each-land-and-remove-2-for-each-internal-edge * 1. we increment the count by 4 whenever we encounter an island * 2. also, we check in two directions: island's left and island's top, we only check these two directions, @@ -32,7 +32,7 @@ public int islandPerimeter(int[][] grid) { } public static class Solution2 { - /** + /* * My completely original solution on 10/4/2021: * Count the number of island neighbors that each island has, then reduce this number from four and add it to the result. */ @@ -41,12 +41,12 @@ public int islandPerimeter(int[][] grid) { int m = grid.length; int n = grid[0].length; boolean[][] visited = new boolean[m][n]; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 1) { Queue queue = new LinkedList<>(); - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); while (!queue.isEmpty()) { int[] curr = queue.poll(); if (!visited[curr[0]][curr[1]]) { @@ -55,10 +55,14 @@ public int islandPerimeter(int[][] grid) { for (int k = 0; k < directions.length - 1; k++) { int newX = curr[0] + directions[k]; int newY = curr[1] + directions[k + 1]; - if (newX >= 0 && newX < m && newY >= 0 && newY < n && grid[newX][newY] == 1) { + if (newX >= 0 + && newX < m + && newY >= 0 + && newY < n + && grid[newX][newY] == 1) { neighborCount++; if (!visited[newX][newY]) { - queue.offer(new int[]{newX, newY}); + queue.offer(new int[] {newX, newY}); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_464.java b/src/main/java/com/fishercoder/solutions/firstthousand/_464.java index fba06b078d..76fcf632bf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_464.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_464.java @@ -5,7 +5,7 @@ public class _464 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/68896/java-solution-using-hashmap-with-detailed-explanation */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_465.java b/src/main/java/com/fishercoder/solutions/firstthousand/_465.java index ff87d0df65..294e51c1c3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_465.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_465.java @@ -9,7 +9,7 @@ public class _465 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/68948/easy-java-solution-with-explanation */ public int minTransfers(int[][] transactions) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_466.java b/src/main/java/com/fishercoder/solutions/firstthousand/_466.java index 2970e15ebb..506f50718f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_466.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_466.java @@ -3,7 +3,7 @@ public class _466 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/70707/ugly-java-brute-force-solution-but-accepted-1088ms */ public int getMaxRepetitions(String s1, int n1, String s2, int n2) { @@ -30,5 +30,4 @@ public int getMaxRepetitions(String s1, int n1, String s2, int n2) { return count2 / n2; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_467.java b/src/main/java/com/fishercoder/solutions/firstthousand/_467.java index 703e302d86..70afc4ee1b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_467.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_467.java @@ -2,7 +2,7 @@ public class _467 { public static class Solution1 { - /** + /* * A naive solution would definitely result in TLE. * Since the pattern keeps repeating, DP is the way to go. * Because the input consists merely of lowercase English letters, we could maintain an array of size 26, @@ -22,7 +22,8 @@ public int findSubstringInWraproundString(String p) { dp[p.charAt(0) - 'a'] = 1; int len = 1; for (int i = 1; i < p.length(); i++) { - if (p.charAt(i) - 1 == p.charAt(i - 1) || (p.charAt(i) == 'a' && p.charAt(i - 1) == 'z')) { + if (p.charAt(i) - 1 == p.charAt(i - 1) + || (p.charAt(i) == 'a' && p.charAt(i - 1) == 'z')) { len++; } else { len = 1; @@ -36,5 +37,4 @@ public int findSubstringInWraproundString(String p) { return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_468.java b/src/main/java/com/fishercoder/solutions/firstthousand/_468.java index 931d9c2ce2..7b50054583 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_468.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_468.java @@ -46,7 +46,6 @@ private String isValidIPv6(String IP) { } catch (Exception e) { return NEITHER; } - } return "IPv6"; } @@ -86,8 +85,11 @@ private String isValidIPv4(String IP) { } private boolean hasInvalidIPV6Char(String str) { - Set set = new HashSet<>(Arrays.asList('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F')); + Set set = + new HashSet<>( + Arrays.asList( + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', + 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F')); for (char c : str.toCharArray()) { if (!set.contains(c)) { return true; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_469.java b/src/main/java/com/fishercoder/solutions/firstthousand/_469.java index 9e9605303e..9a6ee7736a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_469.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_469.java @@ -5,12 +5,14 @@ public class _469 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/70706/beyond-my-knowledge-java-solution-with-in-line-explanation */ public boolean isConvex(List> points) { - // For each set of three adjacent points A, B, C, find the cross product AB · BC. If the sign of - // all the cross products is the same, the angles are all positive or negative (depending on the + // For each set of three adjacent points A, B, C, find the cross product AB · BC. If the + // sign of + // all the cross products is the same, the angles are all positive or negative + // (depending on the // order in which we visit them) so the polygon is convex. boolean gotNegative = false; boolean gotPositive = false; @@ -42,9 +44,12 @@ public boolean isConvex(List> points) { } // Return the cross product AB x BC. - // The cross product is a vector perpendicular to AB and BC having length |AB| * |BC| * Sin(theta) and - // with direction given by the right-hand rule. For two vectors in the X-Y plane, the result is a - // vector with X and Y components 0 so the Z component gives the vector's length and direction. + // The cross product is a vector perpendicular to AB and BC having length |AB| * |BC| * + // Sin(theta) and + // with direction given by the right-hand rule. For two vectors in the X-Y plane, the result + // is a + // vector with X and Y components 0 so the Z component gives the vector's length and + // direction. private int crossProductLength(int Ax, int Ay, int Bx, int By, int Cx, int Cy) { // Get the vectors' coordinates. int BAx = Ax - Bx; @@ -56,5 +61,4 @@ private int crossProductLength(int Ax, int Ay, int Bx, int By, int Cx, int Cy) { return (BAx * BCy - BAy * BCx); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_47.java b/src/main/java/com/fishercoder/solutions/firstthousand/_47.java index 9d012ccd14..dc337a1a8e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_47.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_47.java @@ -8,7 +8,7 @@ public class _47 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/31445/really-easy-java-solution-much-easier-than-the-solutions-with-very-high-vote */ public List> permuteUnique(int[] nums) { @@ -17,13 +17,15 @@ public List> permuteUnique(int[] nums) { return result; } boolean[] used = new boolean[nums.length]; - Arrays.sort(nums);//this sorting is critical for the correctness of this backtracking algorithm as we compare the two adjacent neighbors to filter out possible duplicate permutations + Arrays.sort(nums); // this sorting is critical for the correctness of this backtracking + // algorithm as we compare the two adjacent neighbors to filter out + // possible duplicate permutations backtracking(nums, used, new ArrayList(), result); return result; } - - private void backtracking(int[] nums, boolean[] used, List list, List> result) { + private void backtracking( + int[] nums, boolean[] used, List list, List> result) { if (list.size() == nums.length) { result.add(new ArrayList(list)); return; @@ -33,7 +35,7 @@ private void backtracking(int[] nums, boolean[] used, List list, List 0 && nums[i - 1] == nums[i] && used[i - 1]) { - /** + /* * For this line, both !used[i-1] and used[i-1] will AC. * It is because the first one makes sure when duplicates are selected, the order is ascending (index from small to large). * However, the second one means the descending order. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_471.java b/src/main/java/com/fishercoder/solutions/firstthousand/_471.java index ef0d80d105..d38dc2bfac 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_471.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_471.java @@ -3,7 +3,7 @@ public class _471 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/71963/accepted-solution-in-java */ public String encode(String s) { @@ -13,25 +13,32 @@ public String encode(String s) { for (int i = 0; i < s.length() - l; i++) { int j = i + l; String substr = s.substring(i, j + 1); - // Checking if string length < 5. In that case, we know that encoding will not help. + // Checking if string length < 5. In that case, we know that encoding will not + // help. if (j - i < 4) { dp[i][j] = substr; } else { dp[i][j] = substr; - // Loop for trying all results that we get after dividing the strings into 2 and combine the results of 2 substrings + // Loop for trying all results that we get after dividing the strings into 2 + // and combine the results of 2 substrings for (int k = i; k < j; k++) { if ((dp[i][k] + dp[k + 1][j]).length() < dp[i][j].length()) { dp[i][j] = dp[i][k] + dp[k + 1][j]; } } - // Loop for checking if string can itself found some pattern in it which could be repeated. + // Loop for checking if string can itself found some pattern in it which + // could be repeated. for (int k = 0; k < substr.length(); k++) { String repeatStr = substr.substring(0, k + 1); if (repeatStr != null && substr.length() % repeatStr.length() == 0 && substr.replaceAll(repeatStr, "").length() == 0) { - String ss = substr.length() / repeatStr.length() + "[" + dp[i][i + k] + "]"; + String ss = + substr.length() / repeatStr.length() + + "[" + + dp[i][i + k] + + "]"; if (ss.length() < dp[i][j].length()) { dp[i][j] = ss; } @@ -43,5 +50,4 @@ public String encode(String s) { return dp[0][s.length() - 1]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_472.java b/src/main/java/com/fishercoder/solutions/firstthousand/_472.java index 925cee1fab..fa1f3f8421 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_472.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_472.java @@ -22,7 +22,9 @@ public List findAllConcatenatedWordsInADict(String[] words) { if (word == null || word.length() == 0) { continue; } - remove(word, root);/** every word is comprised of every word itself, thus this word itself needs to be removed first for checking it*/ + remove( + word, + root); /* every word is comprised of every word itself, thus this word itself needs to be removed first for checking it*/ int n = word.length(); boolean[] dp = new boolean[n + 1]; dp[0] = true; @@ -113,8 +115,7 @@ class TrieNode { boolean isWord; TrieNode[] children = new TrieNode[26]; - public TrieNode() { - } + public TrieNode() {} } } @@ -122,7 +123,7 @@ public static class Solution2 { public List findAllConcatenatedWordsInADict(String[] words) { List result = new ArrayList<>(); Set preWords = new HashSet<>(); - /**Words could only be formed by other words that are shorter than itself, so we sort them based on their lengths first.*/ + /*Words could only be formed by other words that are shorter than itself, so we sort them based on their lengths first.*/ Arrays.sort(words, (s1, s2) -> s1.length() - s2.length()); for (int i = 0; i < words.length; i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_473.java b/src/main/java/com/fishercoder/solutions/firstthousand/_473.java index 54d31de669..7f39f75407 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_473.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_473.java @@ -5,7 +5,7 @@ public class _473 { public static class Solution1 { - /** + /* * Partially inspired by: https://discuss.leetcode.com/topic/72107/java-dfs-solution-with-explanation/2 * One hidden requirement: you'll have to use up all of the given matchsticks, nothing could be left behind. */ @@ -58,5 +58,4 @@ private void reverse(int[] nums) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_474.java b/src/main/java/com/fishercoder/solutions/firstthousand/_474.java index 3fd2cab962..2020f65af1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_474.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_474.java @@ -2,7 +2,7 @@ public class _474 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/ones-and-zeroes/discuss/95811/Java-Iterative-DP-Solution-O(mn)-Space and * https://leetcode.com/problems/ones-and-zeroes/discuss/95811/Java-Iterative-DP-Solution-O(mn)-Space/100352 *

@@ -36,5 +36,4 @@ private int[] count(String str) { return res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_475.java b/src/main/java/com/fishercoder/solutions/firstthousand/_475.java index 8654d08251..78b751c27c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_475.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_475.java @@ -5,7 +5,8 @@ public class _475 { public static class Solution1 { - //credit: https://discuss.leetcode.com/topic/71460/short-and-clean-java-binary-search-solution + // credit: + // https://discuss.leetcode.com/topic/71460/short-and-clean-java-binary-search-solution public int findRadius(int[] houses, int[] heaters) { Arrays.sort(heaters); int radius = Integer.MIN_VALUE; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_477.java b/src/main/java/com/fishercoder/solutions/firstthousand/_477.java index d8200514a1..8245642a58 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_477.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_477.java @@ -20,5 +20,4 @@ public int totalHammingDistance(int[] nums) { return r; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_478.java b/src/main/java/com/fishercoder/solutions/firstthousand/_478.java index 3fb33205ac..29e8def87d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_478.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_478.java @@ -2,7 +2,7 @@ public class _478 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/generate-random-point-in-a-circle/discuss/154037/Polar-Coordinates-10-lines * and * https://leetcode.com/problems/generate-random-point-in-a-circle/discuss/155650/Explanation-with-Graphs-why-using-Math.sqrt() @@ -22,12 +22,12 @@ public double[] randPoint() { double degree = Math.random() * 2 * Math.PI; double x = xCenter + len * Math.cos(degree); double y = yCenter + len * Math.sin(degree); - return new double[]{x, y}; + return new double[] {x, y}; } } public static class Solution2 { - /** + /* * How to know one point is within a circle: * https://www.geeksforgeeks.org/find-if-a-point-lies-inside-or-on-circle/ */ @@ -53,7 +53,8 @@ public double[] randPoint() { double[] result = new double[2]; result[0] = (Math.random() * (right - left)) + left; result[1] = (Math.random() * (top - bottom)) + bottom; - while (Math.pow(result[0] - xCenter, 2.0) + Math.pow(result[1] - yCenter, 2.0) > Math.pow(rad, 2.0)) { + while (Math.pow(result[0] - xCenter, 2.0) + Math.pow(result[1] - yCenter, 2.0) + > Math.pow(rad, 2.0)) { result[0] = (Math.random() * (right - left)) + left; result[1] = (Math.random() * (top - bottom)) + bottom; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_479.java b/src/main/java/com/fishercoder/solutions/firstthousand/_479.java index 7e2937313d..dc565e06fd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_479.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_479.java @@ -2,7 +2,7 @@ public class _479 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/74125/java-solution-using-assumed-max-palindrom */ public int largestPalindrome(int n) { @@ -30,7 +30,8 @@ public int largestPalindrome(int n) { // here i and palindrom/i forms the two factor of assumed palindrom for (long i = upperBound; upperBound > lowerBound; i--) { - // if n= 3 none of the factor of palindrom can be more than 999 or less than square root of assumed palindrom + // if n= 3 none of the factor of palindrom can be more than 999 or less than + // square root of assumed palindrom if (palindrom / i > maxNumber || i * i < palindrom) { break; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_48.java b/src/main/java/com/fishercoder/solutions/firstthousand/_48.java index ef111ff5da..75c10565f5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_48.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_48.java @@ -4,15 +4,15 @@ public class _48 { - /** + /* * Note: this is an n*n matrix, in other words, it's a square, this makes it easier as well. */ public static class Solution1 { - //Time: O(n^2) - //Space: O(1) + // Time: O(n^2) + // Space: O(1) public void rotate(int[][] matrix) { - /**First swap the elements on the diagonal, then reverse each row: + /*First swap the elements on the diagonal, then reverse each row: * 1, 2, 3 1, 4, 7 7, 4, 1 * 4, 5, 6 becomes 2, 5, 8 becomes 8, 5, 2 * 7, 8, 9 3, 6, 9 9, 6, 3 @@ -20,7 +20,7 @@ public void rotate(int[][] matrix) { int m = matrix.length; for (int i = 0; i < m; i++) { for (int j = i; j < m; j++) { - /**ATTN: j starts from i, so that the diagonal changes with itself, results in no change.*/ + /*ATTN: j starts from i, so that the diagonal changes with itself, results in no change.*/ int tmp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = tmp; @@ -28,7 +28,7 @@ public void rotate(int[][] matrix) { } CommonUtils.print2DIntArray(matrix); - /**then reverse*/ + /*then reverse*/ for (int i = 0; i < m; i++) { int left = 0; int right = m - 1; @@ -44,7 +44,7 @@ public void rotate(int[][] matrix) { } public static class Solution2 { - /** + /* * First swap the rows bottom up, then swap the element on the diagonal: *

* 1, 2, 3 7, 8, 9 7, 4, 1 @@ -78,7 +78,7 @@ public void rotate(int[][] matrix) { } public static class Solution3 { - /** + /* * You only need to rotate the top right quarter, * with this example: * {1, 2, 3, 4}, @@ -101,24 +101,23 @@ public void rotate(int[][] matrix) { int n = matrix.length; for (int i = 0; i < n / 2; i++) { for (int j = i; j < n - i - 1; j++) { - //save the top left + // save the top left int top = matrix[i][j]; System.out.println("top = " + top); - //move bottom left to top left + // move bottom left to top left matrix[i][j] = matrix[n - 1 - j][i]; - //move bottom right to bottom left + // move bottom right to bottom left matrix[n - 1 - j][i] = matrix[n - i - 1][n - 1 - j]; - //move top right to bottom right + // move top right to bottom right matrix[n - i - 1][n - 1 - j] = matrix[j][n - i - 1]; - //move top left to top right + // move top left to top right matrix[j][n - i - 1] = top; } } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_480.java b/src/main/java/com/fishercoder/solutions/firstthousand/_480.java index 0770991394..5c7c9523d4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_480.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_480.java @@ -6,7 +6,7 @@ public class _480 { public static class Solution1 { - /** + /* * You cannot simply use minus sign '-' to denote the descending order, because e.g. 3 and -3 might both exist in this array, * so we'll have to use the original numbers themselves to store in the heaps. */ @@ -73,5 +73,4 @@ private void add(int num) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_481.java b/src/main/java/com/fishercoder/solutions/firstthousand/_481.java index 53fcf8217c..360c317e0d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_481.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_481.java @@ -3,7 +3,7 @@ public class _481 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/74917/simple-java-solution-using-one-array-and-two-pointers * Algorithm: *

@@ -46,5 +46,4 @@ public int magicalString(int n) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_482.java b/src/main/java/com/fishercoder/solutions/firstthousand/_482.java index a9fcd8f726..50aebb9f45 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_482.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_482.java @@ -21,7 +21,8 @@ public String licenseKeyFormatting(String S, int K) { stringBuilder.append('-'); } } - if (stringBuilder.length() > 1 && stringBuilder.substring(stringBuilder.length() - 1).equals("-")) { + if (stringBuilder.length() > 1 + && stringBuilder.substring(stringBuilder.length() - 1).equals("-")) { return stringBuilder.reverse().substring(1); } return stringBuilder.reverse().toString(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_483.java b/src/main/java/com/fishercoder/solutions/firstthousand/_483.java index 561c3090d7..e1f73ea7c3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_483.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_483.java @@ -5,7 +5,7 @@ public class _483 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/82130/java-solution-with-hand-writing-explain */ public String smallestGoodBase(String n) { @@ -19,7 +19,9 @@ public String smallestGoodBase(String n) { BigInteger left = BigInteger.valueOf(m); left = left.pow(k).subtract(BigInteger.ONE); - BigInteger right = BigInteger.valueOf(nn).multiply(BigInteger.valueOf(m).subtract(BigInteger.ONE)); + BigInteger right = + BigInteger.valueOf(nn) + .multiply(BigInteger.valueOf(m).subtract(BigInteger.ONE)); int cmr = left.compareTo(right); if (cmr == 0) { res = m; @@ -38,5 +40,4 @@ public String smallestGoodBase(String n) { return "" + res; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_484.java b/src/main/java/com/fishercoder/solutions/firstthousand/_484.java index 59f243173b..ccecf545de 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_484.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_484.java @@ -3,7 +3,7 @@ public class _484 { public static class Solution1 { - /** + /* * credit:https://discuss.leetcode.com/topic/76221/java-o-n-clean-solution-easy-to-understand *

* For example, given IDIIDD we start with sorted sequence 1234567 @@ -42,5 +42,4 @@ private void reverse(int[] result, int left, int i) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_485.java b/src/main/java/com/fishercoder/solutions/firstthousand/_485.java index e1d85498b0..f9fe998bee 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_485.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_485.java @@ -17,7 +17,7 @@ public int findMaxConsecutiveOnes(int[] nums) { } public static class Solution2 { - /** + /* * Apply the sliding window template, i.e. two pointer technique. */ public int findMaxConsecutiveOnes(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_486.java b/src/main/java/com/fishercoder/solutions/firstthousand/_486.java index cde5c71619..cfccceeb5b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_486.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_486.java @@ -3,7 +3,7 @@ public class _486 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/76312/java-1-line-recursion-solution * Explanation * So assuming the sum of the array it SUM, so eventually player1 and player2 will split the SUM between themselves. @@ -24,12 +24,14 @@ public boolean predictTheWinner(int[] nums) { private int helper(int[] nums, int start, int end, Integer[][] mem) { if (mem[start][end] == null) { - mem[start][end] = start == end ? nums[end] : - Math.max(nums[end] - helper(nums, start, end - 1, mem), - nums[start] - helper(nums, start + 1, end, mem)); + mem[start][end] = + start == end + ? nums[end] + : Math.max( + nums[end] - helper(nums, start, end - 1, mem), + nums[start] - helper(nums, start + 1, end, mem)); } return mem[start][end]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_487.java b/src/main/java/com/fishercoder/solutions/firstthousand/_487.java index fb3e80db5a..42648fcab2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_487.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_487.java @@ -3,7 +3,7 @@ public class _487 { public static class Solution1 { - /** + /* * I implemented this on my own after a quick read from https://leetcode.com/problems/max-consecutive-ones-ii/solution/ */ public static int findMaxConsecutiveOnes(int[] nums) { @@ -32,7 +32,7 @@ public static int findMaxConsecutiveOnes(int[] nums) { } public static class Solution2 { - /** + /* * This is a more generic solution adapted from https://leetcode.com/problems/max-consecutive-ones-iii/, just set k = 1 here. */ public static int findMaxConsecutiveOnes(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_488.java b/src/main/java/com/fishercoder/solutions/firstthousand/_488.java index 95f181a6a3..4d1f23877f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_488.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_488.java @@ -4,19 +4,23 @@ public class _488 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/79820/short-java-solution-beats-98 * Two layer of recursion, pretty cool! */ - int maxcount = 6; // the max balls you need will not exceed 6 since "The number of balls in your hand won't exceed 5" + int maxcount = + 6; // the max balls you need will not exceed 6 since "The number of balls in your + + // hand won't exceed 5" public int findMinStep(String board, String hand) { int[] handCount = new int[26]; for (int i = 0; i < hand.length(); ++i) { ++handCount[hand.charAt(i) - 'A']; } - int result = dfs(board + "#", handCount); // append a "#" to avoid special process while j==board.length, make the code shorter. + int result = dfs(board + "#", handCount); // append a "#" to avoid special process while + // j==board.length, make the code shorter. return result == maxcount ? -1 : result; } @@ -31,10 +35,13 @@ private int dfs(String s, int[] handCount) { if (s.charAt(j) == s.charAt(i)) { continue; } - need = 3 - (j - i); //balls need to remove current consecutive balls. + need = 3 - (j - i); // balls need to remove current consecutive balls. if (handCount[s.charAt(i) - 'A'] >= need) { handCount[s.charAt(i) - 'A'] -= need; - result = Math.min(result, need + dfs(s.substring(0, i) + s.substring(j), handCount)); + result = + Math.min( + result, + need + dfs(s.substring(0, i) + s.substring(j), handCount)); handCount[s.charAt(i) - 'A'] += need; } i = j; @@ -42,7 +49,7 @@ private int dfs(String s, int[] handCount) { return result; } - //remove consecutive balls longer than 3 + // remove consecutive balls longer than 3 private String removeConsecutive(String board) { for (int i = 0, j = 0; j < board.length(); ++j) { if (board.charAt(j) == board.charAt(i)) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_49.java b/src/main/java/com/fishercoder/solutions/firstthousand/_49.java index d035498b5e..39dade76d0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_49.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_49.java @@ -9,7 +9,7 @@ public class _49 { public static class Solution1 { - /** + /* * Time: O(n*k*logk) where n is the # of strings in the given input and k is the maximum length of each string */ public List> groupAnagrams(String[] strs) { @@ -28,7 +28,7 @@ public List> groupAnagrams(String[] strs) { } public static class Solution2 { - /** + /* * This is an improvement to the above solution in terms of time complexity. * Time: O(n*k) where n is the # of strings in the given input and k is the maximum length of each string */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_490.java b/src/main/java/com/fishercoder/solutions/firstthousand/_490.java index 87c4cd8ccd..94313474ca 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_490.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_490.java @@ -4,7 +4,7 @@ import java.util.Queue; public class _490 { - /** + /* * BFS: the key part of this algorithm is that: this is a ball that won't stop rolling until it hits a wall. * This means we'll have to store all the empty spaces where the ball was forced to stop into the queue, these are * the only places where the next starting points could be. @@ -16,7 +16,7 @@ public boolean hasPath(int[][] maze, int[] start, int[] destination) { if (start[0] == destination[0] && destination[0] == destination[1]) { return true; } - final int[] directions = new int[]{-1, 0, 1, 0, -1}; + final int[] directions = new int[] {-1, 0, 1, 0, -1}; Queue queue = new LinkedList<>(); queue.offer(new Point(start[0], start[1])); int m = maze.length; @@ -27,10 +27,10 @@ public boolean hasPath(int[][] maze, int[] start, int[] destination) { while (!queue.isEmpty()) { Point curr = queue.poll(); int x = curr.x; - int y = curr.y;//keep the original value + int y = curr.y; // keep the original value for (int i = 0; i < directions.length - 1; i++) { int xx = x; - int yy = y;//use temp variables to move + int yy = y; // use temp variables to move while (xx >= 0 && yy >= 0 && xx < m && yy < n && maze[xx][yy] == 0) { xx += directions[i]; yy += directions[i + 1]; @@ -59,4 +59,4 @@ public Point(int x, int y) { this.y = y; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_491.java b/src/main/java/com/fishercoder/solutions/firstthousand/_491.java index 98c40647d5..ffdf1f6630 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_491.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_491.java @@ -17,8 +17,8 @@ public List> findSubsequences(int[] nums) { return new ArrayList<>(backtracking(nums, 0, list, answer)); } - private Set> backtracking(int[] nums, int start, List currList, - Set> answer) { + private Set> backtracking( + int[] nums, int start, List currList, Set> answer) { if (currList.size() >= 2) { answer.add(new ArrayList<>(currList)); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_492.java b/src/main/java/com/fishercoder/solutions/firstthousand/_492.java index 0fea654008..2c2930b94b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_492.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_492.java @@ -21,5 +21,4 @@ public int[] constructRectangle(int area) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_493.java b/src/main/java/com/fishercoder/solutions/firstthousand/_493.java index 733a588b92..3e7dec3dc2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_493.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_493.java @@ -6,7 +6,7 @@ public class _493 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/78933/very-short-and-clear-mergesort-bst-java-solutions */ public int reversePairs(int[] nums) { @@ -20,7 +20,7 @@ private int mergeSort(int[] nums, int start, int end) { int mid = start + (end - start) / 2; int cnt = mergeSort(nums, start, mid) + mergeSort(nums, mid + 1, end); for (int i = start, j = mid + 1; i <= mid; i++) { - /**it has to be 2.0 instead of 2, otherwise it's going to stack overflow, i.e. test3 is going to fail*/ + /*it has to be 2.0 instead of 2, otherwise it's going to stack overflow, i.e. test3 is going to fail*/ while (j <= end && nums[i] > nums[j] * 2.0) { j++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_494.java b/src/main/java/com/fishercoder/solutions/firstthousand/_494.java index d7b5f25efa..e36f6caa49 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_494.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_494.java @@ -18,5 +18,4 @@ private int find(int p, int[] nums, int sum) { return find(p + 1, nums, sum + nums[p]) + find(p + 1, nums, sum - nums[p]); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_495.java b/src/main/java/com/fishercoder/solutions/firstthousand/_495.java index 8d16302a7d..f285843a0d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_495.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_495.java @@ -15,9 +15,8 @@ public int findPoisonedDuration(int[] timeSeries, int duration) { totalDuration += (timeSeries[i + 1] - timeSeries[i]); } } - totalDuration += duration;//plus the last one duration + totalDuration += duration; // plus the last one duration return totalDuration; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_496.java b/src/main/java/com/fishercoder/solutions/firstthousand/_496.java index 3d03e46b47..db94ed98c1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_496.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_496.java @@ -31,7 +31,7 @@ public int[] nextGreaterElement(int[] nums1, int[] nums2) { } public static class Solution2 { - /** + /* * Use monotonic stack, using a pen and paper to help visualize this is a great help! */ public int[] nextGreaterElement(int[] nums1, int[] nums2) { @@ -55,5 +55,4 @@ public int[] nextGreaterElement(int[] nums1, int[] nums2) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_498.java b/src/main/java/com/fishercoder/solutions/firstthousand/_498.java index 974e5e2e29..90c005a474 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_498.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_498.java @@ -7,7 +7,7 @@ public class _498 { public static class Solutoin1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/77865/concise-java-solution/2 * Just keep walking the matrix, when hitting the four borders (top, bottom, left or right), * change directions and keep walking: @@ -24,9 +24,9 @@ public int[] findDiagonalOrder(int[][] mat) { int m = mat.length; int n = mat[0].length; int[] result = new int[m * n]; - //{-1,1} goes from top left to bottom right - //{1,-1} goes from top right to bottom left - int[][] dirs = new int[][]{{-1, 1}, {1, -1}}; + // {-1,1} goes from top left to bottom right + // {1,-1} goes from top right to bottom left + int[][] dirs = new int[][] {{-1, 1}, {1, -1}}; int i = 0; int j = 0; int d = 0; @@ -71,7 +71,10 @@ public int[] findDiagonalOrder(int[][] matrix) { int curRowIdx = (diagonalIndex < maxCol) ? 0 : (diagonalIndex - maxCol + 1); int curColIdx = (diagonalIndex < maxCol) ? diagonalIndex : (maxCol - 1); List diagonal = new ArrayList<>(); - while (curRowIdx >= 0 && curRowIdx < maxRow && curColIdx >= 0 && curColIdx < maxCol) { + while (curRowIdx >= 0 + && curRowIdx < maxRow + && curColIdx >= 0 + && curColIdx < maxCol) { int diagonalElement = matrix[curRowIdx][curColIdx]; diagonal.add(diagonalElement); curRowIdx++; @@ -94,5 +97,4 @@ public int[] findDiagonalOrder(int[][] matrix) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_499.java b/src/main/java/com/fishercoder/solutions/firstthousand/_499.java index d16ecf1c91..57f0c6fec9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_499.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_499.java @@ -5,34 +5,40 @@ public class _499 { public static class Solutoin1 { - /** + /* * credit: https://discuss.leetcode.com/topic/77474/similar-to-the-maze-ii-easy-understanding-java-bfs-solution */ public String findShortestWay(int[][] maze, int[] ball, int[] hole) { - final int[] directions = new int[]{-1, 0, 1, 0, -1}; + final int[] directions = new int[] {-1, 0, 1, 0, -1}; Queue heap = new PriorityQueue<>(); heap.offer(new Point(ball[0], ball[1], 0, "")); int m = maze.length; int n = maze[0].length; Point[][] points = new Point[m][n]; for (int i = 0; i < m * n; i++) { - points[i / n][i % n] = new Point(i / n, i % n);//initialize the length array + points[i / n][i % n] = new Point(i / n, i % n); // initialize the length array } - String[] ds = new String[]{"u", "r", "d", "l"}; + String[] ds = new String[] {"u", "r", "d", "l"}; while (!heap.isEmpty()) { Point curr = heap.poll(); if (points[curr.x][curr.y].compareTo(curr) <= 0) { - continue;//if we have already found a shorter route + continue; // if we have already found a shorter route } points[curr.x][curr.y] = curr; for (int i = 0; i < directions.length - 1; i++) { int x = curr.x; int y = curr.y; - int distance = curr.distance;//use temp variables to move - //we need below while loop to find only "stop" points that could be put into the queue - while (x >= 0 && y >= 0 && x < m && y < n && maze[x][y] == 0 && (x != hole[0] || y != hole[1])) { + int distance = curr.distance; // use temp variables to move + // we need below while loop to find only "stop" points that could be put into + // the queue + while (x >= 0 + && y >= 0 + && x < m + && y < n + && maze[x][y] == 0 + && (x != hole[0] || y != hole[1])) { x += directions[i]; y += directions[i + 1]; distance++; @@ -45,7 +51,9 @@ public String findShortestWay(int[][] maze, int[] ball, int[] hole) { heap.offer(new Point(x, y, distance, curr.path + ds[i])); } } - return points[hole[0]][hole[1]].distance == Integer.MAX_VALUE ? "impossible" : points[hole[0]][hole[1]].path; + return points[hole[0]][hole[1]].distance == Integer.MAX_VALUE + ? "impossible" + : points[hole[0]][hole[1]].path; } class Point implements Comparable { @@ -70,7 +78,9 @@ public Point(int x, int y, int distance, String path) { @Override public int compareTo(Point o) { - return (this.distance == o.distance) ? this.path.compareTo(o.path) : this.distance - o.distance; + return (this.distance == o.distance) + ? this.path.compareTo(o.path) + : this.distance - o.distance; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_5.java b/src/main/java/com/fishercoder/solutions/firstthousand/_5.java index 2c51c8a600..0449c53c17 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_5.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_5.java @@ -13,7 +13,8 @@ public String longestPalindrome(String s) { } for (int i = 0; i < len - 1; i++) { - extendPalindrome(s, i, i); // assume odd length, try to extend Palindrome as possible + extendPalindrome( + s, i, i); // assume odd length, try to extend Palindrome as possible extendPalindrome(s, i, i + 1); // assume even length. } return s.substring(low, low + maxLen); @@ -32,7 +33,7 @@ private void extendPalindrome(String s, int left, int right) { } public static class Solution2 { - /** + /* * Same sliding window idea, but without using global variables. * Credit: https://leetcode.com/problems/longest-palindromic-substring/solution/ */ @@ -63,7 +64,7 @@ private int expand(String s, int left, int right) { } public static class Solution3 { - /** + /* * My own implementation using the same idea. */ public String longestPalindrome(String s) { @@ -94,6 +95,5 @@ private int[] expand(String s, int l, int r) { } return pair; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_50.java b/src/main/java/com/fishercoder/solutions/firstthousand/_50.java index 46ef1e802f..7a8b5343fb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_50.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_50.java @@ -3,7 +3,7 @@ public class _50 { public static class Solution1 { - /** + /* * Time: O(logn) * Space: O(logn) */ @@ -30,7 +30,7 @@ private double fastPow(double x, long n) { } public static class Solution2 { - /** + /* * Time: O(logn) * Space: O(1) */ @@ -53,7 +53,7 @@ public double myPow(double x, int n) { } public static class Solution3 { - /** + /* * credit: https://leetcode.com/problems/powx-n/solutions/19546/short-and-easy-to-understand-solution/comments/162293 */ public double myPow(double x, int n) { @@ -61,7 +61,7 @@ public double myPow(double x, int n) { return 1; } if (n < 0) { - //this is to avoid integer overflow + // this is to avoid integer overflow return 1 / x * myPow(1 / x, -(n + 1)); } if (n % 2 == 0) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_500.java b/src/main/java/com/fishercoder/solutions/firstthousand/_500.java index b46e1cf070..ee4ecba7a2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_500.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_500.java @@ -9,8 +9,10 @@ public class _500 { public String[] findWords(String[] words) { - final Set row1 = new HashSet<>(Arrays.asList('q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p')); - final Set row2 = new HashSet<>(Arrays.asList('a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l')); + final Set row1 = + new HashSet<>(Arrays.asList('q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p')); + final Set row2 = + new HashSet<>(Arrays.asList('a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l')); final Set row3 = new HashSet<>(Arrays.asList('z', 'x', 'c', 'v', 'b', 'n', 'm')); final List> setList = Arrays.asList(row1, row2, row3); List wordList = new ArrayList<>(); @@ -37,5 +39,4 @@ public String[] findWords(String[] words) { } return result; } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_501.java b/src/main/java/com/fishercoder/solutions/firstthousand/_501.java index c8afa2dcf3..5509681b3f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_501.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_501.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -13,7 +12,7 @@ public class _501 { public static class Solution1 { public int[] findMode(TreeNode root) { - int[] result = new int[]{}; + int[] result = new int[] {}; Map map = new HashMap(); if (root == null) { return result; @@ -89,5 +88,4 @@ private void dfs(TreeNode root, Map map) { dfs(root.right, map); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_502.java b/src/main/java/com/fishercoder/solutions/firstthousand/_502.java index 3df80380ef..546a3dba33 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_502.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_502.java @@ -5,14 +5,14 @@ public class _502 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/77768/very-simple-greedy-java-solution-using-two-priorityqueues */ public int findMaximizedCapital(int k, int W, int[] Profits, int[] Capital) { PriorityQueue capitalHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]); PriorityQueue profitHeap = new PriorityQueue<>((a, b) -> b[1] - a[1]); for (int i = 0; i < Profits.length; i++) { - capitalHeap.add(new int[]{Capital[i], Profits[i]}); + capitalHeap.add(new int[] {Capital[i], Profits[i]}); } while (k-- > 0) { while (!capitalHeap.isEmpty() && capitalHeap.peek()[0] <= W) { @@ -26,5 +26,4 @@ public int findMaximizedCapital(int k, int W, int[] Profits, int[] Capital) { return W; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_503.java b/src/main/java/com/fishercoder/solutions/firstthousand/_503.java index ce6509167b..e701d408cc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_503.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_503.java @@ -5,7 +5,7 @@ public class _503 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/77881/typical-ways-to-solve-circular-array-problems-java-solution * Note: we store INDEX into the stack, reversely, the larger index put at the bottom of the stack, the smaller index at the top */ @@ -17,12 +17,13 @@ public int[] nextGreaterElements(int[] nums) { Stack stack = new Stack<>(); for (int i = len - 1; i >= 0; i--) { stack.push(i); - //push all indexes into the stack reversely + // push all indexes into the stack reversely } int[] result = new int[len]; for (int i = len - 1; i >= 0; i--) { result[i] = -1; - //initialize it to be -1 in case we cannot find its next greater element in the array + // initialize it to be -1 in case we cannot find its next greater element in the + // array while (!stack.isEmpty() && (nums[stack.peek()] <= nums[i])) { stack.pop(); } @@ -36,7 +37,7 @@ public int[] nextGreaterElements(int[] nums) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/articles/next-greater-element-ii/ */ public int[] nextGreaterElements(int[] nums) { @@ -52,5 +53,4 @@ public int[] nextGreaterElements(int[] nums) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_505.java b/src/main/java/com/fishercoder/solutions/firstthousand/_505.java index 73c6a0af93..0875f62e47 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_505.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_505.java @@ -6,20 +6,20 @@ public class _505 { public static class Solution1 { - /** + /* * The difference between II and I of this problem: * the extra array is not boolean type any more, but int type, and it's recording the length of each point to start point. */ public int shortestDistance(int[][] maze, int[] start, int[] destination) { - final int[] directions = new int[]{-1, 0, 1, 0, -1}; + final int[] directions = new int[] {-1, 0, 1, 0, -1}; Queue queue = new LinkedList<>(); queue.offer(new Point(start[0], start[1], 0)); int m = maze.length; int n = maze[0].length; int[][] length = new int[m][n]; for (int i = 0; i < m * n; i++) { - length[i / n][i % n] = Integer.MAX_VALUE;//initialize the length array + length[i / n][i % n] = Integer.MAX_VALUE; // initialize the length array } while (!queue.isEmpty()) { @@ -31,8 +31,9 @@ public int shortestDistance(int[][] maze, int[] start, int[] destination) { for (int i = 0; i < directions.length - 1; i++) { int x = curr.x; int y = curr.y; - int distance = curr.distance;//use temp variables to move - //we need below while loop to find only "stop" points that could be put into the queue + int distance = curr.distance; // use temp variables to move + // we need below while loop to find only "stop" points that could be put into + // the queue while (x >= 0 && y >= 0 && x < m && y < n && maze[x][y] == 0) { x += directions[i]; y += directions[i + 1]; @@ -44,8 +45,9 @@ public int shortestDistance(int[][] maze, int[] start, int[] destination) { queue.offer(new Point(x, y, distance)); } } - return length[destination[0]][destination[1]] == Integer.MAX_VALUE ? -1 : length[destination[0]][destination[1]]; - + return length[destination[0]][destination[1]] == Integer.MAX_VALUE + ? -1 + : length[destination[0]][destination[1]]; } class Point { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_506.java b/src/main/java/com/fishercoder/solutions/firstthousand/_506.java index 8b385e30e8..2006cacb3c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_506.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_506.java @@ -33,5 +33,4 @@ public String[] findRelativeRanks(int[] nums) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_508.java b/src/main/java/com/fishercoder/solutions/firstthousand/_508.java index bcaac8c6f0..55d9ae90ce 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_508.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_508.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -12,10 +11,10 @@ public class _508 { public static class Solution1 { - //my purely original but verbose solution + // my purely original but verbose solution public int[] findFrequentTreeSum(TreeNode root) { if (root == null) { - return new int[]{}; + return new int[] {}; } Map map = new HashMap(); @@ -23,7 +22,9 @@ public int[] findFrequentTreeSum(TreeNode root) { Map frequencyMap = new HashMap<>(); for (Map.Entry entry : map.entrySet()) { - frequencyMap.put((Integer) entry.getValue(), frequencyMap.getOrDefault(entry.getValue(), 0) + 1); + frequencyMap.put( + (Integer) entry.getValue(), + frequencyMap.getOrDefault(entry.getValue(), 0) + 1); } List> list = new LinkedList<>(frequencyMap.entrySet()); @@ -66,7 +67,7 @@ private int postOrder(TreeNode root, Map map) { } public static class Solution2 { - //my 2nd purely original but verbose solution + // my 2nd purely original but verbose solution public int[] findFrequentTreeSum(TreeNode root) { Map map = new HashMap<>(); dfs(root, map); @@ -114,7 +115,7 @@ private int dfs(TreeNode root, Map map) { } public static class Solution3 { - /** + /* * Use post-order traversal for this problem as it needs to process subtree first before processing the root. */ Map map = new HashMap<>(); @@ -146,6 +147,8 @@ private int postOrder(TreeNode root) { } } - //a more concise and space-efficient solution: https://discuss.leetcode.com/topic/77775/verbose-java-solution-postorder-traverse-hashmap-18ms - //the key difference between the above post and my original solution is that it's using Frequency as the key of the HashMap + // a more concise and space-efficient solution: + // https://discuss.leetcode.com/topic/77775/verbose-java-solution-postorder-traverse-hashmap-18ms + // the key difference between the above post and my original solution is that it's using + // Frequency as the key of the HashMap } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_509.java b/src/main/java/com/fishercoder/solutions/firstthousand/_509.java index 4d686fd0f2..14e2402aff 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_509.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_509.java @@ -5,7 +5,7 @@ public class _509 { public static class Solution1 { - /** + /* * Time: O(n) * Space: O(n) */ @@ -21,7 +21,7 @@ public int fib(int N) { } public static class Solution2 { - /** + /* * Time: O(n) * Space: O(n) */ @@ -40,7 +40,7 @@ public int fib(int N) { } public static class Solution3 { - /** + /* * Time: O(n) * Space: O(1) */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_513.java b/src/main/java/com/fishercoder/solutions/firstthousand/_513.java index 5ed9a75a3b..639320114d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_513.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_513.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_515.java b/src/main/java/com/fishercoder/solutions/firstthousand/_515.java index 63c07c2cb2..99e844aa6b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_515.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_515.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -43,7 +42,6 @@ public List largestValues(TreeNode root) { } dfs(root, res, 0); return res; - } public void dfs(TreeNode root, List res, int level) { @@ -58,5 +56,4 @@ public void dfs(TreeNode root, List res, int level) { dfs(root.right, res, level + 1); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_516.java b/src/main/java/com/fishercoder/solutions/firstthousand/_516.java index 3939c2f485..014aa3629b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_516.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_516.java @@ -3,7 +3,7 @@ public class _516 { public static class Solution1 { - /** + /* * Inspired by https://discuss.leetcode.com/topic/78603/straight-forward-java-dp-solution * dp[i][j] means the longest palindromic subsequence's length of substring(i, j) * so, in the end, we return dp[0][s.length() - 1] which means the longest palindromic subsequence @@ -12,7 +12,7 @@ public static class Solution1 { public int longestPalindromeSubseq(String s) { int[][] dp = new int[s.length()][s.length()]; for (int i = s.length() - 1; i >= 0; i--) { - dp[i][i] = 1;//initialization + dp[i][i] = 1; // initialization for (int j = i + 1; j < s.length(); j++) { if (s.charAt(i) == s.charAt(j)) { dp[i][j] = dp[i + 1][j - 1] + 2; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_517.java b/src/main/java/com/fishercoder/solutions/firstthousand/_517.java index 0e6cba43b2..8e0676d97f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_517.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_517.java @@ -2,7 +2,7 @@ public class _517 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/79938/super-short-easy-java-o-n-solution */ public int findMinMoves(int[] machines) { @@ -17,7 +17,7 @@ public int findMinMoves(int[] machines) { int cnt = 0; int max = 0; for (int load : machines) { - cnt += load - avg; //load-avg is "gain/lose" + cnt += load - avg; // load-avg is "gain/lose" max = Math.max(Math.max(max, Math.abs(cnt)), load - avg); } return max; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_519.java b/src/main/java/com/fishercoder/solutions/firstthousand/_519.java index 9894c18598..a7a070c15a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_519.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_519.java @@ -26,7 +26,7 @@ public int[] flip() { i = random.nextInt(m); j = random.nextInt(n); } - return new int[]{i, j}; + return new int[] {i, j}; } public void reset() { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_52.java b/src/main/java/com/fishercoder/solutions/firstthousand/_52.java index 278cb9cd9b..3e6f189f5b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_52.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_52.java @@ -3,7 +3,7 @@ public class _52 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/29626/easiest-java-solution-1ms-98-22 */ int count = 0; @@ -16,8 +16,8 @@ public int totalNQueens(int n) { return count; } - private void backtracking(int row, boolean[] cols, boolean[] diagnol, boolean[] antiDiagnol, - int n) { + private void backtracking( + int row, boolean[] cols, boolean[] diagnol, boolean[] antiDiagnol, int n) { if (row == n) { count++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_520.java b/src/main/java/com/fishercoder/solutions/firstthousand/_520.java index c68fcfe0d9..796def71ee 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_520.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_520.java @@ -13,7 +13,7 @@ public boolean detectCapitalUse(String word) { if (words.length >= 2) { int i = 2; if (Character.isUpperCase(words[1])) { - //then all following must be all uppercase + // then all following must be all uppercase while (i < words.length) { if (!Character.isUpperCase(words[i])) { return false; @@ -22,7 +22,7 @@ public boolean detectCapitalUse(String word) { } return true; } else { - //then all following must be all lowercase + // then all following must be all lowercase while (i < words.length) { if (!Character.isLowerCase(words[i])) { return false; @@ -34,7 +34,7 @@ public boolean detectCapitalUse(String word) { } return true; } else { - //then all following must be all lowercase + // then all following must be all lowercase int i = 1; while (i < words.length) { if (!Character.isLowerCase(words[i])) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_521.java b/src/main/java/com/fishercoder/solutions/firstthousand/_521.java index 4949252234..5e7b32d237 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_521.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_521.java @@ -2,7 +2,7 @@ public class _521 { public static class Solution1 { - /** + /* * The gotcha point of this question is: * 1. if a and b are identical, then there will be no common subsequence, return -1 * 2. else if a and b are of equal length, then any one of them will be a subsequence of the other string diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_522.java b/src/main/java/com/fishercoder/solutions/firstthousand/_522.java index cd37fbc589..8cc4749d13 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_522.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_522.java @@ -6,17 +6,19 @@ public class _522 { public static class Solution1 { - /** + /* * Idea: if there's such a LUS there in the list, it must be one of the strings in the given list, * so we'll just go through the list and check if one string is NOT subsequence of any others, if so, return it, otherwise, return -1 */ public int findLUSlength(String[] strs) { - Arrays.sort(strs, new Comparator() { - @Override - public int compare(String o1, String o2) { - return o2.length() - o1.length(); - } - }); + Arrays.sort( + strs, + new Comparator() { + @Override + public int compare(String o1, String o2) { + return o2.length() - o1.length(); + } + }); for (int i = 0; i < strs.length; i++) { boolean found = true; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_523.java b/src/main/java/com/fishercoder/solutions/firstthousand/_523.java index bab68745e6..8f776f126f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_523.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_523.java @@ -6,7 +6,7 @@ public class _523 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/80793/java-o-n-time-o-k-space/20 * "The reason we use modulo is: * (a+(n*x))%x is same as (a%x) @@ -18,18 +18,22 @@ public static class Solution1 { */ public boolean checkSubarraySum(int[] nums, int k) { Map map = new HashMap<>(); - map.put(0, -1);//this line is critical to mark the beginning of the prefix sum, so that next time, when we encounter a running sum of zero, we know that's the answer, see test case 11 + map.put( + 0, + -1); // this line is critical to mark the beginning of the prefix sum, so that + // next time, when we encounter a running sum of zero, we know that's the + // answer, see test case 11 int sum = 0; for (int i = 0; i < nums.length; i++) { sum += nums[i]; if (k != 0) { - /**Because if k == 0, sum %= k will throw ArithmeticException.*/ + /*Because if k == 0, sum %= k will throw ArithmeticException.*/ sum %= k; } Integer prev = map.get(sum); if (prev != null) { if (i - prev > 1) { - /**This makes sure that it has length at least 2*/ + /*This makes sure that it has length at least 2*/ return true; } } else { @@ -41,7 +45,7 @@ public boolean checkSubarraySum(int[] nums, int k) { } public static class Solution2 { - /** + /* * O(n^2), this will time out on LeetCode. */ public boolean checkSubarraySum(int[] nums, int k) { @@ -49,14 +53,15 @@ public boolean checkSubarraySum(int[] nums, int k) { return false; } - //Two continuous zeroes will form a subarray of length 2 with sum 0, 0*k = 0 will always be true + // Two continuous zeroes will form a subarray of length 2 with sum 0, 0*k = 0 will + // always be true for (int i = 0; i < nums.length - 1; i++) { if (nums[i] == 0 && nums[i + 1] == 0) { return true; } } - //then k cannot be zero any more + // then k cannot be zero any more if (k == 0 || nums.length < 2) { return false; } @@ -76,5 +81,4 @@ public boolean checkSubarraySum(int[] nums, int k) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_524.java b/src/main/java/com/fishercoder/solutions/firstthousand/_524.java index 22ab55caaf..b71c4f3773 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_524.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_524.java @@ -7,7 +7,9 @@ public class _524 { public static class Solution1 { public String findLongestWord(String s, List d) { - Collections.sort(d, (a, b) -> a.length() == b.length() ? a.compareTo(b) : b.length() - a.length()); + Collections.sort( + d, + (a, b) -> a.length() == b.length() ? a.compareTo(b) : b.length() - a.length()); for (String dictWord : d) { int i = 0; for (char c : s.toCharArray()) { @@ -22,5 +24,4 @@ public String findLongestWord(String s, List d) { return ""; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_525.java b/src/main/java/com/fishercoder/solutions/firstthousand/_525.java index a6ecaed08e..8298344ac1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_525.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_525.java @@ -6,7 +6,7 @@ public class _525 { public static class Solution1 { - //credit: https://leetcode.com/articles/contiguous-array/#approach-3-using-hashmap-accepted + // credit: https://leetcode.com/articles/contiguous-array/#approach-3-using-hashmap-accepted public int findMaxLength(int[] nums) { if (nums == null || nums.length == 0) { return 0; @@ -14,14 +14,21 @@ public int findMaxLength(int[] nums) { int count = 0; int max = 0; Map map = new HashMap(); - map.put(0, -1);//initialize the map, which means at index zero, the length of contiguous subarray is -1 + map.put( + 0, + -1); // initialize the map, which means at index zero, the length of contiguous + // subarray is -1 for (int i = 0; i < nums.length; i++) { count += nums[i] == 1 ? 1 : -1; if (map.containsKey(count)) { max = Math.max(i - map.get(count), max); } else { - map.put(count, i);//only when the map does not have this key, we put it in the map, this avoids overwriting the map - //also, it helps us keep the most leftside value in the map to help us compute the longest contigous array length + map.put( + count, + i); // only when the map does not have this key, we put it in the map, + // this avoids overwriting the map + // also, it helps us keep the most leftside value in the map to help us compute + // the longest contigous array length } } return max; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_526.java b/src/main/java/com/fishercoder/solutions/firstthousand/_526.java index 55963329ad..2b5bd3bd0f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_526.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_526.java @@ -2,7 +2,7 @@ public class _526 { public static class Solution1 { - /** + /* * A good post to look at: https://discuss.leetcode.com/topic/79916/java-solution-backtracking * and there's a generic template afterwards for backtracking problems */ @@ -29,5 +29,4 @@ private void backtracking(int N, int[] used, int pos) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_527.java b/src/main/java/com/fishercoder/solutions/firstthousand/_527.java index af05a0ff2a..226dc3e1a5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_527.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_527.java @@ -7,7 +7,7 @@ public class _527 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/82613/really-simple-and-straightforward-java-solution */ public List wordsAbbreviation(List dict) { @@ -49,5 +49,4 @@ private String abbreviate(String word, int k) { return stringBuilder.toString(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_528.java b/src/main/java/com/fishercoder/solutions/firstthousand/_528.java index b4ff7bced9..3cf73398a2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_528.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_528.java @@ -4,7 +4,7 @@ public class _528 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/random-pick-with-weight/editorial/ *

* Mental gymnastics (which is explained step by step in the above link): diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_529.java b/src/main/java/com/fishercoder/solutions/firstthousand/_529.java index 4359117df8..f1c2bf466c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_529.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_529.java @@ -17,12 +17,12 @@ public char[][] updateBoard(char[][] board, int[] click) { if (board[currRow][currCol] == 'M') { board[currRow][currCol] = 'X'; } else { - /**checks all eight neighbors of this curr cell, count all mines, this includes 'X' and 'M' */ + /*checks all eight neighbors of this curr cell, count all mines, this includes 'X' and 'M' */ int count = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if (i == 0 && j == 0) { - //this is the curr cell itself, so we skip + // this is the curr cell itself, so we skip continue; } int nextRow = currRow + i; @@ -37,13 +37,13 @@ public char[][] updateBoard(char[][] board, int[] click) { } if (count > 0) { - /**There are mines around this cell, so update it with the number of mines*/ + /*There are mines around this cell, so update it with the number of mines*/ board[currRow][currCol] = (char) (count + '0'); } else { - /**There is no mines around this cell, so update it to be 'B'*/ + /*There is no mines around this cell, so update it to be 'B'*/ board[currRow][currCol] = 'B'; - /**then we'll also check all of its eight surrounding cells, if it's 'E'. we'll also update it to be 'B' and offer it into the queue + /*then we'll also check all of its eight surrounding cells, if it's 'E'. we'll also update it to be 'B' and offer it into the queue * Only when we know this is a 'B', we'll offer into the queue, so below check could only happen here, not in the previous nested for loop.*/ for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { @@ -56,9 +56,9 @@ public char[][] updateBoard(char[][] board, int[] click) { continue; } if (board[nextRow][nextCol] == 'E') { - /**we offer 'E' cells into the queue*/ - queue.offer(new int[]{nextRow, nextCol}); - /**then update this cell to be 'B' */ + /*we offer 'E' cells into the queue*/ + queue.offer(new int[] {nextRow, nextCol}); + /*then update this cell to be 'B' */ board[nextRow][nextCol] = 'B'; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_53.java b/src/main/java/com/fishercoder/solutions/firstthousand/_53.java index 81a88e3f3b..03adcca526 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_53.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_53.java @@ -3,7 +3,7 @@ public class _53 { public static class Solution1 { - /** + /* * Kadane's algorithm. *

* It boils down to: diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_530.java b/src/main/java/com/fishercoder/solutions/firstthousand/_530.java index ed66ea7103..1d16fc4374 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_530.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_530.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.Iterator; import java.util.TreeSet; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_532.java b/src/main/java/com/fishercoder/solutions/firstthousand/_532.java index 93c0857b14..c8bec96018 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_532.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_532.java @@ -31,5 +31,4 @@ public int findPairs(int[] nums, int k) { return answer; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_533.java b/src/main/java/com/fishercoder/solutions/firstthousand/_533.java index 56d673bd92..2d26da30f9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_533.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_533.java @@ -5,7 +5,7 @@ public class _533 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/81686/verbose-java-o-m-n-solution-hashmap/5 * This program is very well designed to do things: * 1. it scans the entire matrix once, but does two things in this scan: @@ -34,8 +34,10 @@ public int findBlackPixel(char[][] picture, int N) { stringBuilder.append(picture[i][j]); } if (count == N) { - /**we use this entire row string as key for the map*/ - map.put(stringBuilder.toString(), map.getOrDefault(stringBuilder.toString(), 0) + 1); + /*we use this entire row string as key for the map*/ + map.put( + stringBuilder.toString(), + map.getOrDefault(stringBuilder.toString(), 0) + 1); } stringBuilder.setLength(0); } @@ -54,5 +56,4 @@ public int findBlackPixel(char[][] picture, int N) { return answer; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_535.java b/src/main/java/com/fishercoder/solutions/firstthousand/_535.java index d51a71ceac..b4d702ba14 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_535.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_535.java @@ -7,7 +7,7 @@ public class _535 { public static class Solution1 { - /** + /* * Simple counter approach * Analysis: * The range of URLs that can be decoded is limited by the range of Integer. @@ -34,7 +34,7 @@ public String decode(String shortUrl) { } public static class Solution2 { - /** + /* * Use Java built-in HashCode * Analysis: * hashCode() does NOT generate unique codes for different strings, collision might happen. @@ -46,7 +46,7 @@ public class Codec { // Encodes a URL to a shortened URL. public String encode(String longUrl) { - /**I don't need to create a local variable to cache longUrl.hashCode() + /*I don't need to create a local variable to cache longUrl.hashCode() * since Java's String cache it already. :) Look at its source code.*/ map.put(longUrl.hashCode(), longUrl); return PREFIX + longUrl.hashCode(); @@ -60,7 +60,7 @@ public String decode(String shortUrl) { } public static class Solution3 { - /** + /* * Use a random number */ Map map = new HashMap<>(); @@ -84,7 +84,7 @@ public String decode(String shortUrl) { } public static class Solution4 { - /** + /* * Use a random but fixed length encoding * Analysis: * 1. This is the most optimal solution so far. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_536.java b/src/main/java/com/fishercoder/solutions/firstthousand/_536.java index d17eaf3aed..0c91bb95fe 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_536.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_536.java @@ -1,14 +1,13 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayDeque; import java.util.Deque; public class _536 { public static class Solution1 { - /** + /* * recursive solution */ public TreeNode str2tree(String s) { @@ -16,7 +15,10 @@ public TreeNode str2tree(String s) { return null; } int firstParen = s.indexOf("("); - int val = firstParen == -1 ? Integer.parseInt(s) : Integer.parseInt(s.substring(0, firstParen)); + int val = + firstParen == -1 + ? Integer.parseInt(s) + : Integer.parseInt(s.substring(0, firstParen)); TreeNode cur = new TreeNode(val); if (firstParen == -1) { return cur; @@ -41,7 +43,7 @@ public TreeNode str2tree(String s) { } public static class Solution2 { - /** + /* * iterative solution */ public TreeNode str2tree(String s) { @@ -69,5 +71,4 @@ public TreeNode str2tree(String s) { return stack.isEmpty() ? null : stack.peek(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_537.java b/src/main/java/com/fishercoder/solutions/firstthousand/_537.java index 1c8339e6d0..aa9c6e276c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_537.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_537.java @@ -8,12 +8,17 @@ public static class Solution1 { public String complexNumberMultiply(String a, String b) { String[] part1And2 = a.split("\\+"); String[] part3And4 = b.split("\\+"); - String product1 = String.valueOf(Integer.parseInt(part1And2[0]) * Integer.parseInt(part3And4[0]));//this is real number multiplication + String product1 = + String.valueOf( + Integer.parseInt(part1And2[0]) + * Integer.parseInt( + part3And4[0])); // this is real number multiplication String product2 = multiply(part1And2[0], part3And4[1]); String product3 = multiply(part3And4[0], part1And2[1]); String product4 = multiplyTwoIs(part3And4[1], part1And2[1]); String twoISum = sumTwoI(product2, product3); - String numberValue = String.valueOf(Integer.valueOf(product1) + Integer.valueOf(product4)); + String numberValue = + String.valueOf(Integer.valueOf(product1) + Integer.valueOf(product4)); return numberValue + "+" + twoISum; } @@ -37,16 +42,18 @@ private String multiply(String p, String withI) { } public static class Solution2 { - /** + /* * (a + bi) * (c + di) could become (ac - bd) + (ad + bc)*i * Thus, we have the following function */ public String complexNumberMultiply(String a, String b) { int[] coefficients1 = Stream.of(a.split("\\+|i")).mapToInt(Integer::parseInt).toArray(); int[] coefficients2 = Stream.of(b.split("\\+|i")).mapToInt(Integer::parseInt).toArray(); - return (coefficients1[0] * coefficients2[0] - coefficients1[1] * coefficients2[1]) + "+" - + (coefficients1[0] * coefficients2[1] + coefficients1[1] * coefficients2[0] + "i"); + return (coefficients1[0] * coefficients2[0] - coefficients1[1] * coefficients2[1]) + + "+" + + (coefficients1[0] * coefficients2[1] + + coefficients1[1] * coefficients2[0] + + "i"); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_538.java b/src/main/java/com/fishercoder/solutions/firstthousand/_538.java index dd7a7d85f7..ed513a488e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_538.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_538.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -10,7 +9,7 @@ public class _538 { public static class Solution1 { - /** + /* * Traverse in this order: right -> root -> left */ public TreeNode convertBST(TreeNode root) { @@ -28,7 +27,7 @@ private int dfs(TreeNode root, int val) { } public static class Solution2 { - //This solution is generic for both BST and regular binary trees + // This solution is generic for both BST and regular binary trees public TreeNode convertBST(TreeNode root) { if (root == null) { return root; @@ -49,7 +48,8 @@ public TreeNode convertBST(TreeNode root) { return generateResultRoot(root, treeMap, result); } - private TreeNode generateResultRoot(TreeNode root, TreeMap treeMap, TreeNode result) { + private TreeNode generateResultRoot( + TreeNode root, TreeMap treeMap, TreeNode result) { if (root != null) { result.val = treeMap.get(root.val) + root.val; } @@ -76,5 +76,4 @@ private void putNodeToList(List list, TreeNode root) { } } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_539.java b/src/main/java/com/fishercoder/solutions/firstthousand/_539.java index 61180d7378..6a0acb9b39 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_539.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_539.java @@ -7,7 +7,7 @@ public class _539 { public static class Soluiton1 { public int findMinDifference(List timePoints) { - /**there are in total 24*60 = 1440 possible time points*/ + /*there are in total 24*60 = 1440 possible time points*/ final int ALL_POSSIBLE_TIMEPOINTS = 1440; boolean[] allTimePoints = new boolean[ALL_POSSIBLE_TIMEPOINTS]; for (String eachTime : timePoints) { @@ -39,5 +39,4 @@ public int findMinDifference(List timePoints) { return min; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_54.java b/src/main/java/com/fishercoder/solutions/firstthousand/_54.java index 036b756a13..ae4f167ebc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_54.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_54.java @@ -6,7 +6,7 @@ public class _54 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/spiral-matrix/discuss/20599/Super-Simple-and-Easy-to-Understand-Solution/185257 */ public List spiralOrder(int[][] matrix) { @@ -43,7 +43,7 @@ public List spiralOrder(int[][] matrix) { } public static class Solution2 { - /** + /* * My completely original solution on 12/29/2021. */ public List spiralOrder(int[][] matrix) { @@ -59,14 +59,14 @@ public List spiralOrder(int[][] matrix) { while (ans.size() < total) { for (; i < m && i >= lowerRow && j < n && j >= lowerCol; ) { ans.add(matrix[i][j]); - if (direction == 0) { //east + if (direction == 0) { // east j++; - } else if (direction == 1) { //south + } else if (direction == 1) { // south i++; - } else if (direction == 2) { //west + } else if (direction == 2) { // west j--; } else { - i--; //north + i--; // north } } if (direction == 0) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_540.java b/src/main/java/com/fishercoder/solutions/firstthousand/_540.java index a042bef04b..08c58a3649 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_540.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_540.java @@ -17,7 +17,10 @@ public int singleNonDuplicate(int[] nums) { int end = nums.length - 1; while (start < end) { int mid = start + (end - start) / 2; - if (mid + 1 < nums.length && nums[mid] != nums[mid + 1] && mid - 1 >= 0 && nums[mid] != nums[mid - 1]) { + if (mid + 1 < nums.length + && nums[mid] != nums[mid + 1] + && mid - 1 >= 0 + && nums[mid] != nums[mid - 1]) { return nums[mid]; } else if (mid + 1 < nums.length && nums[mid] == nums[mid + 1] && mid % 2 == 0) { start = mid + 1; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_542.java b/src/main/java/com/fishercoder/solutions/firstthousand/_542.java index f0891d0d6d..6b152280e8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_542.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_542.java @@ -15,20 +15,24 @@ public int[][] updateMatrix(int[][] mat) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (mat[i][j] == 0) { - deque.offer(new int[]{i, j}); + deque.offer(new int[] {i, j}); } else { ans[i][j] = m * n; } } } - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; while (!deque.isEmpty()) { int[] curr = deque.poll(); for (int i = 0; i < directions.length - 1; i++) { int nextX = directions[i] + curr[0]; int nextY = directions[i + 1] + curr[1]; - if (nextX >= 0 && nextX < m && nextY >= 0 && nextY < n && ans[nextX][nextY] > ans[curr[0]][curr[1]] + 1) { - deque.offer(new int[]{nextX, nextY}); + if (nextX >= 0 + && nextX < m + && nextY >= 0 + && nextY < n + && ans[nextX][nextY] > ans[curr[0]][curr[1]] + 1) { + deque.offer(new int[] {nextX, nextY}); ans[nextX][nextY] = ans[curr[0]][curr[1]] + 1; } } @@ -38,7 +42,7 @@ public int[][] updateMatrix(int[][] mat) { } public static class Solution2 { - /** + /* * A silly, but working solution. Apparently, the above BFS approach is a smarter version of this one. */ public int[][] updateMatrix(int[][] mat) { @@ -49,7 +53,7 @@ public int[][] updateMatrix(int[][] mat) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (mat[i][j] == 0) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); } else { ans[i][j] = m * n; } @@ -88,7 +92,5 @@ public int[][] updateMatrix(int[][] mat) { } return ans; } - } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_543.java b/src/main/java/com/fishercoder/solutions/firstthousand/_543.java index 27801a3147..4d18752d56 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_543.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_543.java @@ -5,7 +5,7 @@ public class _543 { public static class Solution1 { - /** + /* * A great observation of this problem is that the longest path must exist between two leaf nodes, * since it's easy to prove its opposite is not the longest by simply adding one to reach its leaf node. * diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_544.java b/src/main/java/com/fishercoder/solutions/firstthousand/_544.java index 1973d64146..07f461523d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_544.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_544.java @@ -36,5 +36,4 @@ private String generateFinal(List pairs, int n) { } return "(" + pairs.get(0) + "," + pairs.get(1) + ")"; } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_545.java b/src/main/java/com/fishercoder/solutions/firstthousand/_545.java index efa829eb64..b0767909c2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_545.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_545.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -23,11 +22,11 @@ public List boundaryOfBinaryTree(TreeNode root) { public void leftBoundary(TreeNode root, List nodes) { if (root == null || (root.left == null && root.right == null)) { - /**we don't want to add any LEAVES in leftBoundary and rightBoundary functions either, + /*we don't want to add any LEAVES in leftBoundary and rightBoundary functions either, * that's why we have the later condition in the if branch.*/ return; } - nodes.add(root.val);// add BEFORE child visit + nodes.add(root.val); // add BEFORE child visit if (root.left == null) { leftBoundary(root.right, nodes); } else { @@ -59,5 +58,4 @@ public void addLeaves(TreeNode root, List nodes) { addLeaves(root.right, nodes); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_546.java b/src/main/java/com/fishercoder/solutions/firstthousand/_546.java index 047204e578..f2489d3237 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_546.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_546.java @@ -2,7 +2,7 @@ public class _546 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/remove-boxes/#approach-2-using-dp-with-memorizationaccepted *

* For an entry in dp[l][r][k], l represents the starting index of the subarray, @@ -29,8 +29,11 @@ public int calculatePoints(int[] boxes, int[][][] dp, int l, int r, int k) { dp[l][r][k] = calculatePoints(boxes, dp, l, r - 1, 0) + (k + 1) * (k + 1); for (int i = l; i < r; i++) { if (boxes[i] == boxes[r]) { - dp[l][r][k] = Math.max(dp[l][r][k], - calculatePoints(boxes, dp, l, i, k + 1) + calculatePoints(boxes, dp, i + 1, r - 1, 0)); + dp[l][r][k] = + Math.max( + dp[l][r][k], + calculatePoints(boxes, dp, l, i, k + 1) + + calculatePoints(boxes, dp, i + 1, r - 1, 0)); } } return dp[l][r][k]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_547.java b/src/main/java/com/fishercoder/solutions/firstthousand/_547.java index f1f3708cca..2259d0cef5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_547.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_547.java @@ -7,7 +7,7 @@ public int findCircleNum(int[][] isConnected) { if (isConnected == null || isConnected.length == 0 || isConnected[0].length == 0) { return 0; } - int m = isConnected.length;//number of rows in this matrix + int m = isConnected.length; // number of rows in this matrix UnionFind unionFind = new UnionFind(m); for (int i = 0; i < m; i++) { for (int j = i + 1; j < m; j++) { @@ -34,21 +34,21 @@ public UnionFind(int m) { public void union(int i, int j) { int x = find(root, i); int y = find(root, j); - //at this point, x and y should equal, if not, then we should union them into the same value + // at this point, x and y should equal, if not, then we should union them into the + // same value if (x != y) { count--; - root[x] = y;//path compression, i.e. union + root[x] = y; // path compression, i.e. union } } public int find(int[] ids, int i) { if (ids[i] == i) { - //this is the base case, so nothing to recurse on + // this is the base case, so nothing to recurse on return i; } return find(ids, ids[i]); } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_548.java b/src/main/java/com/fishercoder/solutions/firstthousand/_548.java index 263488781e..d48e40be1b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_548.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_548.java @@ -20,13 +20,14 @@ public boolean splitArray(int[] nums) { Set set = new HashSet<>(); for (int i = 1; i < j - 1; i++) { if (sum[i - 1] == sum[j - 1] - sum[i]) { - /**this is sum(0, i-1) and sum(i+1, j-1)*/ + /*this is sum(0, i-1) and sum(i+1, j-1)*/ set.add(sum[i - 1]); } } for (int k = j + 2; k < len - 1; k++) { - if (sum[k - 1] - sum[j] == sum[len - 1] - sum[k] && set.contains(sum[k - 1] - sum[j])) { - /**this is sum(j+1, k-1) and sum(k+1, len-1)*/ + if (sum[k - 1] - sum[j] == sum[len - 1] - sum[k] + && set.contains(sum[k - 1] - sum[j])) { + /*this is sum(j+1, k-1) and sum(k+1, len-1)*/ return true; } } @@ -34,5 +35,4 @@ public boolean splitArray(int[] nums) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_549.java b/src/main/java/com/fishercoder/solutions/firstthousand/_549.java index 9cecc191c2..3f700d907b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_549.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_549.java @@ -14,7 +14,7 @@ public int longestConsecutive(TreeNode root) { private int[] longestPath(TreeNode root) { if (root == null) { - return new int[]{0, 0}; + return new int[] {0, 0}; } int increasing = 1; int decreasing = 1; @@ -37,7 +37,7 @@ private int[] longestPath(TreeNode root) { } max = Math.max(max, decreasing + increasing - 1); - return new int[]{increasing, decreasing}; + return new int[] {increasing, decreasing}; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_55.java b/src/main/java/com/fishercoder/solutions/firstthousand/_55.java index f3080d08fa..9d4a5aa104 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_55.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_55.java @@ -3,7 +3,7 @@ public class _55 { public static class Solution1 { - /** + /* * My very original but lengthy solution. */ public boolean canJump(int[] nums) { @@ -34,7 +34,7 @@ public boolean canJump(int[] nums) { } public static class Solution2 { - /** + /* * The same idea as mine above, but much more concise. * Credit: https://leetcode.com/problems/jump-game/discuss/20917/Linear-and-simple-solution-in-C%2B%2B */ @@ -48,7 +48,7 @@ public boolean canJump(int[] nums) { } public static class Solution3 { - /** + /* * Top-down DP. * Credit: https://leetcode.com/problems/jump-game/solution/ approach 2 *

@@ -59,7 +59,7 @@ public static class Solution3 { */ public boolean canJump(int[] nums) { int[] dp = new int[nums.length]; - //0 means unknown, 1 means reachable, 2 means unreachable + // 0 means unknown, 1 means reachable, 2 means unreachable dp[nums.length - 1] = 1; return canJumpFrom(0, nums, dp); } @@ -81,12 +81,12 @@ private boolean canJumpFrom(int index, int[] nums, int[] dp) { } public static class Solution4 { - /** + /* * This is bottom-up DP. */ public boolean canJump(int[] nums) { int[] dp = new int[nums.length]; - //0 means unknown, 1 means reachable, 2 means unreachable + // 0 means unknown, 1 means reachable, 2 means unreachable dp[nums.length - 1] = 1; for (int i = nums.length - 2; i >= 0; i--) { int furthestReach = Math.min(nums[i] + i, nums.length - 1); @@ -99,6 +99,5 @@ public boolean canJump(int[] nums) { } return dp[0] == 1; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_551.java b/src/main/java/com/fishercoder/solutions/firstthousand/_551.java index 0d458c5538..ed105699cb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_551.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_551.java @@ -26,5 +26,4 @@ public boolean checkRecord(String s) { return true; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_552.java b/src/main/java/com/fishercoder/solutions/firstthousand/_552.java index 703f0fcbb5..f293394c7a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_552.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_552.java @@ -3,14 +3,14 @@ public class _552 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/86526/improving-the-runtime-from-o-n-to-o-log-n */ public int checkRecord(int n) { final int MOD = 1000000007; int[][][] f = new int[n + 1][2][3]; - f[0] = new int[][]{{1, 1, 1}, {1, 1, 1}}; + f[0] = new int[][] {{1, 1, 1}, {1, 1, 1}}; for (int i = 1; i <= n; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 3; k++) { @@ -28,5 +28,4 @@ public int checkRecord(int n) { return f[n][1][2]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_553.java b/src/main/java/com/fishercoder/solutions/firstthousand/_553.java index 91d49081ed..1f7c6882a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_553.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_553.java @@ -4,16 +4,16 @@ public class _553 { public static class Solution1 { - /** + /* * Credit: https://github.com/lydxlx1/LeetCode/blob/master/src/_553.java */ public String optimalDivision(int[] nums) { - /**https://docs.oracle.com/javase/8/docs/api/java/util/StringJoiner.html: - * StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix. - * The String "[George:Sally:Fred]" may be constructed as follows: - StringJoiner sj = new StringJoiner(":", "[", "]"); - sj.add("George").add("Sally").add("Fred"); - String desiredString = sj.toString();*/ + /*https://docs.oracle.com/javase/8/docs/api/java/util/StringJoiner.html: + * StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix. + * The String "[George:Sally:Fred]" may be constructed as follows: + StringJoiner sj = new StringJoiner(":", "[", "]"); + sj.add("George").add("Sally").add("Fred"); + String desiredString = sj.toString();*/ if (nums.length == 1) { return "" + nums[0]; @@ -22,7 +22,7 @@ public String optimalDivision(int[] nums) { return nums[0] + "/" + nums[1]; } - /**Tricky one: the solution is fixed: always wrap the one from the second until the last. + /*Tricky one: the solution is fixed: always wrap the one from the second until the last. * Another important thing to note that such way could work is that: * the prerequisite is: Elements will be in range [2,1000], so no elements are smaller than 1.*/ StringJoiner stringJoiner = new StringJoiner("/"); @@ -32,5 +32,4 @@ public String optimalDivision(int[] nums) { return String.format("%d/(%s)", nums[0], stringJoiner.toString()); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_554.java b/src/main/java/com/fishercoder/solutions/firstthousand/_554.java index e4cc910b30..c1ca25b1aa 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_554.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_554.java @@ -6,7 +6,7 @@ public class _554 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/brick-wall/ *

* we make use of a HashMap @@ -28,7 +28,7 @@ public int leastBricks(List> wall) { for (List row : wall) { int sum = 0; for (int i = 0; i < row.size() - 1; i++) { - //NOTE: i < row.size()-1 + // NOTE: i < row.size()-1 sum += row.get(i); if (map.containsKey(sum)) { map.put(sum, map.get(sum) + 1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_555.java b/src/main/java/com/fishercoder/solutions/firstthousand/_555.java index f84157d1d7..c557b8120a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_555.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_555.java @@ -3,7 +3,7 @@ public class _555 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/86477/neat-java-solution * and article: https://leetcode.com/articles/split-assembled-strings/#approach-3-optimized-solution-accepted */ @@ -20,7 +20,7 @@ public String splitLoopedString(String[] strs) { for (int i = 0; i < strs.length; i++) { sb.setLength(0); String reverse = sb.append(strs[i]).reverse().toString(); - for (String str : new String[]{strs[i], reverse}) { + for (String str : new String[] {strs[i], reverse}) { for (int k = 0; k < str.length(); k++) { sb.setLength(0); sb.append(str.substring(k)); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_556.java b/src/main/java/com/fishercoder/solutions/firstthousand/_556.java index 246d587a8f..f611de716f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_556.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_556.java @@ -1,9 +1,8 @@ package com.fishercoder.solutions.firstthousand; - public class _556 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/85759/this-problem-is-the-same-to-next-permutation-algorithm-only and https://discuss.leetcode.com/topic/85755/java-solution-like-next-permutation-problem-o-n */ @@ -45,5 +44,4 @@ private void swap(char[] a, int i, int j) { a[j] = temp; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_559.java b/src/main/java/com/fishercoder/solutions/firstthousand/_559.java index 04129bc108..7b6a719356 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_559.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_559.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Node; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_56.java b/src/main/java/com/fishercoder/solutions/firstthousand/_56.java index f6fdcc93d1..42ad3f330f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_56.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_56.java @@ -7,12 +7,18 @@ public class _56 { public static class Solution1 { - /** + /* * My completely original solution on 10/12/2021. */ public int[][] merge(int[][] intervals) { List list = new ArrayList<>(); - Arrays.sort(intervals, (a, b) -> a[0] != b[0] ? Integer.compare(a[0], b[0]) : Integer.compare(b[1], a[1]));//to avoid integer subtraction overflow + Arrays.sort( + intervals, + (a, b) -> + a[0] != b[0] + ? Integer.compare(a[0], b[0]) + : Integer.compare( + b[1], a[1])); // to avoid integer subtraction overflow for (int i = 0; i < intervals.length; i++) { int start = intervals[i][0]; int end = intervals[i][1]; @@ -20,10 +26,9 @@ public int[][] merge(int[][] intervals) { end = Math.max(intervals[i + 1][1], end); i++; } - list.add(new int[]{start, end}); + list.add(new int[] {start, end}); } return list.toArray(new int[list.size()][2]); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_560.java b/src/main/java/com/fishercoder/solutions/firstthousand/_560.java index 1b7b4b99ca..babf5698c8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_560.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_560.java @@ -6,7 +6,7 @@ public class _560 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/87850/java-solution-presum-hashmap * We know the key to solve this problem is SUM[i, j]. * So if we know SUM[0, i - 1] and SUM[0, j], @@ -34,7 +34,7 @@ public int subarraySum(int[] nums, int k) { } public static class Solution2 { - /** + /* * My completely original solution on 10/14/2021. * Again, using a pen and paper to visualize your thought process just clears out all ambiguities. *

@@ -61,5 +61,4 @@ public int subarraySum(int[] nums, int k) { return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_561.java b/src/main/java/com/fishercoder/solutions/firstthousand/_561.java index add7e42489..fcf61bd7f1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_561.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_561.java @@ -14,5 +14,4 @@ public int arrayPairSum(int[] nums) { return sum; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_562.java b/src/main/java/com/fishercoder/solutions/firstthousand/_562.java index 19690d3ba9..19932c035a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_562.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_562.java @@ -7,16 +7,17 @@ public int longestLine(int[][] M) { if (M == null || M.length == 0) { return 0; } - int[][] directions = new int[][]{ - {-1, 0}, - {-1, 1}, - {0, 1}, - {1, 1}, - {1, 0}, - {1, -1}, - {0, -1}, - {-1, -1}, - }; + int[][] directions = + new int[][] { + {-1, 0}, + {-1, 1}, + {0, 1}, + {1, 1}, + {1, 0}, + {1, -1}, + {0, -1}, + {-1, -1}, + }; int longestLine = 0; int m = M.length; int n = M[0].length; @@ -28,11 +29,19 @@ public int longestLine(int[][] M) { int nextI = i + directions[k][0]; int nextJ = j + directions[k][1]; int thisLine = 1; - if (nextI >= 0 && nextI < m && nextJ >= 0 && nextJ < n && cache[nextI][nextJ][k] != 0) { + if (nextI >= 0 + && nextI < m + && nextJ >= 0 + && nextJ < n + && cache[nextI][nextJ][k] != 0) { thisLine += cache[nextI][nextJ][k]; cache[i][j][k] = thisLine; } else { - while (nextI >= 0 && nextI < m && nextJ >= 0 && nextJ < n && M[nextI][nextJ] == 1) { + while (nextI >= 0 + && nextI < m + && nextJ >= 0 + && nextJ < n + && M[nextI][nextJ] == 1) { thisLine++; cache[i][j][k] = thisLine; nextI += directions[k][0]; @@ -47,5 +56,4 @@ public int longestLine(int[][] M) { return longestLine; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_563.java b/src/main/java/com/fishercoder/solutions/firstthousand/_563.java index f792db59de..33eae0aee8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_563.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_563.java @@ -31,5 +31,4 @@ public int findTiltDfs(TreeNode root) { return leftTilt + rightTilt + root.val; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_564.java b/src/main/java/com/fishercoder/solutions/firstthousand/_564.java index fa0df50b86..acdd1434f5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_564.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_564.java @@ -25,7 +25,10 @@ public String nearestPalindromic(String n) { s += "9"; } } - long diff = s.equals(n) ? Long.MAX_VALUE : Math.abs(Long.parseLong(s) - Long.parseLong(n)); + long diff = + s.equals(n) + ? Long.MAX_VALUE + : Math.abs(Long.parseLong(s) - Long.parseLong(n)); if (diff < minDiff) { minDiff = diff; ret = s; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_565.java b/src/main/java/com/fishercoder/solutions/firstthousand/_565.java index 866cb6a7f8..26f04a6c29 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_565.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_565.java @@ -22,5 +22,4 @@ public int arrayNesting(int[] nums) { return answer; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_567.java b/src/main/java/com/fishercoder/solutions/firstthousand/_567.java index 2b8f6c2fcd..c4f37e9fda 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_567.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_567.java @@ -3,7 +3,7 @@ public class _567 { public static class Solution1 { - /** + /* * credit: sliding window: https://discuss.leetcode.com/topic/87845/java-solution-sliding-window */ public boolean checkInclusion(String s1, String s2) { @@ -45,7 +45,7 @@ private boolean allZeroes(int[] count) { } public static class Solution2 { - /** + /* * A classic sliding window problem. * I came up with below solution independently on 9/17/2021. *

diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_568.java b/src/main/java/com/fishercoder/solutions/firstthousand/_568.java index f5ecb1002f..459b79084b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_568.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_568.java @@ -5,7 +5,7 @@ public class _568 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/maximum-vacation-days/#approach-2-using-dfs-with-memoization-accepted */ public int maxVacationDays(int[][] flights, int[][] days) { @@ -34,5 +34,4 @@ public int dfs(int[][] flights, int[][] days, int curCity, int weekno, int[][] m return maxvac; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_57.java b/src/main/java/com/fishercoder/solutions/firstthousand/_57.java index eabc38f40e..73253db338 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_57.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_57.java @@ -15,9 +15,11 @@ public int[][] insert(int[][] intervals, int[] newInterval) { } // merge all overlapping intervals to one considering newInterval while (i < intervals.length && intervals[i][0] <= newInterval[1]) { - newInterval = new int[]{ - Math.min(newInterval[0], intervals[i][0]), - Math.max(newInterval[1], intervals[i][1])}; + newInterval = + new int[] { + Math.min(newInterval[0], intervals[i][0]), + Math.max(newInterval[1], intervals[i][1]) + }; i++; } list.add(newInterval); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_572.java b/src/main/java/com/fishercoder/solutions/firstthousand/_572.java index 42840aff60..71b1b2406d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_572.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_572.java @@ -24,6 +24,5 @@ private boolean same(TreeNode s, TreeNode t) { } return same(s.left, t.left) && same(s.right, t.right); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_573.java b/src/main/java/com/fishercoder/solutions/firstthousand/_573.java index 7a11f9c6aa..d7cedaff0f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_573.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_573.java @@ -4,7 +4,7 @@ public class _573 { public static class Solution1 { - /** + /* * reference: https://leetcode.com/articles/squirrel-simulation *

* 1. The order in which to pick the nuts does not matter except the first one @@ -25,7 +25,8 @@ public int minDistance(int height, int width, int[] tree, int[] squirrel, int[][ int totalDist = 0; int savedDist = Integer.MIN_VALUE; for (int[] nut : nuts) { - totalDist += (getDist(nut, tree) * 2);//it needs to travel back and forth, so times two + totalDist += + (getDist(nut, tree) * 2); // it needs to travel back and forth, so times two savedDist = Math.max(savedDist, getDist(nut, tree) - getDist(nut, squirrel)); } return totalDist - savedDist; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_576.java b/src/main/java/com/fishercoder/solutions/firstthousand/_576.java index 90dba97641..f2c8c54763 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_576.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_576.java @@ -2,7 +2,7 @@ public class _576 { public static class Solution1 { - /** + /* * reference: https://leetcode.com/articles/out-of-boundary-paths/#approach-2-recursion-with-memoization-accepted */ public int findPaths(int m, int n, int N, int x, int y) { @@ -26,8 +26,12 @@ public int findPaths(int m, int n, int N, int x, int y) { if (j == 0) { count = (count + dp[i][j]) % M; } - temp[i][j] = (((i > 0 ? dp[i - 1][j] : 0) + (i < m - 1 ? dp[i + 1][j] : 0)) % M - + ((j > 0 ? dp[i][j - 1] : 0) + (j < n - 1 ? dp[i][j + 1] : 0)) % M) % M; + temp[i][j] = + (((i > 0 ? dp[i - 1][j] : 0) + (i < m - 1 ? dp[i + 1][j] : 0)) % M + + ((j > 0 ? dp[i][j - 1] : 0) + + (j < n - 1 ? dp[i][j + 1] : 0)) + % M) + % M; } } dp = temp; @@ -35,5 +39,4 @@ public int findPaths(int m, int n, int N, int x, int y) { return count; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_58.java b/src/main/java/com/fishercoder/solutions/firstthousand/_58.java index f8278d640e..a4112f1576 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_58.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_58.java @@ -15,5 +15,4 @@ public int lengthOfLastWord(String s) { return s.length() - n - 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_581.java b/src/main/java/com/fishercoder/solutions/firstthousand/_581.java index 70cf151c61..c2bebfe522 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_581.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_581.java @@ -5,7 +5,7 @@ public class _581 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/89282/java-o-n-time-o-1-space * Use start and end to keep track of the minimum subarray nums[start...end] which must be sorted for the entire array nums. * If start < end < 0 at the end of the for loop, then the array is already fully sorted. @@ -34,7 +34,7 @@ public int findUnsortedSubarray(int[] nums) { } public static class Solution2 { - /** + /* * Time: O(n) * Space: O(1) *

@@ -45,7 +45,8 @@ public static class Solution2 { public int findUnsortedSubarray(int[] nums) { int end = -2; int max = Integer.MIN_VALUE; - //go from left to right, find the number that is smaller than the max number on its left side, that should be the end index because it needs to be sorted + // go from left to right, find the number that is smaller than the max number on its + // left side, that should be the end index because it needs to be sorted for (int i = 0; i < nums.length; i++) { max = Math.max(max, nums[i]); if (nums[i] < max) { @@ -54,7 +55,8 @@ public int findUnsortedSubarray(int[] nums) { } int start = -1; int min = Integer.MAX_VALUE; - //go from right to left, find the number that is bigger than the min number on its right, that should be the beginning index + // go from right to left, find the number that is bigger than the min number on its + // right, that should be the beginning index for (int i = nums.length - 1; i >= 0; i--) { min = Math.min(min, nums[i]); if (nums[i] > min) { @@ -66,7 +68,7 @@ public int findUnsortedSubarray(int[] nums) { } public static class Solution3 { - /** + /* * Time: O(nlogn) * Space: O(n) */ @@ -84,5 +86,4 @@ public int findUnsortedSubarray(int[] nums) { return (end - start > 0) ? end - start + 1 : 0; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_582.java b/src/main/java/com/fishercoder/solutions/firstthousand/_582.java index 8f8396cb0c..0f2e9c7ec4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_582.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_582.java @@ -30,5 +30,4 @@ public List killProcess(List pid, List ppid, int kill return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_583.java b/src/main/java/com/fishercoder/solutions/firstthousand/_583.java index 6f661ffaf9..1073275de0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_583.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_583.java @@ -10,11 +10,13 @@ public int minDistance(String word1, String word2) { int[][] dp = new int[m + 1][n + 1]; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { - dp[i][j] = word1.charAt(i - 1) == word2.charAt(j - 1) ? dp[i - 1][j - 1] + 1 : Math.max(dp[i - 1][j], dp[i][j - 1]); + dp[i][j] = + word1.charAt(i - 1) == word2.charAt(j - 1) + ? dp[i - 1][j - 1] + 1 + : Math.max(dp[i - 1][j], dp[i][j - 1]); } } return m + n - 2 * dp[m][n]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_587.java b/src/main/java/com/fishercoder/solutions/firstthousand/_587.java index 3e6c23af06..5f19f127b4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_587.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_587.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Point; - import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -10,7 +9,7 @@ public class _587 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/89323/java-solution-convex-hull-algorithm-gift-wrapping-aka-jarvis-march * There are couple of ways to solve Convex Hull problem. https://en.wikipedia.org/wiki/Convex_hull_algorithms * The following code implements Gift wrapping aka Jarvis march algorithm @@ -44,7 +43,8 @@ public List outerTrees(Point[] points) { continue; } int cross = crossProductLength(cur, points[i], next); - if (nextIndex == curIndex || cross > 0 + if (nextIndex == curIndex + || cross > 0 // Handle collinear points || (cross == 0 && distance(points[i], cur) > distance(next, cur))) { next = points[i]; @@ -85,5 +85,4 @@ private int distance(Point p1, Point p2) { return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_588.java b/src/main/java/com/fishercoder/solutions/firstthousand/_588.java index 9fb3a049b5..40619534a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_588.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_588.java @@ -9,7 +9,7 @@ public class _588 { public static class Solution1 { - /** + /* * Credit: https://github.com/lydxlx1/LeetCode/blob/master/src/_588.java */ public static class FileSystem { @@ -43,8 +43,7 @@ TrieNode dfs(String path) { return node; } - public FileSystem() { - } + public FileSystem() {} public List ls(String path) { TrieNode node = dfs(path); @@ -73,12 +72,12 @@ public String readContentFromFile(String filePath) { } } -/** - * Your FileSystem object will be instantiated and called as such: - * FileSystem obj = new FileSystem(); - * List param_1 = obj.ls(path); - * obj.mkdir(path); - * obj.addContentToFile(filePath,content); - * String param_4 = obj.readContentFromFile(filePath); - */ + /* + * Your FileSystem object will be instantiated and called as such: + * FileSystem obj = new FileSystem(); + * List param_1 = obj.ls(path); + * obj.mkdir(path); + * obj.addContentToFile(filePath,content); + * String param_4 = obj.readContentFromFile(filePath); + */ } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_589.java b/src/main/java/com/fishercoder/solutions/firstthousand/_589.java index 3d2e6b9e01..64b058ed44 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_589.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_589.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Node; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_59.java b/src/main/java/com/fishercoder/solutions/firstthousand/_59.java index db2f0bfeb9..2aa90a1de5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_59.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_59.java @@ -3,7 +3,7 @@ public class _59 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/spiral-matrix-ii/discuss/22289/My-Super-Simple-Solution.-Can-be-used-for-both-Spiral-Matrix-I-and-II/21907 */ public int[][] generateMatrix(int n) { @@ -40,7 +40,7 @@ public int[][] generateMatrix(int n) { } public static class Solution2 { - /** + /* * My completely original solution on 10/12/2021. */ public int[][] generateMatrix(int n) { @@ -56,7 +56,7 @@ public int[][] generateMatrix(int n) { int limit = n * n; while (num <= limit) { if (direction % 4 == 0) { - //0 means going east + // 0 means going east for (; j < eastBoundary && num <= limit; j++) { matrix[i][j] = num; num++; @@ -67,7 +67,7 @@ public int[][] generateMatrix(int n) { i++; } if (direction % 4 == 1) { - //1 means going south + // 1 means going south for (; i < southBoundary && num <= limit; i++) { matrix[i][j] = num; num++; @@ -78,7 +78,7 @@ public int[][] generateMatrix(int n) { j--; } if (direction % 4 == 2) { - //2 means going west + // 2 means going west for (; j >= westBoundary && num <= limit; j--) { matrix[i][j] = num; num++; @@ -89,7 +89,7 @@ public int[][] generateMatrix(int n) { i--; } if (direction % 4 == 3) { - //3 means going north + // 3 means going north for (; i > northBoundary && num <= limit; i--) { matrix[i][j] = num; num++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_590.java b/src/main/java/com/fishercoder/solutions/firstthousand/_590.java index 9598492fec..ada5b98eb8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_590.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_590.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Node; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_591.java b/src/main/java/com/fishercoder/solutions/firstthousand/_591.java index 59c8d1ef73..c7061129c0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_591.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_591.java @@ -7,7 +7,7 @@ public class _591 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/91300/java-solution-use-startswith-and-indexof */ public boolean isValid(String code) { @@ -17,12 +17,12 @@ public boolean isValid(String code) { return false; } if (code.startsWith("", j); if (i < 0) { return false; } - i += 3;//"]]>" length is 3 + i += 3; // "]]>" length is 3 } else if (code.startsWith("", j); @@ -58,5 +58,4 @@ public boolean isValid(String code) { return stack.isEmpty(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_592.java b/src/main/java/com/fishercoder/solutions/firstthousand/_592.java index 8ee4627fc6..6f3b33059c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_592.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_592.java @@ -7,7 +7,7 @@ public class _592 { public static class Solution1 { - /** + /* * Credit: https://discuss.leetcode.com/topic/89993/java-solution-fraction-addition-and-gcd */ public String fractionAddition(String expression) { @@ -15,7 +15,8 @@ public String fractionAddition(String expression) { int i = 0; int j = 0; while (j <= expression.length()) { - if (j == expression.length() || j != i && (expression.charAt(j) == '-' || expression.charAt(j) == '+')) { + if (j == expression.length() + || j != i && (expression.charAt(j) == '-' || expression.charAt(j) == '+')) { if (expression.charAt(i) == '+') { nums.add(expression.substring(i + 1, j)); } else { @@ -61,5 +62,4 @@ private int getGCD(int a, int b) { return getGCD(b, a % b); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_593.java b/src/main/java/com/fishercoder/solutions/firstthousand/_593.java index 0544fcfd30..1d60b40c83 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_593.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_593.java @@ -24,7 +24,8 @@ private List> getAllPermutations(List input) { return backTracking(result, input, 0); } - private List> backTracking(List> result, List input, int pos) { + private List> backTracking( + List> result, List input, int pos) { if (pos == input.size()) { return result; } @@ -69,5 +70,4 @@ public boolean isRightAngle(int[] p1, int[] p2, int[] p3) { return degree % 45 == 0; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_598.java b/src/main/java/com/fishercoder/solutions/firstthousand/_598.java index 9a5a352326..9124358ffc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_598.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_598.java @@ -3,7 +3,7 @@ public class _598 { public static class Solution1 { - /** + /* * Since the incrementing starts from zero to op[0] and op[1], we only need to find the range that has the most overlaps. * Thus we keep finding the minimum of both x and y. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_6.java b/src/main/java/com/fishercoder/solutions/firstthousand/_6.java index 15d266264f..e964832733 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_6.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_6.java @@ -1,32 +1,31 @@ package com.fishercoder.solutions.firstthousand; public class _6 { - public static class Solution1 { - public String convert(String s, int numRows) { - StringBuilder[] sb = new StringBuilder[numRows]; - char[] c = s.toCharArray(); - int len = s.length(); - for (int i = 0; i < numRows; i++) { - sb[i] = new StringBuilder();//this is an important step to initialize it - } - int i = 0; - while (i < len) { - for (int index = 0; index < numRows && i < len; index++) { - sb[index].append(c[i++]);// vertically down - } + public static class Solution1 { + public String convert(String s, int numRows) { + StringBuilder[] sb = new StringBuilder[numRows]; + char[] c = s.toCharArray(); + int len = s.length(); + for (int i = 0; i < numRows; i++) { + sb[i] = new StringBuilder(); // this is an important step to initialize it + } + int i = 0; + while (i < len) { + for (int index = 0; index < numRows && i < len; index++) { + sb[index].append(c[i++]); // vertically down + } - for (int index = numRows - 2; index >= 1 && i < len; index--) { - /**Why it should start from numRows - 2? Think of the example when numRows = 3 - the starting point of obliquely going up is 1, which is numRows-2.*/ - sb[index].append(c[i++]);// obliquely up - } - } - - for (i = 1; i < numRows; i++) { - sb[0].append(sb[i]); - } - return sb[0].toString(); - } - } + for (int index = numRows - 2; index >= 1 && i < len; index--) { + /*Why it should start from numRows - 2? Think of the example when numRows = 3 + the starting point of obliquely going up is 1, which is numRows-2.*/ + sb[index].append(c[i++]); // obliquely up + } + } + for (i = 1; i < numRows; i++) { + sb[0].append(sb[i]); + } + return sb[0].toString(); + } + } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_60.java b/src/main/java/com/fishercoder/solutions/firstthousand/_60.java index 018d2ad3ce..5aa01bbbcc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_60.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_60.java @@ -15,7 +15,7 @@ public String getPermutation(int n, int k) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { permcount = permcount / (n - i); - int idx = k / permcount;// the index that this position should + int idx = k / permcount; // the index that this position should // choose sb.append(nums[idx]); // left shift nums[] by one bit diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_600.java b/src/main/java/com/fishercoder/solutions/firstthousand/_600.java index a919b1221a..fbc9578bc3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_600.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_600.java @@ -3,7 +3,7 @@ public class _600 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/articles/non-negative-integers-without-consecutive-ones/#approach-3-using-bit-manipulation-accepted */ public int findIntegers(int num) { @@ -32,5 +32,4 @@ public int findIntegers(int num) { return sum + 1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_604.java b/src/main/java/com/fishercoder/solutions/firstthousand/_604.java index af7ecd9965..49ea03e847 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_604.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_604.java @@ -18,7 +18,11 @@ public StringIterator(String compressedString) { while (j < len && Character.isDigit(compressedString.charAt(j))) { j++; } - deque.addLast(new int[]{compressedString.charAt(i) - 'A', Integer.parseInt(compressedString.substring(i + 1, j))}); + deque.addLast( + new int[] { + compressedString.charAt(i) - 'A', + Integer.parseInt(compressedString.substring(i + 1, j)) + }); i = j; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_605.java b/src/main/java/com/fishercoder/solutions/firstthousand/_605.java index dfcc21d6f3..5f5b915312 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_605.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_605.java @@ -7,7 +7,9 @@ public boolean canPlaceFlowers(int[] flowerbed, int n) { int count = 0; int i = 0; while (i < flowerbed.length) { - if (flowerbed[i] == 0 && (i == 0 || flowerbed[i - 1] == 0) && (i == flowerbed.length - 1 || flowerbed[i + 1] == 0)) { + if (flowerbed[i] == 0 + && (i == 0 || flowerbed[i - 1] == 0) + && (i == flowerbed.length - 1 || flowerbed[i + 1] == 0)) { count++; flowerbed[i] = 1; } @@ -39,7 +41,8 @@ public boolean canPlaceFlowers(int[] flowerbed, int n) { for (int i = 1; i < len - 1; i++) { if (flowerbed[i] == 0 && flowerbed[i - 1] == 0 && flowerbed[i + 1] == 0) { n--; - //modify the input, discuss this with interviwer, if not allowed, then have a copy of this input and modify copy + // modify the input, discuss this with interviwer, if not allowed, then have a + // copy of this input and modify copy flowerbed[i] = 1; } if (n <= 0) { @@ -55,5 +58,4 @@ public boolean canPlaceFlowers(int[] flowerbed, int n) { return false; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_606.java b/src/main/java/com/fishercoder/solutions/firstthousand/_606.java index b97660168d..0649bebafb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_606.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_606.java @@ -55,5 +55,4 @@ private void preorder(TreeNode root, StringBuilder sb) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_61.java b/src/main/java/com/fishercoder/solutions/firstthousand/_61.java index 266a2ac4c8..1aa6b1a609 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_61.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_61.java @@ -5,7 +5,7 @@ public class _61 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/26364/clean-java-solution-with-brief-explanation * link the tail of the linked list to the head to form a circle, then count to find the pint and cut it */ @@ -19,12 +19,12 @@ public ListNode rotateRight(ListNode head, int k) { copyHead = copyHead.next; len++; } - copyHead.next = head;//link the tail and head to make it a circle + copyHead.next = head; // link the tail and head to make it a circle for (int i = len - k % len; i > 1; i--) { head = head.next; } copyHead = head.next; - head.next = null;//break the circle + head.next = null; // break the circle return copyHead; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_611.java b/src/main/java/com/fishercoder/solutions/firstthousand/_611.java index faf94fcbfa..f052b5616d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_611.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_611.java @@ -4,7 +4,7 @@ public class _611 { public static class Solution1 { - /** + /* * Rule: among three sides, we need to find whether the longest of the three is smaller than the sum of the two shorter one. * If so, then these three could form a valid triangle. */ @@ -30,5 +30,4 @@ public int triangleNumber(int[] nums) { return triplets; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_616.java b/src/main/java/com/fishercoder/solutions/firstthousand/_616.java index ea7edbaedf..1ca551e7e2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_616.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_616.java @@ -3,7 +3,7 @@ public class _616 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/92112/java-solution-boolean-array */ public String addBoldTag(String s, String[] dict) { @@ -32,5 +32,4 @@ public String addBoldTag(String s, String[] dict) { return stringBuilder.toString(); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_617.java b/src/main/java/com/fishercoder/solutions/firstthousand/_617.java index 6efe3127a9..90e704eb70 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_617.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_617.java @@ -20,7 +20,7 @@ public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { } public static class Solution2 { - /** + /* * My completely original solution on 9/20/2021, no new extra nodes created. */ public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { @@ -35,5 +35,4 @@ public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { return root1; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_62.java b/src/main/java/com/fishercoder/solutions/firstthousand/_62.java index 4695b660c7..34420349c0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_62.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_62.java @@ -2,7 +2,7 @@ public class _62 { public static class Solution1 { - /** + /* * Another typical DP question, use a 2d array: the first row and the first column need to be * initialized to be 1 since there's only one way to reach every position in the first row and * the first column: either from left or top. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_621.java b/src/main/java/com/fishercoder/solutions/firstthousand/_621.java index 3c323c3880..ad8e9cab2b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_621.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_621.java @@ -55,5 +55,4 @@ public Task(int total, char character) { } } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_622.java b/src/main/java/com/fishercoder/solutions/firstthousand/_622.java index dd3e2b8a0a..7508b2c388 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_622.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_622.java @@ -7,8 +7,9 @@ public static class Solution1 { public static class MyCircularQueue { int[] arr; - int rearIndex;//this one points to the rear of the queue and could grow to 3000 which is the max calls that this problem is bound to - int size;//this is the max size of this circule queue + int rearIndex; // this one points to the rear of the queue and could grow to 3000 + // which is the max calls that this problem is bound to + int size; // this is the max size of this circule queue int frontIndex; public MyCircularQueue(int k) { @@ -55,6 +56,5 @@ public boolean isFull() { return Math.abs(rearIndex - frontIndex) == size; } } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_623.java b/src/main/java/com/fishercoder/solutions/firstthousand/_623.java index f62e031cbd..49e8fd8f0c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_623.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_623.java @@ -33,5 +33,4 @@ private void dfs(TreeNode root, int v, int d) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_624.java b/src/main/java/com/fishercoder/solutions/firstthousand/_624.java index eed6c52f7f..23c392c8d4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_624.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_624.java @@ -15,7 +15,10 @@ public int maxDistance(List> arrays) { Collections.sort(max); int ans = Integer.MIN_VALUE; for (List array : arrays) { - int big = array.get(array.size() - 1) == max.get(max.size() - 1) ? max.get(max.size() - 2) : max.get(max.size() - 1); + int big = + array.get(array.size() - 1) == max.get(max.size() - 1) + ? max.get(max.size() - 2) + : max.get(max.size() - 1); ans = Math.max(ans, big - array.get(0)); } return ans; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_625.java b/src/main/java/com/fishercoder/solutions/firstthousand/_625.java index 1b67c677bb..f07420f37e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_625.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_625.java @@ -6,32 +6,32 @@ public class _625 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/92854/java-solution-result-array * and https://leetcode.com/articles/minimum-factorization/#approach-3-using-factorizationaccepted */ public int smallestFactorization(int a) { - //case 1: a < 10 + // case 1: a < 10 if (a < 10) { return a; } - //case 2: start with 9 and try every possible digit + // case 2: start with 9 and try every possible digit List resultArray = new ArrayList<>(); for (int i = 9; i > 1; i--) { - //if current digit divides a, then store all occurences of current digit in res + // if current digit divides a, then store all occurences of current digit in res while (a % i == 0) { a = a / i; resultArray.add(i); } } - //if a could not be broken in form of digits, return 0 + // if a could not be broken in form of digits, return 0 if (a != 0) { return 0; } - //get the result from the result array in reverse order + // get the result from the result array in reverse order long result = 0; for (int i = resultArray.size() - 1; i >= 0; i--) { result = result * 10 + resultArray.get(i); @@ -42,5 +42,4 @@ public int smallestFactorization(int a) { return (int) result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_628.java b/src/main/java/com/fishercoder/solutions/firstthousand/_628.java index 42161794fa..71a5979634 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_628.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_628.java @@ -12,8 +12,7 @@ public int maximumProduct(int[] nums) { for (int i = nums.length - 1; i >= nums.length - 3; i--) { product *= nums[i]; } - int anotherProduct = nums[0] * nums - [1] * nums[nums.length - 1]; + int anotherProduct = nums[0] * nums[1] * nums[nums.length - 1]; product = Math.max(product, anotherProduct); } else { for (int i = 0; i < nums.length; i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_629.java b/src/main/java/com/fishercoder/solutions/firstthousand/_629.java index 4b0639ef07..c8aac6a7f8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_629.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_629.java @@ -4,7 +4,7 @@ public class _629 { public static class Solution1 { - /** + /* * reference: https://leetcode.com/articles/k-inverse-pairs-array/#approach-5-another-optimized-dynamic-programming-approachaccepted * and * https://discuss.leetcode.com/topic/93815/java-dp-o-nk-solution diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_63.java b/src/main/java/com/fishercoder/solutions/firstthousand/_63.java index b788b292b7..87264499c1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_63.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_63.java @@ -2,7 +2,7 @@ public class _63 { public static class Solution1 { - /** + /* * Idea: grid[i][j] has to be set to zero if obstacleGrid[i][j] == 1, otherwise, we can get * dp[i][j] from its top and left dp. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_630.java b/src/main/java/com/fishercoder/solutions/firstthousand/_630.java index e3af29d870..231956dd53 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_630.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_630.java @@ -5,7 +5,7 @@ public class _630 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/93790/short-java-code-using-priorityqueue * Sort by finish date!!! This is greedy! We should take those classes that finish early first. */ @@ -17,7 +17,7 @@ public int scheduleCourse(int[][] courses) { day += course[0]; maxHeap.offer(course[0]); if (day > course[1]) { - day -= maxHeap.poll();//drop the previous courses that took the most time + day -= maxHeap.poll(); // drop the previous courses that took the most time } } return maxHeap.size(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_631.java b/src/main/java/com/fishercoder/solutions/firstthousand/_631.java index 184c22bb24..9ad9a9f976 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_631.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_631.java @@ -6,7 +6,7 @@ public class _631 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/articles/design-excel-sum-formula/#approach-1-using-topological-sortaccepted */ public static class Excel { @@ -53,12 +53,14 @@ public int sum(int r, char c, String[] strs) { public void topologicalSort(int r, int c) { for (int i = 0; i < formulas.length; i++) { for (int j = 0; j < formulas[0].length; j++) { - if (formulas[i][j] != null && formulas[i][j].cells.containsKey("" + (char) ('A' + c) + (r + 1))) { + if (formulas[i][j] != null + && formulas[i][j].cells.containsKey( + "" + (char) ('A' + c) + (r + 1))) { topologicalSort(i, j); } } } - stack.push(new int[]{r, c}); + stack.push(new int[] {r, c}); } public void execute_stack() { @@ -104,7 +106,7 @@ public int calculate_sum(int r, int c, HashMap cells) { } } - /** + /* * Your Excel object will be instantiated and called as such: * Excel obj = new Excel(H, W); * obj.set(r,c,v); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_632.java b/src/main/java/com/fishercoder/solutions/firstthousand/_632.java index 5da98474bf..dbb48b38a0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_632.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_632.java @@ -5,16 +5,16 @@ public class _632 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/94445/java-code-using-priorityqueue-similar-to-merge-k-array/2 */ public int[] smallestRange(List> nums) { PriorityQueue minHeap = new PriorityQueue<>(nums.size(), (a, b) -> a[0] - b[0]); - /**int[] array consists of three numbers: value; which list in nums; index of value in this list*/ + /*int[] array consists of three numbers: value; which list in nums; index of value in this list*/ int max = nums.get(0).get(0); for (int i = 0; i < nums.size(); i++) { - minHeap.offer(new int[]{nums.get(i).get(0), i, 0}); + minHeap.offer(new int[] {nums.get(i).get(0), i, 0}); max = Math.max(max, nums.get(i).get(0)); } int minRange = Integer.MAX_VALUE; @@ -32,7 +32,7 @@ public int[] smallestRange(List> nums) { max = Math.max(max, curr[0]); } } - return new int[]{start, start + minRange}; + return new int[] {start, start + minRange}; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_634.java b/src/main/java/com/fishercoder/solutions/firstthousand/_634.java index 9ce7b429f1..26866b4608 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_634.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_634.java @@ -2,7 +2,7 @@ public class _634 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/94442/java-5-lines-o-1-space-solution * and https://leetcode.com/articles/find-derangements/#approach-5-using-formula-accepted */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_635.java b/src/main/java/com/fishercoder/solutions/firstthousand/_635.java index c4914b3ba0..6b6f0fa0a7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_635.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_635.java @@ -7,12 +7,12 @@ public class _635 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/94449/concise-java-solution */ public static class LogSystem { - /** + /* * These indices denote and string endings of timestamps of different granularity, i.e. * timestamp[1] in timestamps: "2017:01:01:22:59:59" * -> 2017: 4, 01: 7, 01: 10, 22: 13, 59: 16, 59: 19 @@ -25,11 +25,11 @@ public static class LogSystem { public LogSystem() { timestamps = new LinkedList<>(); units = Arrays.asList("Year", "Month", "Day", "Hour", "Minute", "Second"); - indices = new int[]{4, 7, 10, 13, 16, 19}; + indices = new int[] {4, 7, 10, 13, 16, 19}; } public void put(int id, String timestamp) { - timestamps.add(new String[]{Integer.toString(id), timestamp}); + timestamps.add(new String[] {Integer.toString(id), timestamp}); } public List retrieve(String s, String e, String gra) { @@ -37,8 +37,12 @@ public List retrieve(String s, String e, String gra) { int index = units.indexOf(gra); int stringEnd = indices[index]; for (String[] timestamp : timestamps) { - if (timestamp[1].substring(0, stringEnd).compareTo(s.substring(0, stringEnd)) >= 0 - && timestamp[1].substring(0, stringEnd).compareTo(e.substring(0, stringEnd)) <= 0) { + if (timestamp[1].substring(0, stringEnd).compareTo(s.substring(0, stringEnd)) + >= 0 + && timestamp[1] + .substring(0, stringEnd) + .compareTo(e.substring(0, stringEnd)) + <= 0) { res.add(Integer.parseInt(timestamp[0])); } } @@ -46,5 +50,4 @@ public List retrieve(String s, String e, String gra) { } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_636.java b/src/main/java/com/fishercoder/solutions/firstthousand/_636.java index 3316d1d381..0b8e3342f0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_636.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_636.java @@ -7,7 +7,7 @@ public class _636 { public static class Solution1 { public int[] exclusiveTime(int n, List logs) { - /**Stack is the way to go: + /*Stack is the way to go: * 1. we keep pushing the logId onto the stack whenever we just encounter this logId's start timestamp, * 2. we'll pop this logId only when we encounter this logId's end timestamp. * 3. Meanwhile, we keep a counter called prevTime, @@ -24,7 +24,8 @@ public int[] exclusiveTime(int n, List logs) { if (parts[1].equals("start")) { stack.addLast(Integer.parseInt(parts[0])); } else { - //remember to have result plus 1, i.e. when a task starts at 2, ends at 5, it should be 5 -2 + 1 = 4 + // remember to have result plus 1, i.e. when a task starts at 2, ends at 5, it + // should be 5 -2 + 1 = 4 prevTime++; result[stack.pollLast()]++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_637.java b/src/main/java/com/fishercoder/solutions/firstthousand/_637.java index d6ce4a9b72..0962c32b27 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_637.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_637.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -36,5 +35,4 @@ public List averageOfLevels(TreeNode root) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_638.java b/src/main/java/com/fishercoder/solutions/firstthousand/_638.java index 06bd2121ce..bb45a6c156 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_638.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_638.java @@ -5,14 +5,16 @@ public class _638 { public static class Solution1 { - /** + /* * reference: https://leetcode.com/articles/shopping-offers/#approach-1-using-recursion-accepted */ - public int shoppingOffers(List price, List> special, List needs) { + public int shoppingOffers( + List price, List> special, List needs) { return shopping(price, special, needs, 0); } - public int shopping(List price, List> special, List needs, int i) { + public int shopping( + List price, List> special, List needs, int i) { if (i == special.size()) { return dot(needs, price); } @@ -26,7 +28,9 @@ public int shopping(List price, List> special, List input(char c) { List result = new ArrayList<>(); if (c == '#') { - map.put(stringBuilder.toString(), map.getOrDefault(stringBuilder.toString(), 0) + 1); + map.put( + stringBuilder.toString(), + map.getOrDefault(stringBuilder.toString(), 0) + 1); stringBuilder.setLength(0); - answers.clear();/**The user has finished typing, so we'll clean answers to get ready for next search*/ + answers + .clear(); /*The user has finished typing, so we'll clean answers to get ready for next search*/ } else { stringBuilder.append(c); - /**when its length is 1, we find all the prefix that is a match and put them into answers, + /*when its length is 1, we find all the prefix that is a match and put them into answers, * then for the rest, we'll just remove those that are not match with the prefix any more, we do this logic in else branch*/ if (stringBuilder.length() == 1) { for (Map.Entry entry : map.entrySet()) { @@ -45,9 +48,15 @@ public List input(char c) { answers.add(entry); } } - Collections.sort(answers, (a, b) -> a.getValue() == b.getValue() ? a.getKey().compareTo(b.getKey()) : b.getValue() - a.getValue()); + Collections.sort( + answers, + (a, b) -> + a.getValue() == b.getValue() + ? a.getKey().compareTo(b.getKey()) + : b.getValue() - a.getValue()); } else { - for (Iterator> iterator = answers.iterator(); iterator.hasNext(); ) { + for (Iterator> iterator = answers.iterator(); + iterator.hasNext(); ) { if (!iterator.next().getKey().startsWith(stringBuilder.toString())) { iterator.remove(); } @@ -60,6 +69,5 @@ public List input(char c) { return result; } } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_644.java b/src/main/java/com/fishercoder/solutions/firstthousand/_644.java index cd1092d1df..7c9d47ad94 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_644.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_644.java @@ -1,10 +1,10 @@ package com.fishercoder.solutions.firstthousand; public class _644 { - /**reference: https://leetcode.com/articles/maximum-average-subarray-ii/#approach-2-using-binary-search-accepted + /*reference: https://leetcode.com/articles/maximum-average-subarray-ii/#approach-2-using-binary-search-accepted * https://discuss.leetcode.com/topic/96123/java-solution-o-nlogm-binary-search-the-answer/13*/ - /** + /* * To understand the idea behind this method, let's look at the following points. * Firstly, we know that the value of the average could lie between the range (min, max)(min,max). * Here, minmin and maxmax refer to the minimum and the maximum values out of the given numsnums array. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_645.java b/src/main/java/com/fishercoder/solutions/firstthousand/_645.java index 258a007fb0..dc9217dfdf 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_645.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_645.java @@ -42,7 +42,7 @@ public int[] findErrorNums(int[] nums) { dup2 = i + 1; } } - return new int[]{dup, dup2}; + return new int[] {dup, dup2}; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_646.java b/src/main/java/com/fishercoder/solutions/firstthousand/_646.java index 0a6600748d..8c9c4e0dfa 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_646.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_646.java @@ -3,15 +3,15 @@ import java.util.Arrays; public class _646 { - /** + /* * Although this problem could be solved using DP, greedy is more efficient in both time and space complexity. */ public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/maximum-length-of-pair-chain/editorial/ */ public int findLongestChain(int[][] pairs) { - //sort by the second element + // sort by the second element Arrays.sort(pairs, (a, b) -> a[1] - b[1]); int ans = 0; int prev = Integer.MIN_VALUE; @@ -26,30 +26,32 @@ public int findLongestChain(int[][] pairs) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/maximum-length-of-pair-chain/discuss/105623/Java-Very-Simple-without-DP */ public int findLongestChain(int[][] pairs) { - //sort by the first element + // sort by the first element Arrays.sort(pairs, (a, b) -> a[0] - b[0]); int len = 0; int pre = Integer.MIN_VALUE; for (int[] pair : pairs) { if (pair[0] > pre) { - //no overlap + // no overlap len++; - //so we need to update the previous number to be the end of current pair: pair[1] + // so we need to update the previous number to be the end of current pair: + // pair[1] pre = pair[1]; } else if (pair[1] < pre) { - //overlap but with a smaller second number - //since we want to find the maximum possible chain, so we update pre to be this smaller number - //this means we decided to adopt this pair to be in this chain and give up the previous one - //this logic can be seen clearly in test3 for this class + // overlap but with a smaller second number + // since we want to find the maximum possible chain, so we update pre to be this + // smaller number + // this means we decided to adopt this pair to be in this chain and give up the + // previous one + // this logic can be seen clearly in test3 for this class pre = pair[1]; } } return len; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_647.java b/src/main/java/com/fishercoder/solutions/firstthousand/_647.java index bb145317e2..17ba043966 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_647.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_647.java @@ -3,14 +3,14 @@ public class _647 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/96819/java-solution-8-lines-extendpalindrome */ public int countSubstrings(String s) { int count = 0; for (int i = 0; i < s.length(); i++) { - count += extendPalindrome(s, i, i);//odd length - count += extendPalindrome(s, i, i + 1);//even length + count += extendPalindrome(s, i, i); // odd length + count += extendPalindrome(s, i, i + 1); // even length } return count; } @@ -27,7 +27,7 @@ private int extendPalindrome(String s, int left, int right) { } public static class Solution2 { - /** + /* * Simple brute force solution is accepted as well, although not ideal in terms of time complexity: O(n^2) */ public int countSubstrings(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_649.java b/src/main/java/com/fishercoder/solutions/firstthousand/_649.java index 42e5993263..9ca12a0ef7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_649.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_649.java @@ -21,7 +21,7 @@ public String predictPartyVictory(String senate) { int radiantIndex = radiantQ.poll(); int direIndex = direQ.poll(); if (radiantIndex < direIndex) { - /**Radiant will ban Dire in this case, so we'll add radiant index back to the queue plus n*/ + /*Radiant will ban Dire in this case, so we'll add radiant index back to the queue plus n*/ radiantQ.offer(radiantIndex + len); } else { direQ.offer(direIndex + len); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_65.java b/src/main/java/com/fishercoder/solutions/firstthousand/_65.java index 457455d5b4..a88d813181 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_65.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_65.java @@ -1,7 +1,7 @@ package com.fishercoder.solutions.firstthousand; public class _65 { - /** + /* * credit: https://discuss.leetcode.com/topic/9490/clear-java-solution-with-ifs */ public static class Solution1 { @@ -41,7 +41,7 @@ public boolean isNumber(String s) { } public static class Solution2 { - /** + /* * credit: https://discuss.leetcode.com/topic/2973/java-solution-with-one-line */ public boolean isNumber(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_650.java b/src/main/java/com/fishercoder/solutions/firstthousand/_650.java index dc4e3cb467..d53725397e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_650.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_650.java @@ -6,9 +6,12 @@ public static class Solution1 { public int minSteps(int n) { int[] dp = new int[n + 1]; for (int i = 2; i <= n; i++) { - dp[i] = i;//we assign i to dp[i] first, because for a lot of cases, e.g. for most cases when i is odd, its min steps is i itself, if it's not, we can overwrite it later + dp[i] = i; // we assign i to dp[i] first, because for a lot of cases, e.g. for most + // cases when i is odd, its min steps is i itself, if it's not, we can + // overwrite it later for (int j = i - 1; j > 1; j--) { - //traverse backwards, whenever it's divisible by j, we'll update dp[i] because it's guaranteed to be smaller when j is smaller. + // traverse backwards, whenever it's divisible by j, we'll update dp[i] because + // it's guaranteed to be smaller when j is smaller. if (i % j == 0) { dp[i] = dp[j] + (i / j); break; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_651.java b/src/main/java/com/fishercoder/solutions/firstthousand/_651.java index f93261c140..b79ef58e5d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_651.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_651.java @@ -3,7 +3,7 @@ public class _651 { public static class Solution1 { - /** + /* * Minimum needs to be more than 3 A's in a row, otherwise "Ctrl A, Ctrl C, Ctrl V" will make fewer A's than directly * copying A's with the equal number of steps. * E.g. when n == 5, @@ -23,5 +23,4 @@ public int maxA(int N) { return dp[N]; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_652.java b/src/main/java/com/fishercoder/solutions/firstthousand/_652.java index 6f16cfc969..57dcbca1fd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_652.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_652.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -9,9 +8,9 @@ public class _652 { public static class Solution1 { - /**credit: https://discuss.leetcode.com/topic/97584/java-concise-postorder-traversal-solution*/ + /*credit: https://discuss.leetcode.com/topic/97584/java-concise-postorder-traversal-solution*/ - /** + /* * You don't actually need to check if every other tree is a duplicate of current node, * just when you go through each node, you'll see whether there's already one in the map, * since map.containsKey() checks this TreeNode. @@ -26,7 +25,12 @@ private String postorder(TreeNode curr, HashMap map, List * As the problem states, I always broke the array into two halves and make notes @@ -26,7 +26,8 @@ public TreeNode constructMaximumBinaryTree(int[] nums) { return constructMaxTree(root, maxIndex, nums, 0, nums.length - 1); } - private TreeNode constructMaxTree(TreeNode root, int rootIndex, int[] nums, int start, int end) { + private TreeNode constructMaxTree( + TreeNode root, int rootIndex, int[] nums, int start, int end) { if (rootIndex > start) { int max = Integer.MIN_VALUE; int maxIndex = -1; @@ -36,7 +37,8 @@ private TreeNode constructMaxTree(TreeNode root, int rootIndex, int[] nums, int maxIndex = i; } } - root.left = constructMaxTree(new TreeNode(max), maxIndex, nums, start, rootIndex - 1); + root.left = + constructMaxTree(new TreeNode(max), maxIndex, nums, start, rootIndex - 1); } if (rootIndex < end) { int max = Integer.MIN_VALUE; @@ -47,14 +49,15 @@ private TreeNode constructMaxTree(TreeNode root, int rootIndex, int[] nums, int maxIndex = i; } } - root.right = constructMaxTree(new TreeNode(max), maxIndex, nums, rootIndex + 1, end); + root.right = + constructMaxTree(new TreeNode(max), maxIndex, nums, rootIndex + 1, end); } return root; } } public static class Solution2 { - /** + /* * Completely my original solution as well, but more concise. */ public TreeNode constructMaximumBinaryTree(int[] nums) { @@ -84,7 +87,7 @@ int[] findMax(int[] nums, int start, int end) { max = nums[i]; } } - return new int[]{max, maxIndex}; + return new int[] {max, maxIndex}; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_655.java b/src/main/java/com/fishercoder/solutions/firstthousand/_655.java index 26c3f0479c..3749cafbfe 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_655.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_655.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -10,7 +9,7 @@ public class _655 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/98381/java-recursive-solution * and https://leetcode.com/articles/print-binary-tree/ */ @@ -30,7 +29,8 @@ public List> printTree(TreeNode root) { return result; } - private void populateResult(TreeNode root, List> result, int row, int totalRows, int i, int j) { + private void populateResult( + TreeNode root, List> result, int row, int totalRows, int i, int j) { if (row == totalRows || root == null) { return; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_656.java b/src/main/java/com/fishercoder/solutions/firstthousand/_656.java index 19a03be5e1..90e84c2dc0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_656.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_656.java @@ -7,7 +7,7 @@ public class _656 { public static class Solution1 { - /** + /* * Time: O(n*B) * Reference: https://leetcode.com/articles/coin-path/#approach-3-using-dynamic-programming-accepted */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_659.java b/src/main/java/com/fishercoder/solutions/firstthousand/_659.java index 956764783d..41bbbcaaa5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_659.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_659.java @@ -6,7 +6,7 @@ public class _659 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/99187/java-o-n-time-o-n-space */ public boolean isPossible(int[] nums) { @@ -21,7 +21,8 @@ public boolean isPossible(int[] nums) { } else if (appendFreqMap.getOrDefault(i, 0) > 0) { appendFreqMap.put(i, appendFreqMap.get(i) - 1); appendFreqMap.put(i + 1, appendFreqMap.getOrDefault(i + 1, 0) + 1); - } else if (freqMap.getOrDefault(i + 1, 0) > 0 && freqMap.getOrDefault(i + 2, 0) > 0) { + } else if (freqMap.getOrDefault(i + 1, 0) > 0 + && freqMap.getOrDefault(i + 2, 0) > 0) { freqMap.put(i + 1, freqMap.get(i + 1) - 1); freqMap.put(i + 2, freqMap.get(i + 2) - 1); appendFreqMap.put(i + 3, appendFreqMap.getOrDefault(i + 3, 0) + 1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_66.java b/src/main/java/com/fishercoder/solutions/firstthousand/_66.java index 95ac8b770b..c866392753 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_66.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_66.java @@ -3,7 +3,7 @@ public class _66 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/plus-one/discuss/24082/My-Simple-Java-Solution */ public int[] plusOne(int[] digits) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_662.java b/src/main/java/com/fishercoder/solutions/firstthousand/_662.java index f06e782130..8bb0856fe2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_662.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_662.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.AbstractMap; import java.util.ArrayList; import java.util.LinkedList; @@ -11,7 +10,7 @@ public class _662 { public static class Solution1 { - /** + /* * Use a map to store the node to value map, * we use root as index 1, then its left child is 2*i-1 and right child is 2*i */ @@ -29,18 +28,27 @@ public int widthOfBinaryTree(TreeNode root) { for (int i = 0; i < size; i++) { Map.Entry curr = queue.poll(); if (curr.getKey().left != null) { - Map.Entry newEntry = new AbstractMap.SimpleEntry<>(curr.getKey().left, curr.getValue() * 2 - 1); + Map.Entry newEntry = + new AbstractMap.SimpleEntry<>( + curr.getKey().left, curr.getValue() * 2 - 1); queue.offer(newEntry); list.add(newEntry); } if (curr.getKey().right != null) { - Map.Entry newEntry = new AbstractMap.SimpleEntry<>(curr.getKey().right, curr.getValue() * 2); + Map.Entry newEntry = + new AbstractMap.SimpleEntry<>( + curr.getKey().right, curr.getValue() * 2); queue.offer(newEntry); list.add(newEntry); } } if (list.size() > 1) { - max = Math.max(list.get(list.size() - 1).getValue() - list.get(0).getValue() + 1, max); + max = + Math.max( + list.get(list.size() - 1).getValue() + - list.get(0).getValue() + + 1, + max); } } return max; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_663.java b/src/main/java/com/fishercoder/solutions/firstthousand/_663.java index fa74781b8c..dbacba9459 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_663.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_663.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; public class _663 { public static class Solution1 { - /** + /* * The idea is that we use a map to store the sum of each node, then in the end, * we check if any node has a sum that is exactly half of total sum. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_664.java b/src/main/java/com/fishercoder/solutions/firstthousand/_664.java index 34da63262f..91ed02c4d3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_664.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_664.java @@ -2,7 +2,7 @@ public class _664 { public static class Solution1 { - /** + /* * reference: https://discuss.leetcode.com/topic/100137/java-solution-dp */ public int strangePrinter(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_666.java b/src/main/java/com/fishercoder/solutions/firstthousand/_666.java index 763867cc64..877d111f7c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_666.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_666.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.Map; public class _666 { public static class Solution1 { - /** + /* * OMG, since it's no larger than depth 5, I've got a hardcoded solution here.... * By "harcoded", I mean the constructTree() method. */ @@ -33,56 +32,99 @@ private void computePathSum(TreeNode root, int pathSum) { if (root.left == null && root.right == null) { totalSum += pathSum; } -// pathSum -= root.val; - /**this line is not necessary as I'm passing pathSum as a local variable around, so it's always updated - it's AC'ed with or without this line*/ + // pathSum -= root.val; + /*this line is not necessary as I'm passing pathSum as a local variable around, so it's always updated + it's AC'ed with or without this line*/ } private TreeNode constructTree(int[] nums) { if (nums == null || nums.length == 0) { return null; } - TreeNode root = new TreeNode(Integer.parseInt(Integer.toString(nums[0]).substring(2, 3))); - //depth 2 + TreeNode root = + new TreeNode(Integer.parseInt(Integer.toString(nums[0]).substring(2, 3))); + // depth 2 for (int i = 1; i < nums.length; i++) { - if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 2 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { - root.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 2 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { - root.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 2 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { + root.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 2 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { + root.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); } } - //depth 3 + // depth 3 for (int i = 2; i < nums.length; i++) { - if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { - root.left.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { - root.left.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 3) { - root.right.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 4) { - root.right.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { + root.left.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { + root.left.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 3) { + root.right.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 3 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 4) { + root.right.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); } } - //depth 4 + // depth 4 for (int i = 3; i < nums.length; i++) { - if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { - root.left.left.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { - root.left.left.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 3) { - root.left.right.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 4) { - root.left.right.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 5) { - root.right.left.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 6) { - root.right.left.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 7) { - root.right.right.left = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); - } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 8) { - root.right.right.right = new TreeNode(Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 1) { + root.left.left.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 2) { + root.left.left.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 3) { + root.left.right.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 4) { + root.left.right.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 5) { + root.right.left.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 6) { + root.right.left.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 7) { + root.right.right.left = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); + } else if (Integer.parseInt(Integer.toString(nums[i]).substring(0, 1)) == 4 + && Integer.parseInt(Integer.toString(nums[i]).substring(1, 2)) == 8) { + root.right.right.right = + new TreeNode( + Integer.parseInt(Integer.toString(nums[i]).substring(2, 3))); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_667.java b/src/main/java/com/fishercoder/solutions/firstthousand/_667.java index 2057b5021d..6d89ec67ec 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_667.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_667.java @@ -6,7 +6,7 @@ public class _667 { public static class Solutoin1 { - /** + /* * inspired by this post: https://leetcode.com/problems/beautiful-arrangement-ii/discuss/1154683/Short-and-Simple-Solution-or-Multiple-Approaches-Explained-with-Examples-! and implemented it on my own */ public int[] constructArray(int n, int k) { @@ -38,7 +38,7 @@ public int[] constructArray(int n, int k) { } public static class Solutoin2 { - /** + /* * This is a very smart solution: * First, we can see that the max value k could reach is n-1 which * comes from a sequence like this: diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_668.java b/src/main/java/com/fishercoder/solutions/firstthousand/_668.java index 1304a1c838..ee00d447c9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_668.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_668.java @@ -4,7 +4,7 @@ public class _668 { public static class Solution1 { - /** + /* * This brute force approach resulted in * TLE on Leetcode and * OOM error by _668test.test3() when running in my localhost: @@ -29,7 +29,7 @@ public int findKthNumber(int m, int n, int k) { } public static class Solution2 { - /** + /* * reference: https://discuss.leetcode.com/topic/101132/java-solution-binary-search */ public int findKthNumber(int m, int n, int k) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_67.java b/src/main/java/com/fishercoder/solutions/firstthousand/_67.java index 6a2529b8b4..0ecb54e9a5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_67.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_67.java @@ -2,7 +2,7 @@ public class _67 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/13698/short-ac-solution-in-java-with-explanation * 1. use StringBuilder.reverse() function! Nice! * 2. if a numeric number is represented/stored in String, how to get its value: use Character.getNumericValue(s.charAt(i)) diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_671.java b/src/main/java/com/fishercoder/solutions/firstthousand/_671.java index 4f1b92d268..956dc94007 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_671.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_671.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.TreeSet; public class _671 { @@ -24,6 +23,5 @@ private void dfs(TreeNode root, TreeSet set) { dfs(root.left, set); dfs(root.right, set); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_673.java b/src/main/java/com/fishercoder/solutions/firstthousand/_673.java index 5e1493a61c..9931eb1189 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_673.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_673.java @@ -2,7 +2,7 @@ public class _673 { public static class Solution1 { - /** + /* * Reference: https://discuss.leetcode.com/topic/103020/java-c-simple-dp-solution-with-explanation */ public int findNumberOfLIS(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_675.java b/src/main/java/com/fishercoder/solutions/firstthousand/_675.java index 9ddfb2e60f..ed953b8ab3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_675.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_675.java @@ -8,17 +8,20 @@ public class _675 { public static class Solution1 { public int cutOffTree(List> forest) { - if (forest == null || forest.isEmpty() || forest.size() == 0 || forest.get(0).get(0) == 0) { + if (forest == null + || forest.isEmpty() + || forest.size() == 0 + || forest.get(0).get(0) == 0) { return -1; } int m = forest.size(); int n = forest.get(0).size(); - /**cut trees in ascending order*/ + /*cut trees in ascending order*/ PriorityQueue heap = new PriorityQueue<>((a, b) -> a.height - b.height); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (forest.get(i).get(j) > 1) { - /**This is important: we'll add trees that are only taller than 1!!!*/ + /*This is important: we'll add trees that are only taller than 1!!!*/ heap.offer(new Tree(i, j, forest.get(i).get(j))); } } @@ -39,7 +42,7 @@ public int cutOffTree(List> forest) { } private int bfs(List> forest, Tree target, Tree start, int m, int n) { - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; boolean[][] visited = new boolean[m][n]; Queue queue = new LinkedList<>(); queue.offer(start); @@ -56,7 +59,12 @@ private int bfs(List> forest, Tree target, Tree start, int m, int for (int i = 0; i < 4; i++) { int nextX = tree.x + dirs[i]; int nextY = tree.y + dirs[i + 1]; - if (nextX < 0 || nextY < 0 || nextX >= m || nextY >= n || visited[nextX][nextY] || forest.get(nextX).get(nextY) == 0) { + if (nextX < 0 + || nextY < 0 + || nextX >= m + || nextY >= n + || visited[nextX][nextY] + || forest.get(nextX).get(nextY) == 0) { continue; } queue.offer(new Tree(nextX, nextY, forest.get(nextX).get(nextY))); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_676.java b/src/main/java/com/fishercoder/solutions/firstthousand/_676.java index 82894e2142..75355388b3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_676.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_676.java @@ -10,14 +10,14 @@ public static class MagicDictionary { Set wordSet; - /** + /* * Initialize your data structure here. */ public MagicDictionary() { wordSet = new HashSet<>(); } - /** + /* * Build a dictionary through a list of words */ public void buildDict(String[] dict) { @@ -26,7 +26,7 @@ public void buildDict(String[] dict) { } } - /** + /* * Returns if there is any word in the trie that equals to the given word after modifying exactly one character */ public boolean search(String word) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_677.java b/src/main/java/com/fishercoder/solutions/firstthousand/_677.java index 74653c0226..6c090932fc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_677.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_677.java @@ -10,7 +10,7 @@ public static class MapSum { Map map; - /** + /* * Initialize your data structure here. */ public MapSum() { @@ -31,6 +31,5 @@ public int sum(String prefix) { return sum; } } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_678.java b/src/main/java/com/fishercoder/solutions/firstthousand/_678.java index 98b4255113..299f14a46f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_678.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_678.java @@ -4,7 +4,7 @@ public class _678 { public static class Solution1 { - /** + /* * This solution is correct, but will result in TLE by test4 */ public boolean checkValidString(String s) { @@ -62,7 +62,7 @@ private boolean isValid(String s, int start, int cnt) { } cnt--; } else if (c == '*') { - /**Extra caution: start should be i+1, not start+1 !*/ + /*Extra caution: start should be i+1, not start+1 !*/ return isValid(s, i + 1, cnt + 1) || isValid(s, i + 1, cnt - 1) || isValid(s, i + 1, cnt); @@ -73,7 +73,7 @@ private boolean isValid(String s, int start, int cnt) { } public static class Solution3 { - /** + /* * Greedy solution: * 1. Let lo mean the lowest possible open left paren * 2. Let hi mean the possibilities of highest possible open left paren, so as long as s.charAt(i) != ')', it's possible to be a '(', so we'll increment hi by 1 diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_679.java b/src/main/java/com/fishercoder/solutions/firstthousand/_679.java index ae09eeeb22..77b0617d24 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_679.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_679.java @@ -4,7 +4,7 @@ public class _679 { public static class Solution1 { - /** + /* * Since there are only 4 cards and only 4 operations, we can iterate through all possible combinations, there's a total of 9216 possibilities: * 1. we pick two out of four cards, with order (since order matters for division), 4 * 3 = 12, then pick one of four operations: 12 * 4 = 48; * 2. then we pick two from these three numbers: 12 * 4 * 3 * 4 * 2 = 1152 @@ -16,7 +16,7 @@ public boolean judgePoint24(int[] nums) { private boolean dfs(double[] nums) { if (nums.length == 1) { - return Math.abs(nums[0] - 24) < 1e-8;//1e-8 means 0.000000001, i.e. 10^(-8) + return Math.abs(nums[0] - 24) < 1e-8; // 1e-8 means 0.000000001, i.e. 10^(-8) } for (int i = 0; i < nums.length; i++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_68.java b/src/main/java/com/fishercoder/solutions/firstthousand/_68.java index db96a3102f..20a9fbd2eb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_68.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_68.java @@ -57,5 +57,4 @@ public List fullJustify(String[] words, int L) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_681.java b/src/main/java/com/fishercoder/solutions/firstthousand/_681.java index 3a70192ad6..e133a7596b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_681.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_681.java @@ -17,7 +17,8 @@ public String nextClosestTime(String time) { while (true) { cur = (cur + 1) % (24 * 60); - int[] digits = new int[]{cur / 60 / 10, cur / 60 % 10, cur % 60 / 10, cur % 60 % 10}; + int[] digits = + new int[] {cur / 60 / 10, cur / 60 % 10, cur % 60 / 10, cur % 60 % 10}; search: { for (int d : digits) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_683.java b/src/main/java/com/fishercoder/solutions/firstthousand/_683.java index 5e13093400..61dbefe092 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_683.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_683.java @@ -3,7 +3,7 @@ public class _683 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/104771/java-c-simple-o-n-solution */ public int kEmptySlots(int[] flowers, int k) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_684.java b/src/main/java/com/fishercoder/solutions/firstthousand/_684.java index 38f6407769..08c7177571 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_684.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_684.java @@ -8,7 +8,7 @@ public class _684 { public static class Solution1 { - /** + /* * This is my original solution. A little verbose. */ class UnionFind { @@ -24,7 +24,7 @@ public UnionFind(int[][] edges) { n = edges[0].length; nodes = new HashSet<>(); visitedNodes = new HashSet<>(); - redundantConn = new int[]{}; + redundantConn = new int[] {}; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { nodes.add(edges[i][j]); @@ -78,7 +78,7 @@ private boolean isTree() { public int[] findRedundantConnection(int[][] edges) { UnionFind unionFind = new UnionFind(edges); - int[] result = new int[]{}; + int[] result = new int[] {}; for (int[] edge : edges) { result = unionFind.union(edge); } @@ -87,7 +87,7 @@ public int[] findRedundantConnection(int[][] edges) { } public static class Solution2 { - /** + /* * DFS, credit: https://leetcode.com/problems/redundant-connection/editorial/ * 1. we build the graph one edge at a time, each time, we add both edge[0] to the neighbors of edge[1] and vice versa since this is an un-directed graph; * 2. as soon as we encounter an edge that can connect to each other, it must be the redundant one. @@ -104,7 +104,9 @@ public int[] findRedundantConnection(int[][] edges) { Set visited = new HashSet<>(); for (int[] edge : edges) { visited.clear(); - if (!graph[edge[0]].isEmpty() && !graph[edge[1]].isEmpty() && canConnect(edge[0], edge[1], graph, visited)) { + if (!graph[edge[0]].isEmpty() + && !graph[edge[1]].isEmpty() + && canConnect(edge[0], edge[1], graph, visited)) { return edge; } graph[edge[0]].add(edge[1]); @@ -113,7 +115,8 @@ public int[] findRedundantConnection(int[][] edges) { return null; } - private boolean canConnect(int source, int target, List[] graph, Set visited) { + private boolean canConnect( + int source, int target, List[] graph, Set visited) { if (visited.add(source)) { if (source == target) { return true; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_685.java b/src/main/java/com/fishercoder/solutions/firstthousand/_685.java index a52792563d..9c2dbdf7ea 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_685.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_685.java @@ -7,7 +7,7 @@ public class _685 { public static class Solution1 { - /** + /* * My original solution, failed by _685Test.test3 */ class UnionFind { @@ -21,7 +21,7 @@ class UnionFind { int n; class LinkedNode { - List parents;//at most, there's one node that has two parents + List parents; // at most, there's one node that has two parents int val; public LinkedNode(int val) { @@ -51,7 +51,7 @@ public UnionFind(int[][] edges) { nodes = new HashSet<>(); visitedLinkedNodes = new ArrayList<>(); visitedValues = new HashSet<>(); - redundantConn = new int[]{}; + redundantConn = new int[] {}; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { nodes.add(edges[i][j]); @@ -82,11 +82,15 @@ public void union(int[] edge) { public int[] findRedundantDirectedConnection() { int index = hasTwoParents(); if (index != -1) { - List parents = visitedLinkedNodes.get(index).parents;//parents size is fixed, only 2 + List parents = + visitedLinkedNodes.get(index).parents; // parents size is fixed, only 2 int[] result = new int[2]; for (int i = 0; i < parents.size(); i++) { if (hasCycle(visitedLinkedNodes.get(index), parents.get(i))) { - result = new int[]{parents.get(i).val, visitedLinkedNodes.get(index).val}; + result = + new int[] { + parents.get(i).val, visitedLinkedNodes.get(index).val + }; break; } } @@ -130,7 +134,7 @@ private int hasTwoParents() { public int[] findRedundantDirectedConnection(int[][] edges) { UnionFind unionFind = new UnionFind(edges); - /**two cases: + /*two cases: * 1. the entire edges are just one directed loop, in this case, just return the last edge, see test2 in _685Test.java * 2. there's one directed loop, but one node of the loop has two parents, in this case, what we'll need to do * is just to return the edge in this loop that points to the child that has two parents, see test1 in _685Test.java @@ -145,7 +149,7 @@ public int[] findRedundantDirectedConnection(int[][] edges) { } public static class Solution2 { - /** + /* * credit: https://discuss.leetcode.com/topic/105108/c-java-union-find-with-explanation-o-n */ public int[] findRedundantDirectedConnection(int[][] edges) { @@ -156,8 +160,8 @@ public int[] findRedundantDirectedConnection(int[][] edges) { if (parent[edges[i][1]] == 0) { parent[edges[i][1]] = edges[i][0]; } else { - can2 = new int[]{edges[i][0], edges[i][1]}; - can1 = new int[]{parent[edges[i][1]], edges[i][1]}; + can2 = new int[] {edges[i][0], edges[i][1]}; + can1 = new int[] {parent[edges[i][1]], edges[i][1]}; edges[i][1] = 0; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_686.java b/src/main/java/com/fishercoder/solutions/firstthousand/_686.java index eb386ae247..d4b8cd23cb 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_686.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_686.java @@ -27,7 +27,7 @@ public int repeatedStringMatch(String A, String B) { } public static class Solution2 { - /** + /* * Time: O(N(N+M)) * Space: O(N + M) */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_687.java b/src/main/java/com/fishercoder/solutions/firstthousand/_687.java index 2b26c2bc7a..6db64c03af 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_687.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_687.java @@ -4,7 +4,7 @@ public class _687 { public static class Solution1 { - /** + /* * Use a one element array to pass in and out is a common technique for handling tree questions. */ public int longestUnivaluePath(TreeNode root) { @@ -16,12 +16,14 @@ public int longestUnivaluePath(TreeNode root) { } // calculate longest univalue path from root to leaves - // In addition, the maximum univalue path cross the root node is calculated and then global maximum is udpated. + // In addition, the maximum univalue path cross the root node is calculated and then global + // maximum is udpated. private int dfs(TreeNode root, int[] result) { int leftPath = root.left == null ? 0 : dfs(root.left, result); int rightPath = root.right == null ? 0 : dfs(root.right, result); int leftResult = (root.left != null && root.left.val == root.val) ? leftPath + 1 : 0; - int rightResult = (root.right != null && root.right.val == root.val) ? rightPath + 1 : 0; + int rightResult = + (root.right != null && root.right.val == root.val) ? rightPath + 1 : 0; result[0] = Math.max(result[0], leftResult + rightResult); return Math.max(leftResult, rightResult); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_688.java b/src/main/java/com/fishercoder/solutions/firstthousand/_688.java index 2f16c83bc7..fbfb7613e0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_688.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_688.java @@ -7,13 +7,15 @@ public class _688 { public static class Solution1 { - /** + /* * This BFS solution results in TLE on Leetcode. */ public double knightProbability(int N, int K, int r, int c) { - int[][] directions = {{-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}}; + int[][] directions = { + {-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1} + }; Queue queue = new LinkedList<>(); - queue.offer(new int[]{r, c}); + queue.offer(new int[] {r, c}); int level = K; while (level-- > 0) { int size = queue.size(); @@ -23,7 +25,7 @@ public double knightProbability(int N, int K, int r, int c) { int x = curr[0] + direction[0]; int y = curr[1] + direction[1]; if (x >= 0 && x < N && y >= 0 && y < N) { - queue.offer(new int[]{x, y}); + queue.offer(new int[] {x, y}); } } } @@ -37,14 +39,16 @@ public double knightProbability(int N, int K, int r, int c) { } public static class Solution2 { - /** + /* * Let f[r][c][k] mean the probability that the knight is still on board after k steps, * we can deduce a recursion from its k-1 steps * In addition, instead of using a 3-d array, we can only keep the most recent two layers, * i.e. using only two 2-d arrays. */ public double knightProbability(int N, int K, int r, int c) { - int[][] directions = {{-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}}; + int[][] directions = { + {-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1} + }; double[][] dp0 = new double[N][N]; for (double[] row : dp0) { Arrays.fill(row, 1); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_689.java b/src/main/java/com/fishercoder/solutions/firstthousand/_689.java index e02e7b508c..daef283d17 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_689.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_689.java @@ -2,7 +2,7 @@ public class _689 { public static class Solution1 { - /** + /* * we basically need to find the interval (i, i+k-1) as the middle interval, where k <= i <= n-2k * then this interval (0, i-1) will be the left interval * the interval (i+k, n-1) will be the right interval. @@ -14,7 +14,7 @@ public static class Solution1 { */ public int[] maxSumOfThreeSubarrays(int[] nums, int k) { if (nums == null || nums.length == 0) { - return new int[]{}; + return new int[] {}; } int n = nums.length; int[] sums = new int[n + 1]; @@ -43,13 +43,16 @@ public int[] maxSumOfThreeSubarrays(int[] nums, int k) { } } - //try to find all possible middle intervals + // try to find all possible middle intervals int[] result = new int[3]; int max = 0; for (int i = k; i <= n - 2 * k; i++) { int left = leftMax[i - 1]; int right = rightMax[i + k]; - int total = (sums[i + k] - sums[i]) + (sums[left + k] - sums[left]) + (sums[right + k] - sums[right]); + int total = + (sums[i + k] - sums[i]) + + (sums[left + k] - sums[left]) + + (sums[right + k] - sums[right]); if (total > max) { max = total; result[0] = left; @@ -62,6 +65,6 @@ public int[] maxSumOfThreeSubarrays(int[] nums, int k) { } public static class Solution2 { - /**reference: https://leetcode.com/articles/maximum-sum-of-3-non-overlapping-intervals*/ + /*reference: https://leetcode.com/articles/maximum-sum-of-3-non-overlapping-intervals*/ } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_69.java b/src/main/java/com/fishercoder/solutions/firstthousand/_69.java index fcdd53a0b7..f321356d8d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_69.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_69.java @@ -2,7 +2,7 @@ public class _69 { public static class Solution1 { - /** + /* * A few key points: * 1. all variable use long type, otherwise overflow, just cast to int before returning * 2. left start from 0, not 1 diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_690.java b/src/main/java/com/fishercoder/solutions/firstthousand/_690.java index 33a77dbfea..cbcbd7b1e6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_690.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_690.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.Employee; - import java.util.List; import java.util.stream.Collectors; @@ -12,17 +11,17 @@ public static class Solution1 { int total = 0; public int getImportance(List employees, int id) { - Employee manager = employees.stream().filter(e -> e.id == id).collect(Collectors.toList()).get(0); + Employee manager = + employees.stream().filter(e -> e.id == id).collect(Collectors.toList()).get(0); total += manager.importance; manager.subordinates.forEach(subId -> getImportance(employees, subId)); - /**The above line is equivalent to below for loop*/ -// for (int subId : manager.subordinates) { -// getImportance(employees, subId); -// } + /*The above line is equivalent to below for loop*/ + // for (int subId : manager.subordinates) { + // getImportance(employees, subId); + // } return total; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_691.java b/src/main/java/com/fishercoder/solutions/firstthousand/_691.java index b63da3df37..0fe15b4036 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_691.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_691.java @@ -5,7 +5,7 @@ public class _691 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/106273/c-java-python-dp-memoization-with-optimization-29-ms-c/2 */ public int minStickers(String[] stickers, String target) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_692.java b/src/main/java/com/fishercoder/solutions/firstthousand/_692.java index 381852e065..a92883293a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_692.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_692.java @@ -11,7 +11,7 @@ public class _692 { public static class Solution1 { - /** + /* * O(n) extra space * O(nlogk) time */ @@ -21,14 +21,15 @@ public List topKFrequent(String[] words, int k) { map.put(word, map.getOrDefault(word, 0) + 1); } - SortedSet> sortedset = new TreeSet<>( - (e1, e2) -> { - if (e1.getValue() != e2.getValue()) { - return e2.getValue() - e1.getValue(); - } else { - return e1.getKey().compareToIgnoreCase(e2.getKey()); - } - }); + SortedSet> sortedset = + new TreeSet<>( + (e1, e2) -> { + if (e1.getValue() != e2.getValue()) { + return e2.getValue() - e1.getValue(); + } else { + return e1.getKey().compareToIgnoreCase(e2.getKey()); + } + }); sortedset.addAll(map.entrySet()); List result = new ArrayList<>(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_694.java b/src/main/java/com/fishercoder/solutions/firstthousand/_694.java index 7fdbde042f..4de2652eb9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_694.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_694.java @@ -8,12 +8,13 @@ public class _694 { public static class Solution1 { - int[][] directions = new int[][]{ - {0, 1}, - {1, 0}, - {0, -1}, - {-1, 0} - }; + int[][] directions = + new int[][] { + {0, 1}, + {1, 0}, + {0, -1}, + {-1, 0} + }; public int numDistinctIslands(int[][] grid) { int m = grid.length; @@ -30,7 +31,15 @@ public int numDistinctIslands(int[][] grid) { return uniqueShapeIslands.size(); } - private boolean dfs(int i0, int j0, int i, int j, int[][] grid, int m, int n, List> island) { + private boolean dfs( + int i0, + int j0, + int i, + int j, + int[][] grid, + int m, + int n, + List> island) { if (i < 0 || j < 0 || i >= m || j >= n || grid[i][j] <= 0) { return false; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_695.java b/src/main/java/com/fishercoder/solutions/firstthousand/_695.java index fbbb2785c8..f01b1811b7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_695.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_695.java @@ -43,13 +43,13 @@ public int maxAreaOfIsland(int[][] grid) { int maxArea = 0; int m = grid.length; int n = grid[0].length; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; boolean[][] visited = new boolean[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 1 && !visited[i][j]) { Queue queue = new LinkedList<>(); - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); int area = 0; while (!queue.isEmpty()) { int size = queue.size(); @@ -62,10 +62,15 @@ public int maxAreaOfIsland(int[][] grid) { for (int p = 0; p < directions.length - 1; p++) { int newX = curr[0] + directions[p]; int newY = curr[1] + directions[p + 1]; - if (newX >= 0 && newX < m && newY >= 0 && newY < n && !visited[newX][newY] && grid[newX][newY] == 1) { + if (newX >= 0 + && newX < m + && newY >= 0 + && newY < n + && !visited[newX][newY] + && grid[newX][newY] == 1) { visited[newX][newY] = true; area++; - queue.offer(new int[]{newX, newY}); + queue.offer(new int[] {newX, newY}); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_696.java b/src/main/java/com/fishercoder/solutions/firstthousand/_696.java index 49a8472e00..25115dd474 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_696.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_696.java @@ -4,10 +4,10 @@ public class _696 { public static class Solution1 { public int countBinarySubstrings(String s) { int n = s.length(); - /**a[i][0] denotes from most left up to i (inclusive), how many consecutive 0's + /*a[i][0] denotes from most left up to i (inclusive), how many consecutive 0's * a[i][1] denotes from most left up to i (inclusive), how many consecutive 1's*/ int[][] a = new int[n][2]; - /**a[i][0] denotes from i (inclusive) to the most right, how many consecutive 0's + /*a[i][0] denotes from i (inclusive) to the most right, how many consecutive 0's * b[i][0] denotes from i (inclusive) to the most right, how many consecutive 1's*/ int[][] b = new int[n][2]; for (int i = 0; i < n; i++) { @@ -23,7 +23,6 @@ public int countBinarySubstrings(String s) { } else { b[i][1] = 1 + (i + 1 < n ? b[i + 1][1] : 0); } - } long ans = 0; for (int i = 0; i + 1 < n; i++) { @@ -35,7 +34,7 @@ public int countBinarySubstrings(String s) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/count-binary-substrings/discuss/1172553/JS-Python-Java-C%2B%2B-or-Easy-Rolling-Count-Solution-w-Explanation */ public int countBinarySubstrings(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_698.java b/src/main/java/com/fishercoder/solutions/firstthousand/_698.java index 28c1784e52..d75f436758 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_698.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_698.java @@ -18,19 +18,27 @@ public boolean canPartitionKSubsets(int[] nums, int k) { return canPartition(nums, visited, 0, k, 0, 0, equalSum); } - private boolean canPartition(int[] nums, boolean[] visited, int startIndex, int k, int currSum, int currNum, int target) { + private boolean canPartition( + int[] nums, + boolean[] visited, + int startIndex, + int k, + int currSum, + int currNum, + int target) { if (k == 1) { return true; } if (currSum == target && currNum > 0) { - /**Everytime when we get currSum == target, we'll start from index 0 and look up the numbers that are not used yet + /*Everytime when we get currSum == target, we'll start from index 0 and look up the numbers that are not used yet * and try to find another sum that could equal to target*/ return canPartition(nums, visited, 0, k - 1, 0, 0, target); } for (int i = startIndex; i < nums.length; i++) { if (!visited[i]) { visited[i] = true; - if (canPartition(nums, visited, i + 1, k, currSum + nums[i], currNum++, target)) { + if (canPartition( + nums, visited, i + 1, k, currSum + nums[i], currNum++, target)) { return true; } visited[i] = false; @@ -41,7 +49,7 @@ private boolean canPartition(int[] nums, boolean[] visited, int startIndex, int } public static class Solution2 { - /** + /* * I'm glad that I figured out below solution completely on my own on 9/30/2021. * Backtracking is so beautiful! *

@@ -68,7 +76,8 @@ public boolean canPartitionKSubsets(int[] nums, int k) { return k == found; } - private int recursive(int[] nums, boolean[] used, int targetSum, int currSum, int currIndex) { + private int recursive( + int[] nums, boolean[] used, int targetSum, int currSum, int currIndex) { if (currSum == targetSum) { return 1; } else if (currSum > targetSum) { @@ -79,11 +88,14 @@ private int recursive(int[] nums, boolean[] used, int targetSum, int currSum, in for (int i = currIndex; i > 0; i--) { if (!used[i - 1]) { used[i - 1] = true; - int found = recursive(nums, used, targetSum, currSum + nums[i - 1], i - 1); + int found = + recursive(nums, used, targetSum, currSum + nums[i - 1], i - 1); if (found == 1) { return found; } - used[i - 1] = false;//this is the backtracking step: reset this number to be available if not found + used[i - 1] = + false; // this is the backtracking step: reset this number to be + // available if not found } } } @@ -91,5 +103,4 @@ private int recursive(int[] nums, boolean[] used, int targetSum, int currSum, in } } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_699.java b/src/main/java/com/fishercoder/solutions/firstthousand/_699.java index b0e9db3df8..644b0dec26 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_699.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_699.java @@ -5,7 +5,7 @@ public class _699 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/107107/easy-understood-o-n-2-solution-with-explanation */ public List fallingSquares(int[][] positions) { @@ -13,7 +13,8 @@ public List fallingSquares(int[][] positions) { List result = new ArrayList<>(); int height = 0; for (int[] position : positions) { - Interval curr = new Interval(position[0], position[0] + position[1] - 1, position[1]); + Interval curr = + new Interval(position[0], position[0] + position[1] - 1, position[1]); height = Math.max(height, getHeight(intervals, curr)); result.add(height); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_7.java b/src/main/java/com/fishercoder/solutions/firstthousand/_7.java index 586aec255c..637f915593 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_7.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_7.java @@ -3,7 +3,7 @@ public class _7 { public static class Solution1 { - /**This solution is NOT meeting the problem requirement actually: + /*This solution is NOT meeting the problem requirement actually: * Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1].*/ public int reverse(int x) { long result = 0; @@ -21,7 +21,7 @@ public int reverse(int x) { } public static class Solution2 { - /**credit: https://leetcode.com/problems/reverse-integer/discuss/4060/My-accepted-15-lines-of-code-for-Java*/ + /*credit: https://leetcode.com/problems/reverse-integer/discuss/4060/My-accepted-15-lines-of-code-for-Java*/ public int reverse(int x) { int result = 0; while (x != 0) { @@ -36,4 +36,4 @@ public int reverse(int x) { return result; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_70.java b/src/main/java/com/fishercoder/solutions/firstthousand/_70.java index c61376326d..276bceb452 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_70.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_70.java @@ -2,7 +2,7 @@ public class _70 { public static class Solution1 { - /** + /* * O(n) time * O(n) space */ @@ -21,7 +21,7 @@ public int climbStairs(int n) { } public static class Solution2 { - /** + /* * O(n) time * O(1) space */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_701.java b/src/main/java/com/fishercoder/solutions/firstthousand/_701.java index a3e5ff5c43..d177cb1f4a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_701.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_701.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -50,7 +49,9 @@ private int binarySearch(List list, int target) { right = mid - 1; } } - return left == right ? list.get(left) >= target ? left : left + 1 : left;//here's the most tricky/easy to get buggy part! + return left == right + ? list.get(left) >= target ? left : left + 1 + : left; // here's the most tricky/easy to get buggy part! } private void inorder(TreeNode root, List list) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_705.java b/src/main/java/com/fishercoder/solutions/firstthousand/_705.java index f083f3f561..097838f053 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_705.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_705.java @@ -8,7 +8,7 @@ public static class Solution1 { class MyHashSet { Map map; - /** + /* * Initialize your data structure here. */ public MyHashSet() { @@ -25,7 +25,7 @@ public void remove(int key) { } } - /** + /* * Returns true if this set contains the specified element */ public boolean contains(int key) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_706.java b/src/main/java/com/fishercoder/solutions/firstthousand/_706.java index e188fbfdf9..de74c2bd73 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_706.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_706.java @@ -4,7 +4,7 @@ public class _706 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/design-hashmap/discuss/152746/Java-Solution */ class MyHashMap { @@ -75,13 +75,13 @@ class ListNode { public static class Solution2 { public static class MyHashMap { - /** + /* * Considering the given constraints for this problem on LeetCode, load factors and resizing/rehashing are not considered. Thus an EASY problem. *

* inspired by: https://leetcode.com/problems/design-hashmap/discuss/225312/hashmaparraylinkedlistcollision */ class Node { - /** + /* * We need to have both key and val in this ListNode because all values input key are hashed to the same bucket, so we need its original key * to be a differentiator within this bucket. */ @@ -98,14 +98,14 @@ public Node(int key, int val) { Node[] nodes; int size = 1000000; - /** + /* * Initialize your data structure here. */ public MyHashMap() { nodes = new Node[size]; } - /** + /* * value will always be non-negative. */ public void put(int key, int value) { @@ -128,7 +128,7 @@ private int getHashedKey(int key) { return Integer.hashCode(key) % size; } - /** + /* * Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */ public int get(int key) { @@ -146,11 +146,11 @@ public int get(int key) { return -1; } - /** + /* * Removes the mapping of the specified value key if this map contains a mapping for the key */ public void remove(int key) { - /**We can just set the value of this key to -1 since the constraint for this problem is that all values are >= 0*/ + /*We can just set the value of this key to -1 since the constraint for this problem is that all values are >= 0*/ Node node = nodes[getHashedKey(key)]; Node tmp = node; Node pre = new Node(-1, -1); @@ -167,7 +167,7 @@ public void remove(int key) { } public static class Solution3 { - /** + /* * My completely original, but hacky and cheaty solution to take full advantage of the problem constraints. */ public static class MyHashMap { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_708.java b/src/main/java/com/fishercoder/solutions/firstthousand/_708.java index 4fae4d9937..9cf28e8920 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_708.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_708.java @@ -14,12 +14,11 @@ public Node(int val) { this.val = val; } - public Node() { - } + public Node() {} } public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/insert-into-a-sorted-circular-linked-list/solutions/995676/java-concise-o-n/ */ public Node insert(Node head, int insertVal) { @@ -31,20 +30,20 @@ public Node insert(Node head, int insertVal) { Node node = head; while (node.next != head) { if (node.val <= node.next.val) { - //increasing + // increasing if (node.val <= insertVal && insertVal <= node.next.val) { - //this is the place to insert + // this is the place to insert break; } } else { - //transition point, higher value to lower value + // transition point, higher value to lower value if (node.val < insertVal || insertVal < node.next.val) { break; } } node = node.next; } - //insert this new node + // insert this new node insertNode.next = node.next; node.next = insertNode; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_71.java b/src/main/java/com/fishercoder/solutions/firstthousand/_71.java index 007002756b..0f7152fa54 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_71.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_71.java @@ -9,7 +9,7 @@ public class _71 { public static class Solution1 { - /** + /* * For LinkedList class in Java, if you use pop(), then you'll have to use push() as its corresponding method to remove from the "top" of the stack, using pollLast() will not work. */ public String simplifyPath(String path) { @@ -31,7 +31,7 @@ public String simplifyPath(String path) { } public static class Solution2 { - /** + /* * This solution doesn't vary too much from the above one, except in that it's using pollLast() and addLast() instead of pop() and push(). * Key notes: * if using pollLast, then it must be consistent across all calls, including peekLast() and addLast(), cannot mix with pop() and push(), otherwise, unexpected/undesired results will happen. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_712.java b/src/main/java/com/fishercoder/solutions/firstthousand/_712.java index 736ac90068..9444c4c3d8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_712.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_712.java @@ -2,7 +2,7 @@ public class _712 { public static class Solution1 { - //credit: https://leetcode.com/articles/minimum-ascii-delete-sum-for-two-strings/ + // credit: https://leetcode.com/articles/minimum-ascii-delete-sum-for-two-strings/ public int minimumDeleteSum(String s1, String s2) { int[][] dp = new int[s1.length() + 1][s2.length() + 1]; @@ -19,7 +19,10 @@ public int minimumDeleteSum(String s1, String s2) { if (s1.charAt(i) == s2.charAt(j)) { dp[i][j] = dp[i + 1][j + 1]; } else { - dp[i][j] = Math.min(dp[i + 1][j] + s1.codePointAt(i), dp[i][j + 1] + s2.codePointAt(j)); + dp[i][j] = + Math.min( + dp[i + 1][j] + s1.codePointAt(i), + dp[i][j + 1] + s2.codePointAt(j)); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_713.java b/src/main/java/com/fishercoder/solutions/firstthousand/_713.java index dec191ce1d..0b60cb320c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_713.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_713.java @@ -2,7 +2,7 @@ public class _713 { public static class Solution1 { - /** + /* * Classic two pointer technique, in this problem: * the right pointer keeps moving forward and the left pointer moves forward when the current product >= k */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_714.java b/src/main/java/com/fishercoder/solutions/firstthousand/_714.java index a025853ba2..2599bc5051 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_714.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_714.java @@ -2,7 +2,7 @@ public class _714 { public static class Solution1 { - /** + /* * O(n) time * O(n) space * credit: https://discuss.leetcode.com/topic/108009/java-c-clean-code-dp-greedy @@ -24,7 +24,7 @@ public int maxProfit(int[] prices, int fee) { } public static class Solution2 { - /** + /* * O(n) time * O(1) space * credit: https://leetcode.com/articles/best-time-to-buy-and-sell-stock-with-transaction-fee/ @@ -40,8 +40,17 @@ public int maxProfit(int[] prices, int fee) { int cash = 0; int hold = -prices[0]; for (int i = 1; i < prices.length; i++) { - cash = Math.max(cash, hold + prices[i] - fee);//this means to sell the stock: gain the current ith day's price and pay the transaction fee - hold = Math.max(hold, cash - prices[i]);//this means to buy in this stock on the ith day's price. + cash = + Math.max( + cash, + hold + prices[i] + - fee); // this means to sell the stock: gain the current + // ith day's price and pay the transaction fee + hold = + Math.max( + hold, + cash - prices[i]); // this means to buy in this stock on the ith + // day's price. } return cash; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_716.java b/src/main/java/com/fishercoder/solutions/firstthousand/_716.java index d4fef7273a..6d26f502af 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_716.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_716.java @@ -10,7 +10,7 @@ public class _716 { public static class Solution1 { - /** + /* * This is O(n) for popMax() and pop() while O(1) for the other three operations which is UN-acceptable during an interview! * We need to do better than O(n) time complexity in order to ace the interview! * But O(1) is impossible, so let's aim for O(logn). @@ -20,7 +20,7 @@ public static class MaxStack { private int max; private Stack stack; - /** + /* * initialize your data structure here. */ public MaxStack() { @@ -88,7 +88,7 @@ public int popMax() { } public static class Solution2 { - /** + /* * Use a treemap and a doubly linked list to achieve O(logn) time complexity. */ @@ -114,7 +114,7 @@ public DoublyLinkedList() { } public Node add(int val) { - /**For this doubly linked list, we always add it to the end of the list*/ + /*For this doubly linked list, we always add it to the end of the list*/ Node x = new Node(val); x.next = tail; x.prev = tail.prev; @@ -124,7 +124,7 @@ public Node add(int val) { } public int pop() { - /**for pop(), we always pop one from the tail of the doubly linked list*/ + /*for pop(), we always pop one from the tail of the doubly linked list*/ return unlink(tail.prev).val; } @@ -141,13 +141,13 @@ public int peek() { public static class MaxStack { TreeMap> treeMap; - /** + /* * the reason we have a list of nodes as treemap's value is because one value could be pushed * multiple times into this MaxStack and we want to keep track of all of them. */ DoublyLinkedList doublyLinkedList; - /** + /* * initialize your data structure here. */ public MaxStack() { @@ -195,7 +195,7 @@ public int popMax() { } public static class Solution3 { - /** + /* * My completely original solution on 10/25/2021. * popMax() takes O(n) time, all other operations take O(1) time. */ @@ -212,10 +212,10 @@ public MaxStack() { public void push(int x) { if (stack.isEmpty()) { - stack.addLast(new int[]{x, x}); + stack.addLast(new int[] {x, x}); } else { int[] last = stack.peekLast(); - stack.addLast(new int[]{x, Math.max(last[1], x)}); + stack.addLast(new int[] {x, Math.max(last[1], x)}); } } @@ -240,9 +240,9 @@ public int popMax() { while (!tmp.isEmpty()) { int[] curr = tmp.pollLast(); if (!stack.isEmpty()) { - stack.addLast(new int[]{curr[0], Math.max(curr[0], stack.peekLast()[1])}); + stack.addLast(new int[] {curr[0], Math.max(curr[0], stack.peekLast()[1])}); } else { - stack.addLast(new int[]{curr[0], curr[0]}); + stack.addLast(new int[] {curr[0], curr[0]}); } } return max[0]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_718.java b/src/main/java/com/fishercoder/solutions/firstthousand/_718.java index ce0dd54791..214c0e564b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_718.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_718.java @@ -4,7 +4,7 @@ public class _718 { public static class Solution1 { - /** + /* * This brute force idea results in TLE. */ public int findLength(int[] nums1, int[] nums2) { @@ -33,7 +33,7 @@ private boolean isSubarray(int[] candidate, int[] array) { } public static class Solution2 { - /** + /* * DP approach: * credit: https://leetcode.com/problems/maximum-length-of-repeated-subarray/solution/ * 1. we initialize a 2D matrix as the cash to hold values, initially, all are zeroes, @@ -63,5 +63,4 @@ public int findLength(int[] nums1, int[] nums2) { return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_719.java b/src/main/java/com/fishercoder/solutions/firstthousand/_719.java index 2ce73d4a28..5432a77425 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_719.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_719.java @@ -5,7 +5,7 @@ public class _719 { public static class Solution1 { - /** + /* * This brute force solution results in TLE of course. */ public int smallestDistancePair(int[] nums, int k) { @@ -28,7 +28,7 @@ public int smallestDistancePair(int[] nums, int k) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/articles/find-k-th-smallest-pair-distance/#approach-3-binary-search-sliding-window-accepted */ public int smallestDistancePair(int[] nums, int k) { @@ -45,7 +45,7 @@ public int smallestDistancePair(int[] nums, int k) { } count += right - left; } - //count = number of pairs with distance <= mi + // count = number of pairs with distance <= mi if (count >= k) { hi = mi; } else { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_72.java b/src/main/java/com/fishercoder/solutions/firstthousand/_72.java index 39c30acfc6..9505162ac6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_72.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_72.java @@ -30,8 +30,10 @@ public int minDistance(String word1, String word2) { if (str1[i - 1] != str2[j - 1]) { cost = 1; } - table[i][j] = Math.min(Math.min(table[i - 1][j] + 1, table[i][j - 1] + 1), - table[i - 1][j - 1] + cost); + table[i][j] = + Math.min( + Math.min(table[i - 1][j] + 1, table[i][j - 1] + 1), + table[i - 1][j - 1] + cost); } } return table[m][n]; @@ -40,7 +42,8 @@ public int minDistance(String word1, String word2) { public static class Solution2 { public int minDistance(String word1, String word2) { - // using levenshtein Distance to find minimum transformation operations required from word 1 to word 2 + // using levenshtein Distance to find minimum transformation operations required from + // word 1 to word 2 int[][] dp = new int[word1.length()][word2.length()]; // fill the dp array with -1 value for (int[] rows : dp) { @@ -49,7 +52,8 @@ public int minDistance(String word1, String word2) { return levenshteinDistance(word1, word1.length() - 1, word2, word2.length() - 1, dp); } - private int levenshteinDistance(String s1, int s1Index, String s2, int s2Index, int[][] dp) { + private int levenshteinDistance( + String s1, int s1Index, String s2, int s2Index, int[][] dp) { if (s1Index < 0) { // when s1 is "" perform all insertions to get s1 to s2 return s2Index + 1; @@ -74,7 +78,8 @@ private int levenshteinDistance(String s1, int s1Index, String s2, int s2Index, int substituteValue = levenshteinDistance(s1, s1Index - 1, s2, s2Index - 1, dp); /* Now we need to take the minimum of the 3 operations to find the edit distance and add 1 to the min cost action denoting that an action is performed */ - dp[s1Index][s2Index] = 1 + Math.min(insertValue, Math.min(deleteValue, substituteValue)); + dp[s1Index][s2Index] = + 1 + Math.min(insertValue, Math.min(deleteValue, substituteValue)); } return dp[s1Index][s2Index]; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_720.java b/src/main/java/com/fishercoder/solutions/firstthousand/_720.java index 10537dd8df..99fd1fade4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_720.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_720.java @@ -10,7 +10,9 @@ public String longestWord(String[] words) { private String findLongestWord(TrieNode root, String[] words) { String longestWord = ""; for (String word : words) { - if (longestWord.length() > word.length() || (longestWord.length() == word.length() && (longestWord.compareToIgnoreCase(word) < 0))) { + if (longestWord.length() > word.length() + || (longestWord.length() == word.length() + && (longestWord.compareToIgnoreCase(word) < 0))) { continue; } TrieNode tmp = root; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_721.java b/src/main/java/com/fishercoder/solutions/firstthousand/_721.java index e559c5ed0f..89d17417a4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_721.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_721.java @@ -12,7 +12,7 @@ public class _721 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/accounts-merge/#approach-1-depth-first-search-accepted *

* Time Complexity: O(∑ai*logai) where a​i is the length of accounts[i]. @@ -64,7 +64,7 @@ public List> accountsMerge(List> accounts) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/articles/accounts-merge/#approach-2-union-find-accepted * DSU stands for Disjoint Set Union: https://en.wikipedia.org/wiki/Disjoint-set_data_structure, a.k.a Union Find data structure. *

@@ -93,13 +93,14 @@ public List> accountsMerge(List> accounts) { Map> map = new HashMap<>(); for (String email : emailToName.keySet()) { - //find the index of this email first: use this email's ID to find its parent in the Union Find + // find the index of this email first: use this email's ID to find its parent in the + // Union Find int index = uf.find(emailToId.get(email)); map.computeIfAbsent(index, x -> new ArrayList()).add(email); } for (List component : map.values()) { Collections.sort(component); - //this is to add name to the head of the list + // this is to add name to the head of the list component.add(0, emailToName.get(component.get(0))); } return new ArrayList<>(map.values()); @@ -124,7 +125,8 @@ public int find(int x) { } public void union(int x, int y) { - parent[find(x)] = find(y);//can be written as parent[find(y)] = find(x); they are equivalent + parent[find(x)] = + find(y); // can be written as parent[find(y)] = find(x); they are equivalent } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_722.java b/src/main/java/com/fishercoder/solutions/firstthousand/_722.java index 3a57de8e99..5aead62955 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_722.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_722.java @@ -5,7 +5,7 @@ public class _722 { public static class Solution1 { - /** + /* * My completely original solution. * Not a hard one, just some corner cases to consider. */ @@ -16,26 +16,31 @@ public List removeComments(String[] source) { for (String line : source) { for (int i = 0; i < line.length(); i++) { if (line.charAt(i) == '/' && i + 1 < line.length()) { - //adding (&& !possiblyMultilineComment) is for cases like test 6 + // adding (&& !possiblyMultilineComment) is for cases like test 6 if (line.charAt(i + 1) == '*' && !possiblyMultilineComment) { - //but cannot break here, because this might be a single line comment, so we need to find the closing "*/" + // but cannot break here, because this might be a single line comment, + // so we need to find the closing "*/" possiblyMultilineComment = true; - //increment i by one to bypass this '*' + // increment i by one to bypass this '*' i++; } else if (line.charAt(i + 1) == '/') { - //this is a single line comment, remove + // this is a single line comment, remove if (!possiblyMultilineComment) { - //only at this time, we know this is not part of a possibly multiline comment, - //then we can safely break out, see test case 4 + // only at this time, we know this is not part of a possibly + // multiline comment, + // then we can safely break out, see test case 4 break; } } else if (!possiblyMultilineComment) { sb.append(line.charAt(i)); } - } else if (line.charAt(i) == '*' && i + 1 < line.length() && line.charAt(i + 1) == '/' && possiblyMultilineComment) { - //this is the end of the multiline comment + } else if (line.charAt(i) == '*' + && i + 1 < line.length() + && line.charAt(i + 1) == '/' + && possiblyMultilineComment) { + // this is the end of the multiline comment possiblyMultilineComment = false; - //increment i by one to bypass the closing '/' + // increment i by one to bypass the closing '/' i++; } else if (!possiblyMultilineComment) { sb.append(line.charAt(i)); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_723.java b/src/main/java/com/fishercoder/solutions/firstthousand/_723.java index 8febe83e63..c8024d4337 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_723.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_723.java @@ -2,7 +2,7 @@ public class _723 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/candy-crush/ */ public int[][] candyCrush(int[][] board) { @@ -12,8 +12,10 @@ public int[][] candyCrush(int[][] board) { for (int i = 0; i < row; i++) { for (int j = 0; j < col - 2; j++) { int v = Math.abs(board[i][j]); - if (v != 0 && v == Math.abs(board[i][j + 1]) && v == Math.abs(board[i][j + 2])) { - //mark all of them to be negative + if (v != 0 + && v == Math.abs(board[i][j + 1]) + && v == Math.abs(board[i][j + 2])) { + // mark all of them to be negative board[i][j] = board[i][j + 1] = board[i][j + 2] = -v; todo = true; } @@ -23,7 +25,9 @@ public int[][] candyCrush(int[][] board) { for (int i = 0; i < row - 2; i++) { for (int j = 0; j < col; j++) { int v = Math.abs(board[i][j]); - if (v != 0 && v == Math.abs(board[i + 1][j]) && v == Math.abs(board[i + 2][j])) { + if (v != 0 + && v == Math.abs(board[i + 1][j]) + && v == Math.abs(board[i + 2][j])) { board[i + 1][j] = board[i + 2][j] = board[i][j] = -v; todo = true; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_724.java b/src/main/java/com/fishercoder/solutions/firstthousand/_724.java index ed447f9c50..ccbe4bb5d8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_724.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_724.java @@ -2,7 +2,7 @@ public class _724 { public static class Solution1 { - /** + /* * Space: O(n) * Time: O(n) */ @@ -16,7 +16,8 @@ public int pivotIndex(int[] nums) { sums[i] = sums[i - 1] + nums[i]; } for (int i = 0; i < nums.length; i++) { - if (i == 0 && 0 == sums[nums.length - 1] - sums[i] || (i > 0 && sums[i - 1] == sums[nums.length - 1] - sums[i])) { + if (i == 0 && 0 == sums[nums.length - 1] - sums[i] + || (i > 0 && sums[i - 1] == sums[nums.length - 1] - sums[i])) { return i; } } @@ -25,7 +26,7 @@ public int pivotIndex(int[] nums) { } public static class Solution2 { - /** + /* * Space: O(1) * Time: O(n) */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_725.java b/src/main/java/com/fishercoder/solutions/firstthousand/_725.java index 3f2e3530b2..9efe0002be 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_725.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_725.java @@ -4,7 +4,7 @@ public class _725 { public static class Solution1 { - /** + /* * My very original solution, but verbose. */ public ListNode[] splitListToParts(ListNode head, int k) { @@ -43,7 +43,7 @@ private int getLength(ListNode root) { } public static class Solution2 { - /** + /* * More concise version */ public ListNode[] splitListToParts(ListNode head, int k) { @@ -75,5 +75,4 @@ private int getLength(ListNode root) { return len; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_726.java b/src/main/java/com/fishercoder/solutions/firstthousand/_726.java index 93497a6807..32f03cb10c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_726.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_726.java @@ -10,7 +10,7 @@ public class _726 { public static class Solution1 { - /** + /* * My completely original solution: * 1. use a stack; * 2. whenever we encounter the open paren, we push it into the top of the stack; @@ -33,18 +33,21 @@ public String countOfAtoms(String formula) { sb.append(formula.charAt(i++)); } if (i < formula.length()) { - if (Character.isUpperCase(formula.charAt(i)) || formula.charAt(i) == '(' || formula.charAt(i) == ')') { - //no numbers + if (Character.isUpperCase(formula.charAt(i)) + || formula.charAt(i) == '(' + || formula.charAt(i) == ')') { + // no numbers stack.addLast(new Pair(sb.toString(), 1)); i--; } else { - //there are numbers + // there are numbers StringBuilder numberSb = new StringBuilder(); while (i < formula.length() && Character.isDigit(formula.charAt(i))) { numberSb.append(formula.charAt(i++)); } i--; - stack.addLast(new Pair(sb.toString(), Integer.parseInt(numberSb.toString()))); + stack.addLast( + new Pair(sb.toString(), Integer.parseInt(numberSb.toString()))); } } else { stack.addLast(new Pair(sb.toString(), 1)); @@ -66,7 +69,7 @@ public String countOfAtoms(String formula) { Pair pair = stack.pollLast(); stack2.addLast(new Pair(pair.atom, pair.count * number)); } - stack.pollLast();//poll "(" off of the stack + stack.pollLast(); // poll "(" off of the stack while (!stack2.isEmpty()) { stack.addLast(stack2.pollLast()); } @@ -76,12 +79,12 @@ public String countOfAtoms(String formula) { while (!stack.isEmpty()) { list.add(stack.pollLast()); } - //now merge the same atoms + // now merge the same atoms Map map = new HashMap<>(); for (Pair pair : list) { map.put(pair.atom, map.getOrDefault(pair.atom, 0) + pair.count); } - //now add the merged atoms into the list again before sorting them + // now add the merged atoms into the list again before sorting them list.clear(); for (Map.Entry entry : map.entrySet()) { list.add(new Pair(entry.getKey(), entry.getValue())); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_727.java b/src/main/java/com/fishercoder/solutions/firstthousand/_727.java index e1349988c0..cf10f049d3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_727.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_727.java @@ -4,7 +4,7 @@ public class _727 { public static class Solution1 { - /** + /* * This naive brute force results in TLE. */ public String minWindow(String S, String T) { @@ -32,7 +32,7 @@ private boolean isSubsequence(String T, String sub) { } public static class Solution2 { - /** + /* * credit: https://github.com/lydxlx1/LeetCode/blob/master/src/_727.java */ public String minWindow(String S, String T) { @@ -58,6 +58,5 @@ public String minWindow(String S, String T) { } return ans == INFINITY ? "" : S.substring(tail - ans, tail); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_729.java b/src/main/java/com/fishercoder/solutions/firstthousand/_729.java index fc159a67b4..8a689fa516 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_729.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_729.java @@ -6,7 +6,7 @@ public class _729 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/111205/java-8-liner-treemap */ public static class MyCalendar { @@ -45,7 +45,7 @@ public boolean book(int start, int end) { return false; } } - calendar.add(new int[]{start, end}); + calendar.add(new int[] {start, end}); return true; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_73.java b/src/main/java/com/fishercoder/solutions/firstthousand/_73.java index 5be321696c..bef960ce43 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_73.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_73.java @@ -3,7 +3,7 @@ public class _73 { public static class Solution1 { - /** + /* * Space: O(m*n) */ public void setZeroes(int[][] matrix) { @@ -36,7 +36,7 @@ public void setZeroes(int[][] matrix) { } public static class Solution2 { - /** + /* * Space: O(m+n) */ public void setZeroes(int[][] matrix) { @@ -72,7 +72,7 @@ public void setZeroes(int[][] matrix) { } public static class Solution3 { - /** + /* * Space: O(1) */ public void setZeroes(int[][] matrix) { @@ -121,7 +121,7 @@ public void setZeroes(int[][] matrix) { } public static class Solution4 { - /** + /* * Space: O(1) * credit: https://leetcode.com/problems/set-matrix-zeroes/discuss/26014/Any-shorter-O(1)-space-solution */ @@ -129,7 +129,7 @@ public void setZeroes(int[][] matrix) { int col0 = 1; int m = matrix.length; int n = matrix[0].length; - /**the first iteration (first nested for loop) is to check from top row to bottom row: + /*the first iteration (first nested for loop) is to check from top row to bottom row: * keep the first column state into variable col0; * then starting from the second column, check all the rest of the columns and mark its top cell and its most-left cell if it * s a zero.*/ @@ -146,7 +146,7 @@ public void setZeroes(int[][] matrix) { } } - /**the second iteration (second nested for loop) is to check from bottom row to the top row + /*the second iteration (second nested for loop) is to check from bottom row to the top row * from the right-most column to the second left-most column: as long as its left-most column cell or its top row cell is zero, then set that cell to be zero * at last, check col0 variable, if it's zero, mark that row cell as zero*/ for (int i = m - 1; i >= 0; i--) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_733.java b/src/main/java/com/fishercoder/solutions/firstthousand/_733.java index 176e660310..4ba173b90a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_733.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_733.java @@ -6,7 +6,7 @@ public class _733 { public static class Solution1 { public int[][] floodFill(int[][] image, int sr, int sc, int newColor) { - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; int m = image.length; int n = image[0].length; int originalValue = image[sr][sc]; @@ -15,18 +15,23 @@ public int[][] floodFill(int[][] image, int sr, int sc, int newColor) { boolean[][] visited = new boolean[m][n]; Queue queue = new LinkedList<>(); - queue.offer(new int[]{sr, sc}); + queue.offer(new int[] {sr, sc}); while (!queue.isEmpty()) { int[] curr = queue.poll(); visited[curr[0]][curr[1]] = true; for (int i = 0; i < directions.length - 1; i++) { int nextR = curr[0] + directions[i]; int nextC = curr[1] + directions[i + 1]; - if (nextR < 0 || nextC < 0 || nextR >= m || nextC >= n || image[nextR][nextC] != originalValue || visited[nextR][nextC]) { + if (nextR < 0 + || nextC < 0 + || nextR >= m + || nextC >= n + || image[nextR][nextC] != originalValue + || visited[nextR][nextC]) { continue; } image[nextR][nextC] = newColor; - queue.offer(new int[]{nextR, nextC}); + queue.offer(new int[] {nextR, nextC}); } } return image; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_735.java b/src/main/java/com/fishercoder/solutions/firstthousand/_735.java index 8eddc6f9fc..b5af200a7c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_735.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_735.java @@ -50,7 +50,7 @@ private void collide(Deque stack) { } public static class Solution2 { - /** + /* * My completely original solution on 11/5/2021. */ public int[] asteroidCollision(int[] asteroids) { @@ -65,10 +65,14 @@ public int[] asteroidCollision(int[] asteroids) { } else if (stack.peekLast() == Math.abs(a)) { stack.pollLast(); } else { - while (!stack.isEmpty() && stack.peekLast() > 0 && stack.peekLast() < Math.abs(a)) { + while (!stack.isEmpty() + && stack.peekLast() > 0 + && stack.peekLast() < Math.abs(a)) { stack.pollLast(); } - if (!stack.isEmpty() && stack.peekLast() > 0 && stack.peekLast() == Math.abs(a)) { + if (!stack.isEmpty() + && stack.peekLast() > 0 + && stack.peekLast() == Math.abs(a)) { stack.pollLast(); continue; } else if (stack.isEmpty() || stack.peekLast() < 0) { @@ -89,7 +93,7 @@ public int[] asteroidCollision(int[] asteroids) { } public static class Solution3 { - /** + /* * My completely original solution on 1/14/2022. */ public int[] asteroidCollision(int[] asteroids) { @@ -122,7 +126,7 @@ public int[] asteroidCollision(int[] asteroids) { } public static class Solution4 { - /** + /* * My completely original solution on 7/19/2024. */ public int[] asteroidCollision(int[] asteroids) { @@ -130,7 +134,9 @@ public int[] asteroidCollision(int[] asteroids) { for (int asteroid : asteroids) { if (asteroid < 0 && !stack.isEmpty() && stack.peekLast() > 0) { boolean bothRemoved = false; - while (!stack.isEmpty() && stack.peekLast() > 0 && stack.peekLast() <= -asteroid) { + while (!stack.isEmpty() + && stack.peekLast() > 0 + && stack.peekLast() <= -asteroid) { if (stack.peekLast() == -asteroid) { bothRemoved = true; stack.pollLast(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_738.java b/src/main/java/com/fishercoder/solutions/firstthousand/_738.java index 3ba9cbeffc..4636d5767e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_738.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_738.java @@ -2,14 +2,15 @@ public class _738 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/112808/simple-python-solution-w-explanation/2 */ public int monotoneIncreasingDigits(int N) { String s = Integer.toString(N); int index = -1; for (int i = s.length() - 2; i >= 0; i--) { - if (s.charAt(i) > s.charAt(i + 1) || (index != -1 && s.charAt(index) == s.charAt(i))) { + if (s.charAt(i) > s.charAt(i + 1) + || (index != -1 && s.charAt(index) == s.charAt(i))) { index = i; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_74.java b/src/main/java/com/fishercoder/solutions/firstthousand/_74.java index 68375d74f6..8fc9b51a0a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_74.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_74.java @@ -4,7 +4,8 @@ public class _74 { public static class Solution1 { public boolean searchMatrix(int[][] matrix, int target) { - if (matrix == null || matrix.length == 0 + if (matrix == null + || matrix.length == 0 || matrix[0].length == 0 || matrix[0][0] > target || matrix[matrix.length - 1][matrix[0].length - 1] < target) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_740.java b/src/main/java/com/fishercoder/solutions/firstthousand/_740.java index efe3dd055c..e78295a9c1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_740.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_740.java @@ -6,7 +6,7 @@ public class _740 { public static class Solution1 { - /** + /* * Since the number is within range [1, 10000], we can build another array: * each number in the array denotes the total sum of this number that appears in this array * and @@ -38,7 +38,7 @@ public int deleteAndEarn(int[] nums) { } public static class Solution2 { - /** + /* * A simplified version using treemap instead of an array, credit: https://leetcode.com/problems/delete-and-earn/discuss/109895/JavaC++-Clean-Code-with-Explanation/111626 */ public int deleteAndEarn(int[] nums) { @@ -63,8 +63,9 @@ public int deleteAndEarn(int[] nums) { } public static class Solution3 { - //use DP, this is basically the same code as https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/_3186.java - //except here it's current - 1, in the above it's current - 2 + // use DP, this is basically the same code as + // https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/_3186.java + // except here it's current - 1, in the above it's current - 2 public int deleteAndEarn(int[] nums) { TreeMap treeMap = new TreeMap<>(); for (int num : nums) { @@ -77,7 +78,8 @@ public int deleteAndEarn(int[] nums) { int current = sortedList.get(i); int currentTotal = current * treeMap.get(current); int j = i - 1; - //we keep going to the left of the sorted list until we find a value that's not in the range of current - 1 if possible + // we keep going to the left of the sorted list until we find a value that's not in + // the range of current - 1 if possible while (j >= 0 && sortedList.get(j) >= current - 1) { j--; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_742.java b/src/main/java/com/fishercoder/solutions/firstthousand/_742.java index a50a0b09e5..f047f83b48 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_742.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_742.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -18,10 +17,12 @@ public int findClosestLeaf(TreeNode root, int k) { if (leaves.contains(k)) { return k; } - //Now we can do a BFS traversal + // Now we can do a BFS traversal Queue queue = new LinkedList<>(); Set directNeighbors = graph.get(k); - Set visited = new HashSet<>();//use a visited set to prevent cycles and not adding the target node itself + Set visited = + new HashSet<>(); // use a visited set to prevent cycles and not adding the + // target node itself visited.add(k); for (int node : directNeighbors) { queue.offer(node); @@ -46,7 +47,11 @@ public int findClosestLeaf(TreeNode root, int k) { return root.val; } - private void buildGraph(TreeNode root, Map> map, TreeNode parent, Set leaves) { + private void buildGraph( + TreeNode root, + Map> map, + TreeNode parent, + Set leaves) { if (root == null) { return; } @@ -68,6 +73,5 @@ private void buildGraph(TreeNode root, Map> map, TreeNode buildGraph(root.left, map, root, leaves); buildGraph(root.right, map, root, leaves); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_749.java b/src/main/java/com/fishercoder/solutions/firstthousand/_749.java index 66358f846e..f4c2bfd8b7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_749.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_749.java @@ -2,7 +2,7 @@ public class _749 { public static class Solution1 { - //TODO: implement it + // TODO: implement it public int containVirus(int[][] grid) { return -1; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_751.java b/src/main/java/com/fishercoder/solutions/firstthousand/_751.java index af049518f2..b5de66f685 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_751.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_751.java @@ -5,7 +5,7 @@ public class _751 { public static class Solution1 { public List ipToCIDR(String ip, int n) { - //TODO: implement it + // TODO: implement it return null; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_752.java b/src/main/java/com/fishercoder/solutions/firstthousand/_752.java index 87a38203aa..9cab3ea634 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_752.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_752.java @@ -6,35 +6,37 @@ public class _752 { public static class Solution1 { public int openLock(String[] deadends, String target) { // Map the next slot digit for each current slot digit. - Map nextSlot = new HashMap() { - { - put('0', '1'); - put('1', '2'); - put('2', '3'); - put('3', '4'); - put('4', '5'); - put('5', '6'); - put('6', '7'); - put('7', '8'); - put('8', '9'); - put('9', '0'); - } - }; + Map nextSlot = + new HashMap() { + { + put('0', '1'); + put('1', '2'); + put('2', '3'); + put('3', '4'); + put('4', '5'); + put('5', '6'); + put('6', '7'); + put('7', '8'); + put('8', '9'); + put('9', '0'); + } + }; // Map the previous slot digit for each current slot digit. - Map prevSlot = new HashMap() { - { - put('0', '9'); - put('1', '0'); - put('2', '1'); - put('3', '2'); - put('4', '3'); - put('5', '4'); - put('6', '5'); - put('7', '6'); - put('8', '7'); - put('9', '8'); - } - }; + Map prevSlot = + new HashMap() { + { + put('0', '9'); + put('1', '0'); + put('2', '1'); + put('3', '2'); + put('4', '3'); + put('5', '4'); + put('6', '5'); + put('7', '6'); + put('8', '7'); + put('9', '8'); + } + }; // Set to store visited and dead-end combinations. Set visited = new HashSet<>(Arrays.asList(deadends)); @@ -67,7 +69,8 @@ public int openLock(String[] deadends, String target) { return turns; } - // Explore all possible new combinations by turning each wheel in both directions. + // Explore all possible new combinations by turning each wheel in both + // directions. for (int j = 0; j < curr.length(); j += 1) { // Generate the new combination by turning the wheel to the next digit. StringBuilder newCombination = new StringBuilder(curr); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_754.java b/src/main/java/com/fishercoder/solutions/firstthousand/_754.java index de0f6ad0eb..03ed903377 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_754.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_754.java @@ -2,7 +2,7 @@ public class _754 { public static class Solution1 { - /** + /* * Two case: * 1. go to the right, and reach the goal exactly. * 2. go over the goal by several steps: diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_756.java b/src/main/java/com/fishercoder/solutions/firstthousand/_756.java index 9531bb891c..91152e5538 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_756.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_756.java @@ -7,7 +7,7 @@ public class _756 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/116042/java-solution-map-backtracking */ public boolean pyramidTransition(String bottom, List allowed) { @@ -42,8 +42,12 @@ private boolean helper(String bottom, Map> map) { return false; } - private void getList(String bottom, int idx, StringBuilder sb, List ls, - Map> map) { + private void getList( + String bottom, + int idx, + StringBuilder sb, + List ls, + Map> map) { if (idx == bottom.length() - 1) { ls.add(sb.toString()); return; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_757.java b/src/main/java/com/fishercoder/solutions/firstthousand/_757.java index e92fe07ffd..697b730cbc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_757.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_757.java @@ -2,7 +2,7 @@ import java.util.Arrays; -/** +/* * Approach: Sort the intervals in the ascending order of end range. * In case if the end range of any 2 intervals match, * sort those intervals based on the descending order of start range diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_758.java b/src/main/java/com/fishercoder/solutions/firstthousand/_758.java index 67349b445e..730d4c6138 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_758.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_758.java @@ -2,7 +2,7 @@ public class _758 { public static class Solution1 { - /** + /* * Interestingly, this problem is exactly the same as 616, using 616's code could get it AC'ed. */ public String boldWords(String[] words, String S) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_76.java b/src/main/java/com/fishercoder/solutions/firstthousand/_76.java index 7656082984..6de76ad06a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_76.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_76.java @@ -43,7 +43,7 @@ public String minWindow(String s, String t) { } public static class Solution2 { - /** + /* * I implemented below solution on my own following the hints on LeetCode. * In comparison, Solution1 is more optimized and runs faster. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_763.java b/src/main/java/com/fishercoder/solutions/firstthousand/_763.java index 9d81b1e59a..a1f60562e1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_763.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_763.java @@ -11,12 +11,12 @@ public static class Solution1 { public List partitionLabels(String s) { List result = new ArrayList<>(); int[] last = new int[26]; - /**This is the key step: + /*This is the key step: * we find the last occurrence of each letter and record them in last[]*/ for (int i = 0; i < s.length(); i++) { last[s.charAt(i) - 'a'] = i; } - /**record the last end index of the current substring*/ + /*record the last end index of the current substring*/ int end = 0; int start = 0; for (int i = 0; i < s.length(); i++) { @@ -31,7 +31,7 @@ public List partitionLabels(String s) { } public static class Solution2 { - /** + /* * My completely original solution on 10/14/2021. * * Again, using a pen and paper to visualize how this works, @@ -60,5 +60,4 @@ public List partitionLabels(String s) { return ans; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_764.java b/src/main/java/com/fishercoder/solutions/firstthousand/_764.java index ee5c4df8f8..94c30b86e0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_764.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_764.java @@ -5,7 +5,7 @@ public class _764 { public static class Solution1 { - /** + /* * Dp *

* Time: O(N^2) @@ -54,7 +54,7 @@ public int orderOfLargestPlusSign(int N, int[][] mines) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/largest-plus-sign/discuss/113314/JavaC%2B%2BPython-O(N2)-solution-using-only-one-grid-matrix */ public int orderOfLargestPlusSign(int n, int[][] mines) { @@ -69,10 +69,17 @@ public int orderOfLargestPlusSign(int n, int[][] mines) { } for (int i = 0; i < n; i++) { for (int j = 0, k = n - 1, l = 0, r = 0, u = 0, d = 0; j < n; j++, k--) { - grid[i][j] = Math.min(grid[i][j], l = (grid[i][j] == 0 ? 0 : l + 1));//left direction - grid[i][k] = Math.min(grid[i][k], r = (grid[i][k] == 0 ? 0 : r + 1));//right direction - grid[j][i] = Math.min(grid[j][i], u = (grid[j][i] == 0 ? 0 : u + 1));//upwards - grid[k][i] = Math.min(grid[k][i], d = (grid[k][i] == 0 ? 0 : d + 1));//downwards + grid[i][j] = + Math.min( + grid[i][j], + l = (grid[i][j] == 0 ? 0 : l + 1)); // left direction + grid[i][k] = + Math.min( + grid[i][k], + r = (grid[i][k] == 0 ? 0 : r + 1)); // right direction + grid[j][i] = Math.min(grid[j][i], u = (grid[j][i] == 0 ? 0 : u + 1)); // upwards + grid[k][i] = + Math.min(grid[k][i], d = (grid[k][i] == 0 ? 0 : d + 1)); // downwards } } int result = 0; @@ -84,7 +91,7 @@ public int orderOfLargestPlusSign(int n, int[][] mines) { return result; } - /** + /* * break the above into FOUR separate loops to go over four directions for easier understanding */ public int orderOfLargestPlusSign_initialVersion(int n, int[][] mines) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_767.java b/src/main/java/com/fishercoder/solutions/firstthousand/_767.java index 2f559f71a1..121c4c27c0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_767.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_767.java @@ -13,7 +13,8 @@ public String reorganizeString(String S) { } int len = S.length(); for (char c : map.keySet()) { - if ((len % 2 == 0 && map.get(c) > len / 2) || (len % 2 != 0 && map.get(c) >= len / 2 + 2)) { + if ((len % 2 == 0 && map.get(c) > len / 2) + || (len % 2 != 0 && map.get(c) >= len / 2 + 2)) { return ""; } } @@ -60,7 +61,7 @@ public CustChar(Character c, int count) { } public static class Solution2 { - /** + /* * My completely original solution on 12/24/2021. */ public String reorganizeString(String s) { @@ -76,7 +77,9 @@ public String reorganizeString(String s) { while (!maxHeap.isEmpty()) { PriorityQueue tmp = new PriorityQueue<>((a, b) -> b.count - a.count); Tuple curr = maxHeap.poll(); - while (sb.length() != 0 && sb.charAt(sb.length() - 1) == curr.c && !maxHeap.isEmpty()) { + while (sb.length() != 0 + && sb.charAt(sb.length() - 1) == curr.c + && !maxHeap.isEmpty()) { tmp.offer(curr); curr = maxHeap.poll(); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_769.java b/src/main/java/com/fishercoder/solutions/firstthousand/_769.java index cf5c96d130..853e6f4510 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_769.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_769.java @@ -2,7 +2,7 @@ public class _769 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/max-chunks-to-make-sorted/discuss/113520/Java-solution-left-max-and-right-min. */ public int maxChunksToSorted(int[] arr) { @@ -31,7 +31,7 @@ public int maxChunksToSorted(int[] arr) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/articles/max-chunks-to-make-sorted-i/ */ public int maxChunksToSorted(int[] arr) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_77.java b/src/main/java/com/fishercoder/solutions/firstthousand/_77.java index 3b1788ed17..24ee370c9c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_77.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_77.java @@ -6,7 +6,7 @@ public class _77 { public static class Solution1 { - /** + /* * I'm glad that I worked this one out completely on my own on 10/11/2021! Enjoy the beauty of backtracking! */ public List> combine(int n, int k) { @@ -19,7 +19,8 @@ public List> combine(int n, int k) { return ans; } - private void backtracking(List list, int k, int start, int limit, List> ans) { + private void backtracking( + List list, int k, int start, int limit, List> ans) { if (k == 0) { ans.add(new ArrayList<>(list)); return; @@ -33,7 +34,7 @@ private void backtracking(List list, int k, int start, int limit, List< } public static class Solution2 { - /** + /* * My completely own solution on 1/24/2022. */ public List> combine(int n, int k) { @@ -46,7 +47,8 @@ public List> combine(int n, int k) { return ans; } - private void backtrack(List> ans, int[] nums, int k, List curr, int start) { + private void backtrack( + List> ans, int[] nums, int k, List curr, int start) { if (curr.size() == k) { ans.add(new ArrayList<>(curr)); } else if (curr.size() < k) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_773.java b/src/main/java/com/fishercoder/solutions/firstthousand/_773.java index 81ca71bcd4..cb2489701f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_773.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_773.java @@ -20,19 +20,20 @@ public int slidingPuzzle(int[][] board) { q.offer(start); Set visited = new HashSet<>(); visited.add(start); - //since there are only 6 cells, we just use 0 through 5 to represent the positions: - //0, 1, 2 - //3, 4, 5 - //the swap positions, go from left to right, top to bottom - //swap[index] means the possible positions to swap when '0' is at position index - int[][] swap = new int[][]{ - {1, 3}, - {0, 4, 2}, - {1, 5}, - {0, 4}, - {3, 1, 5}, - {2, 4} - }; + // since there are only 6 cells, we just use 0 through 5 to represent the positions: + // 0, 1, 2 + // 3, 4, 5 + // the swap positions, go from left to right, top to bottom + // swap[index] means the possible positions to swap when '0' is at position index + int[][] swap = + new int[][] { + {1, 3}, + {0, 4, 2}, + {1, 5}, + {0, 4}, + {3, 1, 5}, + {2, 4} + }; int level = 0; while (!q.isEmpty()) { int size = q.size(); @@ -46,7 +47,7 @@ public int slidingPuzzle(int[][] board) { sb.setLength(0); sb.append(curr); - //swap + // swap sb.setCharAt(index, curr.charAt(swapIndex)); sb.setCharAt(swapIndex, '0'); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_775.java b/src/main/java/com/fishercoder/solutions/firstthousand/_775.java index 10229b4e1a..818d21059f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_775.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_775.java @@ -1,11 +1,11 @@ package com.fishercoder.solutions.firstthousand; public class _775 { - /** + /* * credit: https://leetcode.com/problems/global-and-local-inversions/solution/ */ public static class Solution1 { - /** + /* * 1. a local inversion is also a global inversion; * 2. we only need to check if a this input has any non-local inversion, i.e. global inversions that are not local inversions * because local inversion is a subset of global inversions. @@ -25,7 +25,7 @@ public boolean isIdealPermutation(int[] A) { } public static class Solution2 { - /** + /* * from the above solution, we can tell that if we can find the minimum of A[j] where j >= i + 2, then we could quickly return false, so two steps: * 1. remembering minimum * 2. scanning from right to left diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_776.java b/src/main/java/com/fishercoder/solutions/firstthousand/_776.java index 68f1cba3b1..0edd106869 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_776.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_776.java @@ -4,14 +4,14 @@ public class _776 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/119481/recursive-java-solution */ public TreeNode[] splitBST(TreeNode root, int V) { TreeNode small = new TreeNode(0); TreeNode big = new TreeNode(0); split(root, V, small, big); - return new TreeNode[]{small.right, big.left}; + return new TreeNode[] {small.right, big.left}; } private void split(TreeNode root, int v, TreeNode small, TreeNode big) { @@ -33,12 +33,12 @@ private void split(TreeNode root, int v, TreeNode small, TreeNode big) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/articles/split-bst/ */ public TreeNode[] splitBST(TreeNode root, int V) { if (root == null) { - return new TreeNode[]{null, null}; + return new TreeNode[] {null, null}; } else if (root.val <= V) { TreeNode[] result = splitBST(root.right, V); root.right = result[0]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_777.java b/src/main/java/com/fishercoder/solutions/firstthousand/_777.java index fa33fc4312..70cde023ab 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_777.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_777.java @@ -21,10 +21,12 @@ public boolean canTransform(String start, String end) { return false; } - //check R from left, check on the start string for R first - //whenever count becomes negative, this means we encounter an R in a more left position in end string than start string - //since R could only be moved to the right in the start string, there's no way that start string could be shifted to match end string - //test11 illustrates this well + // check R from left, check on the start string for R first + // whenever count becomes negative, this means we encounter an R in a more left position + // in end string than start string + // since R could only be moved to the right in the start string, there's no way that + // start string could be shifted to match end string + // test11 illustrates this well int count = 0; for (int i = 0; i < start.length(); i++) { if (start.charAt(i) == 'R') { @@ -37,9 +39,10 @@ public boolean canTransform(String start, String end) { return false; } } - //check L from left, but check on the end string first, - //this means if L is in a more left index in start string than end string, it's impossible for start to match end - //test12 illustrates this case well + // check L from left, but check on the end string first, + // this means if L is in a more left index in start string than end string, it's + // impossible for start to match end + // test12 illustrates this case well count = 0; for (int i = 0; i < end.length(); i++) { if (end.charAt(i) == 'L') { @@ -54,6 +57,5 @@ public boolean canTransform(String start, String end) { } return true; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_779.java b/src/main/java/com/fishercoder/solutions/firstthousand/_779.java index 0112f36dab..40a07fba6a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_779.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_779.java @@ -6,7 +6,7 @@ public class _779 { public static class Solution1 { - /** + /* * Time: O(2^n) * Space: O(2^n) * This will result int TLE. @@ -33,14 +33,12 @@ public int kthGrammar(int N, int K) { } public static class Solution2 { - /** + /* * Time: O(logn) * Space: O(1) */ public int kthGrammar(int N, int K) { return Integer.bitCount(K - 1) % 2; } - } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_78.java b/src/main/java/com/fishercoder/solutions/firstthousand/_78.java index 58b0f76cc6..4c390af42a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_78.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_78.java @@ -14,7 +14,8 @@ public List> subsets(int[] nums) { result.add(new ArrayList()); for (int i = 0; i < nums.length; i++) { List> temp = new ArrayList(); - //you'll have to create a new one here, otherwise, it'll throw ConcurrentModificationException. + // you'll have to create a new one here, otherwise, it'll throw + // ConcurrentModificationException. for (List list : result) { List newList = new ArrayList(list); newList.add(nums[i]); @@ -27,7 +28,7 @@ public List> subsets(int[] nums) { } public static class Solution2 { - /** + /* * This is the most straightforward solution and easy to follow. */ public List> subsets(int[] nums) { @@ -47,7 +48,7 @@ void backtracking(List> result, List list, int[] nums, in } public static class Solution3 { - /** + /* * This is just a slight modification of Solution2, pay close to attention to notice the difference between them. */ public List> subsets(int[] nums) { @@ -58,7 +59,8 @@ public List> subsets(int[] nums) { return result; } - private void backtracking(List> result, List list, int[] nums, int start) { + private void backtracking( + List> result, List list, int[] nums, int start) { for (int i = start; i < nums.length; i++) { list.add(nums[i]); result.add(new ArrayList<>(list)); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_783.java b/src/main/java/com/fishercoder/solutions/firstthousand/_783.java index 0d3ee4d888..c22e0f7e0c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_783.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_783.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_784.java b/src/main/java/com/fishercoder/solutions/firstthousand/_784.java index 404a368d0e..06a3b1e643 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_784.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_784.java @@ -44,7 +44,7 @@ public List letterCasePermutation(String S) { } public static class Solution2 { - /** + /* * My completely original solution on 10/11/2021. */ public List letterCasePermutation(String s) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_785.java b/src/main/java/com/fishercoder/solutions/firstthousand/_785.java index 69235a051c..14c54f4210 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_785.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_785.java @@ -6,13 +6,14 @@ public class _785 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/is-graph-bipartite/discuss/115503/java-BFS */ public boolean isBipartite(int[][] graph) { int[] visited = new int[graph.length]; - //BFS - //0 means never encountered before, 1 means we put this node into set A, 2 means we put this node into set B + // BFS + // 0 means never encountered before, 1 means we put this node into set A, 2 means we put + // this node into set B for (int i = 0; i < graph.length; i++) { if (graph[i].length != 0 && visited[i] == 0) { visited[i] = 1; @@ -22,7 +23,8 @@ public boolean isBipartite(int[][] graph) { int current = queue.poll(); for (int node : graph[current]) { if (visited[node] == 0) { - //if the current node is in set A (1), then we put its neighbor in set B (2), otherwise set A (1) + // if the current node is in set A (1), then we put its neighbor in + // set B (2), otherwise set A (1) visited[node] = (visited[current] == 1) ? 2 : 1; queue.offer(node); } else { @@ -39,30 +41,32 @@ public boolean isBipartite(int[][] graph) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/is-graph-bipartite/solution/ *

* Let red indicate set A and blue indicate set B, if the graph is a bipartite, * we should be able to greedily color this graph: for each node, if we color it red, then color all of its neighbors blue, etc. */ public boolean isBipartite(int[][] graph) { - //0 means uncolored, 1 means red and 2 means blue + // 0 means uncolored, 1 means red and 2 means blue int[] colors = new int[graph.length]; for (int start = 0; start < graph.length; start++) { if (colors[start] == 0) { Stack stack = new Stack<>(); stack.push(start); - colors[start] = 1;//color it to be red + colors[start] = 1; // color it to be red while (!stack.isEmpty()) { Integer curr = stack.pop(); for (int neighbor : graph[curr]) { if (colors[neighbor] == 0) { stack.push(neighbor); - //if the current node is red (1), then we color it to be blue (2), otherwise red (1) + // if the current node is red (1), then we color it to be blue (2), + // otherwise red (1) colors[neighbor] = (colors[curr] == 1) ? 2 : 1; } else if (colors[neighbor] == colors[curr]) { - //this means the two connected nodes have the same color, so this is not a bipartite + // this means the two connected nodes have the same color, so this + // is not a bipartite return false; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_788.java b/src/main/java/com/fishercoder/solutions/firstthousand/_788.java index 800b659290..45d4606226 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_788.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_788.java @@ -5,7 +5,7 @@ public class _788 { public static class Solution1 { - /** + /* * My very original, but non-DP solution. */ public int rotatedDigits(int n) { @@ -41,7 +41,7 @@ private boolean isRotatedNumber(int num, Map map) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/rotated-digits/discuss/117975/Java-dp-solution-9ms * dp[i] = 0 means invalid; * dp[i] = 1 means valid but the same; @@ -59,7 +59,7 @@ public int rotatedDigits(int n) { dp[num] = 2; } } else { - /**Here's the key/beauty of this DP solution: + /*Here's the key/beauty of this DP solution: * we could keep checking each number by reusing the previous number we worked on, * basically, always break a bigger number into two parts: a number that's its right most digit and everything else, e.g. * num = 12 -> 1 and 2, so we check dp[1] and dp[2] to know if 12 could be rotated to a valid number, @@ -69,10 +69,12 @@ public int rotatedDigits(int n) { int a = dp[num / 10]; int b = dp[num % 10]; if (a == 1 && b == 1) { - //we first check if both are valid and the same, if that's the case, then we mark it as 1 + // we first check if both are valid and the same, if that's the case, then + // we mark it as 1 dp[num] = 1; } else if (a >= 1 && b >= 1) { - //then only in this case, either a or b is greater than 1, it's a valid and different number + // then only in this case, either a or b is greater than 1, it's a valid and + // different number dp[num] = 2; count++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_79.java b/src/main/java/com/fishercoder/solutions/firstthousand/_79.java index 7525fd2332..76d0217f75 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_79.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_79.java @@ -3,7 +3,7 @@ public class _79 { public static class Solution1 { - //credit: https://discuss.leetcode.com/topic/21142/my-java-solution + // credit: https://discuss.leetcode.com/topic/21142/my-java-solution boolean[][] visited; @@ -25,7 +25,12 @@ boolean search(char[][] board, String word, int i, int j, int pos) { if (pos == word.length()) { return true; } - if (i < 0 || j < 0 || i >= board.length || j >= board[0].length || word.charAt(pos) != board[i][j] || visited[i][j]) { + if (i < 0 + || j < 0 + || i >= board.length + || j >= board[0].length + || word.charAt(pos) != board[i][j] + || visited[i][j]) { return false; } visited[i][j] = true; @@ -66,18 +71,26 @@ private boolean search(char[][] board, int i, int j, String word, int index) { // store the visited char in a temp variable char temp = board[i][j]; board[i][j] = ' '; - if (i > 0 && board[i - 1][j] == word.charAt(index + 1) && search(board, i - 1, j, word, index + 1) == true) { + if (i > 0 + && board[i - 1][j] == word.charAt(index + 1) + && search(board, i - 1, j, word, index + 1) == true) { return true; } - if (i < board.length - 1 && board[i + 1][j] == word.charAt(index + 1) && search(board, i + 1, j, word, index + 1) == true) { + if (i < board.length - 1 + && board[i + 1][j] == word.charAt(index + 1) + && search(board, i + 1, j, word, index + 1) == true) { return true; } - if (j > 0 && board[i][j - 1] == word.charAt(index + 1) && search(board, i, j - 1, word, index + 1) == true) { + if (j > 0 + && board[i][j - 1] == word.charAt(index + 1) + && search(board, i, j - 1, word, index + 1) == true) { return true; } - if (j < board[0].length - 1 && board[i][j + 1] == word.charAt(index + 1) && search(board, i, j + 1, word, index + 1) == true) { + if (j < board[0].length - 1 + && board[i][j + 1] == word.charAt(index + 1) + && search(board, i, j + 1, word, index + 1) == true) { return true; } @@ -87,7 +100,7 @@ private boolean search(char[][] board, int i, int j, String word, int index) { } public static class Solution3 { - /** + /* * I came up with below solution completely independently on 10/7/2021, although space complexity is O(m*n) instead of constant. */ public boolean exist(char[][] board, String word) { @@ -101,7 +114,7 @@ public boolean exist(char[][] board, String word) { if (existByDfs(board, i, j, word.substring(1), visited, m, n)) { return true; } - //backtracking + // backtracking visited[i][j] = false; } } @@ -109,21 +122,33 @@ public boolean exist(char[][] board, String word) { return false; } - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; - private boolean existByDfs(char[][] board, int startI, int startJ, String word, boolean[][] visited, int m, int n) { + private boolean existByDfs( + char[][] board, + int startI, + int startJ, + String word, + boolean[][] visited, + int m, + int n) { if (word.equals("")) { return true; } for (int i = 0; i < directions.length - 1; i++) { int nextX = startI + directions[i]; int nextY = startJ + directions[i + 1]; - if (nextX >= 0 && nextX < m && nextY >= 0 && nextY < n && !visited[nextX][nextY] && board[nextX][nextY] == word.charAt(0)) { + if (nextX >= 0 + && nextX < m + && nextY >= 0 + && nextY < n + && !visited[nextX][nextY] + && board[nextX][nextY] == word.charAt(0)) { visited[nextX][nextY] = true; if (existByDfs(board, nextX, nextY, word.substring(1), visited, m, n)) { return true; } - //backtracking + // backtracking visited[nextX][nextY] = false; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_792.java b/src/main/java/com/fishercoder/solutions/firstthousand/_792.java index ed1521a57c..7cbef6d3f0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_792.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_792.java @@ -5,7 +5,7 @@ public class _792 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/number-of-matching-subsequences/discuss/1290406/C%2B%2BJavaPython-Next-Letter-Pointers-Picture-explain-O(N-%2B-S) */ public int numMatchingSubseq(String s, String[] words) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_8.java b/src/main/java/com/fishercoder/solutions/firstthousand/_8.java index 4f955f3b96..e3994726b8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_8.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_8.java @@ -1,43 +1,42 @@ -package com.fishercoder.solutions.firstthousand; - -public class _8 { - - public static class Solution1 { - /** - * four corner cases: - * 1. discards all leading zeroes - * 2. sign of the number - * 3. overflow - * 4. invalid input - */ - public int myAtoi(String s) { - int pointer = 0; - int result = 0; - while (pointer < s.length() && Character.isWhitespace(s.charAt(pointer))) { - pointer++; - } - if (pointer == s.length()) { - return 0; - } - boolean negativeFlag = (s.charAt(pointer) == '-'); - if (s.charAt(pointer) == '+' || s.charAt(pointer) == '-') { - pointer++; - } - for (; pointer < s.length(); pointer++) { - if (s.charAt(pointer) > '9' || s.charAt(pointer) < '0') { - break; - } else { - int digit = s.charAt(pointer) - '0'; - if (!negativeFlag && result > (Integer.MAX_VALUE - digit) / 10) { - return Integer.MAX_VALUE; - } else if (negativeFlag && result < (Integer.MIN_VALUE + digit) / 10) { - return Integer.MIN_VALUE; - } - result = result * 10 + (negativeFlag ? -digit : digit); - } - } - return result; - } - } - -} +package com.fishercoder.solutions.firstthousand; + +public class _8 { + + public static class Solution1 { + /* + * four corner cases: + * 1. discards all leading zeroes + * 2. sign of the number + * 3. overflow + * 4. invalid input + */ + public int myAtoi(String s) { + int pointer = 0; + int result = 0; + while (pointer < s.length() && Character.isWhitespace(s.charAt(pointer))) { + pointer++; + } + if (pointer == s.length()) { + return 0; + } + boolean negativeFlag = (s.charAt(pointer) == '-'); + if (s.charAt(pointer) == '+' || s.charAt(pointer) == '-') { + pointer++; + } + for (; pointer < s.length(); pointer++) { + if (s.charAt(pointer) > '9' || s.charAt(pointer) < '0') { + break; + } else { + int digit = s.charAt(pointer) - '0'; + if (!negativeFlag && result > (Integer.MAX_VALUE - digit) / 10) { + return Integer.MAX_VALUE; + } else if (negativeFlag && result < (Integer.MIN_VALUE + digit) / 10) { + return Integer.MIN_VALUE; + } + result = result * 10 + (negativeFlag ? -digit : digit); + } + } + return result; + } + } +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_80.java b/src/main/java/com/fishercoder/solutions/firstthousand/_80.java index 4083417590..44e96c4d70 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_80.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_80.java @@ -30,5 +30,4 @@ public int removeDuplicates(int[] nums) { return counter; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_800.java b/src/main/java/com/fishercoder/solutions/firstthousand/_800.java index 65a6fc8d44..7160359877 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_800.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_800.java @@ -21,22 +21,27 @@ public String similarRGB(String color) { } private int computeSimilarity(String candidate, String color) { - return -(Integer.parseInt(candidate.substring(1, 3), 16) - Integer.parseInt( - color.substring(1, 3), 16)) * (Integer.parseInt(candidate.substring(1, 3), 16) - - Integer.parseInt(color.substring(1, 3), 16)) - - (Integer.parseInt(candidate.substring(3, 5), 16) - Integer.parseInt( - color.substring(3, 5), 16)) * (Integer.parseInt(candidate.substring(3, 5), 16) - - Integer.parseInt(color.substring(3, 5), 16)) - - (Integer.parseInt(candidate.substring(5, 7), 16) - Integer.parseInt( - color.substring(5, 7), 16)) * (Integer.parseInt(candidate.substring(5, 7), 16) - - Integer.parseInt(color.substring(5, 7), 16)); + return -(Integer.parseInt(candidate.substring(1, 3), 16) + - Integer.parseInt(color.substring(1, 3), 16)) + * (Integer.parseInt(candidate.substring(1, 3), 16) + - Integer.parseInt(color.substring(1, 3), 16)) + - (Integer.parseInt(candidate.substring(3, 5), 16) + - Integer.parseInt(color.substring(3, 5), 16)) + * (Integer.parseInt(candidate.substring(3, 5), 16) + - Integer.parseInt(color.substring(3, 5), 16)) + - (Integer.parseInt(candidate.substring(5, 7), 16) + - Integer.parseInt(color.substring(5, 7), 16)) + * (Integer.parseInt(candidate.substring(5, 7), 16) + - Integer.parseInt(color.substring(5, 7), 16)); } private List computeAllShorthandCombinations() { List result = new ArrayList<>(); - List hexNumber = new ArrayList<>( - Arrays.asList('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', - 'f')); + List hexNumber = + new ArrayList<>( + Arrays.asList( + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', + 'd', 'e', 'f')); for (int i = 0; i < hexNumber.size(); i++) { for (int j = 0; j < hexNumber.size(); j++) { for (int k = 0; k < hexNumber.size(); k++) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_802.java b/src/main/java/com/fishercoder/solutions/firstthousand/_802.java index 5ebb80770c..467e19e249 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_802.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_802.java @@ -7,7 +7,7 @@ public class _802 { public static class Solution1 { - /** + /* * This is a variation of the templated topological sort in that it doesn't use indegree array, instead, it uses an outdegree array. *

* For topological sort, it usually makes sense to just keep an array of elements since it's a graph of n nodes, diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_804.java b/src/main/java/com/fishercoder/solutions/firstthousand/_804.java index d70674f5eb..920f28bc0b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_804.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_804.java @@ -7,9 +7,11 @@ public class _804 { public static class Solution1 { public int uniqueMorseRepresentations(String[] words) { String[] morseCodes = - new String[]{".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", - "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", - ".--", "-..-", "-.--", "--.."}; + new String[] { + ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", + "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", + "...-", ".--", "-..-", "-.--", "--.." + }; Set concatenation = new HashSet<>(); StringBuilder sb = new StringBuilder(); for (String word : words) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_806.java b/src/main/java/com/fishercoder/solutions/firstthousand/_806.java index de78533a94..de0e9f6f3f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_806.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_806.java @@ -16,7 +16,7 @@ public int[] numberOfLines(int[] widths, String S) { offsetInCurrentLine = widths[c - 'a']; } } - return new int[]{numOfLines, offsetInCurrentLine}; + return new int[] {numOfLines, offsetInCurrentLine}; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_809.java b/src/main/java/com/fishercoder/solutions/firstthousand/_809.java index 9535ff48f7..cd85c68957 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_809.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_809.java @@ -16,12 +16,12 @@ private boolean check(String S, String w) { int i = 0; int j = 0; /* Logic is to check whether character at same index of S and w are same - if same, - 1. Find the consecutive number of occurrences of the char in S (say len1) and w ( say len2) - 2. If len1 == len 2 , move to the next char in S and w - 3. If len1 >= 3 and len2 < len1, means we can make the char in w stretchy to match len1 - 4. else, return false, because it's not possible to stretch the char in w - */ + if same, + 1. Find the consecutive number of occurrences of the char in S (say len1) and w ( say len2) + 2. If len1 == len 2 , move to the next char in S and w + 3. If len1 >= 3 and len2 < len1, means we can make the char in w stretchy to match len1 + 4. else, return false, because it's not possible to stretch the char in w + */ while (i < S.length() && j < w.length()) { char ch1 = S.charAt(i); char ch2 = w.charAt(j); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_81.java b/src/main/java/com/fishercoder/solutions/firstthousand/_81.java index e081933464..2c9213dbbc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_81.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_81.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.firstthousand; -/** +/* * 81. Search in Rotated Sorted Array II *

* There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). @@ -30,9 +30,9 @@ public boolean search(int[] nums, int target) { int left = 0; int right = nums.length - 1; - //check each num so we will check left == right - //We always get a sorted part and a half part - //we can check sorted part to decide where to go next + // check each num so we will check left == right + // We always get a sorted part and a half part + // we can check sorted part to decide where to go next while (left <= right) { int mid = left + (right - left) / 2; if (nums[mid] == target) { @@ -40,26 +40,27 @@ public boolean search(int[] nums, int target) { } if (nums[left] < nums[mid]) { - //if left part is sorted + // if left part is sorted if (target < nums[left] || target > nums[mid]) { - //target is in rotated part + // target is in rotated part left = mid + 1; } else { right = mid - 1; } } else if (nums[left] > nums[mid]) { - //right part is sorted + // right part is sorted if (target < nums[mid] || target > nums[right]) { - //target is in rotated part + // target is in rotated part right = mid - 1; } else { left = mid + 1; } } else { - //duplicates, we know nums[mid] != target, so nums[left] != target - //based on current information, we can only move left pointer to skip one cell - //thus in the worst case, we would have target: 2, and array like 11111111, then - //the running time would be O(n) + // duplicates, we know nums[mid] != target, so nums[left] != target + // based on current information, we can only move left pointer to skip one cell + // thus in the worst case, we would have target: 2, and array like 11111111, + // then + // the running time would be O(n) left++; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_811.java b/src/main/java/com/fishercoder/solutions/firstthousand/_811.java index 35910b709e..b8da068f02 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_811.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_811.java @@ -18,7 +18,9 @@ public List subdomainVisits(String[] cpdomains) { sb.insert(0, "."); } sb.insert(0, subDomains[i]); - map.put(sb.toString(), map.getOrDefault(sb.toString(), 0) + Integer.parseInt(pair[0])); + map.put( + sb.toString(), + map.getOrDefault(sb.toString(), 0) + Integer.parseInt(pair[0])); } } List result = new ArrayList<>(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_812.java b/src/main/java/com/fishercoder/solutions/firstthousand/_812.java index 381c20b3bf..f8d5564970 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_812.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_812.java @@ -2,7 +2,7 @@ public class _812 { public static class Solution1 { - /** + /* * reference: https://www.mathopenref.com/coordtrianglearea.html */ public double largestTriangleArea(int[][] points) { @@ -10,9 +10,15 @@ public double largestTriangleArea(int[][] points) { for (int i = 0; i < points.length - 2; i++) { for (int j = i + 1; j < points.length - 1; j++) { for (int k = j + 1; k < points.length; k++) { - double area = Math.abs(points[i][0] * (points[j][1] - points[k][1]) + points[j][0] * (points[k][1] - points[i][1]) + points[k][0] * (points[i][1] - points[j][1])) / 2.0; + double area = + Math.abs( + points[i][0] * (points[j][1] - points[k][1]) + + points[j][0] + * (points[k][1] - points[i][1]) + + points[k][0] + * (points[i][1] - points[j][1])) + / 2.0; largestArea = Math.max(largestArea, area); - } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_814.java b/src/main/java/com/fishercoder/solutions/firstthousand/_814.java index 6b9d4e0020..f95a14f4f7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_814.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_814.java @@ -4,7 +4,7 @@ public class _814 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/binary-tree-pruning/discuss/122730/C%2B%2BJavaPython-Self-Explaining-Solution-and-2-lines */ public TreeNode pruneTree(TreeNode root) { @@ -19,5 +19,4 @@ public TreeNode pruneTree(TreeNode root) { return root; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_816.java b/src/main/java/com/fishercoder/solutions/firstthousand/_816.java index 13354cba16..2357234a6b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_816.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_816.java @@ -31,9 +31,12 @@ private List findAllPossibilities(String str) { for (int i = 1; i < str.length(); i++) { String integerPart = str.substring(0, i); String floatPart = str.substring(i); - if (integerPart.length() > 1 && integerPart.charAt(0) != '0' && floatPart.charAt(floatPart.length() - 1) != '0') { + if (integerPart.length() > 1 + && integerPart.charAt(0) != '0' + && floatPart.charAt(floatPart.length() - 1) != '0') { result.add(integerPart + "." + floatPart); - } else if (integerPart.length() == 1 && floatPart.charAt(floatPart.length() - 1) != '0') { + } else if (integerPart.length() == 1 + && floatPart.charAt(floatPart.length() - 1) != '0') { result.add(integerPart + "." + floatPart); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_82.java b/src/main/java/com/fishercoder/solutions/firstthousand/_82.java index 39f7f0488a..eef715a9d1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_82.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_82.java @@ -22,5 +22,4 @@ public ListNode deleteDuplicates(ListNode head) { return pre.next; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_820.java b/src/main/java/com/fishercoder/solutions/firstthousand/_820.java index a3678cecf5..07788c5a04 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_820.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_820.java @@ -10,7 +10,8 @@ public int minimumLengthEncoding(String[] words) { for (int j = words.length - 2; j >= 0; j--) { for (int i = j + 1; i < words.length; i++) { if (!removed[i]) { - if (words[i].substring(words[i].length() - words[j].length()).equals(words[j])) { + if (words[i].substring(words[i].length() - words[j].length()) + .equals(words[j])) { removed[j] = true; break; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_823.java b/src/main/java/com/fishercoder/solutions/firstthousand/_823.java index c8ece8610b..ff3ed17760 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_823.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_823.java @@ -6,7 +6,7 @@ public class _823 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/binary-trees-with-factors/discuss/126277/Concise-Java-solution-using-HashMap-with-detailed-explanation.-Easily-understand!!! */ private static final long MOD = 1000000007L; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_826.java b/src/main/java/com/fishercoder/solutions/firstthousand/_826.java index 602ed3e5f7..50a51386fd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_826.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_826.java @@ -9,13 +9,14 @@ public static class Solution1 { public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) { List jobs = new ArrayList<>(); for (int i = 0; i < difficulty.length; i++) { - jobs.add(new int[]{difficulty[i], profit[i]}); + jobs.add(new int[] {difficulty[i], profit[i]}); } - //sort by difficulty level + // sort by difficulty level Collections.sort(jobs, (a, b) -> a[0] - b[0]); - //update the profit values: because a later (with more difficult) job must be able to handle a prior job, so we take the more profitable one - //this makes this jobs list in non-decreasing order in both dimensions + // update the profit values: because a later (with more difficult) job must be able to + // handle a prior job, so we take the more profitable one + // this makes this jobs list in non-decreasing order in both dimensions for (int i = 0; i < jobs.size() - 1; i++) { jobs.get(i + 1)[1] = Math.max(jobs.get(i)[1], jobs.get(i + 1)[1]); } @@ -31,7 +32,7 @@ private int binarySearch(int ability, List jobs) { int left = 0; int right = jobs.size() - 1; int maxProfit = 0; - //it's important to use <= here so we don't miss a possible element + // it's important to use <= here so we don't miss a possible element while (left <= right) { int mid = left + (right - left) / 2; if (ability >= jobs.get(mid)[0]) { @@ -43,6 +44,5 @@ private int binarySearch(int ability, List jobs) { } return maxProfit; } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_836.java b/src/main/java/com/fishercoder/solutions/firstthousand/_836.java index d501327227..e476c8d1d0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_836.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_836.java @@ -2,7 +2,7 @@ public class _836 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/rectangle-overlap/discuss/132340/C%2B%2BJavaPython-1-line-Solution-1D-to-2D */ public boolean isRectangleOverlap(int[] rec1, int[] rec2) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_838.java b/src/main/java/com/fishercoder/solutions/firstthousand/_838.java index d643e1799f..8685e0b30b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_838.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_838.java @@ -16,7 +16,9 @@ public String pushDominoes(String dominoes) { newSb.append('L'); if (i == 1 && currentSb.charAt(i - 1) == '.') { newSb.replace(i - 1, i, "L"); - } else if (i > 1 && currentSb.charAt(i - 1) == '.' && currentSb.charAt(i - 2) != 'R') { + } else if (i > 1 + && currentSb.charAt(i - 1) == '.' + && currentSb.charAt(i - 2) != 'R') { newSb.replace(i - 1, i, "L"); } } else if (currentSb.charAt(i) == 'R') { @@ -24,7 +26,9 @@ public String pushDominoes(String dominoes) { if (i == currentSb.length() - 2 && currentSb.charAt(i + 1) == '.') { newSb.replace(i + 1, i + 2, "R"); i++; - } else if (i < currentSb.length() - 2 && currentSb.charAt(i + 1) == '.' && currentSb.charAt(i + 2) != 'L') { + } else if (i < currentSb.length() - 2 + && currentSb.charAt(i + 1) == '.' + && currentSb.charAt(i + 2) != 'L') { newSb.replace(i + 1, i + 2, "R"); i++; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_84.java b/src/main/java/com/fishercoder/solutions/firstthousand/_84.java index bf17c8c9d2..c379d5cd40 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_84.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_84.java @@ -6,7 +6,7 @@ public class _84 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/articles/largest-rectangle-histogram/#approach-5-using-stack-accepted * and https://discuss.leetcode.com/topic/7599/o-n-stack-based-java-solution */ @@ -27,5 +27,4 @@ public int largestRectangleArea(int[] heights) { return maxArea; } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_840.java b/src/main/java/com/fishercoder/solutions/firstthousand/_840.java index 33fe32027d..077d74b699 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_840.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_840.java @@ -24,23 +24,29 @@ public int numMagicSquaresInside(int[][] grid) { private boolean isValid(int[][] grid, int i, int j, Set set, int sum) { return sum == grid[i + 1][j] + grid[i + 1][j + 1] + grid[i + 1][j + 2] && sum == grid[i + 2][j] + grid[i + 2][j + 1] + grid[i + 2][j + 2] - && sum == grid[i][j] + grid[i + 1][j] + grid[i + 2][j] && sum == grid[i][j + 1] + grid[i + 1][j + 1] + grid[i + 2][j + 1] && sum == grid[i][j + 2] + grid[i + 1][j + 2] + grid[i + 2][j + 2] - && sum == grid[i][j] + grid[i + 1][j + 1] + grid[i + 2][j + 2] && sum == grid[i][j + 2] + grid[i + 1][j + 1] + grid[i + 2][j] - - && set.add(grid[i][j]) && isLegit(grid[i][j]) - && set.add(grid[i][j + 1]) && isLegit(grid[i][j + 1]) - && set.add(grid[i][j + 2]) && isLegit(grid[i][j + 2]) - && set.add(grid[i + 1][j]) && isLegit(grid[i + 1][j]) - && set.add(grid[i + 1][j + 1]) && isLegit(grid[i + 1][j + 1]) - && set.add(grid[i + 1][j + 2]) && isLegit(grid[i + 1][j + 2]) - && set.add(grid[i + 2][j]) && isLegit(grid[i + 2][j]) - && set.add(grid[i + 2][j + 1]) && isLegit(grid[i + 2][j + 1]) - && set.add(grid[i + 2][j + 2]) && isLegit(grid[i + 2][j + 2]); + && set.add(grid[i][j]) + && isLegit(grid[i][j]) + && set.add(grid[i][j + 1]) + && isLegit(grid[i][j + 1]) + && set.add(grid[i][j + 2]) + && isLegit(grid[i][j + 2]) + && set.add(grid[i + 1][j]) + && isLegit(grid[i + 1][j]) + && set.add(grid[i + 1][j + 1]) + && isLegit(grid[i + 1][j + 1]) + && set.add(grid[i + 1][j + 2]) + && isLegit(grid[i + 1][j + 2]) + && set.add(grid[i + 2][j]) + && isLegit(grid[i + 2][j]) + && set.add(grid[i + 2][j + 1]) + && isLegit(grid[i + 2][j + 1]) + && set.add(grid[i + 2][j + 2]) + && isLegit(grid[i + 2][j + 2]); } private boolean isLegit(int num) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_841.java b/src/main/java/com/fishercoder/solutions/firstthousand/_841.java index c2ef366dec..48c5502708 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_841.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_841.java @@ -57,7 +57,7 @@ public boolean canVisitAllRooms(List> rooms) { } public static class Solution3 { - /** + /* * My completely original recursive solution. */ public boolean canVisitAllRooms(List> rooms) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_847.java b/src/main/java/com/fishercoder/solutions/firstthousand/_847.java index 4f0838522f..9c02f0773d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_847.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_847.java @@ -3,7 +3,7 @@ public class _847 { public static class Solution1 { public int shortestPathLength(int[][] graph) { - //TODO: implement this + // TODO: implement this return -1; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_848.java b/src/main/java/com/fishercoder/solutions/firstthousand/_848.java index c5bc7c54a6..22098c9fb7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_848.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_848.java @@ -3,7 +3,8 @@ public class _848 { public static class Solution1 { public String shiftingLetters(String s, int[] shifts) { - long[] preSums = new long[shifts.length];//use long type to avoid integer addition overflow + long[] preSums = + new long[shifts.length]; // use long type to avoid integer addition overflow for (int i = shifts.length - 1; i >= 0; i--) { if (i < shifts.length - 1) { preSums[i] = preSums[i + 1] + shifts[i]; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_849.java b/src/main/java/com/fishercoder/solutions/firstthousand/_849.java index 320d1b68d2..9d9fa299d6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_849.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_849.java @@ -49,7 +49,7 @@ private void extend(int[] seats, int position) { } public static class Solution2 { - /** + /* * my completely original solution on 9/13/2021. */ public int maxDistToClosest(int[] seats) { @@ -65,7 +65,9 @@ public int maxDistToClosest(int[] seats) { Integer leftNeighbor = treeMap.floor(i); Integer rightNeighbor = treeMap.ceiling(i); if (leftNeighbor != null && rightNeighbor != null) { - maxDistance = Math.max(maxDistance, Math.min(i - leftNeighbor, rightNeighbor - i)); + maxDistance = + Math.max( + maxDistance, Math.min(i - leftNeighbor, rightNeighbor - i)); } else if (leftNeighbor == null) { maxDistance = Math.max(maxDistance, rightNeighbor - i); } else { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_85.java b/src/main/java/com/fishercoder/solutions/firstthousand/_85.java index 410dcfbc13..947d48938e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_85.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_85.java @@ -21,7 +21,7 @@ public int maximalRectangle(char[][] matrix) { int currLeft = 0; int currRight = n; - //compute height, this can be achieved from either side + // compute height, this can be achieved from either side for (int j = 0; j < n; j++) { if (matrix[i][j] == '1') { height[j]++; @@ -30,7 +30,7 @@ public int maximalRectangle(char[][] matrix) { } } - //compute left, from left to right + // compute left, from left to right for (int j = 0; j < n; j++) { if (matrix[i][j] == '1') { left[j] = Math.max(left[j], currLeft); @@ -40,7 +40,7 @@ public int maximalRectangle(char[][] matrix) { } } - //compute right, from right to left + // compute right, from right to left for (int j = n - 1; j >= 0; j--) { if (matrix[i][j] == '1') { right[j] = Math.min(right[j], currRight); @@ -50,7 +50,7 @@ public int maximalRectangle(char[][] matrix) { } } - //compute rectangle area, this can be achieved from either side + // compute rectangle area, this can be achieved from either side for (int j = 0; j < n; j++) { maxA = Math.max(maxA, (right[j] - left[j]) * height[j]); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_851.java b/src/main/java/com/fishercoder/solutions/firstthousand/_851.java index fc8ac4ba60..5a8b9cccf4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_851.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_851.java @@ -7,7 +7,7 @@ public class _851 { public static class Solution1 { - /** + /* * My completely original solution. Practice does make perfect! * Topological sort template does work well for this: * 1. make variable names as descriptive as possible to help sort out your logic; @@ -42,7 +42,7 @@ public int[] loudAndRich(int[][] richer, int[] quiet) { int quietnessForRicherPerson = quiet[result[curr]]; if (quietnessForRicherPerson < quietnessForLessRichPerson) { result[v] = result[curr]; - //remember to update the quietness value for this node as well + // remember to update the quietness value for this node as well quiet[v] = quiet[curr]; } indegree[v]--; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_856.java b/src/main/java/com/fishercoder/solutions/firstthousand/_856.java index 3643410565..18f821326c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_856.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_856.java @@ -4,20 +4,20 @@ public class _856 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/score-of-parentheses/discuss/141763/Java-solution-using-Stack */ public int scoreOfParentheses(String S) { Stack stack = new Stack<>(); for (int i = 0; i < S.length(); i++) { if (S.charAt(i) == '(') { - stack.push(-1);//we use -1 to indicate this is a left paren '(' + stack.push(-1); // we use -1 to indicate this is a left paren '(' } else { int curr = 0; while (stack.peek() != -1) { curr += stack.pop(); } - stack.pop();//this is to push the '(' off of the stack + stack.pop(); // this is to push the '(' off of the stack stack.push(curr == 0 ? 1 : curr * 2); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_86.java b/src/main/java/com/fishercoder/solutions/firstthousand/_86.java index 516b4b247c..a701f9d59e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_86.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_86.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_860.java b/src/main/java/com/fishercoder/solutions/firstthousand/_860.java index 9a9a51aaf5..b519c6246a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_860.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_860.java @@ -56,13 +56,13 @@ public boolean lemonadeChange(int[] bills) { } public static class Solution2 { - /** + /* * My original solution on 8/14/2024. * You only need to keep track of the number of $5 and $10 bills at hand. */ public boolean lemonadeChange(int[] bills) { - int[] changes = new int[2];//5 and 10 + int[] changes = new int[2]; // 5 and 10 for (int bill : bills) { if (bill == 5) { changes[0]++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_861.java b/src/main/java/com/fishercoder/solutions/firstthousand/_861.java index a8e07f657a..a3b5c28974 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_861.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_861.java @@ -2,7 +2,7 @@ public class _861 { public static class Solution1 { - /** + /* * We can simply apply greedy methodology here. * 1. we check if the left most digits are ones or not, if it's a zero, * then we'll just flip this entire row, reason being the left most digit carries the biggest weight when interpreting this binary row/number; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_863.java b/src/main/java/com/fishercoder/solutions/firstthousand/_863.java index e298148dfd..2072b0b422 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_863.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_863.java @@ -1,12 +1,11 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.*; public class _863 { public static class Solution1 { - /** + /* * Since it's asking for distance k, a.k.a shortest distance, BFS should be the way to go. * For this particular problem: we'll do BFS twice: * 1st time: we build a child to parent mapping, in binary tree, there's only parent to children mapping, so we'll need to establish this child to parent link; @@ -44,7 +43,8 @@ public List distanceK(TreeNode root, TreeNode target, int k) { if (curr.right != null && !visited.contains(curr.right.val)) { queue.offer(curr.right); } - if (childToParentMap.containsKey(curr.val) && !visited.contains(childToParentMap.get(curr.val).val)) { + if (childToParentMap.containsKey(curr.val) + && !visited.contains(childToParentMap.get(curr.val).val)) { queue.offer(childToParentMap.get(curr.val)); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_87.java b/src/main/java/com/fishercoder/solutions/firstthousand/_87.java index 6effac222f..59201883e6 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_87.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_87.java @@ -3,7 +3,7 @@ public class _87 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/19158/accepted-java-solution */ public boolean isScramble(String s1, String s2) { @@ -27,12 +27,12 @@ public boolean isScramble(String s1, String s2) { } for (int i = 1; i < s1.length(); i++) { - if (isScramble(s1.substring(0, i), s2.substring(0, i)) && isScramble( - s1.substring(i), s2.substring(i))) { + if (isScramble(s1.substring(0, i), s2.substring(0, i)) + && isScramble(s1.substring(i), s2.substring(i))) { return true; } - if (isScramble(s1.substring(0, i), s2.substring(s2.length() - i)) && isScramble( - s1.substring(i), s2.substring(0, s2.length() - i))) { + if (isScramble(s1.substring(0, i), s2.substring(s2.length() - i)) + && isScramble(s1.substring(i), s2.substring(0, s2.length() - i))) { return true; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_872.java b/src/main/java/com/fishercoder/solutions/firstthousand/_872.java index 5382fef3fe..44deaff476 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_872.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_872.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -15,8 +14,7 @@ public boolean leafSimilar(TreeNode root1, TreeNode root2) { return leaves1.equals(leaves2); } - private void preorder(TreeNode root, - List leaves) { + private void preorder(TreeNode root, List leaves) { if (root == null) { return; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_877.java b/src/main/java/com/fishercoder/solutions/firstthousand/_877.java index 6fd9c51011..27758b1dc3 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_877.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_877.java @@ -4,7 +4,7 @@ public class _877 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/stone-game/discuss/154660/Java-This-is-minimax-%2B-dp-(fully-detailed-explanation-%2B-generalization-%2B-easy-understand-code) *

* Suppose the ID for Alex is 1, that for Lee is 0 @@ -31,9 +31,15 @@ private int recursion(int[][][] dp, int left, int right, int identifier, int[] p } int next = Math.abs(identifier - 1); if (identifier == 1) { - dp[left][right][identifier] = Math.max(piles[left] + recursion(dp, left + 1, right, next, piles), piles[right] + recursion(dp, left, right - 1, next, piles)); + dp[left][right][identifier] = + Math.max( + piles[left] + recursion(dp, left + 1, right, next, piles), + piles[right] + recursion(dp, left, right - 1, next, piles)); } else { - dp[left][right][identifier] = Math.min(-piles[left] + recursion(dp, left + 1, right, next, piles), -piles[right] + recursion(dp, left, right - 1, next, piles)); + dp[left][right][identifier] = + Math.min( + -piles[left] + recursion(dp, left + 1, right, next, piles), + -piles[right] + recursion(dp, left, right - 1, next, piles)); } return dp[left][right][identifier]; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_88.java b/src/main/java/com/fishercoder/solutions/firstthousand/_88.java index 5f9e2c3029..031b235f0b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_88.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_88.java @@ -3,7 +3,7 @@ public class _88 { public static class Solution1 { - /** + /* * The key to reach this optimal solution is: start from the right side instead of the left. */ public void merge(int[] nums1, int m, int[] nums2, int n) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_880.java b/src/main/java/com/fishercoder/solutions/firstthousand/_880.java index 4f3878ff28..c8e41d8345 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_880.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_880.java @@ -3,7 +3,7 @@ public class _880 { public static class Solution1 { public String decodeAtIndex(String S, int K) { - //TODO: implement it + // TODO: implement it return ""; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_883.java b/src/main/java/com/fishercoder/solutions/firstthousand/_883.java index 776a03ed25..f046c0fd60 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_883.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_883.java @@ -2,7 +2,7 @@ public class _883 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/projection-area-of-3d-shapes/discuss/156726/C%2B%2BJavaPython-Straight-Forward-One-Pass */ public int projectionArea(int[][] grid) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_885.java b/src/main/java/com/fishercoder/solutions/firstthousand/_885.java index 722e110787..37d24310e5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_885.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_885.java @@ -2,26 +2,26 @@ public class _885 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/spiral-matrix-iii/discuss/158977/Java-15-lines-concise-solution-with-comments */ public int[][] spiralMatrixIII(int rows, int cols, int rStart, int cStart) { - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; int[][] result = new int[rows * cols][2]; int i = 0; - result[i++] = new int[]{rStart, cStart}; + result[i++] = new int[] {rStart, cStart}; int len = 0; int d = 0; while (i < rows * cols) { if (d == 0 || d == 2) { - //plus one when moving east or west + // plus one when moving east or west len++; } for (int k = 0; k < len; k++) { rStart += directions[d]; cStart += directions[d + 1]; if (rStart >= 0 && rStart < rows && cStart >= 0 && cStart < cols) { - result[i++] = new int[]{rStart, cStart}; + result[i++] = new int[] {rStart, cStart}; } } d = (d + 1) % 4; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_89.java b/src/main/java/com/fishercoder/solutions/firstthousand/_89.java index 31480876aa..02aff4af3f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_89.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_89.java @@ -26,15 +26,19 @@ public List grayCode(int n) { } public static void main(String... args) { - System.out.println("-----------------------------------------------------------------------------------------"); - System.out.println("How to understand i << n? It means n to the power of two, see below. So we have an equivalent solution, which is solution2."); + System.out.println( + "-----------------------------------------------------------------------------------------"); + System.out.println( + "How to understand i << n? It means n to the power of two, see below. So we have an equivalent solution, which is solution2."); System.out.println("1 << 2: " + (1 << 2)); System.out.println("1 << 3: " + (1 << 3)); System.out.println("1 << 4: " + (1 << 4)); System.out.println("1 << 5: " + (1 << 5)); System.out.println("1 << 6: " + (1 << 6)); - System.out.println("-----------------------------------------------------------------------------------------"); - System.out.println("How to understand i >> 1? It means to shift the number i to the right by 1 bit, see below"); + System.out.println( + "-----------------------------------------------------------------------------------------"); + System.out.println( + "How to understand i >> 1? It means to shift the number i to the right by 1 bit, see below"); System.out.println("0 >> 1: " + (0 >> 1)); System.out.println("1 >> 1: " + (1 >> 1)); System.out.println("2 >> 1: " + (2 >> 1)); @@ -43,5 +47,4 @@ public static void main(String... args) { System.out.println("5 >> 1: " + (5 >> 1)); System.out.println("6 >> 1: " + (6 >> 1)); } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_890.java b/src/main/java/com/fishercoder/solutions/firstthousand/_890.java index 1d03e228b8..744f6624f0 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_890.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_890.java @@ -48,19 +48,21 @@ public List findAndReplacePattern(String[] words, String pattern) { } private boolean matches(String word, String pattern) { - Map map1 = new HashMap<>();//word -> p - Map map2 = new HashMap<>();//p -> word + Map map1 = new HashMap<>(); // word -> p + Map map2 = new HashMap<>(); // p -> word for (int i = 0; i < pattern.length(); i++) { if (!map1.containsKey(word.charAt(i))) { map1.put(word.charAt(i), pattern.charAt(i)); } - if (map1.containsKey(word.charAt(i)) && map1.get(word.charAt(i)) != pattern.charAt(i)) { + if (map1.containsKey(word.charAt(i)) + && map1.get(word.charAt(i)) != pattern.charAt(i)) { return false; } if (!map2.containsKey(pattern.charAt(i))) { map2.put(pattern.charAt(i), word.charAt(i)); } - if (map2.containsKey(pattern.charAt(i)) && map2.get(pattern.charAt(i)) != word.charAt(i)) { + if (map2.containsKey(pattern.charAt(i)) + && map2.get(pattern.charAt(i)) != word.charAt(i)) { return false; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_892.java b/src/main/java/com/fishercoder/solutions/firstthousand/_892.java index 79ace2f86a..17c992ac13 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_892.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_892.java @@ -2,7 +2,7 @@ public class _892 { public static class Solution1 { - /** + /* * It's the way that you approach a problem like this matters. This is why we practice LeetCode - train your thought process, i.e. how do you approach a seemingly complex problem. *

* Inspired by: https://leetcode.com/problems/surface-area-of-3d-shapes/discuss/163414/C%2B%2BJava1-line-Python-Minus-Hidden-Area @@ -24,7 +24,7 @@ public int surfaceArea(int[][] grid) { } } } - //check its right side neighbors + // check its right side neighbors for (int i = 0; i < m; i++) { for (int j = 0; j < n - 1; j++) { if (grid[i][j] != 0 && grid[i][j + 1] != 0) { @@ -32,7 +32,7 @@ public int surfaceArea(int[][] grid) { } } } - //check its downside neighbors + // check its downside neighbors for (int i = 0; i < m - 1; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] != 0 && grid[i + 1][j] != 0) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_893.java b/src/main/java/com/fishercoder/solutions/firstthousand/_893.java index 1b35266742..4e63033b6c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_893.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_893.java @@ -8,7 +8,7 @@ public class _893 { public static class Solution1 { - /** + /* * my original solution, a bit lengthy: * generate a unique signaure as key for each equivelant group and sum them up */ @@ -29,12 +29,15 @@ private String getCommonKey(String word) { } Arrays.sort(oddIndexed); Arrays.sort(evenIndexed); - return new StringBuffer().append(new String(evenIndexed)).append(new String(oddIndexed)).toString(); + return new StringBuffer() + .append(new String(evenIndexed)) + .append(new String(oddIndexed)) + .toString(); } } public static class Solution2 { - /** + /* * more concise solution: https://leetcode.com/problems/groups-of-special-equivalent-strings/discuss/163413/Java-Concise-Set-Solution * but somehow a bit slower than mine: 12 ms vs 7ms * I guess due to the problem constraint and this: "1 <= A[i].length <= 20" to have made this problem simpler diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_895.java b/src/main/java/com/fishercoder/solutions/firstthousand/_895.java index 0aecd46cb0..d6c7d00983 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_895.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_895.java @@ -18,7 +18,7 @@ public FreqStack() { public void push(int x) { map.put(x, map.getOrDefault(x, 0) + 1); - maxHeap.offer(new int[]{x, map.get(x), counter++}); + maxHeap.offer(new int[] {x, map.get(x), counter++}); } public int pop() { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_896.java b/src/main/java/com/fishercoder/solutions/firstthousand/_896.java index a2f8a8dec7..1292d67060 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_896.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_896.java @@ -4,7 +4,7 @@ public class _896 { public static class Solution1 { public boolean isMonotonic(int[] nums) { int i = 0; - //check if it's increasing + // check if it's increasing for (; i < nums.length - 1; i++) { if (nums[i] > nums[i + 1]) { break; @@ -14,7 +14,7 @@ public boolean isMonotonic(int[] nums) { return true; } i = 0; - //check if it's decreasing + // check if it's decreasing for (; i < nums.length - 1; i++) { if (nums[i] < nums[i + 1]) { break; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_897.java b/src/main/java/com/fishercoder/solutions/firstthousand/_897.java index c028f6a9dd..8f28fc25ad 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_897.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_897.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_9.java b/src/main/java/com/fishercoder/solutions/firstthousand/_9.java index d5f3601e9b..73195729ae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_9.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_9.java @@ -1,7 +1,7 @@ package com.fishercoder.solutions.firstthousand; public class _9 { - /**credit: https://discuss.leetcode.com/topic/8090/9-line-accepted-java-code-without-the-need-of-handling-overflow + /*credit: https://discuss.leetcode.com/topic/8090/9-line-accepted-java-code-without-the-need-of-handling-overflow * reversing only half and then compare if they're equal.*/ public static class Solution1 { public boolean isPalindrome(int x) { @@ -22,5 +22,4 @@ public boolean isPalindrome(int x) { return (x == reversed || x == reversed / 10); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_90.java b/src/main/java/com/fishercoder/solutions/firstthousand/_90.java index 1bc93a1776..031658a3ae 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_90.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_90.java @@ -65,7 +65,8 @@ public List> subsetsWithDup(int[] nums) { return result; } - private void backtracking(int[] nums, int start, List> result, List list) { + private void backtracking( + int[] nums, int start, List> result, List list) { for (int i = start; i < nums.length; i++) { if (i > start && nums[i] == nums[i - 1]) { continue; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_900.java b/src/main/java/com/fishercoder/solutions/firstthousand/_900.java index ab4c7e3507..2c1fba7a02 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_900.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_900.java @@ -31,7 +31,6 @@ public int next(int n) { } return lastElement; } - } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_901.java b/src/main/java/com/fishercoder/solutions/firstthousand/_901.java index 47491999e8..0cebda0e45 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_901.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_901.java @@ -16,7 +16,7 @@ public int next(int price) { while (!stack.isEmpty() && stack.peek()[0] <= price) { result += stack.pop()[1]; } - stack.push(new int[]{price, result}); + stack.push(new int[] {price, result}); return result; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_904.java b/src/main/java/com/fishercoder/solutions/firstthousand/_904.java index 5bd2c3b7c5..de833cfc6b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_904.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_904.java @@ -5,7 +5,7 @@ public class _904 { public static class Solution1 { - /** + /* * This is a two-pointer solution, a.k.a sliding window */ public int totalFruit(int[] fruits) { @@ -14,9 +14,10 @@ public int totalFruit(int[] fruits) { int startIndex = 0; for (int i = 0; i < fruits.length; i++) { if (set.size() < 2 || set.contains(fruits[i])) { - //either one of the two cases, we keep adding fruits[i] into the set and expand i to the right + // either one of the two cases, we keep adding fruits[i] into the set and expand + // i to the right } else { - //in other cases, we know there's a 3rd type of fruit we just encountered, + // in other cases, we know there's a 3rd type of fruit we just encountered, // so keep the 2nd type of fruit as lastOne, go backwards, // find the first 1st type of fruit as j, set startIndex = j + 1, // remove the 1st type of fruit from the set and break diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_91.java b/src/main/java/com/fishercoder/solutions/firstthousand/_91.java index 349e539340..a2aa585a4b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_91.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_91.java @@ -4,7 +4,7 @@ import java.util.Map; public class _91 { - /** + /* * Credit: https://discuss.leetcode.com/topic/35840/java-clean-dp-solution-with-explanation * I used a dp array of size n + 1 to save subproblem solutions. * dp[0] means an empty string will have one way to decode, @@ -36,7 +36,7 @@ public int numDecodings(String s) { } public static class Solution2 { - /**credit: https://leetcode.com/problems/decode-ways/solution/ + /*credit: https://leetcode.com/problems/decode-ways/solution/ * Approach 1: Recursive Approach with Memoization * * The actual code goes from the right most character to the left side to build out the dp cache map. @@ -52,11 +52,11 @@ private int dp(Map cache, String s, int index) { return cache.get(index); } if (index == s.length()) { - //this means we reached the end of the string, so return 1 as success + // this means we reached the end of the string, so return 1 as success return 1; } if (s.charAt(index) == '0') { - //this means this string cannot be decoded + // this means this string cannot be decoded return 0; } if (index == s.length() - 1) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_912.java b/src/main/java/com/fishercoder/solutions/firstthousand/_912.java index 1fdd0900b0..43b60a2644 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_912.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_912.java @@ -2,17 +2,18 @@ public class _912 { public static class Solution1 { - /** + /* * Implementation of MergeSort which is a stable sort, unlike QuickSort which isn't. */ public int[] sortArray(int[] nums) { - //use a helper function to take in two additional parameters for the ease of recursion + // use a helper function to take in two additional parameters for the ease of recursion return sort(nums, 0, nums.length - 1); } - //this is the recursive function + // this is the recursive function private int[] sort(int[] nums, int left, int right) { - //this condition keeps dividing the array until nums becomes one individual item and then it goes back to the call stack + // this condition keeps dividing the array until nums becomes one individual item and + // then it goes back to the call stack if (left < right) { int mid = left + (right - left) / 2; sort(nums, left, mid); @@ -25,20 +26,22 @@ private int[] sort(int[] nums, int left, int right) { private void merge(int[] nums, int left, int mid, int right) { int leftSize = mid - left + 1; int rightSize = right - mid; - //use two temp array to copy the original values in the input before we overwrite them + // use two temp array to copy the original values in the input before we overwrite them int[] leftHalf = new int[leftSize]; int[] rightHalf = new int[rightSize]; for (int i = 0; i < leftSize; i++) { - //this index is key: it should be nums[left + i] as it should start from left instead of zero + // this index is key: it should be nums[left + i] as it should start from left + // instead of zero leftHalf[i] = nums[left + i]; } for (int i = 0; i < rightSize; i++) { - //similarly, this index is key as well: it should be nums[mid + i + 1] instead of starting from zero + // similarly, this index is key as well: it should be nums[mid + i + 1] instead of + // starting from zero rightHalf[i] = nums[mid + i + 1]; } int i = 0; int j = 0; - //again, this index k = left is key, it should start from left instead of 0 + // again, this index k = left is key, it should start from left instead of 0 int k = left; while (i < leftSize && j < rightSize) { if (leftHalf[i] < rightHalf[j]) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_914.java b/src/main/java/com/fishercoder/solutions/firstthousand/_914.java index 093c4717db..bcecebb55e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_914.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_914.java @@ -6,12 +6,12 @@ public class _914 { public static class Solution1 { public boolean hasGroupsSizeX(int[] deck) { - //Size too small for partitions + // Size too small for partitions if (deck.length < 2) { return false; } - //Track repetitions of values in deck array + // Track repetitions of values in deck array Map mapReps = new HashMap<>(); for (int card : deck) { if (!mapReps.containsKey(card)) { @@ -21,17 +21,17 @@ public boolean hasGroupsSizeX(int[] deck) { } } - //Create array of map values + // Create array of map values int num = 0; int[] arrReps = new int[mapReps.size()]; for (Map.Entry e : mapReps.entrySet()) { arrReps[num++] = e.getValue(); } - //Find greatest common denominator + // Find greatest common denominator num = arrGCD(arrReps, arrReps.length); - //If gcd of all repetitions is greater than 1, it's partitionable. + // If gcd of all repetitions is greater than 1, it's partitionable. return num > 1; } @@ -48,4 +48,4 @@ private int arrGCD(int[] arr, int n) { return result; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_918.java b/src/main/java/com/fishercoder/solutions/firstthousand/_918.java index c26356950a..1c8c247089 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_918.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_918.java @@ -2,7 +2,7 @@ public class _918 { public static class Solution1 { - /** + /* * This is my original solution, but results in TLE on LeetCode. * Time: O(n^2) */ @@ -25,7 +25,7 @@ public int maxSubarraySumCircular(int[] nums) { } public static class Solution2 { - /** + /* * Credit: https://leetcode.com/problems/maximum-sum-circular-subarray/discuss/178422/One-Pass * Think of two cases: * 1. the max comes from the contiguous part of the original array @@ -54,7 +54,7 @@ public int maxSubarraySumCircular(int[] nums) { } public static class Solution3 { - /** + /* * Credit: https://leetcode.com/problems/maximum-sum-circular-subarray/discuss/633058/Java-or-C%2B%2B-or-Python3-or-With-detailed-explanation-or-O(N)-time-or-O(1) * This one is similar to the above Solution2, but only slightly differs in that it starts from i = 1 instead of i = 0 * And it listed out a few examples to help illustrate why this algorithm makes sense. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_919.java b/src/main/java/com/fishercoder/solutions/firstthousand/_919.java index 5fa6966451..9d18f99b5c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_919.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_919.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.LinkedList; import java.util.Map; @@ -9,7 +8,7 @@ public class _919 { public static class Solution1 { - /** + /* * My completely original solution. * Beats 98.11% submissions. */ diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_92.java b/src/main/java/com/fishercoder/solutions/firstthousand/_92.java index 3aac9e380a..672aadc031 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_92.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_92.java @@ -5,7 +5,7 @@ public class _92 { public static class Solution1 { - /** + /* * credit: https://discuss.leetcode.com/topic/8976/simple-java-solution-with-clear-explanation */ public ListNode reverseBetween(ListNode head, int m, int n) { @@ -18,15 +18,19 @@ public ListNode reverseBetween(ListNode head, int m, int n) { pre = pre.next; } - ListNode start = pre.next;// start is the node prior to reversing, in the given example, + ListNode start = + pre.next; // start is the node prior to reversing, in the given example, // start is node with value 1 - ListNode then = start.next;// then is the node that we'll start to reverse, in the given + ListNode then = + start.next; // then is the node that we'll start to reverse, in the given // example, it's 2 for (int i = 0; i < n - m; i++) { - // pay special attention to this for loop, it's assigning then.next to start.next, it + // pay special attention to this for loop, it's assigning then.next to start.next, + // it // didn't initialize a new node - // this does exactly what I desired to do, but I just didn't figure out how to implement + // this does exactly what I desired to do, but I just didn't figure out how to + // implement // it, thumbs up to the OP! start.next = then.next; then.next = pre.next; @@ -38,7 +42,7 @@ public ListNode reverseBetween(ListNode head, int m, int n) { } public static class Solution2 { - /** + /* * My completely original solution on 10/25/2021. */ public ListNode reverseBetween(ListNode head, int left, int right) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_922.java b/src/main/java/com/fishercoder/solutions/firstthousand/_922.java index 5bb4fecf81..bf4aa491e8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_922.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_922.java @@ -5,7 +5,7 @@ public class _922 { public static class Solution1 { - /** + /* * Space: O(n) * Time: O(n) */ @@ -33,7 +33,7 @@ public int[] sortArrayByParityII(int[] nums) { } public static class Solution2 { - /** + /* * Space: O(1) * Time: O(n^2) */ @@ -64,7 +64,7 @@ public int[] sortArrayByParityII(int[] nums) { } public static class Solution3 { - /** + /* * This is the most efficient solution: one implicit condition is that: * we start with index zero for i, so we look for nums[i] that is not an even number to be swapped with; * we start with index one for j, so we look for nums[j] that is not an odd number to be swapped with. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_925.java b/src/main/java/com/fishercoder/solutions/firstthousand/_925.java index 76c58bf298..d16c2be76d 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_925.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_925.java @@ -15,7 +15,6 @@ public boolean isLongPressedName(String name, String typed) { } else { j++; } - } return i == name.length(); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_934.java b/src/main/java/com/fishercoder/solutions/firstthousand/_934.java index ff4b1f0278..dbe31578e1 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_934.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_934.java @@ -5,7 +5,7 @@ public class _934 { public static class Solution1 { - /** + /* * Time: O(m*n) * Space: O(m*n) */ @@ -17,10 +17,13 @@ public int shortestBridge(int[][] grid) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 1) { - q1.offer(new int[]{i, j}); - q2.offer(new int[]{i, j}); - grid[i][j] = 2;//we mark this one as 2 and all its connected islands to be 2 as well using BFS below - //once we find the first land, we break and start BFS to find all remaining lands that are connected to this one as island A + q1.offer(new int[] {i, j}); + q2.offer(new int[] {i, j}); + grid[i][j] = + 2; // we mark this one as 2 and all its connected islands to be 2 as + // well using BFS below + // once we find the first land, we break and start BFS to find all remaining + // lands that are connected to this one as island A break; } } @@ -28,7 +31,7 @@ public int shortestBridge(int[][] grid) { break; } } - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; while (!q1.isEmpty()) { int size = q1.size(); for (int i = 0; i < size; i++) { @@ -36,16 +39,21 @@ public int shortestBridge(int[][] grid) { for (int j = 0; j < dirs.length - 1; j++) { int nextx = curr[0] + dirs[j]; int nexty = curr[1] + dirs[j + 1]; - if (nextx >= 0 && nextx < m && nexty >= 0 && nexty < n && grid[nextx][nexty] == 1) { + if (nextx >= 0 + && nextx < m + && nexty >= 0 + && nexty < n + && grid[nextx][nexty] == 1) { grid[nextx][nexty] = 2; - q1.offer(new int[]{nextx, nexty}); - q2.offer(new int[]{nextx, nexty}); + q1.offer(new int[] {nextx, nexty}); + q2.offer(new int[] {nextx, nexty}); } } } } - //now with the above BFS done, we've discovered all island lands that should be island A - //then we go through q2 to check for shortest distance to island B + // now with the above BFS done, we've discovered all island lands that should be island + // A + // then we go through q2 to check for shortest distance to island B int distance = 0; while (!q2.isEmpty()) { int size = q2.size(); @@ -58,8 +66,10 @@ public int shortestBridge(int[][] grid) { if (grid[nextx][nexty] == 1) { return distance; } else if (grid[nextx][nexty] == 0) { - q2.offer(new int[]{nextx, nexty}); - grid[nextx][nexty] = -1;//this is important to mark it as visited, otherwise we'll go into infinite loop and TLE + q2.offer(new int[] {nextx, nexty}); + grid[nextx][nexty] = + -1; // this is important to mark it as visited, otherwise + // we'll go into infinite loop and TLE } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_935.java b/src/main/java/com/fishercoder/solutions/firstthousand/_935.java index 27ff79afab..9c47c666dc 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_935.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_935.java @@ -20,15 +20,22 @@ public static class Solution1 { // whereFromHere[i] is an array of keys that can be reached from the ith digit private static final int[][] whereFromHere = { - {4, 6}, {6, 8}, {7, 9}, {4, 8}, // 0, 1, 2, 3 - {3, 9, 0}, {}, {1, 7, 0}, // 4, 5, 6 - {2, 6}, {1, 3}, {2, 4} // 7, 8, 9 + {4, 6}, + {6, 8}, + {7, 9}, + {4, 8}, // 0, 1, 2, 3 + {3, 9, 0}, + {}, + {1, 7, 0}, // 4, 5, 6 + {2, 6}, + {1, 3}, + {2, 4} // 7, 8, 9 }; public int knightDialer(int N) { // a[i] is the number of ways we can end up on the ith digit // The initial array is for N = 1, i.e. for 0 hops. - long[] a = new long[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + long[] a = new long[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // Simulate N - 1 hops for (int i = 0; i < N - 1; ++i) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_936.java b/src/main/java/com/fishercoder/solutions/firstthousand/_936.java index 3a027bcd92..1743542a80 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_936.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_936.java @@ -5,7 +5,7 @@ public class _936 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/stamping-the-sequence/discuss/201546/12ms-Java-Solution-Beats-100 *

* Think reversely! diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_938.java b/src/main/java/com/fishercoder/solutions/firstthousand/_938.java index 3df0e85fa5..55a9ad3400 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_938.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_938.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_94.java b/src/main/java/com/fishercoder/solutions/firstthousand/_94.java index 51cf988e4c..c0a71832cd 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_94.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_94.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -24,7 +23,7 @@ List inorder(TreeNode root, List result) { } public static class Solution2 { - //iterative approach + // iterative approach public List inorderTraversal(TreeNode root) { List result = new ArrayList(); Stack stack = new Stack(); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_95.java b/src/main/java/com/fishercoder/solutions/firstthousand/_95.java index f1d2c79a08..3ae7cee755 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_95.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_95.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_951.java b/src/main/java/com/fishercoder/solutions/firstthousand/_951.java index abea84e97c..5a45c8b75e 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_951.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_951.java @@ -16,10 +16,8 @@ public boolean flipEquiv(TreeNode root1, TreeNode root2) { return false; } - return ( - (flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right)) - || (flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left)) - ); + return ((flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right)) + || (flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left))); } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_953.java b/src/main/java/com/fishercoder/solutions/firstthousand/_953.java index b94b570fc1..2fed2f046b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_953.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_953.java @@ -37,28 +37,30 @@ private boolean sorted(String firstWord, String secondWord, Map { - int pos1 = 0; - int pos2 = 0; - for (int i = 0; i < Math.min(o1.length(), o2.length()); i++) { - pos1 = order.indexOf(o1.charAt(i)); - pos2 = order.indexOf(o2.charAt(i)); - if (pos1 != pos2) { - break; - } - } + Arrays.sort( + words, + (o1, o2) -> { + int pos1 = 0; + int pos2 = 0; + for (int i = 0; i < Math.min(o1.length(), o2.length()); i++) { + pos1 = order.indexOf(o1.charAt(i)); + pos2 = order.indexOf(o2.charAt(i)); + if (pos1 != pos2) { + break; + } + } - if (pos1 == pos2 && o1.length() != o2.length()) { - return o1.length() - o2.length(); - } + if (pos1 == pos2 && o1.length() != o2.length()) { + return o1.length() - o2.length(); + } - return pos1 - pos2; - }); + return pos1 - pos2; + }); for (int i = 0; i < words.length; i++) { if (!copy[i].equals(words[i])) { return false; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_954.java b/src/main/java/com/fishercoder/solutions/firstthousand/_954.java index 072cad78c3..c8e2af4e15 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_954.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_954.java @@ -7,7 +7,7 @@ public class _954 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/array-of-doubled-pairs/solution/ */ public boolean canReorderDoubled(int[] A) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_957.java b/src/main/java/com/fishercoder/solutions/firstthousand/_957.java index da093b073a..106d3c4b2a 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_957.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_957.java @@ -43,4 +43,4 @@ private int[] getNextDay(int[] cells) { return nextDay; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_958.java b/src/main/java/com/fishercoder/solutions/firstthousand/_958.java index 9f55478f46..d9a4ee6c3b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_958.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_958.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_97.java b/src/main/java/com/fishercoder/solutions/firstthousand/_97.java index de284550a0..34353dcfee 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_97.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_97.java @@ -17,9 +17,12 @@ public boolean isInterleave(String s1, String s2, String s3) { if (s1.charAt(i) == s3.charAt(i)) { dp[i + 1][0] = true; } else { - //if one char fails, that means it breaks, the rest of the chars won't matter any more. - //Mian and I found one missing test case on Lintcode: ["b", "aabccc", "aabbbcb"] - //if we don't break, here, Lintcode could still accept this code, but Leetcode fails it. + // if one char fails, that means it breaks, the rest of the chars won't matter + // any more. + // Mian and I found one missing test case on Lintcode: ["b", "aabccc", + // "aabbbcb"] + // if we don't break, here, Lintcode could still accept this code, but Leetcode + // fails it. break; } } @@ -35,8 +38,9 @@ public boolean isInterleave(String s1, String s2, String s3) { for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { int k = i + j - 1; - dp[i][j] = (s1.charAt(i - 1) == s3.charAt(k) && dp[i - 1][j]) - || (s2.charAt(j - 1) == s3.charAt(k) && dp[i][j - 1]); + dp[i][j] = + (s1.charAt(i - 1) == s3.charAt(k) && dp[i - 1][j]) + || (s2.charAt(j - 1) == s3.charAt(k) && dp[i][j - 1]); } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_970.java b/src/main/java/com/fishercoder/solutions/firstthousand/_970.java index b217f23cf8..a22f15de78 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_970.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_970.java @@ -31,7 +31,7 @@ public List powerfulIntegers(int x, int y, int bound) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/powerful-integers/discuss/214212/JavaC%2B%2BPython-Brute-Force */ public List powerfulIntegers(int x, int y, int bound) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_973.java b/src/main/java/com/fishercoder/solutions/firstthousand/_973.java index 38c85bf27d..4c96ae2ed4 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_973.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_973.java @@ -8,18 +8,20 @@ public static class Solution1 { public int[][] kClosest(int[][] points, int k) { int[][] ans = new int[k][2]; - PriorityQueue pq = new PriorityQueue<>((o1, o2) -> { - double dist1 = getDistance(o1); - double dist2 = getDistance(o2); + PriorityQueue pq = + new PriorityQueue<>( + (o1, o2) -> { + double dist1 = getDistance(o1); + double dist2 = getDistance(o2); - if (dist1 > dist2) { - return 1; - } else if (dist1 < dist2) { - return -1; - } else { - return 0; - } - }); + if (dist1 > dist2) { + return 1; + } else if (dist1 < dist2) { + return -1; + } else { + return 0; + } + }); for (int[] point : points) { pq.add(point); @@ -39,7 +41,9 @@ private double getDistance(int[] point) { public static class Solution2 { public int[][] kClosest(int[][] points, int k) { - PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> (b[0] * b[0] + b[1] * b[1]) - (a[0] * a[0] + a[1] * a[1])); + PriorityQueue maxHeap = + new PriorityQueue<>( + (a, b) -> (b[0] * b[0] + b[1] * b[1]) - (a[0] * a[0] + a[1] * a[1])); for (int[] point : points) { long distance = (long) point[0] * point[0] + point[1] * point[1]; if (maxHeap.size() < k) { @@ -48,7 +52,7 @@ public int[][] kClosest(int[][] points, int k) { int[] peek = maxHeap.peek(); long peekedDistance = (long) peek[0] * peek[0] + peek[1] * peek[1]; if (peekedDistance > distance) { - //this is an optimization so that the space complexity is limited to O(k) + // this is an optimization so that the space complexity is limited to O(k) maxHeap.poll(); maxHeap.offer(point); } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_977.java b/src/main/java/com/fishercoder/solutions/firstthousand/_977.java index 7559b6f503..f68fd56ac8 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_977.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_977.java @@ -4,7 +4,7 @@ public class _977 { public static class Solution1 { - /** + /* * O(nlogn) solution */ public int[] sortedSquares(int[] nums) { @@ -18,12 +18,14 @@ public int[] sortedSquares(int[] nums) { } public static class Solution2 { - /** + /* * O(n) solution */ public int[] sortedSquares(int[] nums) { int[] ans = new int[nums.length]; - for (int i = nums.length - 1, left = 0, right = nums.length - 1; i < nums.length && left <= right; i--) { + for (int i = nums.length - 1, left = 0, right = nums.length - 1; + i < nums.length && left <= right; + i--) { if (Math.abs(nums[left]) < Math.abs(nums[right])) { ans[i] = nums[right] * nums[right]; right--; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_979.java b/src/main/java/com/fishercoder/solutions/firstthousand/_979.java index 919a76aba1..0ce650bbd5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_979.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_979.java @@ -4,7 +4,7 @@ public class _979 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/distribute-coins-in-binary-tree/discuss/221930/JavaC%2B%2BPython-Recursive-Solution */ int moves = 0; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_98.java b/src/main/java/com/fishercoder/solutions/firstthousand/_98.java index 2f7a9c8bfd..e9c8c7f2e7 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_98.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_98.java @@ -20,5 +20,4 @@ boolean valid(TreeNode root, Integer min, Integer max) { return valid(root.left, min, root.val) && valid(root.right, root.val, max); } } - } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_980.java b/src/main/java/com/fishercoder/solutions/firstthousand/_980.java index cf466d4441..8b60e62622 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_980.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_980.java @@ -3,7 +3,7 @@ public class _980 { public static class Solution1 { - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; int paths = 0; public int uniquePathsIII(int[][] grid) { @@ -19,7 +19,12 @@ private int backtracking(int[][] grid, int m, int n, boolean[][] visited, int[] for (int i = 0; i < directions.length - 1; i++) { int nextX = directions[i] + start[0]; int nextY = directions[i + 1] + start[1]; - if (nextX >= 0 && nextX < m && nextY >= 0 && nextY < n && grid[nextX][nextY] != -1 && !visited[nextX][nextY]) { + if (nextX >= 0 + && nextX < m + && nextY >= 0 + && nextY < n + && grid[nextX][nextY] != -1 + && !visited[nextX][nextY]) { if (grid[nextX][nextY] == 2) { if (allZeroesVisited(visited, grid)) { paths++; @@ -29,7 +34,7 @@ private int backtracking(int[][] grid, int m, int n, boolean[][] visited, int[] } } visited[nextX][nextY] = true; - backtracking(grid, m, n, visited, new int[]{nextX, nextY}); + backtracking(grid, m, n, visited, new int[] {nextX, nextY}); visited[nextX][nextY] = false; } } @@ -51,7 +56,7 @@ private int[] findStart(int[][] grid) { for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { if (grid[i][j] == 1) { - return new int[]{i, j}; + return new int[] {i, j}; } } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_981.java b/src/main/java/com/fishercoder/solutions/firstthousand/_981.java index 476b6702ee..0f122afc52 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_981.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_981.java @@ -11,7 +11,7 @@ public static class TimeMap { Map> map; - /** + /* * Initialize your data structure here. */ public TimeMap() { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_985.java b/src/main/java/com/fishercoder/solutions/firstthousand/_985.java index cccdda581d..6515895d3b 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_985.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_985.java @@ -3,7 +3,7 @@ import java.util.Arrays; public class _985 { - + public static class Solution1 { public int[] sumEvenAfterQueries(int[] A, int[][] queries) { diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_986.java b/src/main/java/com/fishercoder/solutions/firstthousand/_986.java index 7985df9b5f..2a975981c2 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_986.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_986.java @@ -13,7 +13,7 @@ public int[][] intervalIntersection(int[][] firstList, int[][] secondList) { int start = Math.max(firstList[i][0], secondList[j][0]); int end = Math.min(firstList[i][1], secondList[j][1]); if (start <= end) { - list.add(new int[]{start, end}); + list.add(new int[] {start, end}); } if (end == firstList[i][1]) { i++; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_987.java b/src/main/java/com/fishercoder/solutions/firstthousand/_987.java index 48cbfc5999..6a3b436e17 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_987.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_987.java @@ -1,12 +1,11 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.*; public class _987 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/discuss/231148/Java-TreeMap-Solution */ public List> verticalTraversal(TreeNode root) { @@ -24,7 +23,11 @@ public List> verticalTraversal(TreeNode root) { return list; } - private void dfs(TreeNode root, int x, int y, TreeMap>> map) { + private void dfs( + TreeNode root, + int x, + int y, + TreeMap>> map) { if (root == null) { return; } @@ -42,7 +45,7 @@ private void dfs(TreeNode root, int x, int y, TreeMap> verticalTraversal(TreeNode root) { @@ -69,15 +72,17 @@ public List> verticalTraversal(TreeNode root) { List> result = new ArrayList<>(); for (Integer key : map.keySet()) { List list = map.get(key); - Collections.sort(list, (a, b) -> { - if (a.row != b.row) { - return a.row - b.row; - } else if (a.col != b.col) { - return a.col - b.col; - } else { - return a.node.val - b.node.val; - } - }); + Collections.sort( + list, + (a, b) -> { + if (a.row != b.row) { + return a.row - b.row; + } else if (a.col != b.col) { + return a.col - b.col; + } else { + return a.node.val - b.node.val; + } + }); List intList = new ArrayList<>(); for (NodeWithCoords nodeWithCoords : list) { intList.add(nodeWithCoords.node.val); diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_988.java b/src/main/java/com/fishercoder/solutions/firstthousand/_988.java index 67eb69756b..2c8030696f 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_988.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_988.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -54,7 +53,8 @@ private String findSmallest(List paths) { return reversed.get(0); } - private void dfs(TreeNode root, String path, List paths, Map map) { + private void dfs( + TreeNode root, String path, List paths, Map map) { if (root == null) { return; } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_99.java b/src/main/java/com/fishercoder/solutions/firstthousand/_99.java index 97c6bd3eb1..a980eaa720 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_99.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_99.java @@ -12,7 +12,7 @@ public static class Solution1 { public void recoverTree(TreeNode root) { traverseTree(root); - //swap the two elements + // swap the two elements int temp = firstElement.val; firstElement.val = secondElement.val; secondElement.val = temp; @@ -25,8 +25,10 @@ private void traverseTree(TreeNode root) { traverseTree(root.left); - //prevElement means the one previous to the current root, refer to in-order traversal, previous element must be smaller than the current root - //if it's bigger, then we find the first element, thus we store it in the variable called firstElement + // prevElement means the one previous to the current root, refer to in-order traversal, + // previous element must be smaller than the current root + // if it's bigger, then we find the first element, thus we store it in the variable + // called firstElement if (firstElement == null && prevElement.val >= root.val) { firstElement = prevElement; } @@ -35,12 +37,12 @@ private void traverseTree(TreeNode root) { secondElement = root; } - //this is the last step in the "do some business logic", so we'll always to have update the previous node to be the current root before it traverses the right subtree - //since the current root will be the new previous node for the right subtree. + // this is the last step in the "do some business logic", so we'll always to have update + // the previous node to be the current root before it traverses the right subtree + // since the current root will be the new previous node for the right subtree. prevElement = root; traverseTree(root.right); } - } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_993.java b/src/main/java/com/fishercoder/solutions/firstthousand/_993.java index 7e9cf75159..259bf97249 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_993.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_993.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.firstthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -67,7 +66,9 @@ public boolean isCousins(TreeNode root, int x, int y) { childToParentMap.put(curr.right.val, curr.val); } } - if (childToParentMap.containsKey(x) && childToParentMap.containsKey(y) && childToParentMap.get(x) != childToParentMap.get(y)) { + if (childToParentMap.containsKey(x) + && childToParentMap.containsKey(y) + && childToParentMap.get(x) != childToParentMap.get(y)) { return true; } else if (childToParentMap.containsKey(x) || childToParentMap.containsKey(y)) { return false; diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_994.java b/src/main/java/com/fishercoder/solutions/firstthousand/_994.java index b24ff9a726..a9d04deae9 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_994.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_994.java @@ -7,14 +7,14 @@ public class _994 { public static class Solution1 { - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; public int orangesRotting(int[][] grid) { Queue rottens = new LinkedList<>(); for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { if (grid[i][j] == 2) { - rottens.add(new int[]{i, j}); + rottens.add(new int[] {i, j}); } } } @@ -27,13 +27,17 @@ public int orangesRotting(int[][] grid) { for (int i = 0; i < 4; i++) { int x = rotten[0] + directions[i]; int y = rotten[1] + directions[i + 1]; - if (x >= 0 && x < grid.length && y >= 0 && y < grid[0].length && grid[x][y] == 1) { + if (x >= 0 + && x < grid.length + && y >= 0 + && y < grid[0].length + && grid[x][y] == 1) { grid[x][y] = 2; if (!counted) { times++; } counted = true; - rottens.add(new int[]{x, y}); + rottens.add(new int[] {x, y}); } } } @@ -50,7 +54,7 @@ public int orangesRotting(int[][] grid) { } public static class Solution2 { - /** + /* * My completely original solution on 10/11/2021. */ public int orangesRotting(int[][] grid) { @@ -63,12 +67,12 @@ public int orangesRotting(int[][] grid) { if (grid[i][j] == 1) { fresh.add(i * n + j); } else if (grid[i][j] == 2) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); } } } int time = 0; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; while (!queue.isEmpty() && !fresh.isEmpty()) { int size = queue.size(); time++; @@ -77,13 +81,17 @@ public int orangesRotting(int[][] grid) { for (int k = 0; k < directions.length - 1; k++) { int nextX = curr[0] + directions[k]; int nextY = curr[1] + directions[k + 1]; - if (nextX >= 0 && nextX < m && nextY >= 0 && nextY < n && grid[nextX][nextY] == 1) { + if (nextX >= 0 + && nextX < m + && nextY >= 0 + && nextY < n + && grid[nextX][nextY] == 1) { fresh.remove(nextX * n + nextY); if (fresh.isEmpty()) { return time; } grid[nextX][nextY] = 2; - queue.offer(new int[]{nextX, nextY}); + queue.offer(new int[] {nextX, nextY}); } } } @@ -93,7 +101,7 @@ public int orangesRotting(int[][] grid) { } public static class Solution3 { - /** + /* * My original solution on 10/29/2021. */ public int orangesRotting(int[][] grid) { @@ -105,7 +113,7 @@ public int orangesRotting(int[][] grid) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == 2) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); visited[i][j] = true; } else if (grid[i][j] == 1) { freshOranges++; @@ -113,7 +121,7 @@ public int orangesRotting(int[][] grid) { } } int mins = 0; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; while (!queue.isEmpty()) { int size = queue.size(); boolean hasOneToRot = false; @@ -122,11 +130,16 @@ public int orangesRotting(int[][] grid) { for (int j = 0; j < directions.length - 1; j++) { int newx = directions[j] + curr[0]; int newy = directions[j + 1] + curr[1]; - if (newx >= 0 && newx < m && newy >= 0 && newy < n && grid[newx][newy] == 1 && !visited[newx][newy]) { + if (newx >= 0 + && newx < m + && newy >= 0 + && newy < n + && grid[newx][newy] == 1 + && !visited[newx][newy]) { freshOranges--; grid[newx][newy] = 2; visited[newx][newy] = true; - queue.offer(new int[]{newx, newy}); + queue.offer(new int[] {newx, newy}); hasOneToRot = true; } } diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_997.java b/src/main/java/com/fishercoder/solutions/firstthousand/_997.java index bc8197f681..396311856c 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_997.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_997.java @@ -23,7 +23,7 @@ public int findJudge(int n, int[][] trust) { } public static class Solution2 { - /** + /* * Credit: https://leetcode.com/problems/find-the-town-judge/solution/ solution 2 * Also, note: is it possible to have more than one town judges? * No! It's impossible! If it's possible, suppose there are two town judges, then both of them have to be trusted by everyone else which includes the other judge. diff --git a/src/main/java/com/fishercoder/solutions/firstthousand/_999.java b/src/main/java/com/fishercoder/solutions/firstthousand/_999.java index deb05eb824..c4078bbca5 100644 --- a/src/main/java/com/fishercoder/solutions/firstthousand/_999.java +++ b/src/main/java/com/fishercoder/solutions/firstthousand/_999.java @@ -2,7 +2,7 @@ public class _999 { public static class Solution1 { - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; public int numRookCaptures(char[][] board) { int m = board.length; @@ -22,8 +22,10 @@ public int numRookCaptures(char[][] board) { for (int i = 0; i < 4; i++) { int neighborRow = rowR + directions[i]; int neighborCol = colR + directions[i + 1]; - if (neighborRow >= 0 && neighborRow < m - && neighborCol >= 0 && neighborCol < n + if (neighborRow >= 0 + && neighborRow < m + && neighborCol >= 0 + && neighborCol < n && board[neighborRow][neighborCol] != 'B') { if (directions[i] == 0 && directions[i + 1] == 1) { while (neighborCol < n) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3004.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3004.java index fd8aebed4b..b72065466d 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3004.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3004.java @@ -7,7 +7,7 @@ public class _3004 { public static class Solution1 { - /** + /* * My completely original solution. * Practice makes perfect! * Post-order traversal is the way to go since we need to process all children first before processing any particular node. @@ -23,8 +23,9 @@ public ColoredTreeNode(int val, int color) { this.val = val; this.color = color; this.children = new ArrayList<>(); - this.allSubtreeSameColor = true;//initialize to be true until it's built/proven to be false - this.totalChildrenCount = 1;//count itself as its own child + this.allSubtreeSameColor = + true; // initialize to be true until it's built/proven to be false + this.totalChildrenCount = 1; // count itself as its own child } } @@ -46,7 +47,7 @@ private int postOrder(ColoredTreeNode root) { if (root == null) { return 0; } - int totalChildrenCount = 1;//count itself as a child + int totalChildrenCount = 1; // count itself as a child for (ColoredTreeNode child : root.children) { int count = postOrder(child); totalChildrenCount += count; @@ -64,8 +65,12 @@ private int postOrder(ColoredTreeNode root) { private ColoredTreeNode buildTree(int[][] edges, int[] colors) { Map map = new HashMap<>(); for (int i = 0; i < edges.length; i++) { - ColoredTreeNode parent = map.getOrDefault(edges[i][0], new ColoredTreeNode(edges[i][0], colors[edges[i][0]])); - ColoredTreeNode child = map.getOrDefault(edges[i][1], new ColoredTreeNode(edges[i][1], colors[edges[i][1]])); + ColoredTreeNode parent = + map.getOrDefault( + edges[i][0], new ColoredTreeNode(edges[i][0], colors[edges[i][0]])); + ColoredTreeNode child = + map.getOrDefault( + edges[i][1], new ColoredTreeNode(edges[i][1], colors[edges[i][1]])); parent.children.add(child); map.put(edges[i][0], parent); map.put(edges[i][1], child); diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3016.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3016.java index 4ab9953209..88baa0a05f 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3016.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3016.java @@ -11,12 +11,13 @@ public int minimumPushes(String word) { for (char c : word.toCharArray()) { map.put(c, map.getOrDefault(c, 0) + 1); } - PriorityQueue> maxHeap = new PriorityQueue<>((a, b) -> b.getValue() - a.getValue()); + PriorityQueue> maxHeap = + new PriorityQueue<>((a, b) -> b.getValue() - a.getValue()); for (Map.Entry entry : map.entrySet()) { maxHeap.offer(entry); } - int[] possibleSets = new int[]{1, 2, 3, 4}; - int digitsLength = 8;//a total of 8 digits that can be assigned + int[] possibleSets = new int[] {1, 2, 3, 4}; + int digitsLength = 8; // a total of 8 digits that can be assigned Map assigned = new HashMap<>(); for (int j = 0; j < possibleSets.length && !maxHeap.isEmpty(); j++) { for (int i = 0; i < digitsLength && !maxHeap.isEmpty(); i++) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3024.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3024.java index 944bef7ddb..e892849491 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3024.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3024.java @@ -17,7 +17,9 @@ public String triangleType(int[] nums) { } private boolean validTriangle(int[] nums) { - return nums[0] + nums[1] > nums[2] && nums[1] + nums[2] > nums[0] && nums[0] + nums[2] > nums[1]; + return nums[0] + nums[1] > nums[2] + && nums[1] + nums[2] > nums[0] + && nums[0] + nums[2] > nums[1]; } } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3063.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3063.java index e957536054..06f183f572 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3063.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3063.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.fourththousand; import com.fishercoder.common.classes.ListNode; - import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3112.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3112.java index 5fd5d18292..0ca5a2104f 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3112.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3112.java @@ -7,7 +7,7 @@ public class _3112 { public static class Solution1 { - /** + /* * My completely original solution: Dijkstra's algorithm! */ public int[] minimumTime(int n, int[][] edges, int[] disappear) { @@ -16,8 +16,8 @@ public int[] minimumTime(int n, int[][] edges, int[] disappear) { graph[i] = new ArrayList<>(); } for (int[] edge : edges) { - graph[edge[0]].add(new int[]{edge[1], edge[2]}); - graph[edge[1]].add(new int[]{edge[0], edge[2]}); + graph[edge[0]].add(new int[] {edge[1], edge[2]}); + graph[edge[1]].add(new int[] {edge[0], edge[2]}); } int[] ans = new int[n]; int[] shortestTimes = new int[disappear.length]; @@ -25,7 +25,8 @@ public int[] minimumTime(int n, int[][] edges, int[] disappear) { shortestTimes[0] = 0; dijkstra(graph, disappear, shortestTimes); for (int target = 1; target < n; target++) { - if (shortestTimes[target] == Integer.MAX_VALUE || shortestTimes[target] >= disappear[target]) { + if (shortestTimes[target] == Integer.MAX_VALUE + || shortestTimes[target] >= disappear[target]) { ans[target] = -1; } else { ans[target] = shortestTimes[target]; @@ -36,7 +37,7 @@ public int[] minimumTime(int n, int[][] edges, int[] disappear) { private void dijkstra(List[] graph, int[] disappear, int[] shortestTimes) { PriorityQueue q = new PriorityQueue<>((a, b) -> a[1] - b[1]); - q.offer(new int[]{0, 0}); + q.offer(new int[] {0, 0}); while (!q.isEmpty()) { int[] curr = q.poll(); int currNode = curr[0]; @@ -47,9 +48,10 @@ private void dijkstra(List[] graph, int[] disappear, int[] shortestTimes) for (int[] neighbor : graph[currNode]) { int neighborNode = neighbor[0]; int neighborCost = neighbor[1]; - if (neighborCost + currCost < shortestTimes[neighborNode] && neighborCost + currCost < disappear[neighborNode]) { + if (neighborCost + currCost < shortestTimes[neighborNode] + && neighborCost + currCost < disappear[neighborNode]) { shortestTimes[neighborNode] = neighborCost + currCost; - q.offer(new int[]{neighborNode, shortestTimes[neighborNode]}); + q.offer(new int[] {neighborNode, shortestTimes[neighborNode]}); } } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3136.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3136.java index a5f80e9962..c5fdc62b7f 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3136.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3136.java @@ -10,7 +10,8 @@ public boolean isValid(String word) { if (word.length() < 3) { return false; } - Set vowels = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); + Set vowels = + new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); boolean containsVowel = false; boolean containsConsonant = false; for (char c : word.toCharArray()) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3157.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3157.java index 105ab157e8..30ae1265af 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3157.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3157.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.fourththousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; import java.util.TreeMap; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3175.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3175.java index c6bc843d0e..f7a69eeec2 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3175.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3175.java @@ -9,15 +9,16 @@ public int findWinningPlayer(int[] skills, int k) { Deque q = new LinkedList<>(); int highestSkill = 0; for (int i = 0; i < skills.length; i++) { - q.offer(new int[]{i, skills[i], 0}); + q.offer(new int[] {i, skills[i], 0}); highestSkill = Math.max(highestSkill, skills[i]); } int count = 0; while (true) { int[] first = q.pollFirst(); if (first[1] == highestSkill) { - //if the highest skill stands at the head of the queue, then it'll keep standing there - //so it's guaranteed that it'll be the winner + // if the highest skill stands at the head of the queue, then it'll keep + // standing there + // so it's guaranteed that it'll be the winner return first[0]; } int[] second = q.pollFirst(); diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3178.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3178.java index d50965043a..dc3f822044 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3178.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3178.java @@ -3,36 +3,37 @@ public class _3178 { public static class Solution1 { public int numberOfChild(int n, int k) { - //decrement by 1 to make it easier to do math so it becomes o to n - 1 + // decrement by 1 to make it easier to do math so it becomes o to n - 1 n--; int roundTrips = k / n; int remainingSteps = k % n; if (roundTrips % 2 == 0) { - //this means it's forward direction + // this means it's forward direction return remainingSteps; } else { - //this means it's reverse direction + // this means it's reverse direction return n - remainingSteps; } } } public static class Solution2 { - /** + /* * Also, my completely original solution, much more elegant and efficient. */ public int numberOfChild(int n, int k) { - //n - 1 is the number of steps is takes to finish from one end to the other + // n - 1 is the number of steps is takes to finish from one end to the other // 2 * (n - 1) is the whole round trip, so after this, it's back to the starting point - //so we only need to handle the modulo remainder of 2 * (n - 1) + // so we only need to handle the modulo remainder of 2 * (n - 1) k = k % ((n - 1) * 2); if (k < n) { - //in this case, we can directly return k + // in this case, we can directly return k return k; } else { - //in this case, it's in the reverse direction, we deduct the number of steps needed to finish the forward direction first + // in this case, it's in the reverse direction, we deduct the number of steps needed + // to finish the forward direction first k -= n - 1; - //then return the correct child index + // then return the correct child index return n - k - 1; } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3186.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3186.java index e82392bb1f..bf8de241a4 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3186.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3186.java @@ -17,9 +17,10 @@ public long maximumTotalDamage(int[] power) { for (int i = 1; i < sortedList.size(); i++) { int currentPower = sortedList.get(i); long currentDamage = (long) currentPower * treeMap.get(currentPower); - //from i - 1, all the way to the left of this sorted list, check to find the nearest valid power - //using this test case: new int[]{7, 1, 6, 3}, would easily illustrate this idea - //dp[i] holds the maximum possible damage for up to sortedList[i] + // from i - 1, all the way to the left of this sorted list, check to find the + // nearest valid power + // using this test case: new int[]{7, 1, 6, 3}, would easily illustrate this idea + // dp[i] holds the maximum possible damage for up to sortedList[i] int j = i - 1; while (j >= 0 && sortedList.get(j) >= currentPower - 2) { j--; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3189.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3189.java index 09b9514cec..10ad868271 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3189.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3189.java @@ -4,7 +4,7 @@ public class _3189 { public static class Solution1 { - /** + /* * Greedy is the way to go for this problem. */ public int minMoves(int[][] rooks) { @@ -13,13 +13,13 @@ public int minMoves(int[][] rooks) { int moves = 0; for (int i = 0; i < len; i++) { int[] rook = rooks[i]; - //move each rook to row i + // move each rook to row i moves += Math.abs(rook[0] - i); } Arrays.sort(rooks, (a, b) -> a[1] - b[1]); for (int i = 0; i < len; i++) { int[] rook = rooks[i]; - //move each rook to its column i + // move each rook to its column i moves += Math.abs(rook[1] - i); } return moves; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3192.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3192.java index 4d14470ada..b69e9878ea 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3192.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3192.java @@ -2,7 +2,7 @@ public class _3192 { public static class Solution1 { - /** + /* * 1. Go from left to right; * 2. The only way to flip the entire array to be 1s is to change each nums[i] = 0 to nums[i] = 1 whenever we encounter a 0; * 3. if we flip each number twice, it's back to its original number, so we only need to keep track of how many times each number is flipped instead of actually flipping the number; @@ -14,11 +14,14 @@ public int minOperations(int[] nums) { int ops = 0; for (int i = 0; i < nums.length; i++) { if (nums[i] == 0 && ops % 2 == 0) { - //this means after an even number of flipping, this number is (originally) a zero, so we need to flip it and all the numbers to its right + // this means after an even number of flipping, this number is (originally) a + // zero, so we need to flip it and all the numbers to its right ops++; } if (nums[i] == 1 && ops % 2 == 1) { - //this means after an odd number of flipping prior to reaching this number and this number is a one, so it should have been flipped to become a zero, so we need to flip it + // this means after an odd number of flipping prior to reaching this number and + // this number is a one, so it should have been flipped to become a zero, so we + // need to flip it ops++; } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3195.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3195.java index b472375682..66fd61670f 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3195.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3195.java @@ -2,7 +2,7 @@ public class _3195 { public static class Solution1 { - /** + /* * My completely original solution: * 1. project all 1's to each of the four sides; * 2. use four variables to denote four corners diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3196.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3196.java index 04ecac3186..0042aec59d 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3196.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3196.java @@ -2,7 +2,7 @@ public class _3196 { public static class Solution1 { - /** + /* * I knew it's a DP problem, I was close to figuring out the recurrence relationship. *

* Credit: https://leetcode.com/problems/maximize-total-cost-of-alternating-subarrays/solutions/5355138/dynamic-programming-and-space-optimized-beats-100-easy-to-understand/ diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3199.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3199.java index 09b8a41d46..274969f1c9 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3199.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3199.java @@ -19,8 +19,8 @@ public int tripletCount(int[] a, int[] b, int[] c) { private boolean evenSetBits(int num) { int bits = 0; - //this is the idea of calculating hamming weight: - //https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/firstthousand/_191.java#L16_L23 + // this is the idea of calculating hamming weight: + // https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/firstthousand/_191.java#L16_L23 while (num != 0) { bits++; num &= num - 1; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3208.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3208.java index 6959975414..3be269ce96 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3208.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3208.java @@ -2,7 +2,7 @@ public class _3208 { public static class Solution1 { - /** + /* * My completely original solution: * we just keep looking for the possible k alternating groups, if it encounters the same color, then set i to that pointer and restart. */ diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3212.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3212.java index 63661b3d4d..5a172d7948 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3212.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3212.java @@ -2,7 +2,7 @@ public class _3212 { public static class Solution1 { - /** + /* * My completely original solution: (although it could be further optimized.) * use a 3-d array, dp[i][j][0] means the number of x's and dp[i][j][1] means the number of y's startring from (0,0) all the way to (i,j) * then how to compute prefix sum: diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3217.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3217.java index c0d9374106..1ead3cd257 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3217.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3217.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.fourththousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3218.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3218.java index a483397840..88e362100c 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3218.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3218.java @@ -4,7 +4,7 @@ public class _3218 { public static class Solution1 { - /** + /* * My completely original solution. */ public int minimumCost(int m, int n, int[] horizontalCut, int[] verticalCut) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3219.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3219.java index 367ecb3e79..63fda748c3 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3219.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3219.java @@ -4,7 +4,7 @@ public class _3219 { public static class Solution1 { - /** + /* * My completely original solution. */ public long minimumCost(int m, int n, int[] horizontalCut, int[] verticalCut) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3224.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3224.java index 7a9b1c1787..a977a9ed1f 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3224.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3224.java @@ -8,11 +8,11 @@ public class _3224 { public static class Solution1 { - /** + /* * My completely original solution during the contest. */ public int minChanges(int[] nums, int k) { - //compute the frequency of each diff + // compute the frequency of each diff Map map = new HashMap<>(); for (int i = 0; i < nums.length / 2; i++) { int diff = Math.abs(nums[nums.length - i - 1] - nums[i]); @@ -20,18 +20,18 @@ public int minChanges(int[] nums, int k) { } List list = new ArrayList<>(); for (Map.Entry entry : map.entrySet()) { - list.add(new int[]{entry.getKey(), entry.getValue()}); + list.add(new int[] {entry.getKey(), entry.getValue()}); } - //sort them by their frequency + // sort them by their frequency Collections.sort(list, (a, b) -> b[1] - a[1]); List modes = new ArrayList<>(); modes.add(list.get(0)); int i = 1; - //in case there are ties (same frequency, different mode values) + // in case there are ties (same frequency, different mode values) while (i < list.size() && list.get(i)[1] == list.get(0)[1]) { modes.add(list.get(i++)); } - //we'll take the second most frequent mode as well, otherwise, test case 4 won't pass + // we'll take the second most frequent mode as well, otherwise, test case 4 won't pass if (i < list.size()) { modes.add(list.get(i)); } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3228.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3228.java index e9f9aa1b08..c2427332b2 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3228.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3228.java @@ -2,7 +2,7 @@ public class _3228 { public static class Solution1 { - /** + /* * This is literal simulation and swap the 1s and 0s, but ended up in TLE, so you'll have to do better. */ public int maxOperations(String s) { @@ -14,7 +14,8 @@ public int maxOperations(String s) { while (oneIndex < len && arr[oneIndex] == '0') { oneIndex++; } - //now we found the first one, then we'll have to find the last one in case there's a consecutive group of 1's + // now we found the first one, then we'll have to find the last one in case there's a + // consecutive group of 1's int firstOneOccurrence = oneIndex; while (oneIndex < len && zeroIndex < len) { while (oneIndex < len && arr[oneIndex] == '1') { @@ -26,7 +27,8 @@ public int maxOperations(String s) { while (zeroIndex < len && arr[zeroIndex] == '1') { zeroIndex++; } - //likewise, we need to find the last occurrence of 0 in case there's a group of consecutive 0's + // likewise, we need to find the last occurrence of 0 in case there's a group of + // consecutive 0's while (zeroIndex < len && arr[zeroIndex] == '0') { zeroIndex++; } @@ -54,12 +56,12 @@ private int[] swap(char[] arr, int zeroIndex, int oneIndex) { char tmp = arr[zeroIndex]; arr[zeroIndex] = arr[oneIndex]; arr[oneIndex] = tmp; - return new int[]{oneIndex - 1, zeroIndex - 1}; + return new int[] {oneIndex - 1, zeroIndex - 1}; } } public static class Solution2 { - /** + /* * TODO: finish this. */ public int maxOperations(String s) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3232.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3232.java index 8b8207d526..a472167d8a 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3232.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3232.java @@ -5,7 +5,7 @@ public static class Solution1 { public boolean canAliceWin(int[] nums) { int aliceScore = 0; int bobScore = 0; - //alice single digit, bob double digits + // alice single digit, bob double digits for (int num : nums) { if (num > 9) { bobScore += num; @@ -16,7 +16,7 @@ public boolean canAliceWin(int[] nums) { if (aliceScore > bobScore) { return true; } - //now alice double, bob the rest + // now alice double, bob the rest aliceScore = 0; bobScore = 0; for (int num : nums) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3233.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3233.java index 46cea0ac10..00707d1b8c 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3233.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3233.java @@ -4,7 +4,7 @@ public class _3233 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/find-the-count-of-numbers-which-are-not-special/solutions/5546339/sieve-of-eratosthenes/ * In order for a number to be special, it must be a square of a prime number; * so we use sieve algorithm to find all prime numbers up to Math.sqrt(r); @@ -19,17 +19,18 @@ public int nonSpecialCount(int l, int r) { isPrime[1] = false; for (int i = 2; i * i < isPrime.length; i++) { if (isPrime[i]) { - //below for loop is key to construct isPrime[] array: - //we start j from i * i, as long as j is within boundary, we increase j by i each time - //i.e. if i = 2, j starts from 4, then 6, 8, 10, 12 - //if i = 3, j starts from 9, then 12, 15, 18, 21 + // below for loop is key to construct isPrime[] array: + // we start j from i * i, as long as j is within boundary, we increase j by i + // each time + // i.e. if i = 2, j starts from 4, then 6, 8, 10, 12 + // if i = 3, j starts from 9, then 12, 15, 18, 21 for (int j = i * i; j < isPrime.length; j += i) { isPrime[j] = false; } } } - //now count special numbers + // now count special numbers int special = 0; for (int i = Math.max(2, (int) Math.sqrt(l)); i < isPrime.length; i++) { if (isPrime[i]) { @@ -39,11 +40,10 @@ public int nonSpecialCount(int l, int r) { } } } - //total number of numbers in this range + // total number of numbers in this range int totalCount = r - l + 1; - //minus the special ones + // minus the special ones return totalCount - special; } - } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3234.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3234.java index da646cacc5..4d1f5d52d3 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3234.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3234.java @@ -2,7 +2,7 @@ public class _3234 { public static class Solution1 { - /** + /* * Sliding window. * credit: https://leetcode.com/problems/count-the-number-of-substrings-with-dominant-ones/solutions/5547005/sliding-window-java-o-sqrt-of-n-n/ * The idea is: @@ -14,16 +14,18 @@ public int numberOfSubstrings(String s) { for (int zeroes = 0; zeroes * zeroes < s.length(); zeroes++) { int[] count = new int[2]; int lastPos = -1; - //end keeps moving to the right in each iteration + // end keeps moving to the right in each iteration for (int start = 0, end = 0; end < s.length(); end++) { count[s.charAt(end) - '0']++; while (start < end) { if (s.charAt(start) == '0' && count[0] > zeroes) { - //this means we have more zeroes than we want, so we'll move start to the right by one + // this means we have more zeroes than we want, so we'll move start to + // the right by one count[0]--; lastPos = start; } else if (s.charAt(start) == '1' && (count[1] - 1) >= (zeroes * zeroes)) { - //this means the current start position is '1' and after excluding it, the window is still a valid dominant one + // this means the current start position is '1' and after excluding it, + // the window is still a valid dominant one count[1]--; } else { break; diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3237.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3237.java index 6c7e1c69c0..49975f0ae4 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3237.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3237.java @@ -5,7 +5,7 @@ public class _3237 { public static class Solution1 { - /** + /* * My completely original solution, very natural to think of doubly linked list + hashmap. * Whenever a window is chosen (iterating on in the queries array), that window will be put onto the head of the list, * all other windows will be pushed to the right by one position. @@ -29,18 +29,20 @@ private int[] backToArray(DoublyLinkedListNode pre, int length) { return ans; } - private void moveToHead(int q, DoublyLinkedListNode headPrev, Map map) { + private void moveToHead( + int q, DoublyLinkedListNode headPrev, Map map) { DoublyLinkedListNode node = map.get(q); - //if this window is already at the head, then we don't need to do anything + // if this window is already at the head, then we don't need to do anything if (headPrev.next == node) { return; } - //get this node's next and prev pointers + // get this node's next and prev pointers DoublyLinkedListNode next = node.next; DoublyLinkedListNode prev = node.prev; - //connect it's next to its previous' next, essentially cutting the current node out of the chain + // connect it's next to its previous' next, essentially cutting the current node out of + // the chain prev.next = next; - //in case this is tail, we don't need to re-assign its next pointer + // in case this is tail, we don't need to re-assign its next pointer if (next != null) { next.prev = prev; } @@ -50,7 +52,8 @@ private void moveToHead(int q, DoublyLinkedListNode headPrev, Map map) { + private DoublyLinkedListNode buildList( + int[] windows, Map map) { DoublyLinkedListNode pre = new DoublyLinkedListNode(-1); DoublyLinkedListNode tmp = pre; for (int i = 0; i < windows.length; i++) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3239.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3239.java index f08bc52702..c927608166 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3239.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3239.java @@ -6,7 +6,7 @@ public int minFlips(int[][] grid) { int m = grid.length; int n = grid[0].length; int ans = m * n; - //try rows first + // try rows first int flips = 0; for (int i = 0; i < m; i++) { for (int left = 0, right = n - 1; left < right; left++, right--) { @@ -17,7 +17,7 @@ public int minFlips(int[][] grid) { } ans = Math.min(ans, flips); flips = 0; - //try columns now + // try columns now for (int j = 0; j < n; j++) { for (int top = 0, bottom = m - 1; top < bottom; top++, bottom--) { if (grid[top][j] != grid[bottom][j]) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3240.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3240.java index 0306460ca4..9d9b414e63 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3240.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3240.java @@ -2,7 +2,7 @@ public class _3240 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/minimum-number-of-flips-to-make-binary-grid-palindromic-ii/solutions/5580937/java-o-m-n/ */ public int minFlips(int[][] grid) { @@ -22,7 +22,7 @@ public int minFlips(int[][] grid) { int diff = 0; int p0 = 0; int p1 = 0; - //process if there's odd number of rows + // process if there's odd number of rows if (m % 2 == 1) { for (int j = 0; j < n / 2; j++) { if (grid[m / 2][j] != grid[m / 2][n - j - 1]) { @@ -36,7 +36,7 @@ public int minFlips(int[][] grid) { } } } - //process if there's odd number of columns + // process if there's odd number of columns if (n % 2 == 1) { for (int i = 0; i < m / 2; i++) { if (grid[i][n / 2] != grid[m - i - 1][n / 2]) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3241.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3241.java index a4e1e81e29..b7c8bd10ba 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3241.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3241.java @@ -7,7 +7,7 @@ public class _3241 { public static class Solution1 { - /** + /* * This is my original solution during the contest, it's correct but not efficient enough, so got TLE on LeetCode. * TODO: figure out a more efficient approach. */ @@ -29,7 +29,7 @@ public int[] timeTaken(int[][] edges) { private int markAllNodes(List[] graph, int startNode) { PriorityQueue q = new PriorityQueue<>((a, b) -> a[1] - b[1]); - q.offer(new int[]{startNode, 0}); + q.offer(new int[] {startNode, 0}); int[] shortestTime = new int[graph.length]; Arrays.fill(shortestTime, Integer.MAX_VALUE); shortestTime[startNode] = 0; @@ -47,13 +47,13 @@ private int markAllNodes(List[] graph, int startNode) { if (currTime + 2 < shortestTime[neighbor]) { shortestTime[neighbor] = currTime + 2; maxTime = Math.max(maxTime, shortestTime[neighbor]); - q.offer(new int[]{neighbor, shortestTime[neighbor]}); + q.offer(new int[] {neighbor, shortestTime[neighbor]}); } } else { if (currTime + 1 < shortestTime[neighbor]) { shortestTime[neighbor] = currTime + 1; maxTime = Math.max(maxTime, shortestTime[neighbor]); - q.offer(new int[]{neighbor, shortestTime[neighbor]}); + q.offer(new int[] {neighbor, shortestTime[neighbor]}); } } } diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3242.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3242.java index 3065cb3325..c263c79138 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3242.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3242.java @@ -18,13 +18,13 @@ public neighborSum(int[][] grid) { this.map = new HashMap<>(); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { - map.put(grid[i][j], new int[]{i, j}); + map.put(grid[i][j], new int[] {i, j}); } } } public int adjacentSum(int value) { - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; int[] pos = this.map.get(value); int sum = 0; for (int i = 0; i < dirs.length - 1; i++) { @@ -38,12 +38,13 @@ public int adjacentSum(int value) { } public int diagonalSum(int value) { - int[][] dirs = new int[][]{ - {-1, 1}, - {1, 1}, - {1, -1}, - {-1, -1} - }; + int[][] dirs = + new int[][] { + {-1, 1}, + {1, 1}, + {1, -1}, + {-1, -1} + }; int[] pos = this.map.get(value); int sum = 0; for (int[] dir : dirs) { diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3249.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3249.java index c50d2d2fae..6632806861 100644 --- a/src/main/java/com/fishercoder/solutions/fourththousand/_3249.java +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3249.java @@ -7,7 +7,7 @@ public class _3249 { public static class Solution1 { - /** + /* * My completely original solution during the contest. */ class TreeNode { @@ -18,7 +18,7 @@ class TreeNode { public TreeNode(int val) { this.val = val; this.children = new ArrayList<>(); - this.totalChildrenCount = 1;//count itself as its own child + this.totalChildrenCount = 1; // count itself as its own child } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1004.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1004.java index 10fd1f0bc2..b231074a22 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1004.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1004.java @@ -2,7 +2,7 @@ public class _1004 { public static class Solution1 { - /** + /* * Two pointer technique, a.k.a sliding window. */ public int longestOnes(int[] nums, int k) { @@ -13,7 +13,7 @@ public int longestOnes(int[] nums, int k) { k--; } while (k < 0) { - //in this case, we'll move the left pointer to the right + // in this case, we'll move the left pointer to the right if (nums[left] == 0) { k++; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1005.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1005.java index 3f63e63dba..8806176fa7 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1005.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1005.java @@ -5,7 +5,7 @@ public class _1005 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/maximize-sum-of-array-after-k-negations/discuss/252228/A-very-simple-java-solution */ public int largestSumAfterKNegations(int[] A, int K) { @@ -25,7 +25,7 @@ public int largestSumAfterKNegations(int[] A, int K) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/maximize-sum-of-array-after-k-negations/discuss/252254/JavaC%2B%2BPython-Sort */ public int largestSumAfterKNegations(int[] A, int K) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1008.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1008.java index 37be82326b..128e97fd45 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1008.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1008.java @@ -4,7 +4,7 @@ public class _1008 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/discuss/252232/JavaC%2B%2BPython-O(N)-Solution */ int i = 0; @@ -25,7 +25,7 @@ private TreeNode bstFromPreorder(int[] preorder, int bound) { } public static class Solution2 { - /** + /* * I'm happy to have come up with this solution completely on my own on 10/13/2021.Enjoy the beauty of recursion! */ public TreeNode bstFromPreorder(int[] preorder) { @@ -47,6 +47,5 @@ private TreeNode bstFromPreorder(int[] preorder, int start, int end) { root.right = bstFromPreorder(preorder, i, end); return root; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1010.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1010.java index 6b3a12103e..ff23768cf6 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1010.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1010.java @@ -5,7 +5,7 @@ public class _1010 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/discuss/256726/Java-O(n)-code-w-comment-similar-to-Two-Sum *

* Think of Problem 1: Two Sum @@ -27,7 +27,7 @@ public int numPairsDivisibleBy60(int[] time) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60/solution/ */ public int numPairsDivisibleBy60(int[] time) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1018.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1018.java index bed1a0a3ca..8915e98de0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1018.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1018.java @@ -5,7 +5,7 @@ public class _1018 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/binary-prefix-divisible-by-5/discuss/266051/Java-beats-100 */ public List prefixesDivBy5(int[] A) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1022.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1022.java index edbfc82563..2af350c676 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1022.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1022.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1024.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1024.java index 0d694c5924..d1b06aa392 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1024.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1024.java @@ -4,7 +4,7 @@ public class _1024 { public static class Solution1 { - /** + /* * Greedy * Time: O(nlogn) where n is the number of clips * Space: O(1) @@ -26,13 +26,13 @@ public int videoStitching(int[][] clips, int time) { } public static class Solution2 { - /** + /* * DP * Time: ? * Space: ? */ public int videoStitching(int[][] clips, int time) { - //TODO: implement it. + // TODO: implement it. return -1; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1025.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1025.java index b72c6875f0..818857e870 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1025.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1025.java @@ -2,7 +2,7 @@ public class _1025 { public static class Solution1 { - /** + /* * After writing out a few examples, beginning from n = 1, up to n = 5, the logic flows out naturally: * 1. when N deduced to 1, whoever plays now loses because no integers exist between 0 and 1; * 2. when N deduced to 2, whoever plays now wins because he/she will pick one and the next player is left with nothing to play; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1026.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1026.java index c7c25862a3..31da38d4c0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1026.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1026.java @@ -4,7 +4,7 @@ public class _1026 { public static class Solution1 { - /** + /* * My completely original solution on 12/31/2021. */ int maxDiff = 0; @@ -18,9 +18,14 @@ private void dfs(TreeNode root) { if (root == null) { return; } - int[] minmax = new int[]{root.val, root.val}; + int[] minmax = new int[] {root.val, root.val}; findMinMax(root, minmax); - maxDiff = Math.max(maxDiff, Math.max(Math.abs(root.val - minmax[0]), Math.abs(minmax[1] - root.val))); + maxDiff = + Math.max( + maxDiff, + Math.max( + Math.abs(root.val - minmax[0]), + Math.abs(minmax[1] - root.val))); dfs(root.left); dfs(root.right); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1029.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1029.java index 86ac0acc88..d6cec8e531 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1029.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1029.java @@ -4,7 +4,7 @@ public class _1029 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/two-city-scheduling/discuss/280173/Java-4-lines-intuitive-solution * and * https://leetcode.com/problems/two-city-scheduling/discuss/278771/Java-sort-solution diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1030.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1030.java index 0d5a68ad4e..745967c340 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1030.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1030.java @@ -8,7 +8,7 @@ public static class Solution1 { public int[][] allCellsDistOrder(int R, int C, int r0, int c0) { int[][] result = new int[R * C][2]; Queue queue = new LinkedList<>(); - queue.offer(new int[]{r0, c0}); + queue.offer(new int[] {r0, c0}); boolean[][] visited = new boolean[R][C]; int i = 0; while (!queue.isEmpty()) { @@ -21,12 +21,11 @@ public int[][] allCellsDistOrder(int R, int C, int r0, int c0) { } visited[row][col] = true; - result[i++] = new int[]{row, col}; - queue.offer(new int[]{row, col + 1}); - queue.offer(new int[]{row + 1, col}); - queue.offer(new int[]{row - 1, col}); - queue.offer(new int[]{row, col - 1}); - + result[i++] = new int[] {row, col}; + queue.offer(new int[] {row, col + 1}); + queue.offer(new int[] {row + 1, col}); + queue.offer(new int[] {row - 1, col}); + queue.offer(new int[] {row, col - 1}); } return result; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1033.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1033.java index 3e94d9bf14..c6ac8942af 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1033.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1033.java @@ -33,7 +33,7 @@ public int[] numMovesStones(int a, int b, int c) { int min = minMoves(t[0], t[1], t[2]); int max = maxMoves(t[0], t[1], t[2]); - return new int[]{min, max}; + return new int[] {min, max}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1034.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1034.java index 2605358f90..05e45e12cb 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1034.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1034.java @@ -2,17 +2,18 @@ public class _1034 { public static class Solution1 { - /** + /* * My completely original solution. */ - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; public int[][] colorBorder(int[][] grid, int row, int col, int color) { int m = grid.length; int n = grid[0].length; boolean[][] visited = new boolean[m][n]; visited[row][col] = true; - //copy the input as the final output so that we keep the input intact during dfs, otherwise, it'll lead to incorrect result like in test case 3 + // copy the input as the final output so that we keep the input intact during dfs, + // otherwise, it'll lead to incorrect result like in test case 3 int[][] result = new int[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { @@ -22,14 +23,32 @@ public int[][] colorBorder(int[][] grid, int row, int col, int color) { return dfs(grid, row, col, color, m, n, grid[row][col], visited, result); } - private int[][] dfs(int[][] grid, int row, int col, int color, int m, int n, int originalColor, boolean[][] visited, int[][] result) { - if (row == 0 || col == 0 || row == m - 1 || col == n - 1 || neighborDiffColor(row, col, grid, originalColor, m, n)) { + private int[][] dfs( + int[][] grid, + int row, + int col, + int color, + int m, + int n, + int originalColor, + boolean[][] visited, + int[][] result) { + if (row == 0 + || col == 0 + || row == m - 1 + || col == n - 1 + || neighborDiffColor(row, col, grid, originalColor, m, n)) { result[row][col] = color; } for (int i = 0; i < dirs.length - 1; i++) { int nextRow = dirs[i] + row; int nextCol = dirs[i + 1] + col; - if (nextRow >= 0 && nextRow < m && nextCol >= 0 && nextCol < n && grid[nextRow][nextCol] == originalColor && !visited[nextRow][nextCol]) { + if (nextRow >= 0 + && nextRow < m + && nextCol >= 0 + && nextCol < n + && grid[nextRow][nextCol] == originalColor + && !visited[nextRow][nextCol]) { visited[nextRow][nextCol] = true; dfs(grid, nextRow, nextCol, color, m, n, originalColor, visited, result); } @@ -37,12 +56,18 @@ private int[][] dfs(int[][] grid, int row, int col, int color, int m, int n, int return result; } - private boolean neighborDiffColor(int row, int col, int[][] grid, int originalColor, int m, int n) { - //if any of the four neighbors has a different color, we consider this cell as a boarding cell as well as it's a boarder to this connected component + private boolean neighborDiffColor( + int row, int col, int[][] grid, int originalColor, int m, int n) { + // if any of the four neighbors has a different color, we consider this cell as a + // boarding cell as well as it's a boarder to this connected component for (int i = 0; i < dirs.length - 1; i++) { int nextRow = row + dirs[i]; int nextCol = col + dirs[i + 1]; - if (nextRow >= 0 && nextCol >= 0 && nextRow < m && nextCol < n && grid[nextRow][nextCol] != originalColor) { + if (nextRow >= 0 + && nextCol >= 0 + && nextRow < m + && nextCol < n + && grid[nextRow][nextCol] != originalColor) { return true; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1037.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1037.java index aa64a0a996..9b9d3d4c4a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1037.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1037.java @@ -3,7 +3,8 @@ public class _1037 { public static class Solution1 { public boolean isBoomerang(int[][] points) { - return (points[1][1] - points[0][1]) * (points[2][0] - points[0][0]) != (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]); + return (points[1][1] - points[0][1]) * (points[2][0] - points[0][0]) + != (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1038.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1038.java index 0db3605bbf..1aa5ad5cf9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1038.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1038.java @@ -4,7 +4,7 @@ public class _1038 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/discuss/286725/JavaC%2B%2BPython-Revered-Inorder-Traversal */ int greaterSum = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1043.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1043.java index 23a92bc256..e1466a06d2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1043.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1043.java @@ -2,7 +2,7 @@ public class _1043 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/partition-array-for-maximum-sum/discuss/290863/JavaC%2B%2BPython-DP */ public int maxSumAfterPartitioning(int[] A, int K) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1049.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1049.java index 9f46dca938..756b80be7c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1049.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1049.java @@ -3,7 +3,7 @@ public class _1049 { public static class Solution1 { public int lastStoneWeightII(int[] stones) { - //TODO: implement it + // TODO: implement it return 1; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1051.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1051.java index 3649eee451..ddc2cde46e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1051.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1051.java @@ -3,7 +3,7 @@ import java.util.Arrays; public class _1051 { - + public static class Solution1 { public int heightChecker(int[] heights) { int[] originals = Arrays.copyOf(heights, heights.length); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1056.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1056.java index 01361a7eaa..d83060d049 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1056.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1056.java @@ -5,15 +5,16 @@ public class _1056 { public static class Solution1 { - Map map = new HashMap() { - { - put(0, 0); - put(1, 1); - put(8, 8); - put(6, 9); - put(9, 6); - } - }; + Map map = + new HashMap() { + { + put(0, 0); + put(1, 1); + put(8, 8); + put(6, 9); + put(9, 6); + } + }; public boolean confusingNumber(int N) { if (N == 0) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1057.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1057.java index 8bfda01366..0d32f5d4f6 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1057.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1057.java @@ -11,11 +11,16 @@ public int[] assignBikes(int[][] workers, int[][] bikes) { TreeMap> treeMap = new TreeMap<>(); for (int i = 0; i < w; i++) { for (int j = 0; j < b; j++) { - int distance = Math.abs(workers[i][0] - bikes[j][0]) + Math.abs(workers[i][1] - bikes[j][1]); + int distance = + Math.abs(workers[i][0] - bikes[j][0]) + + Math.abs(workers[i][1] - bikes[j][1]); if (!treeMap.containsKey(distance)) { - treeMap.put(distance, new PriorityQueue<>((x, y) -> x[0] == y[0] ? x[1] - y[1] : x[0] - y[0])); + treeMap.put( + distance, + new PriorityQueue<>( + (x, y) -> x[0] == y[0] ? x[1] - y[1] : x[0] - y[0])); } - treeMap.get(distance).add(new int[]{i, j}); + treeMap.get(distance).add(new int[] {i, j}); } } int[] ans = new int[w]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1059.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1059.java index 08a1346b5d..cbcd5d172a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1059.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1059.java @@ -5,7 +5,7 @@ public class _1059 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/all-paths-from-source-lead-to-destination/editorial/ * A very powerful algorithm, three colors to DFS a tree/graph. */ @@ -24,24 +24,26 @@ public boolean leadsToDestination(int n, int[][] edges, int source, int destinat return leadsToDest(graph, colors, source, destination); } - private boolean leadsToDest(List[] graph, Color[] colors, int node, int destination) { - //if it's not WHITE, then it should be BLACK, otherwise, there's a circle + private boolean leadsToDest( + List[] graph, Color[] colors, int node, int destination) { + // if it's not WHITE, then it should be BLACK, otherwise, there's a circle if (colors[node] != Color.WHITE) { return colors[node] == Color.BLACK; } - //if this is a leaf node, then it should be destination, otherwise, it's a dead end and we return false + // if this is a leaf node, then it should be destination, otherwise, it's a dead end and + // we return false if (graph[node].size() == 0) { return node == destination; } - //now, we start processing this node and mark it as GRAY + // now, we start processing this node and mark it as GRAY colors[node] = Color.GRAY; for (int neighbor : graph[node]) { if (!leadsToDest(graph, colors, neighbor, destination)) { return false; } } - //recursive processing is done, we mark it as BLACK + // recursive processing is done, we mark it as BLACK colors[node] = Color.BLACK; return true; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1060.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1060.java index 86b0e3f4a1..dc1a52f885 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1060.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1060.java @@ -2,8 +2,9 @@ public class _1060 { public static class Solution1 { - //Time: O(n) - //This is to calculate the number of missing elements in between each two numbers from left to right + // Time: O(n) + // This is to calculate the number of missing elements in between each two numbers from left + // to right public int missingElement(int[] nums, int k) { int missing; for (int i = 1; i < nums.length; i++) { @@ -18,20 +19,30 @@ public int missingElement(int[] nums, int k) { } public static class Solution2 { - //Time: O(logn) - //credit: https://leetcode.com/problems/missing-element-in-sorted-array/editorial/ - //We use binary search here, instead of focusing on the missing elements between two adjacent numbers, - // we can focus on the number of missing elements between any two numbers: nums[0] and nums[i] - //e.g. given this array: 4, 7, 9, 10, 14, i = 2; - //if nothing is missing, the elements should be 4,5,6,7,8,9, in other words, + // Time: O(logn) + // credit: https://leetcode.com/problems/missing-element-in-sorted-array/editorial/ + // We use binary search here, instead of focusing on the missing elements between two + // adjacent numbers, + // we can focus on the number of missing elements between any two numbers: nums[0] and + // nums[i] + // e.g. given this array: 4, 7, 9, 10, 14, i = 2; + // if nothing is missing, the elements should be 4,5,6,7,8,9, in other words, // the total number of elements should be nums[2] - nums[0] + 1 = 9 - 4 + 1 = 6 - //however, in reality, there's only i - 0 + 1 = 2 - 0 + 1 = 3 elements, so we are missing 6 - 3 = 3 elements, they are 5,6,8 - //so the formula became: (nums[i] - nums[0] + 1) - (i - 0 + 1) = nums[i] - nums[0] - i + // however, in reality, there's only i - 0 + 1 = 2 - 0 + 1 = 3 elements, so we are missing 6 + // - 3 = 3 elements, they are 5,6,8 + // so the formula became: (nums[i] - nums[0] + 1) - (i - 0 + 1) = nums[i] - nums[0] - i public int missingElement(int[] nums, int k) { int left = 0; int right = nums.length - 1; while (left < right) { - int mid = right - (right - left) / 2;//has to be written this way, otherwise, infinite loop, since we assign mid to left instead of mid + 1 to left, although mathematically, it's equivalent to left + (right - left) / 2, integer division rounds off in Java + int mid = + right + - (right - left) + / 2; // has to be written this way, otherwise, infinite + // loop, since we assign mid to left instead of mid + 1 + // to left, although mathematically, it's equivalent to + // left + (right - left) / 2, integer division rounds + // off in Java if (nums[mid] - nums[0] - mid < k) { left = mid; } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1062.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1062.java index 5f2f63fd70..2208384b41 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1062.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1062.java @@ -5,7 +5,7 @@ public class _1062 { public static class Solution1 { - /** + /* * My completely original solution, although kind of brute-force, on 1/20/2022. * Two pointer technique: * j starts from the right, i starts from the left, diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1065.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1065.java index 039aa7a413..fdd4604789 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1065.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1065.java @@ -13,21 +13,23 @@ public int[][] indexPairs(String text, String[] words) { lists.addAll(findAllMatchsForThisWord(word, text)); } if (lists.isEmpty()) { - return new int[][]{}; + return new int[][] {}; } - Collections.sort(lists, (o1, o2) -> { - if (o1.get(0) > o2.get(0)) { - return 1; - } else if (o1.get(0) < o2.get(0)) { - return -1; - } else { - if (o1.get(1) > o2.get(1)) { - return 1; - } else { - return -1; - } - } - }); + Collections.sort( + lists, + (o1, o2) -> { + if (o1.get(0) > o2.get(0)) { + return 1; + } else if (o1.get(0) < o2.get(0)) { + return -1; + } else { + if (o1.get(1) > o2.get(1)) { + return 1; + } else { + return -1; + } + } + }); int[][] result = new int[lists.size()][lists.get(0).size()]; for (int i = 0; i < lists.size(); i++) { result[i][0] = lists.get(i).get(0); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1066.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1066.java index a498a35a47..91d7461480 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1066.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1066.java @@ -9,7 +9,12 @@ public int assignBikes(int[][] workers, int[][] bikes) { return minSum; } - private void backtracking(int[][] workers, int[][] bikes, int workersIndex, boolean[] bikesAssigned, int currentSum) { + private void backtracking( + int[][] workers, + int[][] bikes, + int workersIndex, + boolean[] bikesAssigned, + int currentSum) { if (workersIndex >= workers.length) { minSum = Math.min(minSum, currentSum); return; @@ -22,7 +27,12 @@ private void backtracking(int[][] workers, int[][] bikes, int workersIndex, bool for (int j = 0; j < bikes.length; j++) { if (!bikesAssigned[j]) { bikesAssigned[j] = true; - backtracking(workers, bikes, workersIndex + 1, bikesAssigned, currentSum + dist(workers[workersIndex], bikes[j])); + backtracking( + workers, + bikes, + workersIndex + 1, + bikesAssigned, + currentSum + dist(workers[workersIndex], bikes[j])); bikesAssigned[j] = false; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1078.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1078.java index 26aa8b4231..d38b9f4ac1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1078.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1078.java @@ -7,8 +7,7 @@ public class _1078 { public static class Solution1 { public String[] findOcurrences(String text, String first, String second) { String[] words = text.split(" "); - return IntStream - .range(0, words.length - 2) + return IntStream.range(0, words.length - 2) .filter(i -> words[i].equals(first) && words[i + 1].equals(second)) .mapToObj(i -> words[i + 2]) .collect(Collectors.toList()) diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1079.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1079.java index 4b40777d89..cf5cc3fd4c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1079.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1079.java @@ -24,13 +24,14 @@ private void dfs(char[] chars, boolean[] used, StringBuilder sb, List re IntStream.range(0, chars.length) .filter(i -> !used[i]) .filter(i -> i <= 0 || chars[i - 1] != chars[i] || used[i - 1]) - .forEach(i -> { - used[i] = true; - sb.append(chars[i]); - dfs(chars, used, sb, result); - used[i] = false; - sb.deleteCharAt(sb.length() - 1); - }); + .forEach( + i -> { + used[i] = true; + sb.append(chars[i]); + dfs(chars, used, sb, result); + used[i] = false; + sb.deleteCharAt(sb.length() - 1); + }); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1080.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1080.java index a1435caf78..ffb944242e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1080.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1080.java @@ -4,7 +4,7 @@ public class _1080 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths/solutions/1340243/concise-dfs-solution-cpp-and-java-0ms/ * DFS does this very cleanly. */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1087.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1087.java index 40472d2b91..568981ef4b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1087.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1087.java @@ -15,7 +15,8 @@ public String[] expand(String s) { return r; } - private List backtracking(List letters, int start, StringBuilder sb, List result) { + private List backtracking( + List letters, int start, StringBuilder sb, List result) { if (start >= letters.size()) { result.add(sb.toString()); return result; @@ -54,7 +55,7 @@ private List parse(String s) { } public static class Solution2 { - /** + /* * My completely original solution on 1/17/2022. */ public String[] expand(String s) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1091.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1091.java index 86f4eca784..d300c0f87c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1091.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1091.java @@ -5,8 +5,9 @@ public class _1091 { public static class Solution1 { - //you can count in the normal four directions first, then count the diagonal ones to form this array - int[] directions = new int[]{0, 1, 1, 0, -1, 1, -1, -1, 0}; + // you can count in the normal four directions first, then count the diagonal ones to form + // this array + int[] directions = new int[] {0, 1, 1, 0, -1, 1, -1, -1, 0}; public int shortestPathBinaryMatrix(int[][] grid) { int m = grid.length; @@ -16,7 +17,7 @@ public int shortestPathBinaryMatrix(int[][] grid) { } int minPath = 0; Queue queue = new LinkedList<>(); - queue.offer(new int[]{0, 0}); + queue.offer(new int[] {0, 0}); boolean[][] visited = new boolean[m][n]; visited[0][0] = true; while (!queue.isEmpty()) { @@ -29,8 +30,13 @@ public int shortestPathBinaryMatrix(int[][] grid) { for (int j = 0; j < directions.length - 1; j++) { int newx = directions[j] + curr[0]; int newy = directions[j + 1] + curr[1]; - if (newx >= 0 && newx < n && newy >= 0 && newy < n && !visited[newx][newy] && grid[newx][newy] == 0) { - queue.offer(new int[]{newx, newy}); + if (newx >= 0 + && newx < n + && newy >= 0 + && newy < n + && !visited[newx][newy] + && grid[newx][newy] == 0) { + queue.offer(new int[] {newx, newy}); visited[newx][newy] = true; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1094.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1094.java index 4919e84376..cd6cad4a31 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1094.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1094.java @@ -20,7 +20,7 @@ public boolean carPooling(int[][] trips, int capacity) { if (capacity < 0) { return false; } - heap.offer(new int[]{peopleCnt, endTime}); + heap.offer(new int[] {peopleCnt, endTime}); } return true; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1099.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1099.java index 335e791d56..8562dacefa 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1099.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1099.java @@ -4,7 +4,7 @@ public class _1099 { public static class Solution1 { - /** + /* * Time: O(n^2) * Space: O(1) */ @@ -22,7 +22,7 @@ public int twoSumLessThanK(int[] nums, int k) { } public static class Solution2 { - /** + /* * Time: O(nlogn) * Space: O(1) */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1104.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1104.java index d01b8e9d1d..4d7e56dc63 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1104.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1104.java @@ -3,7 +3,6 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -14,7 +13,7 @@ public class _1104 { public static class Solution1 { - /** + /* * This brute force solution is correct but results in TLE on LeetCode. */ public List pathInZigZagTree(int label) { @@ -83,7 +82,7 @@ private Deque buildZigZagOrderList(int label) { } public static class Solution2 { - /** + /* * We'll directly compute the index of its parent, it'll be much faster this way. */ public List pathInZigZagTree(int label) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1105.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1105.java index 2df8a3d733..f5909801e1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1105.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1105.java @@ -2,7 +2,7 @@ public class _1105 { public static class Solution1 { - /** + /* * Bottom up DP: * 1. we place the books sequentially, for each book, there are only two options: * place it on a new level (this will maximize the height of the shelf); @@ -15,18 +15,20 @@ public static class Solution1 { * during this process, we minimize the height for dp[i]. */ public int minHeightShelves(int[][] books, int shelfWidth) { - //dp[i] means the minimum shelf height after placing all books up to and excluding book i + // dp[i] means the minimum shelf height after placing all books up to and excluding book + // i int[] dp = new int[books.length + 1]; dp[0] = 0; dp[1] = books[0][1]; int len = books.length; for (int i = 2; i <= len; i++) { - //suppose we put this book on a new level + // suppose we put this book on a new level int remainingShelfWidth = shelfWidth - books[i - 1][0]; int maxHeight = books[i - 1][1]; dp[i] = books[i - 1][1] + dp[i - 1]; - //now we calculate the height if previous books are placed onto this new level to try to minimize dp[i] + // now we calculate the height if previous books are placed onto this new level to + // try to minimize dp[i] for (int j = i - 1; j > 0 && remainingShelfWidth - books[j - 1][0] >= 0; j--) { maxHeight = Math.max(maxHeight, books[j - 1][1]); remainingShelfWidth -= books[j - 1][0]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1108.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1108.java index 7dd4de5c1e..bab73f0699 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1108.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1108.java @@ -3,14 +3,14 @@ public class _1108 { public static class Solution1 { public String defangIPaddr(String address) { - //String.replaceAll() takes in a regex which needs to be escaped + // String.replaceAll() takes in a regex which needs to be escaped return address.replaceAll("\\.", "\\[\\.\\]"); } } public static class Solution2 { public String defangIPaddr(String address) { - //String.replace() takes in a string which does NOT need to be escaped + // String.replace() takes in a string which does NOT need to be escaped return address.replace(".", "[.]"); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1110.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1110.java index d37e02aaaa..79792d3977 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1110.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1110.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedList; @@ -76,7 +75,7 @@ private boolean delete(TreeNode curr, int toDelete, Queue queue) { } public static class Solution2 { - //use BFS + // use BFS public List delNodes(TreeNode root, int[] toDelete) { Set deleteSet = new HashSet<>(); for (int d : toDelete) { @@ -88,16 +87,17 @@ public List delNodes(TreeNode root, int[] toDelete) { while (!q.isEmpty()) { TreeNode curr = q.poll(); - //process left child if any + // process left child if any if (curr.left != null) { - //add it into the q first because we need to process it any ways as it might have children that might not need to be deleted + // add it into the q first because we need to process it any ways as it might + // have children that might not need to be deleted q.offer(curr.left); if (deleteSet.contains(curr.left.val)) { curr.left = null; } } - //process right child if any + // process right child if any if (curr.right != null) { q.offer(curr.right); if (deleteSet.contains(curr.right.val)) { @@ -105,7 +105,8 @@ public List delNodes(TreeNode root, int[] toDelete) { } } - //process this curr node: if it needs to be deleted, then add its non-null children into forest as we checked its children + // process this curr node: if it needs to be deleted, then add its non-null children + // into forest as we checked its children // and we know they do not need to be deleted at this point if (deleteSet.contains(curr.val)) { if (curr.left != null) { @@ -115,9 +116,10 @@ public List delNodes(TreeNode root, int[] toDelete) { forest.add(curr.right); } } - //we don't add curr into forest here, otherwise there might be duplicate as we might have added them as their parent's child already + // we don't add curr into forest here, otherwise there might be duplicate as we + // might have added them as their parent's child already } - //at this point, only root might be missing, so we check root + // at this point, only root might be missing, so we check root if (!deleteSet.contains(root.val)) { forest.add(root); } @@ -126,11 +128,13 @@ public List delNodes(TreeNode root, int[] toDelete) { } public static class Solution3 { - //use DFS/Post-order traversal - //key to recognize to apply post-order traversal: we need to handle subtree/children first before handling the root. - //it is in this case, handle children first in case children do not need to be removed and the parent needs to be removed, - //so we avoid the case of prematurely removing the parent before handling its children - //credit: https://leetcode.com/problems/delete-nodes-and-return-forest/editorial/ + // use DFS/Post-order traversal + // key to recognize to apply post-order traversal: we need to handle subtree/children first + // before handling the root. + // it is in this case, handle children first in case children do not need to be removed and + // the parent needs to be removed, + // so we avoid the case of prematurely removing the parent before handling its children + // credit: https://leetcode.com/problems/delete-nodes-and-return-forest/editorial/ public List delNodes(TreeNode root, int[] toDelete) { List forest = new ArrayList<>(); if (root == null) { @@ -160,7 +164,7 @@ private TreeNode postOrder(TreeNode root, Set deleteSet, List if (root.right != null) { forest.add(root.right); } - //return null to its parent to delete the current node + // return null to its parent to delete the current node return null; } return root; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1118.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1118.java index 07c2908c42..d653f170ae 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1118.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1118.java @@ -3,7 +3,7 @@ public class _1118 { public static class Solution1 { public int numberOfDays(int Y, int M) { - int[] map = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + int[] map = new int[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (isLeapYear(Y) && M == 2) { return 29; } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1120.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1120.java index 4f11fa8b5f..c05a30e8e2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1120.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1120.java @@ -4,7 +4,7 @@ public class _1120 { public static class Solution1 { - /** + /* * Almost identical idea to https://leetcode.com/problems/count-nodes-equal-to-average-of-subtree * When it comes to subtree, or, you need to process subtrees first before processing root, post-order traversal/recursion is handy. */ @@ -25,7 +25,7 @@ private int[] postOrder(TreeNode root) { int nodeCount = left[1] + right[1] + 1; double ave = ((double) nodeSum / nodeCount); maxAve = Math.max(ave, maxAve); - return new int[]{nodeSum, nodeCount}; + return new int[] {nodeSum, nodeCount}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1123.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1123.java index 019e0a82de..5bcd2c9189 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1123.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1123.java @@ -4,7 +4,7 @@ public class _1123 { public static class Solution1 { - //TODO: implement it + // TODO: implement it public TreeNode lcaDeepestLeaves(TreeNode root) { return null; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1128.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1128.java index 53a8d20655..1fd4313600 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1128.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1128.java @@ -18,6 +18,5 @@ public int numEquivDominoPairs(int[][] dominoes) { } return count; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1136.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1136.java index 6e57576e40..f4285b276a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1136.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1136.java @@ -51,7 +51,7 @@ public int minimumSemesters(int n, int[][] relations) { } public static class Solution2 { - /** + /* * A straightforward one to practice topological sort (template). * Use an indegree/outdegree array and an array of list type. */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1137.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1137.java index 2e9c3f336b..b0322c5f73 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1137.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1137.java @@ -12,7 +12,8 @@ public int tribonacci(int n) { numbers[0] = 0; numbers[1] = 1; numbers[2] = 1; - IntStream.rangeClosed(3, n).forEach(i -> numbers[i] = numbers[i - 1] + numbers[i - 2] + numbers[i - 3]); + IntStream.rangeClosed(3, n) + .forEach(i -> numbers[i] = numbers[i - 1] + numbers[i - 2] + numbers[i - 3]); return numbers[n]; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1138.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1138.java index 4163050a1a..f69ce7a123 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1138.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1138.java @@ -65,7 +65,7 @@ private Map initMap() { for (char c = 'a'; c <= 'z'; c++, number++) { row = number / 5; col = number % 5; - map.put(c, new int[]{row, col}); + map.put(c, new int[] {row, col}); } return map; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1143.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1143.java index 29266fe47e..aa81d3a643 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1143.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1143.java @@ -2,7 +2,7 @@ public class _1143 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/longest-common-subsequence/solution/ *

* Recall that there are two different techniques we can use to implement a dynamic programming solution; memoization and tabulation. @@ -31,9 +31,10 @@ private int topDownRecursiveSolve(int[][] dp, int i, int j, String text1, String if (dp[i][j] != -1) { return dp[i][j]; } - //option1: we don't include text1.charAt(i) in the optimal solution + // option1: we don't include text1.charAt(i) in the optimal solution int option1 = topDownRecursiveSolve(dp, i + 1, j, text1, text2); - //option2: we do include text1.charAt(i) in the optimal solution as long as a match in text2 at or after j does exist + // option2: we do include text1.charAt(i) in the optimal solution as long as a match in + // text2 at or after j does exist int firstOccurence = text2.indexOf(text1.charAt(i), j); int option2 = 0; if (firstOccurence != -1) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1145.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1145.java index 65b428291e..d1303828bd 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1145.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1145.java @@ -15,8 +15,11 @@ public boolean btreeGameWinningMove(TreeNode root, int n, int x) { int rightCount = countNodes(root.right); int parent = n - (leftCount + rightCount + 1); - // possible to win if no. of nodes in 1 path is > than sum of nodes in the other 2 paths - return parent > (leftCount + rightCount) || leftCount > (parent + rightCount) || rightCount > (parent + leftCount); + // possible to win if no. of nodes in 1 path is > than sum of nodes in the other 2 + // paths + return parent > (leftCount + rightCount) + || leftCount > (parent + rightCount) + || rightCount > (parent + leftCount); } return btreeGameWinningMove(root.left, n, x) || btreeGameWinningMove(root.right, n, x); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1146.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1146.java index 9f4ca33bd6..955930521c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1146.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1146.java @@ -5,7 +5,9 @@ public class _1146 { public static class Solution1 { public static class SnapshotArray { - TreeMap[] snapshots;//using this data structure is much more efficient in terms of storage, esp. if snap() calls happen frequently + TreeMap[] + snapshots; // using this data structure is much more efficient in terms of + // storage, esp. if snap() calls happen frequently int snapId; public SnapshotArray(int length) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1150.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1150.java index e72e68f4e0..8d3f7a5796 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1150.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1150.java @@ -2,7 +2,7 @@ public class _1150 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array/discuss/358130/Java-just-one-binary-search-O(logN))-0ms-beats-100 */ public boolean isMajorityElement(int[] nums, int target) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1151.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1151.java index f5c04b8b1e..4a6d0b5279 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1151.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1151.java @@ -2,7 +2,7 @@ public class _1151 { public static class Solution1 { - /** + /* * My completely original solution on 11/4/2021. * Typical sliding window problem/solution */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1152.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1152.java index 95bb139a42..5327e470d2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1152.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1152.java @@ -10,7 +10,8 @@ public class _1152 { public static class Solution1 { - public List mostVisitedPattern(String[] username, int[] timestamp, String[] website) { + public List mostVisitedPattern( + String[] username, int[] timestamp, String[] website) { Map> userToSiteMap = new HashMap<>(); for (int i = 0; i < username.length; i++) { if (!userToSiteMap.containsKey(username[i])) { @@ -34,7 +35,8 @@ public List mostVisitedPattern(String[] username, int[] timestamp, Strin Set encounteredSequence = new HashSet<>(); for (String sequence : allSequences) { if (encounteredSequence.add(sequence)) { - sequenceCountMap.put(sequence, sequenceCountMap.getOrDefault(sequence, 0) + 1); + sequenceCountMap.put( + sequence, sequenceCountMap.getOrDefault(sequence, 0) + 1); } } } @@ -58,12 +60,18 @@ public List mostVisitedPattern(String[] username, int[] timestamp, Strin return mostVisitedPattern; } - private List formAllSequences(List times, TreeMap timeToSiteMap) { + private List formAllSequences( + List times, TreeMap timeToSiteMap) { List result = new ArrayList<>(); for (int i = 0; i < times.size() - 2; i++) { for (int j = i + 1; j < times.size() - 1; j++) { for (int k = j + 1; k < times.size(); k++) { - result.add(timeToSiteMap.get(times.get(i)) + "->" + timeToSiteMap.get(times.get(j)) + "->" + timeToSiteMap.get(times.get(k))); + result.add( + timeToSiteMap.get(times.get(i)) + + "->" + + timeToSiteMap.get(times.get(j)) + + "->" + + timeToSiteMap.get(times.get(k))); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1160.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1160.java index dc39efe2c0..f2d1e24eb6 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1160.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1160.java @@ -11,7 +11,6 @@ public int countCharacters(String[] words, String chars) { for (char c : chars.toCharArray()) { int count = map.getOrDefault(c, 0); map.put(c, count + 1); - } for (String word : words) { if (canForm(word, map)) { @@ -33,6 +32,5 @@ private boolean canForm(String word, final Map map) { } return true; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1161.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1161.java index c9e7d8d4fe..3af9eac591 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1161.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1161.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; import java.util.TreeMap; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1170.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1170.java index c13363101e..c4f1092011 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1170.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1170.java @@ -4,7 +4,7 @@ public class _1170 { public static class Solution1 { - /** + /* * Use simple iteration when finding counts * Time: O(n^m) where m is the size of queries and n is the size of words * Space: O(max(m, n) where m is the size of queries and n is the size of words) @@ -57,7 +57,7 @@ private int computeLowestFrequency(String string) { } public static class Solution2 { - /** + /* * Use binary search when finding counts * Time: O(n^logn) where m is the size of queries and n is the size of words * Space: O(max(m, n) where m is the size of queries and n is the size of words) diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1171.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1171.java index 29cea2709e..71cd6e3cba 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1171.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1171.java @@ -1,12 +1,11 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.ListNode; - import java.util.*; public class _1171 { public static class Solution1 { - /** + /* * I keep shrinking the array whenever I found there's a range of sum that equals to zero * until the size of the list doesn't change any more. * This is probably not super efficient, but accepted on LeetCode. @@ -35,7 +34,8 @@ private List convertToList(ListNode head) { List list = new ArrayList<>(); while (head != null) { if (head.val != 0) { - //if it's zero, we'll just ignore it, this can help us take care of the zero values + // if it's zero, we'll just ignore it, this can help us take care of the zero + // values list.add(head.val); } head = head.next; @@ -74,7 +74,7 @@ private List shrinkList(List list) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/remove-zero-sum-consecutive-nodes-from-linked-list/discuss/366337/Java-Iterative-and-Recursive-solution * this post explains it all * key of the hashmap is the prefix sum of all the nodes we've gone so far diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1175.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1175.java index b369712a71..f956497154 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1175.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1175.java @@ -5,7 +5,8 @@ public class _1175 { public static class Solution1 { - //credit: https://leetcode.com/problems/prime-arrangements/discuss/371884/Simple-Java-With-comment-sieve_of_eratosthenes + // credit: + // https://leetcode.com/problems/prime-arrangements/discuss/371884/Simple-Java-With-comment-sieve_of_eratosthenes static int MOD = 1000000007; public static int numPrimeArrangements(int n) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1185.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1185.java index d34c402258..e19b6a8b53 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1185.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1185.java @@ -2,7 +2,7 @@ public class _1185 { public static class Solution1 { - /** + /* * Time: O(1) * Space: O(1) *

@@ -10,8 +10,11 @@ public static class Solution1 { * based on the fact that 1/1/1971 is a Friday and calculate the given day. */ public String dayOfTheWeek(int day, int month, int year) { - String[] daysInTheWeek = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; - int[] daysInTheMonth = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + String[] daysInTheWeek = + new String[] { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" + }; + int[] daysInTheMonth = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int numberOfDays = 0; for (int i = 1971; i < year; i++) { numberOfDays += i % 4 == 0 ? 366 : 365; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1186.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1186.java index 35fe7d2309..85de820652 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1186.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1186.java @@ -3,7 +3,7 @@ public class _1186 { public static class Solution1 { public int maximumSum(int[] arr) { - //TODO: implement it + // TODO: implement it return -1; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1189.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1189.java index 194e5f5da4..22447b2b77 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1189.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1189.java @@ -7,7 +7,11 @@ public int maxNumberOfBalloons(String text) { for (char c : text.toCharArray()) { counts[c - 'a']++; } - return Math.min(counts[0], Math.min(counts[1], Math.min(counts[11] / 2, Math.min(counts[14] / 2, counts[13])))); + return Math.min( + counts[0], + Math.min( + counts[1], + Math.min(counts[11] / 2, Math.min(counts[14] / 2, counts[13])))); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1190.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1190.java index 00016390ad..0d321bc2ed 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1190.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1190.java @@ -18,7 +18,7 @@ public String reverseParentheses(String s) { queue.offer(stack.pop()); } if (!stack.isEmpty()) { - stack.pop();//pop off the open paren + stack.pop(); // pop off the open paren } while (!queue.isEmpty()) { stack.push(queue.poll()); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1197.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1197.java index 237a9f5f0e..c2160d9032 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1197.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1197.java @@ -7,24 +7,25 @@ public class _1197 { public static class Solution1 { - /** + /* * My completely original solution. */ public int minKnightMoves(int x, int y) { - int boundary = 600;//this is from the constraints of this problem: -300 <= x, y <= 300 + int boundary = 600; // this is from the constraints of this problem: -300 <= x, y <= 300 Queue q = new LinkedList<>(); - q.offer(new int[]{0, 0}); + q.offer(new int[] {0, 0}); int moves = 0; - int[][] dirs = new int[][]{ - {-2, 1}, - {-1, 2}, - {1, 2}, - {2, 1}, - {2, -1}, - {1, -2}, - {-1, -2}, - {-2, -1} - }; + int[][] dirs = + new int[][] { + {-2, 1}, + {-1, 2}, + {1, 2}, + {2, 1}, + {2, -1}, + {1, -2}, + {-1, -2}, + {-2, -1} + }; Set visited = new HashSet<>(); visited.add(0); while (!q.isEmpty()) { @@ -38,8 +39,9 @@ public int minKnightMoves(int x, int y) { int nextx = dir[0] + curr[0]; int nexty = dir[1] + curr[1]; if (visited.add(nexty * boundary + nextx)) { - //formula: col * size of matrix + row, is a common way to project a 2D matrix onto 1D array - q.offer(new int[]{nextx, nexty}); + // formula: col * size of matrix + row, is a common way to project a 2D + // matrix onto 1D array + q.offer(new int[] {nextx, nexty}); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1198.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1198.java index 5d12126b7b..622b097b35 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1198.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1198.java @@ -7,7 +7,7 @@ public int smallestCommonElement(int[][] mat) { int n = mat[0].length; for (int j = 0; j < n; j++) { int minCommon = mat[0][j]; - //we'll start from the second row + // we'll start from the second row int i = 1; for (; i < m; i++) { if (thisRowHasThisNumber(mat[i], minCommon)) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1200.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1200.java index 3122eb779f..19a6b9ca67 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1200.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1200.java @@ -6,7 +6,7 @@ public class _1200 { public static class Solution1 { - /** + /* * Time: O(nlogn) due to sorting * Space: O(k) where k is the distinct number of differences between two numbers in the given array */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1207.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1207.java index 7dc8f26528..93c357963f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1207.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1207.java @@ -10,11 +10,15 @@ public class _1207 { public static class Solution1 { public boolean uniqueOccurrences(int[] arr) { Map map = new HashMap<>(); - Arrays.stream(arr).forEach(num -> { - map.put(num, map.containsKey(num) ? map.get(num) + 1 : 1); - }); + Arrays.stream(arr) + .forEach( + num -> { + map.put(num, map.containsKey(num) ? map.get(num) + 1 : 1); + }); Set set = new HashSet<>(); - return map.keySet().stream().mapToInt(key -> key).allMatch(key -> set.add(map.get(key))); + return map.keySet().stream() + .mapToInt(key -> key) + .allMatch(key -> set.add(map.get(key))); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1209.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1209.java index b563cd750f..e4302e8269 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1209.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1209.java @@ -76,7 +76,7 @@ public String removeDuplicates(String s, int k) { } public static class Solution3 { - /** + /* * My completely original solution on 1/6/2021. */ class CharCount { @@ -117,7 +117,7 @@ public String removeDuplicates(String s, int k) { } public static class Solution4 { - //my completely original solution on 6/19/2024 + // my completely original solution on 6/19/2024 public String removeDuplicates(String s, int k) { Deque stack = new LinkedList<>(); for (char c : s.toCharArray()) { @@ -151,6 +151,5 @@ public Pair(char c, int count) { this.count = count; } } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1213.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1213.java index 88f01d0dc1..2b37c22f4c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1213.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1213.java @@ -5,7 +5,7 @@ public class _1213 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/intersection-of-three-sorted-arrays/discuss/397603/Simple-Java-solution-beats-100 */ public List arraysIntersection(int[] arr1, int[] arr2, int[] arr3) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1214.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1214.java index a93c0b250e..cab9ade29b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1214.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1214.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; @@ -54,6 +53,5 @@ private List inorderDfs(TreeNode root, List list) { } return list; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1217.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1217.java index c6b6fff128..9487e11a8d 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1217.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1217.java @@ -2,7 +2,7 @@ public class _1217 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/play-with-chips/discuss/398239/C%2B%2B-3-lines */ public int minCostToMoveChips(int[] position) { @@ -15,7 +15,9 @@ public int minCostToMoveChips(int[] position) { chipsAtOddPosition++; } } - return chipsAtEvenPosition > chipsAtOddPosition ? chipsAtOddPosition : chipsAtEvenPosition; + return chipsAtEvenPosition > chipsAtOddPosition + ? chipsAtOddPosition + : chipsAtEvenPosition; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1219.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1219.java index b479fa87cf..54da88416f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1219.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1219.java @@ -12,7 +12,7 @@ public int getMaximumGold(int[][] grid) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] > 0) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); } } } @@ -21,21 +21,36 @@ public int getMaximumGold(int[][] grid) { int[] start = queue.poll(); boolean[][] visited = new boolean[m][n]; visited[start[0]][start[1]] = true; - maxGold = Math.max(maxGold, backtracking(grid, start, grid[start[0]][start[1]], visited)); + maxGold = + Math.max( + maxGold, + backtracking(grid, start, grid[start[0]][start[1]], visited)); } return maxGold; } - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; private int backtracking(int[][] grid, int[] start, int gold, boolean[][] visited) { int max = gold; for (int i = 0; i < directions.length - 1; i++) { int nextX = start[0] + directions[i]; int nextY = start[1] + directions[i + 1]; - if (nextX >= 0 && nextX < grid.length && nextY >= 0 && nextY < grid[0].length && !visited[nextX][nextY] && grid[nextX][nextY] > 0) { + if (nextX >= 0 + && nextX < grid.length + && nextY >= 0 + && nextY < grid[0].length + && !visited[nextX][nextY] + && grid[nextX][nextY] > 0) { visited[nextX][nextY] = true; - max = Math.max(max, backtracking(grid, new int[]{nextX, nextY}, gold + grid[nextX][nextY], visited)); + max = + Math.max( + max, + backtracking( + grid, + new int[] {nextX, nextY}, + gold + grid[nextX][nextY], + visited)); visited[nextX][nextY] = false; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1228.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1228.java index 707a29ebef..af33a9fea4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1228.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1228.java @@ -8,7 +8,7 @@ public class _1228 { public static class Solution1 { - /** + /* * A super verbose and inefficient but working way... */ public int missingNumber(int[] arr) { @@ -31,7 +31,7 @@ public int missingNumber(int[] arr) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/missing-number-in-arithmetic-progression/discuss/408474/JavaC%2B%2BPython-Arithmetic-Sum-and-Binary-Search */ public int missingNumber(int[] arr) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1230.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1230.java index be04fffd57..3e879096c2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1230.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1230.java @@ -4,9 +4,9 @@ public class _1230 { public static class Solution1 { public double probabilityOfHeads(double[] prob, int target) { int n = prob.length; - //initialize a 2-D array, column size should be target + 1 - //dp[i][j] means the probability of getting j heads using the first i coins - //so dp[n][target] is the answer where n is the number of coins + // initialize a 2-D array, column size should be target + 1 + // dp[i][j] means the probability of getting j heads using the first i coins + // so dp[n][target] is the answer where n is the number of coins double[][] dp = new double[n + 1][target + 1]; dp[0][0] = 1; for (int i = 1; i <= n; i++) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1232.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1232.java index dc016fcb5d..c9da10f177 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1232.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1232.java @@ -2,7 +2,7 @@ public class _1232 { public static class Solution1 { - /** + /* * To check if they share the same slope, we use this formula: *

* check whether (y4 - y3)/(x4- x3) equals to (y2 - y1)/(x2 - x1) @@ -12,8 +12,10 @@ public static class Solution1 { */ public boolean checkStraightLine(int[][] coordinates) { for (int i = 2; i < coordinates.length - 1; i++) { - if ((coordinates[1][0] - coordinates[0][0]) * (coordinates[i + 1][1] - coordinates[i][1]) - != (coordinates[1][1] - coordinates[0][1]) * (coordinates[i + 1][0] - coordinates[i][0])) { + if ((coordinates[1][0] - coordinates[0][0]) + * (coordinates[i + 1][1] - coordinates[i][1]) + != (coordinates[1][1] - coordinates[0][1]) + * (coordinates[i + 1][0] - coordinates[i][0])) { return false; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1237.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1237.java index c777657479..86255fc1a8 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1237.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1237.java @@ -16,7 +16,7 @@ abstract class CustomFunction { } public static class Solution1 { - /** + /* * Time: O(x*y) * Space: O(1) */ @@ -34,7 +34,7 @@ public List> findSolution(CustomFunction customfunction, int z) { } public static class Solution2 { - /** + /* * linear search *

* Time: O(x + y) @@ -59,7 +59,7 @@ public List> findSolution(CustomFunction customfunction, int z) { } public static class Solution3 { - /** + /* * binary search *

* Time: O(xlogy) @@ -85,5 +85,4 @@ public List> findSolution(CustomFunction customfunction, int z) { return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1242.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1242.java index b22d450f67..7740d2ed72 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1242.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1242.java @@ -9,7 +9,7 @@ public interface HtmlParser { } public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/web-crawler-multithreaded/solutions/699006/java-blockingqueue-executorservice/ */ public List crawl(String startUrl, HtmlParser htmlParser) { @@ -20,36 +20,43 @@ public List crawl(String startUrl, HtmlParser htmlParser) { Set visited = new HashSet<>(); Queue tasks = new LinkedList<>(); - //create a thread pool to crawling the URLs - ExecutorService executorService = Executors.newFixedThreadPool(4, r -> { - Thread t = new Thread(r); - //LeetCode doesn't allow executor.shutdown(), so use daemon threads to let the program shutdown, otherwise TLE. - t.setDaemon(true); - return t; - }); + // create a thread pool to crawling the URLs + ExecutorService executorService = + Executors.newFixedThreadPool( + 4, + r -> { + Thread t = new Thread(r); + // LeetCode doesn't allow executor.shutdown(), so use daemon threads + // to let the program shutdown, otherwise TLE. + t.setDaemon(true); + return t; + }); while (true) { String url = queue.poll(); if (url != null) { if (getHostName(url).equals(targetHostName) && visited.add(url)) { result.add(url); - tasks.add(executorService.submit(() -> { - List urls = htmlParser.getUrls(url); - for (String u : urls) { - queue.offer(u); - } - })); + tasks.add( + executorService.submit( + () -> { + List urls = htmlParser.getUrls(url); + for (String u : urls) { + queue.offer(u); + } + })); } } else { if (!tasks.isEmpty()) { - //wait for the next task to complete which might add new URLs into the queue + // wait for the next task to complete which might add new URLs into the + // queue Future nextTask = tasks.poll(); try { nextTask.get(); } catch (InterruptedException | ExecutionException e) { } } else { - //exit when all tasks are completed. + // exit when all tasks are completed. break; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1243.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1243.java index abf245410f..925f0a5ac4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1243.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1243.java @@ -18,9 +18,7 @@ public List transformArray(int[] arr) { } } } while (!Arrays.equals(copy, arr)); - return Arrays.stream(arr) - .boxed() - .collect(Collectors.toList()); + return Arrays.stream(arr).boxed().collect(Collectors.toList()); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1248.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1248.java index e77cf45e27..f594e4ef24 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1248.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1248.java @@ -5,7 +5,7 @@ public static class Solution1 { public int numberOfSubarrays(int[] nums, int k) { for (int i = 0; i < nums.length; i++) { for (int j = 0; j < nums.length; j++) { - //TODO: implement it + // TODO: implement it } } return -1; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1249.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1249.java index 324b6e0349..1795133648 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1249.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1249.java @@ -2,7 +2,6 @@ import java.util.Deque; import java.util.LinkedList; -import java.util.Stack; public class _1249 { public static class Solution1 { @@ -41,7 +40,7 @@ public String minRemoveToMakeValid(String s) { } public static class Solution2 { - /** + /* * My completely original solution on 10/26/2021. */ public String minRemoveToMakeValid(String s) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1252.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1252.java index 5a5af5f233..649b00fa73 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1252.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1252.java @@ -2,7 +2,7 @@ public class _1252 { public static class Solution1 { - /** + /* * Time: O(m*n + k) where k is the length of indices * Space: O(m*n) */ @@ -37,7 +37,7 @@ private void addOneToRow(int[][] matrix, int rowIndex) { } public static class Solution2 { - /** + /* * Time: O(m*n + k) where k is the length of indices * Space: O(m + n) */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1254.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1254.java index 7cd1975bdb..4bfc4aa281 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1254.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1254.java @@ -5,7 +5,7 @@ public class _1254 { public static class Solution1 { - /** + /* * BFS each cell in the grid with a visited matrix to avoid infinite loop. */ public int closedIsland(int[][] grid) { @@ -24,9 +24,9 @@ public int closedIsland(int[][] grid) { } private boolean bfs(int x, int y, int m, int n, int[][] grid, boolean[][] visited) { - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; Queue q = new LinkedList<>(); - q.offer(new int[]{x, y}); + q.offer(new int[] {x, y}); boolean isClosed = true; while (!q.isEmpty()) { int size = q.size(); @@ -36,11 +36,11 @@ private boolean bfs(int x, int y, int m, int n, int[][] grid, boolean[][] visite int newx = dirs[j] + curr[0]; int newy = dirs[j + 1] + curr[1]; if (newx < 0 || newx >= m || newy < 0 || newy >= n) { - //this means that (x,y) is a boundary cell + // this means that (x,y) is a boundary cell isClosed = false; } else if (!visited[newx][newy] && grid[newx][newy] == 0) { visited[newx][newy] = true; - q.offer(new int[]{newx, newy}); + q.offer(new int[] {newx, newy}); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1257.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1257.java index a938ecf5d4..295314202f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1257.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1257.java @@ -7,7 +7,8 @@ public class _1257 { public static class Solution1 { - public String findSmallestRegion(List> regions, String region1, String region2) { + public String findSmallestRegion( + List> regions, String region1, String region2) { Map childToParent = new HashMap<>(); for (List region : regions) { for (int i = 1; i < region.size(); i++) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1258.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1258.java index e931e8093d..21f4e8e59b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1258.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1258.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -30,7 +29,8 @@ public List generateSentences(List> synonyms, String text) return list; } - private List findAllSynonymForThisWord(String sentence, int i, Map> map) { + private List findAllSynonymForThisWord( + String sentence, int i, Map> map) { String[] words = sentence.split(" "); List list = new ArrayList<>(); Set synonyms = map.get(words[i]); @@ -50,7 +50,8 @@ private String formWord(String[] words) { return sb.substring(0, sb.length() - 1); } - private Map> buildSynonymDict(String[] words, List> synonyms) { + private Map> buildSynonymDict( + String[] words, List> synonyms) { Map> map = new HashMap<>(); for (String key : words) { if (!map.containsKey(key)) { @@ -69,6 +70,5 @@ private Map> buildSynonymDict(String[] words, List> shiftGrid(int[][] grid, int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1266.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1266.java index f4d3163975..1502d08457 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1266.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1266.java @@ -2,7 +2,7 @@ public class _1266 { public static class Solution1 { - /** + /* * Time: O(n) * Space: O(1) *

diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1267.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1267.java index ae3bbc1c61..400a362945 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1267.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1267.java @@ -2,7 +2,7 @@ public class _1267 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/count-servers-that-communicate/discuss/436188/Java-or-Clean-And-Simple-or-Beats-100 */ public int countServers(int[][] grid) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1268.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1268.java index 6f4b2b6301..e7fea19a68 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1268.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1268.java @@ -143,7 +143,6 @@ private TrieNode buildTrie(String[] words) { tmp.isWord = true; } } - } return root; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1271.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1271.java index 871aff974d..3eee4f8c4c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1271.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1271.java @@ -10,7 +10,11 @@ public String toHexspeak(String num) { long numInt = Long.parseLong(num); String hexString = Long.toHexString(numInt); StringBuilder sb = new StringBuilder(); - Set set = new HashSet<>(Arrays.asList('A', 'B', 'C', 'D', 'E', 'F', '1', '0', 'a', 'b', 'c', 'd', 'e', 'f')); + Set set = + new HashSet<>( + Arrays.asList( + 'A', 'B', 'C', 'D', 'E', 'F', '1', '0', 'a', 'b', 'c', 'd', 'e', + 'f')); for (char c : hexString.toCharArray()) { if (!set.contains(c)) { return "ERROR"; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1273.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1273.java index c5340a0875..58fdd13598 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1273.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1273.java @@ -12,10 +12,11 @@ public int deleteTreeNodes(int nodes, int[] parent, int[] value) { while (i > 0 && parent[i] == parentIndex) { sum += value[i--]; } - //we'll reset the value to be the newly computed sum of this node and all of its children + // we'll reset the value to be the newly computed sum of this node and all of its + // children value[parentIndex] = value[parentIndex] + sum; } - //then we'll reset this node's children to be zero if this node's computed sum is zero + // then we'll reset this node's children to be zero if this node's computed sum is zero for (int i = 0; i < value.length; i++) { if (value[i] == 0) { for (int j = 0; j < parent.length; j++) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1275.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1275.java index 9d36ab6cdf..02d2cf56fa 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1275.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1275.java @@ -20,7 +20,7 @@ public String tictactoe(int[][] moves) { } private String wins(String[][] board) { - //check rows + // check rows for (int i = 0; i < 3; i++) { if (board[i][0] == null) { break; @@ -31,7 +31,7 @@ private String wins(String[][] board) { } } - //check columns + // check columns for (int j = 0; j < 3; j++) { if (board[0][j] == null) { break; @@ -42,12 +42,13 @@ private String wins(String[][] board) { } } - //check diagonals + // check diagonals if (board[1][1] == null) { return ""; } String str = board[1][1]; - if (str.equals(board[0][0]) && str.equals(board[2][2]) || (str.equals(board[0][2]) && str.equals(board[2][0]))) { + if (str.equals(board[0][0]) && str.equals(board[2][2]) + || (str.equals(board[0][2]) && str.equals(board[2][0]))) { return getWinner(str); } return ""; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1277.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1277.java index cae35f6012..20d1bd0e00 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1277.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1277.java @@ -2,7 +2,7 @@ public class _1277 { public static class Solution1 { - /** + /* * In-place solution. * credit: https://leetcode.com/problems/count-square-submatrices-with-all-ones/discuss/441306/Python-DP-solution */ @@ -13,7 +13,11 @@ public int countSquares(int[][] matrix) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (matrix[i][j] > 0 && i > 0 && j > 0) { - matrix[i][j] = Math.min(matrix[i - 1][j - 1], Math.min(matrix[i - 1][j], matrix[i][j - 1])) + 1; + matrix[i][j] = + Math.min( + matrix[i - 1][j - 1], + Math.min(matrix[i - 1][j], matrix[i][j - 1])) + + 1; } count += matrix[i][j]; } @@ -23,7 +27,7 @@ public int countSquares(int[][] matrix) { } public static class Solution2 { - /** + /* * Use m*n extra space solution. * credit: https://leetcode.com/problems/count-square-submatrices-with-all-ones/discuss/441312/Java-Simple-DP-solution */ @@ -44,7 +48,9 @@ public int countSquares(int[][] matrix) { for (int i = 1; i < m; i++) { for (int j = 1; j < n; j++) { if (matrix[i][j] == 1) { - dp[i][j] = Math.min(dp[i - 1][j - 1], Math.min(dp[i - 1][j], dp[i][j - 1])) + 1; + dp[i][j] = + Math.min(dp[i - 1][j - 1], Math.min(dp[i - 1][j], dp[i][j - 1])) + + 1; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1286.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1286.java index ae8a3f8df2..8338d21eff 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1286.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1286.java @@ -20,7 +20,8 @@ public CombinationIterator(String characters, int combinationLength) { buildAllCombinations(characters, 0, new StringBuilder(), visited); } - private void buildAllCombinations(String characters, int start, StringBuilder sb, boolean[] visited) { + private void buildAllCombinations( + String characters, int start, StringBuilder sb, boolean[] visited) { if (sb.length() == combinationLength) { list.add(sb.toString()); return; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1291.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1291.java index e10a567ae9..a2c414c39f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1291.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1291.java @@ -5,7 +5,7 @@ public class _1291 { public static class Solution1 { public List sequentialDigits(int low, int high) { - //TODO: implement it + // TODO: implement it return null; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1295.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1295.java index d8fed02ad0..4a22819476 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1295.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1295.java @@ -17,7 +17,10 @@ public int findNumbers(int[] nums) { public static class Solution2 { public int findNumbers(int[] nums) { - return (int) Arrays.stream(nums).filter(num -> String.valueOf(num).length() % 2 == 0).count(); + return (int) + Arrays.stream(nums) + .filter(num -> String.valueOf(num).length() % 2 == 0) + .count(); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1296.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1296.java index 8c1de8e8e7..b52aed0c1c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1296.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1296.java @@ -27,7 +27,9 @@ public boolean isPossibleDivide(int[] nums, int k) { } private int findNextMin(TreeMap treeMap) { - return treeMap.isEmpty() ? Integer.MIN_VALUE : treeMap.entrySet().iterator().next().getKey(); + return treeMap.isEmpty() + ? Integer.MIN_VALUE + : treeMap.entrySet().iterator().next().getKey(); } private boolean isConsecutiveK(TreeMap treeMap, int min, int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1300.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1300.java index b87d35c158..68b839f395 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1300.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1300.java @@ -13,10 +13,10 @@ public int findBestValue(int[] arr, int target) { if (ave >= max) { return max; } - //if ave is the best value, what's the difference to target? + // if ave is the best value, what's the difference to target? int closetDiff = findClosestDiffIfReplaceWithVal(arr, ave, target); int bestValue = ave; - //extend candidate towards the right to see how close the sum could be to target + // extend candidate towards the right to see how close the sum could be to target int candidateOnTheRight = ave; while (candidateOnTheRight <= max) { int thisOne = findClosestDiffIfReplaceWithVal(arr, ++candidateOnTheRight, target); @@ -28,7 +28,7 @@ public int findBestValue(int[] arr, int target) { } } - //extend candidate towards the left to see how close the sum could be to target + // extend candidate towards the left to see how close the sum could be to target int candidateOnTheLeft = ave; while (candidateOnTheLeft >= min) { int thisOne = findClosestDiffIfReplaceWithVal(arr, --candidateOnTheLeft, target); @@ -53,6 +53,5 @@ private int findClosestDiffIfReplaceWithVal(int[] arr, int replaceValue, int tar } return Math.abs(sum - target); } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1302.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1302.java index 6f90faff96..b0a9c6ee59 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1302.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1302.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1305.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1305.java index 91708c858f..57757a7313 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1305.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1305.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1309.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1309.java index 7685e76109..ad76db7b9c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1309.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1309.java @@ -5,7 +5,7 @@ public class _1309 { public static class Solution1 { - //TODO: very silly solution, optimze it + // TODO: very silly solution, optimze it public String freqAlphabets(String s) { Map map = new HashMap<>(); map.put("1", "a"); @@ -36,10 +36,16 @@ public String freqAlphabets(String s) { map.put("26#", "z"); StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); ) { - if (Integer.parseInt("" + s.charAt(i)) == 1 && i + 1 < s.length() && i + 2 < s.length() && s.charAt(i + 2) == '#') { + if (Integer.parseInt("" + s.charAt(i)) == 1 + && i + 1 < s.length() + && i + 2 < s.length() + && s.charAt(i + 2) == '#') { sb.append(map.get(s.substring(i, i + 3))); i += 3; - } else if (Integer.parseInt("" + s.charAt(i)) == 2 && i + 1 < s.length() && i + 2 < s.length() && s.charAt(i + 2) == '#') { + } else if (Integer.parseInt("" + s.charAt(i)) == 2 + && i + 1 < s.length() + && i + 2 < s.length() + && s.charAt(i + 2) == '#') { sb.append(map.get(s.substring(i, i + 3))); i += 3; } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1314.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1314.java index 0776008e6f..b02b15e487 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1314.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1314.java @@ -5,7 +5,7 @@ public class _1314 { public static class Solution1 { - /** + /* * This is a brute force solution without using prefix sum. i.e. lots of repeated computation. */ public int[][] matrixBlockSum(int[][] mat, int k) { @@ -40,7 +40,7 @@ private List findRange(int iOrJ, int k, int upper) { } public static class Solution2 { - /** + /* * This is using prefix sum, much more efficient and saves a lot of repeated computation, * built on top of this: https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/firstthousand/_304.java */ @@ -50,8 +50,10 @@ public int[][] matrixBlockSum(int[][] mat, int k) { int[][] prefixSum = new int[m + 1][n + 1]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { - //because we add prefixSum[i + 1][j] and prefixSum[i][j + 1], this means we added their shared area twice, so we'll deduct it once: prefixSum[i][j] - prefixSum[i + 1][j + 1] = mat[i][j] + prefixSum[i + 1][j] + prefixSum[i][j + 1] - prefixSum[i][j]; + // because we add prefixSum[i + 1][j] and prefixSum[i][j + 1], this means we + // added their shared area twice, so we'll deduct it once: prefixSum[i][j] + prefixSum[i + 1][j + 1] = + mat[i][j] + prefixSum[i + 1][j] + prefixSum[i][j + 1] - prefixSum[i][j]; } } int[][] result = new int[m][n]; @@ -62,8 +64,13 @@ public int[][] matrixBlockSum(int[][] mat, int k) { int col1 = range[2]; int row2 = range[1]; int col2 = range[3]; - //because we deducted prefixSum[row2 + 1][col1] and prefixSum[row1][col2 + 1], we deducted the shared area prefixSum[row1][col1] twice, so we added it back - result[i][j] = prefixSum[row2 + 1][col2 + 1] - prefixSum[row2 + 1][col1] - prefixSum[row1][col2 + 1] + prefixSum[row1][col1]; + // because we deducted prefixSum[row2 + 1][col1] and prefixSum[row1][col2 + 1], + // we deducted the shared area prefixSum[row1][col1] twice, so we added it back + result[i][j] = + prefixSum[row2 + 1][col2 + 1] + - prefixSum[row2 + 1][col1] + - prefixSum[row1][col2 + 1] + + prefixSum[row1][col1]; } } return result; @@ -74,7 +81,7 @@ private int[] findRange(int i, int j, int k, int m, int n) { int rowMax = i + k < m ? i + k : m - 1; int colMin = j - k < 0 ? 0 : j - k; int colMax = j + k < n ? j + k : n - 1; - return new int[]{rowMin, rowMax, colMin, colMax}; + return new int[] {rowMin, rowMax, colMin, colMax}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1317.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1317.java index 26950e179d..8ea7aa8aaf 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1317.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1317.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1317. Convert Integer to the Sum of Two No-Zero Integers * * Given an integer n. No-Zero integer is a positive integer which doesn't contain any 0 in its decimal representation. @@ -41,7 +41,7 @@ public int[] getNoZeroIntegers(int n) { int right = n - 1; while (left <= right) { if (noZero(left) && noZero(right)) { - return new int[]{left, right}; + return new int[] {left, right}; } else { left++; right--; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1323.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1323.java index 2d93771653..4726ccfc67 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1323.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1323.java @@ -2,7 +2,7 @@ import java.util.stream.IntStream; -/** +/* * 1323. Maximum 69 Number * * Given a positive integer num consisting only of digits 6 and 9. @@ -36,7 +36,10 @@ public class _1323 { public static class Solution1 { public int maximum69Number(int num) { char[] chars = Integer.toString(num).toCharArray(); - IntStream.range(0, chars.length).filter(i -> chars[i] == '6').findFirst().ifPresent(i -> chars[i] = '9'); + IntStream.range(0, chars.length) + .filter(i -> chars[i] == '6') + .findFirst() + .ifPresent(i -> chars[i] = '9'); return Integer.parseInt(new String(chars)); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1324.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1324.java index 4fdebbaf4b..2030720c17 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1324.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1324.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -/** +/* * 1324. Print Words Vertically * * Given a string s. Return all the words vertically in the same order in which they appear in s. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1325.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1325.java index 732a734956..fcd3e180f5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1325.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1325.java @@ -2,7 +2,7 @@ import com.fishercoder.common.classes.TreeNode; -/** +/* * 1325. Delete Leaves With a Given Value * * Given a binary tree root and an integer target, delete all the leaf nodes with value target. @@ -66,7 +66,7 @@ * */ public class _1325 { public static class Solution1 { - /** + /* * my original but verbose solution */ public TreeNode removeLeafNodes(TreeNode root, int target) { @@ -84,10 +84,16 @@ private TreeNode removeLeafNodes(int target, TreeNode root) { root = null; return root; } - if (root.left != null && root.left.val == target && root.left.left == null && root.left.right == null) { + if (root.left != null + && root.left.val == target + && root.left.left == null + && root.left.right == null) { root.left = null; } - if (root.right != null && root.right.val == target && root.right.left == null && root.right.right == null) { + if (root.right != null + && root.right.val == target + && root.right.left == null + && root.right.right == null) { root.right = null; } removeLeafNodes(target, root.left); @@ -107,7 +113,7 @@ private boolean hasTargetLeafNodes(TreeNode root, int target) { } public static class Solution2 { - /**A much more concise and efficient solution.*/ + /*A much more concise and efficient solution.*/ public TreeNode removeLeafNodes(TreeNode root, int target) { if (root == null) { return root; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1329.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1329.java index b52c69b8ce..42394c83e4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1329.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1329.java @@ -4,7 +4,7 @@ import java.util.Collections; import java.util.List; -/** +/* * 1329. Sort the Matrix Diagonally * * Given a m * n matrix mat of integers, diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1331.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1331.java index 8824bc28fc..c008344979 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1331.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1331.java @@ -4,7 +4,7 @@ import java.util.Map; import java.util.TreeSet; -/** +/* * 1331. Rank Transform of an Array * * Given an array of integers arr, replace each element with its rank. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1332.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1332.java index ea18394d4b..2369bb9b63 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1332.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1332.java @@ -2,7 +2,7 @@ public class _1332 { public static class Solution1 { - /** + /* * Notice: there are only two characters in the given string: 'a' and 'b' */ public int removePalindromeSub(String s) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1333.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1333.java index 831aa65a3f..20002b62a3 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1333.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1333.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.stream.Collectors; -/** +/* * 1333. Filter Restaurants by Vegan-Friendly, Price and Distance * * Given the array restaurants where restaurants[i] = [idi, ratingi, veganFriendlyi, pricei, distancei]. @@ -49,11 +49,13 @@ * */ public class _1333 { public static class Solution1 { - public List filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice, int maxDistance) { + public List filterRestaurants( + int[][] restaurants, int veganFriendly, int maxPrice, int maxDistance) { List list = new ArrayList<>(); for (int[] restaurant : restaurants) { if (((veganFriendly == 1 && restaurant[2] == 1) || veganFriendly == 0) - && restaurant[3] <= maxPrice && restaurant[4] <= maxDistance) { + && restaurant[3] <= maxPrice + && restaurant[4] <= maxDistance) { list.add(restaurant); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1334.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1334.java index 9dcb988646..168db640c2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1334.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1334.java @@ -7,7 +7,7 @@ public class _1334 { public static class Solution1 { - /** + /* * Dijkstra's algorithm to find the shortest path from each node to all possibly reachable nodes within limit. * Dijkstra's algorithm applies to weights are non-negative problems. * Keys to implement Dijkstra's algorithm: @@ -28,8 +28,8 @@ public int findTheCity(int n, int[][] edges, int distanceThreshold) { int source = edge[0]; int dest = edge[1]; int weight = edge[2]; - graph.get(source).add(new int[]{dest, weight}); - graph.get(dest).add(new int[]{source, weight}); + graph.get(source).add(new int[] {dest, weight}); + graph.get(dest).add(new int[] {source, weight}); } for (int i = 0; i < n; i++) { dijkstraAlgo(graph, i, shortestPaths[i]); @@ -37,7 +37,8 @@ public int findTheCity(int n, int[][] edges, int distanceThreshold) { return findCityWithFewestReachableCities(shortestPaths, distanceThreshold); } - private int findCityWithFewestReachableCities(int[][] shortestPaths, int distanceThreshold) { + private int findCityWithFewestReachableCities( + int[][] shortestPaths, int distanceThreshold) { int ans = 0; int fewestReachable = shortestPaths.length; for (int i = 0; i < shortestPaths.length; i++) { @@ -59,7 +60,7 @@ private void dijkstraAlgo(List> graph, int startCity, int[] shortest Arrays.fill(shortestPath, Integer.MAX_VALUE); shortestPath[startCity] = 0; PriorityQueue minHeap = new PriorityQueue<>((a, b) -> a[1] - b[1]); - minHeap.offer(new int[]{startCity, 0}); + minHeap.offer(new int[] {startCity, 0}); while (!minHeap.isEmpty()) { int[] curr = minHeap.poll(); int currCity = curr[0]; @@ -72,11 +73,10 @@ private void dijkstraAlgo(List> graph, int startCity, int[] shortest int neighborCost = neighbor[1]; if (currCost + neighborCost < shortestPath[neighborCity]) { shortestPath[neighborCity] = currCost + neighborCost; - minHeap.offer(new int[]{neighborCity, shortestPath[neighborCity]}); + minHeap.offer(new int[] {neighborCity, shortestPath[neighborCity]}); } } } } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1337.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1337.java index 6b40198437..e569dc72c5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1337.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1337.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1337. Remove Palindromic Subsequences * * Given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1338.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1338.java index a0f4a29c16..00ae9befc9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1338.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1338.java @@ -1,7 +1,7 @@ package com.fishercoder.solutions.secondthousand; -import java.util.Collections; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,7 +35,7 @@ public int minSetSize(int[] arr) { } List list = new ArrayList<>(); for (int key : map.keySet()) { - list.add(new int[]{map.get(key), key}); + list.add(new int[] {map.get(key), key}); } Collections.sort(list, (a, b) -> b[0] - a[0]); int minSet = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1339.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1339.java index ae4b522bcd..ef18cf1771 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1339.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1339.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -34,7 +33,7 @@ private long postOrder(TreeNode root, Set set) { } public static class Solution2 { - /** + /* * My completely original solution, but much more verbose and uses more extra space. */ public int maxProduct(TreeNode root) { @@ -52,7 +51,8 @@ public int maxProduct(TreeNode root) { return (int) (result % modulo); } - private void postOrderBuildProductList(TreeNode root, Map sumMap, List productList, Long total) { + private void postOrderBuildProductList( + TreeNode root, Map sumMap, List productList, Long total) { if (root == null) { return; } @@ -62,16 +62,16 @@ private void postOrderBuildProductList(TreeNode root, Map sumMap postOrderBuildProductList(root.left, sumMap, productList, total); postOrderBuildProductList(root.right, sumMap, productList, total); if (root.left != null) { - //suppose we cut off left subtree now + // suppose we cut off left subtree now long leftSum = sumMap.get(root.left); long remainder = total - leftSum; - productList.add(new long[]{leftSum, remainder}); + productList.add(new long[] {leftSum, remainder}); } if (root.right != null) { - //suppose we cut off right subtree now + // suppose we cut off right subtree now long rightSum = sumMap.get(root.right); long remainder = total - rightSum; - productList.add(new long[]{rightSum, remainder}); + productList.add(new long[] {rightSum, remainder}); } } @@ -85,6 +85,5 @@ private long postOrderBuildSumMap(TreeNode root, Map sumMap) { sumMap.put(root, sum); return sum; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1341.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1341.java index 3dc73313e9..107234d5a5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1341.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1341.java @@ -17,7 +17,7 @@ public int[] kWeakestRows(int[][] mat, int k) { break; } } - list.add(new int[]{i, soldiers}); + list.add(new int[] {i, soldiers}); } Collections.sort(list, (a, b) -> a[1] == b[1] ? a[0] - b[0] : a[1] - b[1]); int[] result = new int[k]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1345.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1345.java index f3e4ca1b9e..de5115361a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1345.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1345.java @@ -8,7 +8,7 @@ public class _1345 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/jump-game-iv/discuss/502699/JavaC%2B%2B-BFS-Solution-Clean-code-O(N) */ public int minJumps(int[] arr) { @@ -36,7 +36,10 @@ public int minJumps(int[] arr) { indexQueue.offer(next); } } - nextPossibleIndices.clear();//this line is the key to this entire algorithm to avoid TLE, explanation: https://leetcode.com/problems/jump-game-iv/discuss/502699/JavaC++-BFS-Solution-Clean-code-O(N)/445620 + nextPossibleIndices + .clear(); // this line is the key to this entire algorithm to avoid TLE, + // explanation: + // https://leetcode.com/problems/jump-game-iv/discuss/502699/JavaC++-BFS-Solution-Clean-code-O(N)/445620 } steps++; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1348.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1348.java index 1db401cb72..e6e3c3d59c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1348.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1348.java @@ -9,7 +9,7 @@ public class _1348 { public static class Solution1 { public static class TweetCounts { - /** + /* * credit: https://leetcode.com/problems/tweet-counts-per-frequency/discuss/503453/Java-TreeMap-Accepted-Solution-Easy-Understand */ private Map> map; @@ -26,7 +26,8 @@ public void recordTweet(String tweetName, int time) { tweetMap.put(time, tweetMap.getOrDefault(time, 0) + 1); } - public List getTweetCountsPerFrequency(String freq, String tweetName, int startTime, int endTime) { + public List getTweetCountsPerFrequency( + String freq, String tweetName, int startTime, int endTime) { if (!map.containsKey(tweetName)) { return null; } @@ -41,7 +42,8 @@ public List getTweetCountsPerFrequency(String freq, String tweetName, i int size = ((endTime - startTime) / interval) + 1; int[] buckets = new int[size]; TreeMap tweetMap = map.get(tweetName); - for (Map.Entry entry : tweetMap.subMap(startTime, endTime + 1).entrySet()) { + for (Map.Entry entry : + tweetMap.subMap(startTime, endTime + 1).entrySet()) { int index = (entry.getKey() - startTime) / interval; buckets[index] += entry.getValue(); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1349.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1349.java index 2e113fd880..eccbf7d590 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1349.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1349.java @@ -4,7 +4,7 @@ public class _1349 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/maximum-students-taking-exam/discuss/503686/A-simple-tutorial-on-this-bitmasking-problem */ public int maxStudents(char[][] seats) { @@ -29,8 +29,11 @@ public int maxStudents(char[][] seats) { dp[i][j] = Integer.bitCount(j); } else { for (int k = 0; k < stateSize; k++) { - if (((k << 1) & j) == 0 && ((j << 1) & k) == 0 && dp[i - 1][k] != -1) { - dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + Integer.bitCount(j)); + if (((k << 1) & j) == 0 + && ((j << 1) & k) == 0 + && dp[i - 1][k] != -1) { + dp[i][j] = + Math.max(dp[i][j], dp[i - 1][k] + Integer.bitCount(j)); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1352.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1352.java index 713219f56d..00ebc10514 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1352.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1352.java @@ -5,7 +5,7 @@ public class _1352 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/product-of-the-last-k-numbers/discuss/510260/JavaC%2B%2BPython-Prefix-Product */ public static class ProductOfNumbers { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1353.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1353.java index 0a64ff3836..fd1a64cb16 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1353.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1353.java @@ -5,7 +5,7 @@ public class _1353 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended/discuss/510263/JavaC%2B%2BPython-Priority-Queue *

* 1. Sort events by start time, if ties, by end time; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1354.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1354.java index 6efdfed959..f21a8e6596 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1354.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1354.java @@ -4,7 +4,7 @@ public class _1354 { public static class Solution1 { - /** + /* * Use % is the key here to avoid TLE, a good test case for this is [1,1000000000] */ public boolean isPossible(int[] target) { @@ -27,4 +27,4 @@ public boolean isPossible(int[] target) { return true; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1357.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1357.java index e4ace61762..6e12ae9c86 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1357.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1357.java @@ -28,7 +28,7 @@ public double getBill(int[] product, int[] amount) { totalPrice += productsToPrices.get(product[i]) * amount[i]; } if (customerCount + 1 == n) { - //apply discount + // apply discount totalPrice *= (double) (100 - discount) / 100; customerCount = 0; } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1358.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1358.java index 7c59d4cda1..253be3a57c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1358.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1358.java @@ -2,7 +2,7 @@ public class _1358 { public static class Solution1 { - /** + /* * A classic sliding window problem, no dp or backtracking, just sliding window: use two pointers. * my new favorite question! */ @@ -20,6 +20,5 @@ public int numberOfSubstrings(String s) { } return result; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1360.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1360.java index c7aa1d4cba..47c36457a0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1360.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1360.java @@ -5,8 +5,15 @@ public static class Solution1 { public int daysBetweenDates(String date1, String date2) { String[] strings1 = date1.split("-"); String[] strings2 = date2.split("-"); - return Math.abs(julianDay(Integer.parseInt(strings1[0]), Integer.parseInt(strings1[1]), Integer.parseInt(strings1[2])) - - julianDay(Integer.parseInt(strings2[0]), Integer.parseInt(strings2[1]), Integer.parseInt(strings2[2]))); + return Math.abs( + julianDay( + Integer.parseInt(strings1[0]), + Integer.parseInt(strings1[1]), + Integer.parseInt(strings1[2])) + - julianDay( + Integer.parseInt(strings2[0]), + Integer.parseInt(strings2[1]), + Integer.parseInt(strings2[2]))); } public int julianDay(int year, int month, int day) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1361.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1361.java index 43b9cc0a42..75633f3c8c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1361.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1361.java @@ -17,7 +17,7 @@ public boolean validateBinaryTreeNodes(int n, int[] leftChild, int[] rightChild) indegree[rightChild[i]]++; } } - //only one node has in-degree = 0 + // only one node has in-degree = 0 int indegreeZero = 0; for (int num : indegree) { if (num == 0) { @@ -26,12 +26,12 @@ public boolean validateBinaryTreeNodes(int n, int[] leftChild, int[] rightChild) return false; } } - //every other node's in-degree must be exactly equal to 1 + // every other node's in-degree must be exactly equal to 1 if (num > 1) { return false; } } - //no bi-directional pointing + // no bi-directional pointing Map> map = new HashMap<>(); for (int i = 0; i < n; i++) { map.put(i, new ArrayList<>()); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1362.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1362.java index 0b5294f7b2..cf695269cf 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1362.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1362.java @@ -15,7 +15,7 @@ public int[] closestDivisors(int num) { } product = left * right; } - return new int[]{left, right}; + return new int[] {left, right}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1366.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1366.java index 8044867589..48e0ff7acc 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1366.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1366.java @@ -24,23 +24,24 @@ public String rankTeams(String[] votes) { nodes[vote.charAt(i) - 'A'].count[i]++; } } - Arrays.sort(nodes, new Comparator() { - @Override - public int compare(Node o1, Node o2) { - for (int i = 0; i < 26; i++) { - if (o1.count[i] != o2.count[i]) { - return o2.count[i] - o1.count[i]; + Arrays.sort( + nodes, + new Comparator() { + @Override + public int compare(Node o1, Node o2) { + for (int i = 0; i < 26; i++) { + if (o1.count[i] != o2.count[i]) { + return o2.count[i] - o1.count[i]; + } + } + return o1.c - o2.c; } - } - return o1.c - o2.c; - } - }); + }); StringBuilder sb = new StringBuilder(); for (int i = 0; i < votes[0].length(); i++) { sb.append(nodes[i].c); } return sb.toString(); } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1367.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1367.java index 25995f2349..048f5aed94 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1367.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1367.java @@ -2,7 +2,6 @@ import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1372.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1372.java index 33db1cb38f..45c67680d5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1372.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1372.java @@ -2,11 +2,9 @@ import com.fishercoder.common.classes.TreeNode; -import java.sql.Struct; - public class _1372 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree/discuss/531808/Java-Recursion-Try-each-node-as-a-zigzag-root-then-return-valid-sum-to-parent */ int maxLength = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1373.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1373.java index fd30839473..d5dd1bb926 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1373.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1373.java @@ -4,14 +4,14 @@ public class _1373 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/maximum-sum-bst-in-binary-tree/discuss/532021/Java-Post-Order */ public int maxSumBST(TreeNode root) { return postOrder(root)[4]; } - /** + /* * result[0] means this tree is a BST * result[1] means the sum of this tree * result[2] means the left boundary @@ -20,16 +20,25 @@ public int maxSumBST(TreeNode root) { */ private int[] postOrder(TreeNode root) { if (root == null) { - return new int[]{1, 0, Integer.MAX_VALUE, Integer.MIN_VALUE, 0}; + return new int[] {1, 0, Integer.MAX_VALUE, Integer.MIN_VALUE, 0}; } int[] leftSide = postOrder(root.left); int[] rightSide = postOrder(root.right); int localMax = Math.max(leftSide[4], rightSide[4]); - if (leftSide[0] == 1 && rightSide[0] == 1 && root.val > leftSide[3] && root.val < rightSide[2]) { + if (leftSide[0] == 1 + && rightSide[0] == 1 + && root.val > leftSide[3] + && root.val < rightSide[2]) { int sum = root.val + leftSide[1] + rightSide[1]; - return new int[]{1, sum, leftSide[2] == Integer.MAX_VALUE ? root.val : leftSide[2], rightSide[3] == Integer.MIN_VALUE ? root.val : rightSide[3], Math.max(localMax, sum)}; + return new int[] { + 1, + sum, + leftSide[2] == Integer.MAX_VALUE ? root.val : leftSide[2], + rightSide[3] == Integer.MIN_VALUE ? root.val : rightSide[3], + Math.max(localMax, sum) + }; } else { - return new int[]{0, 0, 0, 0, localMax}; + return new int[] {0, 0, 0, 0, localMax}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1375.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1375.java index 37c4ba647f..fdc96f4670 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1375.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1375.java @@ -4,7 +4,7 @@ public class _1375 { public static class Solution1 { public int numTimesAllBlue(int[] light) { int blues = 0; - int[] status = new int[light.length];//0 means off, 1 means on + int[] status = new int[light.length]; // 0 means off, 1 means on for (int i = 0; i < light.length; i++) { status[light[i] - 1] = 1; if (checkAllBlues(status, i)) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1376.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1376.java index c4b46e85b5..1289b0f07e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1376.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1376.java @@ -33,7 +33,14 @@ public int numOfMinutes(int n, int headID, int[] manager, int[] informTime) { return maxMinutes; } - private void backtracking(boolean[] visited, int managerId, int currentMinutes, int[] informTime, Set managerIdSet, Set visitedEmployees, Map> map) { + private void backtracking( + boolean[] visited, + int managerId, + int currentMinutes, + int[] informTime, + Set managerIdSet, + Set visitedEmployees, + Map> map) { if (visitedEmployees.contains(managerId)) { visitedEmployees.remove(managerId); } @@ -49,7 +56,14 @@ private void backtracking(boolean[] visited, int managerId, int currentMinutes, List suboridnates = map.get(managerId); for (int subordinate : suboridnates) { if (!visited[subordinate]) { - backtracking(visited, subordinate, currentMinutes + informTime[managerId], informTime, managerIdSet, visitedEmployees, map); + backtracking( + visited, + subordinate, + currentMinutes + informTime[managerId], + informTime, + managerIdSet, + visitedEmployees, + map); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1377.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1377.java index 46bcd0c8d8..a732f33fc4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1377.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1377.java @@ -1,15 +1,13 @@ package com.fishercoder.solutions.secondthousand; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Queue; public class _1377 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/frog-position-after-t-seconds/discuss/532505/Java-Straightforward-BFS-Clean-code-O(N) */ public double frogPosition(int n, int[][] edges, int t, int target) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1379.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1379.java index 6bcaf11063..9f64b37f9d 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1379.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1379.java @@ -4,7 +4,8 @@ public class _1379 { public static class Solution1 { - public final TreeNode getTargetCopy(final TreeNode original, final TreeNode cloned, final TreeNode target) { + public final TreeNode getTargetCopy( + final TreeNode original, final TreeNode cloned, final TreeNode target) { if (original == null) { return null; } @@ -20,10 +21,11 @@ public final TreeNode getTargetCopy(final TreeNode original, final TreeNode clon } public static class Solution2 { - /** + /* * My completely original solution on 5/17/2022. */ - public final TreeNode getTargetCopy(final TreeNode original, final TreeNode cloned, final TreeNode target) { + public final TreeNode getTargetCopy( + final TreeNode original, final TreeNode cloned, final TreeNode target) { if (original == null || cloned == null) { return null; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1381.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1381.java index 00409b2e66..14cf302a89 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1381.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1381.java @@ -39,7 +39,7 @@ public void increment(int k, int val) { } } - /** + /* * Implementation of Stack using Array */ public static class Solution2 { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1382.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1382.java index b60f38cfd1..3722ca5c88 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1382.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1382.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1386.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1386.java index c41229065d..6146b3f4d4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1386.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1386.java @@ -21,13 +21,29 @@ public int maxNumberOfFamilies(int n, int[][] reservedSeats) { if (reservedOnes.size() > 6) { continue; } - if (!reservedOnes.contains(2) && !reservedOnes.contains(3) && !reservedOnes.contains(4) && !reservedOnes.contains(5) && !reservedOnes.contains(6) && !reservedOnes.contains(7) && !reservedOnes.contains(8) && !reservedOnes.contains(9)) { + if (!reservedOnes.contains(2) + && !reservedOnes.contains(3) + && !reservedOnes.contains(4) + && !reservedOnes.contains(5) + && !reservedOnes.contains(6) + && !reservedOnes.contains(7) + && !reservedOnes.contains(8) + && !reservedOnes.contains(9)) { count += 2; - } else if (!reservedOnes.contains(4) && !reservedOnes.contains(5) && !reservedOnes.contains(6) && !reservedOnes.contains(7)) { + } else if (!reservedOnes.contains(4) + && !reservedOnes.contains(5) + && !reservedOnes.contains(6) + && !reservedOnes.contains(7)) { count++; - } else if (!reservedOnes.contains(2) && !reservedOnes.contains(3) && !reservedOnes.contains(4) && !reservedOnes.contains(5)) { + } else if (!reservedOnes.contains(2) + && !reservedOnes.contains(3) + && !reservedOnes.contains(4) + && !reservedOnes.contains(5)) { count++; - } else if (!reservedOnes.contains(6) && !reservedOnes.contains(7) && !reservedOnes.contains(8) && !reservedOnes.contains(9)) { + } else if (!reservedOnes.contains(6) + && !reservedOnes.contains(7) + && !reservedOnes.contains(8) + && !reservedOnes.contains(9)) { count++; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1387.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1387.java index 7309a9e2d0..9002d0e581 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1387.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1387.java @@ -9,7 +9,7 @@ public static class Solution1 { public int getKth(int lo, int hi, int k) { List power = new ArrayList<>(); for (int i = lo; i <= hi; i++) { - power.add(new int[]{getSteps(i), i}); + power.add(new int[] {getSteps(i), i}); } Collections.sort(power, (a, b) -> a[0] != b[0] ? a[0] - b[0] : a[1] - b[1]); return power.get(k - 1)[1]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1388.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1388.java index bfe96f13df..62c849786e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1388.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1388.java @@ -18,10 +18,12 @@ public int maxSizeSlices(int[] slices) { dp[i][j] = Math.max(dp[i][j], dp[i][k - 1] + dp[k][j]); } for (int k = i + 1; k < j; k += 3) { - dp[i][j] = Math.max(dp[i][j], - (i + 1 <= k - 1 ? dp[i + 1][k - 1] : 0) - + b[k] + (k + 1 <= j - 1 ? dp[k + 1][j - 1] : 0) - ); + dp[i][j] = + Math.max( + dp[i][j], + (i + 1 <= k - 1 ? dp[i + 1][k - 1] : 0) + + b[k] + + (k + 1 <= j - 1 ? dp[k + 1][j - 1] : 0)); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1390.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1390.java index c2097573ea..1f2f38f8e0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1390.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1390.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -/** +/* * 1390. Four Divisors * * Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1392.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1392.java index b6f7aaa296..b6ef654c46 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1392.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1392.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1392. Longest Happy Prefix * * A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself). @@ -31,14 +31,16 @@ * */ public class _1392 { public static class Solution1 { - /**credit: https://leetcode.com/problems/longest-happy-prefix/discuss/547446/C%2B%2BJava-Incremental-Hash-and-DP*/ + /*credit: https://leetcode.com/problems/longest-happy-prefix/discuss/547446/C%2B%2BJava-Incremental-Hash-and-DP*/ public String longestPrefix(String s) { int times = 2; long prefixHash = 0; long suffixHash = 0; long multiplier = 1; long len = 0; - long mod = 1000000007;//use some large prime as a modulo to avoid overflow errors, e.g. 10 ^ 9 + 7. + long mod = + 1000000007; // use some large prime as a modulo to avoid overflow errors, e.g. + // 10 ^ 9 + 7. for (int i = 0; i < s.length() - 1; i++) { prefixHash = (prefixHash * times + s.charAt(i)) % mod; suffixHash = (multiplier * s.charAt(s.length() - i - 1) + suffixHash) % mod; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1394.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1394.java index ef8d47af1d..0dabdeba41 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1394.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1394.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.Map; -/** +/* * 1394. Find Lucky Integer in an Array * * Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1395.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1395.java index dc5a10d2f9..a3dd808b8f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1395.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1395.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1395. Count Number of Teams *

* There are n soldiers standing in a line. Each soldier is assigned a unique rating value. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1396.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1396.java index 285ee3234a..fa01094524 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1396.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1396.java @@ -47,11 +47,12 @@ public void checkOut(int id, String stationName, int t) { String startToEndStation = stationAndTime.getStation() + "->" + stationName; int duration = t - stationAndTime.getTime(); if (!averageTimeMap.containsKey(startToEndStation)) { - averageTimeMap.put(startToEndStation, new double[]{duration, 1}); + averageTimeMap.put(startToEndStation, new double[] {duration, 1}); } else { double[] pair = averageTimeMap.get(startToEndStation); - double newAverage = (double) (pair[0] * pair[1] + duration) / (double) (pair[1] + 1); - averageTimeMap.put(startToEndStation, new double[]{newAverage, pair[1] + 1}); + double newAverage = + (double) (pair[0] * pair[1] + duration) / (double) (pair[1] + 1); + averageTimeMap.put(startToEndStation, new double[] {newAverage, pair[1] + 1}); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1399.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1399.java index 1060f09d0d..8fd89e9ef4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1399.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1399.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Map; -/** +/* * 1399. Count Largest Group * * Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1400.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1400.java index de5e269929..f49730b90d 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1400.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1400.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.Map; -/** +/* * 1400. Construct K Palindrome Strings * * Given a string s and an integer k. You should construct k non-empty palindrome strings using all the characters in s. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1401.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1401.java index 0ba56868fc..8b7c9d9859 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1401.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1401.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1401. Circle and Rectangle Overlapping * * Given a circle represented as (radius, x_center, y_center) and an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-left corner, and (x2, y2) are the coordinates of the top-right corner of the rectangle. @@ -32,7 +32,8 @@ * */ public class _1401 { public static class Solution1 { - public boolean checkOverlap(int radius, int xCenter, int yCenter, int x1, int y1, int x2, int y2) { + public boolean checkOverlap( + int radius, int xCenter, int yCenter, int x1, int y1, int x2, int y2) { if (x1 <= xCenter && x2 >= xCenter && y1 <= yCenter && y2 >= yCenter) { return true; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1403.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1403.java index 6eeb89c3f3..b6153ad281 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1403.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1403.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.stream.Collectors; -/** +/* * 1403. Minimum Subsequence in Non-Increasing Order * * Given the array nums, obtain a subsequence of the array whose sum of elements is strictly greater than the sum of the non included elements in such subsequence. @@ -35,10 +35,11 @@ public class _1403 { public static class Solution1 { public List minSubsequence(int[] nums) { - List list = Arrays.stream(nums) - .boxed() - .sorted(Collections.reverseOrder()) - .collect(Collectors.toCollection(() -> new ArrayList<>(nums.length))); + List list = + Arrays.stream(nums) + .boxed() + .sorted(Collections.reverseOrder()) + .collect(Collectors.toCollection(() -> new ArrayList<>(nums.length))); int sum = list.stream().mapToInt(num -> num).sum(); int minSum = 0; List result = new ArrayList<>(); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1405.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1405.java index 4ad35076a7..b160a3a004 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1405.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1405.java @@ -37,7 +37,7 @@ public String longestDiverseString(int a, int b, int c) { two.count--; } - //only after the above two poll() calls, then do below: + // only after the above two poll() calls, then do below: if (one.count > 0) { maxHeap.offer(one); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1408.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1408.java index 562bd3b52f..5fabff802d 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1408.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1408.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Set; -/** +/* * 1408. String Matching in an Array * * Given an array of string words. Return all strings in words which is substring of another word in any order. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1409.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1409.java index 75292b414f..22f63725a1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1409.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1409.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.Map; -/** +/* * 1409. Queries on a Permutation With Key * * Given the array queries of positive integers between 1 and m, you have to process all queries[i] (from i=0 to i=queries.length-1) according to the following rules: diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1410.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1410.java index bc5c898851..3af2863f3e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1410.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1410.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1410. HTML Entity Parser * * HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. @@ -51,10 +51,12 @@ public String entityParser(String text) { if (i + 7 <= text.length() && text.substring(i, i + 7).equals("⁄")) { sb.append("/"); i += 6; - } else if (i + 6 <= text.length() && text.substring(i, i + 6).equals(""")) { + } else if (i + 6 <= text.length() + && text.substring(i, i + 6).equals(""")) { sb.append("\""); i += 5; - } else if (i + 6 <= text.length() && text.substring(i, i + 6).equals("'")) { + } else if (i + 6 <= text.length() + && text.substring(i, i + 6).equals("'")) { sb.append("'"); i += 5; } else if (i + 5 <= text.length() && text.substring(i, i + 5).equals("&")) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1413.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1413.java index 5faaec01ed..a18616f492 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1413.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1413.java @@ -1,6 +1,6 @@ package com.fishercoder.solutions.secondthousand; -/** +/* * 1413. Minimum Value to Get Positive Step by Step Sum * * Given an array of integers nums, you start with an initial positive value startValue. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1414.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1414.java index 1a6cc743a2..8c0f5dd3a4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1414.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1414.java @@ -4,7 +4,7 @@ public class _1414 { public static class Solution1 { - /** + /* * My completely original solution, heap is not really necessary, a regular array/list works out as well. */ public int findMinFibonacciNumbers(int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1415.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1415.java index ddd3844f07..6925060733 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1415.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1415.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -/** +/* * 1415. The k-th Lexicographical String of All Happy Strings of Length n * * A happy string is a string that: @@ -44,7 +44,7 @@ public class _1415 { public static class Solution1 { public String getHappyString(int n, int k) { - char[] chars = new char[]{'a', 'b', 'c'}; + char[] chars = new char[] {'a', 'b', 'c'}; List happyStrings = new ArrayList<>(); happyStrings.add(""); happyStrings = findAllHappyStrings(chars, n, happyStrings); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1417.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1417.java index 28c5587de8..34b599cce0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1417.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1417.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -/** +/* * 1417. Reformat The String * * Given alphanumeric string s. (Alphanumeric string is a string consisting of lowercase English letters and digits). diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1418.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1418.java index 491d1db52f..f067af1d60 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1418.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1418.java @@ -9,7 +9,7 @@ import java.util.Set; import java.util.TreeMap; -/** +/* * 1418. Display Table of Food Orders in a Restaurant * * Given the array orders, which represents the orders that customers have done in a restaurant. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1423.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1423.java index 793dd97900..a018851f9b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1423.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1423.java @@ -23,7 +23,7 @@ public int maxScore(int[] cardPoints, int k) { } public static class Solution2 { - /** + /* * My own implementation after looking at hints on LeetCode. */ public int maxScore(int[] cardPoints, int k) { @@ -37,7 +37,8 @@ public int maxScore(int[] cardPoints, int k) { } long windowSum = 0; int ans = 0; - for (int i = 0, j = i; i < cardPoints.length - windowSize && j <= cardPoints.length + 1; ) { + for (int i = 0, j = i; + i < cardPoints.length - windowSize && j <= cardPoints.length + 1; ) { if (j - i < windowSize) { windowSum += cardPoints[j]; j++; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1424.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1424.java index 4e78ac7a8b..0b97b2b869 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1424.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1424.java @@ -4,7 +4,7 @@ public class _1424 { public static class Solution1 { - /** + /* * One key note: * For all elements on the same diagonal, the sums of their row index and column index are equal. * This is widely applicable to all matrix problems. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1428.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1428.java index 0feadbd4e4..65516b2d6e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1428.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1428.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.BinaryMatrix; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -15,7 +14,7 @@ public int leftMostColumnWithOne(BinaryMatrix binaryMatrix) { List list = new ArrayList(); for (int i = 0; i < m; i++) { int leftMostColumn = binarySearch(i, binaryMatrix, n - 1); - list.add(new int[]{i, leftMostColumn}); + list.add(new int[] {i, leftMostColumn}); } Collections.sort(list, (a, b) -> a[1] - b[1]); return list.get(0)[1] == 101 ? -1 : list.get(0)[1]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1429.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1429.java index d5b4f2677e..f170bce4fd 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1429.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1429.java @@ -6,7 +6,7 @@ public class _1429 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/first-unique-number/discuss/602698/Java-Easy-Set-O(1) *

* LinkedHashSet is a handy data structure to help preserve the order of all unique elements. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1438.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1438.java index 5983426b98..f904ad8195 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1438.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1438.java @@ -4,7 +4,7 @@ public class _1438 { public static class Solution1 { - /** + /* * My completely original solution on 1/19/2022. */ public int longestSubarray(int[] nums, int limit) { @@ -17,7 +17,9 @@ public int longestSubarray(int[] nums, int limit) { } maxHeap.offer(nums[right]); minHeap.offer(nums[right]); - if (!maxHeap.isEmpty() && !minHeap.isEmpty() && (maxHeap.peek() - minHeap.peek() <= limit)) { + if (!maxHeap.isEmpty() + && !minHeap.isEmpty() + && (maxHeap.peek() - minHeap.peek() <= limit)) { ans = Math.max(ans, right - left + 1); } else { maxHeap.remove(nums[left]); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1439.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1439.java index 2a770a7018..58809e235a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1439.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1439.java @@ -6,7 +6,7 @@ public class _1439 { public static class Solution1 { - /** + /* * My completely own implementation after reading the hint on LeetCode: * 1. We put the sum along with every single element's index in each row as an array into a TreeSet, let it sort by its sum ascendingly; * each time we poll an element out of the set, we can find the next m smallest sums by moving each row index to the right by one. @@ -17,21 +17,23 @@ public static class Solution1 { * Again, using a pen and paper to visualize my thought process helps a lot! */ public int kthSmallest(int[][] mat, int k) { - TreeSet treeSet = new TreeSet<>(new Comparator() { - @Override - public int compare(int[] o1, int[] o2) { - if (o1[0] != o2[0]) { - return o1[0] - o2[0]; - } else { - for (int i = 1; i < o1.length; i++) { - if (o1[i] != o2[i]) { - return o1[i] - o2[i]; - } - } - return 0; - } - } - }); + TreeSet treeSet = + new TreeSet<>( + new Comparator() { + @Override + public int compare(int[] o1, int[] o2) { + if (o1[0] != o2[0]) { + return o1[0] - o2[0]; + } else { + for (int i = 1; i < o1.length; i++) { + if (o1[i] != o2[i]) { + return o1[i] - o2[i]; + } + } + return 0; + } + } + }); int m = mat.length; int n = mat[0].length; int sum = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1448.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1448.java index 613a564df0..b4f792ce96 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1448.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1448.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.Collections; import java.util.PriorityQueue; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1452.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1452.java index e8f1694f23..066d4ba178 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1452.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1452.java @@ -13,16 +13,18 @@ public class _1452 { public static class Solution1 { public List peopleIndexes(List> favoriteCompanies) { - TreeMap map = new TreeMap<>(new Comparator() { - @Override - public int compare(String o1, String o2) { - int diffLength = o1.length() - o2.length(); - if (diffLength != 0) { - return diffLength; - } - return o1.compareTo(o2); - } - }); + TreeMap map = + new TreeMap<>( + new Comparator() { + @Override + public int compare(String o1, String o2) { + int diffLength = o1.length() - o2.length(); + if (diffLength != 0) { + return diffLength; + } + return o1.compareTo(o2); + } + }); Map> setMap = new HashMap<>(); for (int i = 0; i < favoriteCompanies.size(); i++) { List list = favoriteCompanies.get(i); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1456.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1456.java index 2aa76e28de..47f5d3bb08 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1456.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1456.java @@ -25,7 +25,9 @@ public int maxVowels(String s, int k) { left = 0; for (; right < s.length(); right++, left++) { char leftChar = s.charAt(left); - if (set.contains(leftChar) && vowels.containsKey(leftChar) && vowels.get(leftChar) > 0) { + if (set.contains(leftChar) + && vowels.containsKey(leftChar) + && vowels.get(leftChar) > 0) { vowels.put(leftChar, vowels.get(leftChar) - 1); } char rightChar = s.charAt(right); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1457.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1457.java index f4eab9f268..91273ff8a8 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1457.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1457.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1461.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1461.java index 1fd1ab35a0..1f41edbf3e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1461.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1461.java @@ -5,7 +5,7 @@ public class _1461 { public static class Solution1 { - /** + /* * inspired by https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/discuss/660505/Java-4-lines-solution */ public boolean hasAllCodes(String s, int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1462.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1462.java index 1944cd8e68..9cd3043a1c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1462.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1462.java @@ -7,11 +7,12 @@ public class _1462 { public static class Solution1 { - /** + /* * My completely original solution. * DFS + part of topological sort (building the adjacency list) */ - public List checkIfPrerequisite(int numCourses, int[][] prerequisites, int[][] queries) { + public List checkIfPrerequisite( + int numCourses, int[][] prerequisites, int[][] queries) { List[] graph = new ArrayList[numCourses]; for (int i = 0; i < numCourses; i++) { graph[i] = new ArrayList<>(); @@ -20,7 +21,7 @@ public List checkIfPrerequisite(int numCourses, int[][] prerequisites, graph[pre[0]].add(pre[1]); } List result = new ArrayList<>(); - //this cache is essential to speed things up, otherwise TLE on LeetCode + // this cache is essential to speed things up, otherwise TLE on LeetCode Map cache = new HashMap<>(); for (int[] query : queries) { result.add(isPrereq(query[0], query[1], graph, cache)); @@ -28,7 +29,8 @@ public List checkIfPrerequisite(int numCourses, int[][] prerequisites, return result; } - private Boolean isPrereq(int pre, int target, List[] graph, Map cache) { + private Boolean isPrereq( + int pre, int target, List[] graph, Map cache) { if (pre == target) { cache.put(pre + "-" + target, true); return true; @@ -47,6 +49,6 @@ private Boolean isPrereq(int pre, int target, List[] graph, Map> map = new HashMap<>(); Queue queue = new LinkedList<>(); int minReorder = 0; @@ -14,7 +14,7 @@ public int minReorder(int n, int[][] connections) { visited.add(i); } - //key is departure city, value is entering city + // key is departure city, value is entering city Map> reverseMap = new HashMap<>(); for (int[] con : connections) { if (!map.containsKey(con[1])) { @@ -27,8 +27,8 @@ public int minReorder(int n, int[][] connections) { } reverseMap.get(con[0]).add(con[1]); - //for all those directly connected to city 0, must be reordered if not yet - //and they are the start nodes of BFS + // for all those directly connected to city 0, must be reordered if not yet + // and they are the start nodes of BFS if (con[0] == 0) { minReorder++; queue.offer(con[1]); @@ -66,17 +66,20 @@ public int minReorder(int n, int[][] connections) { } public static class Solution2 { - /** + /* * build an adjacency list and BFS */ public int minReorder(int n, int[][] connections) { - //int[] in the below map holds two integers, the first one means the node, the second one means the direction: + // int[] in the below map holds two integers, the first one means the node, the second + // one means the direction: // 0 means it's pointing to the key, i.e. doesn't need to be flipped, // 1 means it's the opposite direction, i.e. needs to be flipped Map> adjList = new HashMap<>(); for (int[] conn : connections) { - adjList.computeIfAbsent(conn[0], k -> new ArrayList<>()).add(new int[]{conn[1], 1}); - adjList.computeIfAbsent(conn[1], k -> new ArrayList<>()).add(new int[]{conn[0], 0}); + adjList.computeIfAbsent(conn[0], k -> new ArrayList<>()) + .add(new int[] {conn[1], 1}); + adjList.computeIfAbsent(conn[1], k -> new ArrayList<>()) + .add(new int[] {conn[0], 0}); } int count = 0; Queue queue = new LinkedList<>(); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1469.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1469.java index 6c9d9a0769..412fb690e9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1469.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1469.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1472.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1472.java index 99296b7f77..b1e94b8ace 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1472.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1472.java @@ -38,6 +38,5 @@ public String forward(int steps) { return history.get(curr); } } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1481.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1481.java index 9af87c75fd..be375531f0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1481.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1481.java @@ -11,11 +11,10 @@ public int findLeastNumOfUniqueInts(int[] arr, int k) { for (int num : arr) { unSortedMap.put(num, unSortedMap.getOrDefault(num, 0) + 1); } - //LinkedHashMap preserve the ordering of elements in which they are inserted + // LinkedHashMap preserve the ordering of elements in which they are inserted LinkedHashMap sortedMap = new LinkedHashMap<>(); - unSortedMap.entrySet() - .stream() + unSortedMap.entrySet().stream() .sorted(Map.Entry.comparingByValue()) .forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue())); int leastUniq = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1482.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1482.java index 9e190e721d..389deb9c46 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1482.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1482.java @@ -2,7 +2,7 @@ public class _1482 { public static class Solution1 { - /** + /* * https://leetcode.com/problems/minimum-number-of-days-to-make-m-bouquets/discuss/686316/JavaC%2B%2BPython-Binary-Search */ public int minDays(int[] bloomDay, int m, int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1485.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1485.java index 698ef92a3b..b5d5d9f27c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1485.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1485.java @@ -61,17 +61,12 @@ public static class Node { public Node right; public Node random; - public Node() { - } - - ; + public Node() {} public Node(int val) { this.val = val; } - ; - public Node(int val, Node left, Node right, Node random) { this.val = val; this.left = left; @@ -86,17 +81,12 @@ public static class NodeCopy { public NodeCopy right; public NodeCopy random; - public NodeCopy() { - } - - ; + public NodeCopy() {} public NodeCopy(int val) { this.val = val; } - ; - public NodeCopy(int val, NodeCopy left, NodeCopy right, NodeCopy random) { this.val = val; this.left = left; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1490.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1490.java index b3796c986b..14b9389a40 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1490.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1490.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.Node; - import java.util.HashMap; import java.util.LinkedList; import java.util.Map; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1493.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1493.java index 51978640de..e54a39e203 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1493.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1493.java @@ -14,9 +14,9 @@ public int longestSubarray(int[] nums) { right++; } if (right < nums.length && nums[right] == 1) { - brackets.add(new int[]{i, right}); + brackets.add(new int[] {i, right}); } else { - brackets.add(new int[]{i, right - 1}); + brackets.add(new int[] {i, right - 1}); } i = right; } @@ -41,7 +41,7 @@ public int longestSubarray(int[] nums) { } public static class Solution2 { - /** + /* * Sliding window solution * Credit: https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element/discuss/708112/JavaC%2B%2BPython-Sliding-Window-at-most-one-0 *

diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1507.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1507.java index 9f0ba33889..755ffef4f9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1507.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1507.java @@ -59,6 +59,5 @@ private String getMonth(String month) { } return result; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1509.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1509.java index 95c74e65a9..547be11472 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1509.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1509.java @@ -10,16 +10,16 @@ public int minDifference(int[] nums) { } Arrays.sort(nums); int len = nums.length; - //try to change three biggest nums to smallest + // try to change three biggest nums to smallest int minDiff = Math.abs(nums[len - 4] - nums[0]); - //now try to change the three smallest to biggest + // now try to change the three smallest to biggest minDiff = Math.min(minDiff, nums[len - 1] - nums[3]); - //now try to change first two and last one + // now try to change first two and last one minDiff = Math.min(minDiff, nums[len - 2] - nums[2]); - //now try to change first one and last two + // now try to change first one and last two minDiff = Math.min(minDiff, nums[len - 3] - nums[1]); return minDiff; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1524.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1524.java index 2a72a23846..9bf5e37a18 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1524.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1524.java @@ -2,7 +2,7 @@ public class _1524 { public static class Solution1 { - /** + /* * This brute force solution will throw exceed time limit exceeded exception on LeetCode. */ public int numOfSubarrays(int[] arr) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1526.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1526.java index b1e2efdfd1..ae5e0b628a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1526.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1526.java @@ -2,7 +2,7 @@ public class _1526 { public static class Solution1 { - /** + /* * This brute force solution results in TLE on LeetCode. */ public int minNumberOperations(int[] target) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1530.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1530.java index 8b05eae343..f49da8f469 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1530.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1530.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -24,7 +23,8 @@ public int countPairs(TreeNode root, int distance) { return pairs / 2; } - private int bfsToPossibleLeaves(TreeNode leaf, int distance, Map childToParentMap) { + private int bfsToPossibleLeaves( + TreeNode leaf, int distance, Map childToParentMap) { Queue q = new LinkedList<>(); q.offer(leaf); Set visited = new HashSet<>(); @@ -43,7 +43,8 @@ private int bfsToPossibleLeaves(TreeNode leaf, int distance, Map childToParentMap, List leafNodes) { + private void postOrderToFindAllLeavesAndBuildChildParentMap( + TreeNode node, Map childToParentMap, List leafNodes) { if (node == null) { return; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1534.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1534.java index b3ac99b75e..f80c3463b9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1534.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1534.java @@ -7,7 +7,9 @@ public int countGoodTriplets(int[] arr, int a, int b, int c) { for (int i = 0; i < arr.length - 2; i++) { for (int j = i + 1; j < arr.length - 1; j++) { for (int k = j + 1; k < arr.length; k++) { - if (Math.abs(arr[i] - arr[j]) <= a && Math.abs(arr[j] - arr[k]) <= b && Math.abs(arr[i] - arr[k]) <= c) { + if (Math.abs(arr[i] - arr[j]) <= a + && Math.abs(arr[j] - arr[k]) <= b + && Math.abs(arr[i] - arr[k]) <= c) { count++; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1539.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1539.java index 7fd00d64a7..e3b6b81045 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1539.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1539.java @@ -5,7 +5,7 @@ public class _1539 { public static class Solution1 { - /** + /* * Space: O(n) * Time: O(n) */ @@ -33,7 +33,7 @@ public int findKthPositive(int[] arr, int k) { } public static class Solution2 { - /** + /* * Space: O(1) * Time: O(n) */ @@ -66,7 +66,7 @@ public int findKthPositive(int[] arr, int k) { } public static class Solution3 { - /** + /* * Use binary search: * use an array without missing integers to illustrate: * 1, 2, 3, 4, 5 @@ -88,11 +88,11 @@ public int findKthPositive(int[] arr, int k) { right = mid - 1; } } - //when it exits the above while loop, left = right + 1; - //the k-th missing number should be between arr[right] and arr[left] - //the number of integers missing before arr[right] is arr[right] - right - 1; - //so the number to return is: - //arr[right] + k - (arr[right] - right - 1) = k + right + 1 = k + left; + // when it exits the above while loop, left = right + 1; + // the k-th missing number should be between arr[right] and arr[left] + // the number of integers missing before arr[right] is arr[right] - right - 1; + // so the number to return is: + // arr[right] + k - (arr[right] - right - 1) = k + right + 1 = k + left; return left + k; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1541.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1541.java index de3dc0519d..e88ec9bb78 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1541.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1541.java @@ -14,7 +14,8 @@ public int minInsertions(String s) { stack.add(c); } else { if (stack.peek() == ')') { - //in this case, we need to add one more ')' to get two consecutive right paren, then we could pop the one ')' and one '(' off the stack + // in this case, we need to add one more ')' to get two consecutive + // right paren, then we could pop the one ')' and one '(' off the stack insertionsNeeded++; stack.pop(); stack.pop(); @@ -25,13 +26,14 @@ public int minInsertions(String s) { } } else if (c == ')') { if (stack.isEmpty()) { - //in this case, we need to add one '(' before we add this ')' onto this stack + // in this case, we need to add one '(' before we add this ')' onto this + // stack insertionsNeeded++; stack.add('('); stack.add(c); } else { if (stack.peek() == ')') { - //in this case, we could pop the one ')' and one '(' off the stack + // in this case, we could pop the one ')' and one '(' off the stack stack.pop(); stack.pop(); } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1544.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1544.java index a9b7eedc4c..87ed442880 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1544.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1544.java @@ -14,7 +14,8 @@ public String makeGood(String s) { if (Character.toLowerCase(stack.peek()) == Character.toLowerCase(c)) { if ((Character.isLowerCase(stack.peek()) && Character.isUpperCase(c))) { stack.pop(); - } else if (Character.isUpperCase(stack.peek()) && Character.isLowerCase(c)) { + } else if (Character.isUpperCase(stack.peek()) + && Character.isLowerCase(c)) { stack.pop(); } else { stack.add(c); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1560.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1560.java index f353175a1f..171d3fb6f2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1560.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1560.java @@ -1,10 +1,10 @@ package com.fishercoder.solutions.secondthousand; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Collections; public class _1560 { public static class Solution1 { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1570.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1570.java index 8a70db4dcb..660da14e7a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1570.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1570.java @@ -5,7 +5,7 @@ public class _1570 { public static class Solution1 { - /** + /* * This is a brute force but accepted solution. */ class SparseVector { @@ -28,7 +28,7 @@ public int dotProduct(SparseVector vec) { } public static class Solution2 { - /** + /* * More optimal solution: * 1. use a map to store only non-zero values to save space; * 2. loop through the smaller list; @@ -41,7 +41,7 @@ class SparseVector { this.indexAndNumList = new ArrayList<>(); for (int i = 0; i < nums.length; i++) { if (nums[i] != 0) { - this.indexAndNumList.add(new int[]{i, nums[i]}); + this.indexAndNumList.add(new int[] {i, nums[i]}); } } } @@ -70,8 +70,9 @@ private int dotProduct(List smaller, List bigger) { private int[] binarySearch(List indexAndNumList, int target) { int left = 0; int right = indexAndNumList.size() - 1; - int[] result = new int[]{-1, 0}; - if (indexAndNumList.get(right)[0] < target || indexAndNumList.get(left)[0] > target) { + int[] result = new int[] {-1, 0}; + if (indexAndNumList.get(right)[0] < target + || indexAndNumList.get(left)[0] > target) { return result; } while (left <= right) { @@ -84,7 +85,7 @@ private int[] binarySearch(List indexAndNumList, int target) { left = mid + 1; } } - return new int[]{-1, 0}; + return new int[] {-1, 0}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1576.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1576.java index 513dc32f3b..cd159b97ac 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1576.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1576.java @@ -2,7 +2,7 @@ public class _1576 { public static class Solution1 { - /** + /* * Each char could have at most two neighbors, so we only need to toggle between three character candidates to avoid repetition. */ public String modifyString(String s) { @@ -23,6 +23,5 @@ public String modifyString(String s) { } return String.valueOf(arr); } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1577.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1577.java index 9cd52bb4d0..cc3926a424 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1577.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1577.java @@ -27,6 +27,5 @@ private long twoProduct(long product, int[] nums) { } return count; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1583.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1583.java index a6e36f6857..761e81b89f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1583.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1583.java @@ -23,7 +23,11 @@ public int unhappyFriends(int n, int[][] preferences, int[][] pairs) { return unhappyFriends; } - private boolean isUnHappy(int self, int assignedFriend, int[][] preferences, Map assignedPairs) { + private boolean isUnHappy( + int self, + int assignedFriend, + int[][] preferences, + Map assignedPairs) { int[] preference = preferences[self]; int assignedFriendPreferenceIndex = findIndex(preference, assignedFriend); for (int i = 0; i <= assignedFriendPreferenceIndex; i++) { @@ -32,7 +36,8 @@ private boolean isUnHappy(int self, int assignedFriend, int[][] preferences, Map if (preferredFriendAssignedFriend == self) { return false; } - int candidateAssignedFriendIndex = findIndex(preferences[preferredFriend], preferredFriendAssignedFriend); + int candidateAssignedFriendIndex = + findIndex(preferences[preferredFriend], preferredFriendAssignedFriend); if (isPreferred(self, preferences[preferredFriend], candidateAssignedFriendIndex)) { return true; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1598.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1598.java index 1b0aa5a491..0821b9962b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1598.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1598.java @@ -10,7 +10,7 @@ public int minOperations(String[] logs) { steps--; } } else if (log.equals("./")) { - //do nothing + // do nothing } else { steps++; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1600.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1600.java index d07bc69cad..8bb81fa222 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1600.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1600.java @@ -7,7 +7,7 @@ public class _1600 { public static class Solution1 { - /** + /* * My completely original solution: * 1. use a tree structure to represent the king family; * 2. then use preorder traversal to find the inheritance order; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1601.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1601.java index 9964d1643f..9be6d475f5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1601.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1601.java @@ -31,4 +31,4 @@ private void helper(int[][] requests, int index, int[] count, int num) { helper(requests, index + 1, count, num); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1602.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1602.java index 7623ac555a..a5fada96fe 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1602.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1602.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.LinkedList; import java.util.Queue; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1604.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1604.java index 33ad7e08ea..f806a02c2b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1604.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1604.java @@ -22,7 +22,8 @@ public List alertNames(String[] keyName, String[] keyTime) { List minutes = new ArrayList<>(); for (String time : times) { String[] hourAndMin = time.split(":"); - Integer minute = Integer.parseInt(hourAndMin[0]) * 60 + Integer.parseInt(hourAndMin[1]); + Integer minute = + Integer.parseInt(hourAndMin[0]) * 60 + Integer.parseInt(hourAndMin[1]); minutes.add(minute); } Collections.sort(minutes); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1605.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1605.java index 53f2ca12f3..c24de19be0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1605.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1605.java @@ -4,21 +4,21 @@ public class _1605 { public static class Solution1 { - /** + /* * My completely original solution: * 1. sort out your logic with a pen and paper first, greedy algorithm should be the way to go; * 2. each time, take out the minimum value from both rowSet and colSet, put that entire value onto the result grid, * then deduct that value from the other set if they are not equal, put it back into the minHeap, repeat until both minHeaps are empty; */ public int[][] restoreMatrix(int[] rowSum, int[] colSum) { - //form two minHeaps, use their values to sort + // form two minHeaps, use their values to sort PriorityQueue rowMinHeap = new PriorityQueue<>((a, b) -> a[1] - b[1]); for (int i = 0; i < rowSum.length; i++) { - rowMinHeap.offer(new int[]{i, rowSum[i]}); + rowMinHeap.offer(new int[] {i, rowSum[i]}); } PriorityQueue colMinHeap = new PriorityQueue<>((a, b) -> a[1] - b[1]); for (int j = 0; j < colSum.length; j++) { - colMinHeap.offer(new int[]{j, colSum[j]}); + colMinHeap.offer(new int[] {j, colSum[j]}); } int[][] result = new int[rowSum.length][colSum.length]; @@ -27,12 +27,12 @@ public int[][] restoreMatrix(int[] rowSum, int[] colSum) { int[] minCol = colMinHeap.poll(); if (minRow[1] < minCol[1]) { result[minRow[0]][minCol[0]] = minRow[1]; - colMinHeap.offer(new int[]{minCol[0], minCol[1] - minRow[1]}); + colMinHeap.offer(new int[] {minCol[0], minCol[1] - minRow[1]}); } else if (minRow[1] > minCol[1]) { result[minRow[0]][minCol[0]] = minCol[1]; - rowMinHeap.offer(new int[]{minRow[0], minRow[1] - minCol[1]}); + rowMinHeap.offer(new int[] {minRow[0], minRow[1] - minCol[1]}); } else { - //the min values from row and col are equal + // the min values from row and col are equal result[minRow[0]][minCol[0]] = minCol[1]; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1609.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1609.java index 9b7141b8f2..8f8f9a5227 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1609.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1609.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1620.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1620.java index bb08796ae2..da4738ee24 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1620.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1620.java @@ -8,7 +8,11 @@ public static int[] bestCoordinate(int[][] towers, int radius) { for (int i = 0; i < towers.length; i++) { int thisQuality = 0; for (int j = 0; j < towers.length; j++) { - double distance = Math.sqrt((towers[i][0] - towers[j][0]) * (towers[i][0] - towers[j][0]) + (towers[i][1] - towers[j][1]) * (towers[i][1] - towers[j][1])); + double distance = + Math.sqrt( + (towers[i][0] - towers[j][0]) * (towers[i][0] - towers[j][0]) + + (towers[i][1] - towers[j][1]) + * (towers[i][1] - towers[j][1])); if (distance <= radius) { thisQuality += Math.floor(towers[j][2] / (1 + distance)); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1625.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1625.java index 5c49a979bf..befb2beae3 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1625.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1625.java @@ -14,7 +14,7 @@ public String findLexSmallestString(String s, int a, int b) { String smallest = s; while (!queue.isEmpty()) { String current = queue.poll(); - //add + // add char[] c = current.toCharArray(); for (int i = 1; i < c.length; i++) { if (i % 2 == 1) { @@ -28,7 +28,7 @@ public String findLexSmallestString(String s, int a, int b) { if (seen.add(next)) { queue.add(next); } - //rotate + // rotate next = next.substring(next.length() - b) + next.substring(0, next.length() - b); if (seen.add(next)) { queue.add(next); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1626.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1626.java index 84c267bfe0..ffffc6c65e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1626.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1626.java @@ -11,16 +11,18 @@ public int bestTeamScore(int[] scores, int[] ages) { players[i][0] = ages[i]; players[i][1] = scores[i]; } - //sort by age first, if tie, then sort by scores + // sort by age first, if tie, then sort by scores Arrays.sort(players, (a, b) -> a[0] != b[0] ? a[0] - b[0] : a[1] - b[1]); - //dp array is the max possible score up to this age, i.e. dp[2] means the max score up to from age 0 up to age 2 + // dp array is the max possible score up to this age, i.e. dp[2] means the max score up + // to from age 0 up to age 2 int[] dp = new int[len]; dp[0] = players[0][1]; for (int i = 1; i < len; i++) { - int maxScoreUpToAgeI = players[i][1];//this is the max score possible on this age i alone + int maxScoreUpToAgeI = + players[i][1]; // this is the max score possible on this age i alone for (int j = 0; j < i; j++) { - //then we try to find all possible scores from the min age up to this age i + // then we try to find all possible scores from the min age up to this age i if (players[i][1] >= players[j][1]) { maxScoreUpToAgeI = Math.max(maxScoreUpToAgeI, dp[j] + players[i][1]); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1628.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1628.java index f29f5db6d7..e287bcf5d9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1628.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1628.java @@ -6,7 +6,7 @@ public class _1628 { public static class Solution1 { - /** + /* * Being able to think of resorting to Stack data structure is the key here to a straightforward solution. */ @@ -63,7 +63,6 @@ public List print(Node node, List list) { print(node.right, list); return list; } - } public static class TreeBuilder { @@ -79,7 +78,6 @@ public Node buildTree(String[] postfix) { } return stack.pop(); } - } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1641.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1641.java index d71f4ff7f1..3b204ab7e5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1641.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1641.java @@ -4,7 +4,7 @@ public class _1641 { public static class Solution1 { - /** + /* * I solved this problem using Math, no DP, recursion or backtracking techniques. * Time: beat 100% submission consistently since it's O(n), essentialy it's O(1) because the contraints in the problem state: 1 <= n <= 50 * After writing out from n = 1 to 3, we can see the pattern. @@ -14,7 +14,7 @@ public int countVowelStrings(int n) { if (n == 1) { return 5; } - int[] arr = new int[]{1, 1, 1, 1, 1}; + int[] arr = new int[] {1, 1, 1, 1, 1}; int sum = 5; for (int i = 2; i <= n; i++) { int[] copy = new int[5]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1642.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1642.java index 09a38e4dc1..7065a6ed46 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1642.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1642.java @@ -7,18 +7,19 @@ public static class Solution1 { public int furthestBuilding(int[] heights, int bricks, int ladders) { PriorityQueue minHeap = new PriorityQueue<>(); int i = 0; - //we'll assume to use ladders for the first l jumps and adjust it afterwards + // we'll assume to use ladders for the first l jumps and adjust it afterwards for (; i < heights.length - 1 && minHeap.size() < ladders; i++) { int diff = heights[i + 1] - heights[i]; if (diff > 0) { minHeap.offer(diff); } } - //now ladders have been used up, we'll use bricks to jump + // now ladders have been used up, we'll use bricks to jump while (i < heights.length - 1) { int diff = heights[i + 1] - heights[i]; if (diff > 0) { - //we'll check if the last one that cost a ladder could actually be filled with some bricks + // we'll check if the last one that cost a ladder could actually be filled with + // some bricks if (!minHeap.isEmpty() && minHeap.peek() < diff) { bricks -= minHeap.poll(); minHeap.offer(diff); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1644.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1644.java index c5d80bf158..851491a265 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1644.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1644.java @@ -4,7 +4,7 @@ public class _1644 { public static class Solution1 { - /** + /* * This is my not so elegant but original solution to get it accepted. */ boolean[] exists = new boolean[2]; @@ -48,7 +48,7 @@ private TreeNode dfs(TreeNode root, TreeNode p, TreeNode q) { } public static class Solution2 { - /** + /* * This still checks nodes existence. */ int found = 0; @@ -73,7 +73,7 @@ private TreeNode lca(TreeNode root, TreeNode p, TreeNode q) { } public static class Solution3 { - /** + /* * Credit: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-ii/solutions/944963/beat-96-recursion-without-count-easy-understanding/ */ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { @@ -82,13 +82,13 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { } TreeNode result = findLCA(root, p, q); if (result == p) { - //if p equals result, we'll check the existence of q in the subtree of p + // if p equals result, we'll check the existence of q in the subtree of p return findLCA(p, q, q) != null ? result : null; } else if (result == q) { - //if q equals result, we'll check the existence of p in the subtree of q + // if q equals result, we'll check the existence of p in the subtree of q return findLCA(q, p, p) != null ? result : null; } - //otherwise, it's this case: (p != result && q != result) || result == null + // otherwise, it's this case: (p != result && q != result) || result == null return result; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1653.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1653.java index 1641c3be3b..d285aa5587 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1653.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1653.java @@ -8,7 +8,7 @@ public static class Solution1 { public int minimumDeletions(String s) { int[][] dp = new int[s.length()][2]; int count = 0; - //we count the number of 'b's to the left of each index + // we count the number of 'b's to the left of each index for (int i = 0; i < s.length(); i++) { dp[i][0] = count; if (s.charAt(i) == 'b') { @@ -16,7 +16,7 @@ public int minimumDeletions(String s) { } } count = 0; - //now we count the number of 'a's to the left of each index + // now we count the number of 'a's to the left of each index for (int i = s.length() - 1; i >= 0; i--) { dp[i][1] = count; if (s.charAt(i) == 'a') { @@ -24,7 +24,8 @@ public int minimumDeletions(String s) { } } int deletions = s.length(); - //we can balance the string by deleting all 'b's to the left and all 'a's to the right at each index + // we can balance the string by deleting all 'b's to the left and all 'a's to the right + // at each index for (int i = 0; i < s.length(); i++) { deletions = Math.min(deletions, dp[i][0] + dp[i][1]); } @@ -33,7 +34,7 @@ public int minimumDeletions(String s) { } public static class Solution2 { - /** + /* * use stack * whenever we encounter a "ba" pair, we increase deletions count by one */ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1657.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1657.java index 4445ce0727..f17563c4a4 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1657.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1657.java @@ -23,6 +23,5 @@ public boolean closeStrings(String word1, String word2) { Arrays.sort(counts2); return set1.equals(set2) && Arrays.equals(counts1, counts2); } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1658.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1658.java index 683eea67e5..7a04046934 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1658.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1658.java @@ -2,7 +2,7 @@ public class _1658 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/discuss/936074/JavaPython-3-Sliding-window%3A-Longest-subarray-sum-to-the-target-sum(nums)-x. */ public int minOperations(int[] nums, int x) { @@ -25,6 +25,5 @@ public int minOperations(int[] nums, int x) { } return size < 0 ? -1 : len - size; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1660.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1660.java index 5c003d61d5..b5b9e7da66 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1660.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1660.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; @@ -9,7 +8,7 @@ public class _1660 { public static class Solution1 { - /** + /* * First off, this problem description is confusing. * Second, that aside, I learned a cool technique to pass TreeNode[]{node, nodeParent} into the queue * so that you can easily reference one node's parent without building an additional hashmap. @@ -17,7 +16,7 @@ public static class Solution1 { */ public TreeNode correctBinaryTree(TreeNode root) { Queue q = new LinkedList<>(); - q.offer(new TreeNode[]{root, null}); + q.offer(new TreeNode[] {root, null}); Set visited = new HashSet<>(); visited.add(root.val); while (!q.isEmpty()) { @@ -35,11 +34,11 @@ public TreeNode correctBinaryTree(TreeNode root) { return root; } if (node.left != null) { - q.offer(new TreeNode[]{node.left, node}); + q.offer(new TreeNode[] {node.left, node}); visited.add(node.left.val); } if (node.right != null) { - q.offer(new TreeNode[]{node.right, node}); + q.offer(new TreeNode[] {node.right, node}); visited.add(node.right.val); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1670.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1670.java index 50a18f81b6..bd520d3658 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1670.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1670.java @@ -5,7 +5,7 @@ public class _1670 { public static class Solution1 { - /** + /* * This is a brute force approach. * TODO: use two Deques to implement a solution. */ @@ -37,7 +37,8 @@ public int popFront() { public int popMiddle() { if (list.size() > 0) { - return list.remove(list.size() % 2 == 0 ? list.size() / 2 - 1 : list.size() / 2); + return list.remove( + list.size() % 2 == 0 ? list.size() / 2 - 1 : list.size() / 2); } return -1; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1673.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1673.java index 55906a4b48..44532c1c6a 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1673.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1673.java @@ -7,7 +7,9 @@ public static class Solution1 { public int[] mostCompetitive(int[] nums, int k) { Stack stack = new Stack<>(); for (int i = 0; i < nums.length; i++) { - while (!stack.isEmpty() && nums[i] < stack.peek() && nums.length - i + stack.size() > k) { + while (!stack.isEmpty() + && nums[i] < stack.peek() + && nums.length - i + stack.size() > k) { stack.pop(); } if (stack.size() < k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1676.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1676.java index b3e1618edc..7dba492077 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1676.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1676.java @@ -1,13 +1,12 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashSet; import java.util.Set; public class _1676 { public static class Solution1 { - /** + /* * Since there are conditions for this problem: all values in the tree and given nodes are unique, * we could simply use a HashSet to track the number of nodes we've found so far during the traversal. *

@@ -42,7 +41,7 @@ private int dfs(TreeNode root, Set target) { } public static class Solution2 { - /** + /* * Silly brute force way. */ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode[] nodes) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1686.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1686.java index 52f93ff5db..ee553e30f9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1686.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1686.java @@ -4,15 +4,16 @@ public class _1686 { public static class Solution1 { - /** + /* * 1. The most optimal strategy for each player is take the stone with the currently max combined value instead of just his own max value * because when they take the stone, it also removes the same stone from the other player, ending the best situation for them; * 2. Both players would stick to the above strategy since it's the best for themselves and they are playing optimally. */ public int stoneGameVI(int[] aliceValues, int[] bobValues) { - PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> a[0] - b[0] == 0 ? a[1] - b[1] : b[0] - a[0]); + PriorityQueue maxHeap = + new PriorityQueue<>((a, b) -> a[0] - b[0] == 0 ? a[1] - b[1] : b[0] - a[0]); for (int i = 0; i < aliceValues.length; i++) { - maxHeap.offer(new int[]{aliceValues[i] + bobValues[i], i}); + maxHeap.offer(new int[] {aliceValues[i] + bobValues[i], i}); } int[] sums = new int[aliceValues.length]; boolean aliceTurn = true; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1690.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1690.java index b806e606bd..c25600cbca 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1690.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1690.java @@ -29,13 +29,15 @@ private void setMaxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ(int i, int j) { if (j - i == 0) { maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j] = 0; } else if (j - i == 1) { - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j] = Math.max(stonesRef[i - 1], stonesRef[j - 1]); + maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j] = + Math.max(stonesRef[i - 1], stonesRef[j - 1]); } else { - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j] = Math.max( - this.sumOfTheStonesValueInPosIToJ(i + 1, j) - - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i + 1][j], - this.sumOfTheStonesValueInPosIToJ(i, j - 1) - - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j - 1]); + maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j] = + Math.max( + this.sumOfTheStonesValueInPosIToJ(i + 1, j) + - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i + 1][j], + this.sumOfTheStonesValueInPosIToJ(i, j - 1) + - maxDiffScoureBetweenTowPlayerWhenPlayInPosItoJ[i][j - 1]); } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1695.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1695.java index a987129d0a..9c90e0edad 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1695.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1695.java @@ -30,7 +30,7 @@ public int maximumUniqueSubarray(int[] nums) { } public static class Solution2 { - /** + /* * My completely original solution on 10/202/2021. Classic sliding window solution. */ public int maximumUniqueSubarray(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1701.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1701.java index d6a0239e50..d29b117030 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1701.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1701.java @@ -2,7 +2,7 @@ public class _1701 { public static class Solution1 { - /** + /* * A simple one-pass, just simulate what the problem describes. */ public double averageWaitingTime(int[][] customers) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1704.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1704.java index d88aa2fa06..8bc1d59ae3 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1704.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1704.java @@ -8,9 +8,18 @@ public class _1704 { public static class Solution1 { public boolean halvesAreAlike(String s) { - Set vowels = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); - int firstHalfVowelsCount = (int) IntStream.range(0, s.length() / 2).filter(i -> vowels.contains(s.charAt(i))).count(); - int secondHalfVowelsCount = (int) IntStream.range(s.length() / 2, s.length()).filter(i -> vowels.contains(s.charAt(i))).count(); + Set vowels = + new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')); + int firstHalfVowelsCount = + (int) + IntStream.range(0, s.length() / 2) + .filter(i -> vowels.contains(s.charAt(i))) + .count(); + int secondHalfVowelsCount = + (int) + IntStream.range(s.length() / 2, s.length()) + .filter(i -> vowels.contains(s.charAt(i))) + .count(); return firstHalfVowelsCount == secondHalfVowelsCount; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1705.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1705.java index 2e25e983b2..8f02c0db35 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1705.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1705.java @@ -5,12 +5,12 @@ public class _1705 { public static class Solution1 { public int eatenApples(int[] apples, int[] days) { - /**we sort the heap by its expiration dates, we'll eat the earliest expiration apples first*/ + /*we sort the heap by its expiration dates, we'll eat the earliest expiration apples first*/ PriorityQueue minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]); int eatenApples = 0; for (int i = 0; i < apples.length || !minHeap.isEmpty(); i++) { if (i < apples.length) { - minHeap.offer(new int[]{i + days[i], apples[i]}); + minHeap.offer(new int[] {i + days[i], apples[i]}); } while (!minHeap.isEmpty() && (minHeap.peek()[0] <= i || minHeap.peek()[1] <= 0)) { minHeap.poll(); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1711.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1711.java index c3be25b86b..2807f8aaaf 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1711.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1711.java @@ -5,7 +5,7 @@ public class _1711 { public static class Solution1 { - /** + /* * This is a very brilliant solution: * 1. go through each number only once: for each number, we iterate through all possible power of twos, at max, there's only 21 due to the constraints of this problem; * 2. since it's asking for the sum of two, we can check we have encountered the other number before using a hashmap @@ -17,7 +17,8 @@ public int countPairs(int[] deliciousness) { long pairs = 0; for (int del : deliciousness) { int power = 1; - //we only need to go up to 21 since one of the constraints is: 0 <= deliciousness[i] <= 2 to the power of 20 + // we only need to go up to 21 since one of the constraints is: 0 <= + // deliciousness[i] <= 2 to the power of 20 for (int j = 0; j < 22; j++) { if (map.containsKey(power - del)) { pairs += map.get(power - del); @@ -28,6 +29,5 @@ public int countPairs(int[] deliciousness) { } return (int) (pairs % MODULAR); } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1717.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1717.java index 49ae3be179..5bb943be11 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1717.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1717.java @@ -33,5 +33,4 @@ public int maximumGain(String s, int x, int y) { return max; } } - } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1721.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1721.java index 697d798ba1..9e86202da1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1721.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1721.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; @@ -74,10 +73,10 @@ public static class Solution3 { public ListNode swapNodes(ListNode head, int k) { // O(n) linear time /* - 1. Calculate length of linked list - 2. Initialize 3 ptrs, temp1 and temp2 used for pointing to nodes at k, (len - k + 1) - and temp3 used to iterate over the linked list - */ + 1. Calculate length of linked list + 2. Initialize 3 ptrs, temp1 and temp2 used for pointing to nodes at k, (len - k + 1) + and temp3 used to iterate over the linked list + */ int length = 0; int secondIndex; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1726.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1726.java index 38c4dd9625..ca920391f8 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1726.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1726.java @@ -37,6 +37,5 @@ public int tupleSameProduct(int[] nums) { } return count; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1727.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1727.java index 193a55dd42..3072cc3524 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1727.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1727.java @@ -4,7 +4,7 @@ public class _1727 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/largest-submatrix-with-rearrangements/discuss/1020682/Java-or-6ms-or-easy-understanding-with-comments-and-images */ public int largestSubmatrix(int[][] matrix) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1730.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1730.java index 1cea06d8da..cabb871f9b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1730.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1730.java @@ -15,12 +15,12 @@ public int getFood(char[][] grid) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (grid[i][j] == '*') { - q.offer(new int[]{i, j}); + q.offer(new int[] {i, j}); visited.add(i * n + j); } } } - int[] dirs = new int[]{0, 1, 0, -1, 0}; + int[] dirs = new int[] {0, 1, 0, -1, 0}; int steps = 0; while (!q.isEmpty()) { int size = q.size(); @@ -29,9 +29,13 @@ public int getFood(char[][] grid) { for (int j = 0; j < dirs.length - 1; j++) { int nextx = curr[0] + dirs[j]; int nexty = curr[1] + dirs[j + 1]; - if (nextx >= 0 && nextx < m && nexty >= 0 && nexty < n && visited.add(nextx * n + nexty)) { + if (nextx >= 0 + && nextx < m + && nexty >= 0 + && nexty < n + && visited.add(nextx * n + nexty)) { if (grid[nextx][nexty] == 'O') { - q.offer(new int[]{nextx, nexty}); + q.offer(new int[] {nextx, nexty}); } else if (grid[nextx][nexty] == '#') { return steps + 1; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1740.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1740.java index 4ee15393f2..035d237e7b 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1740.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1740.java @@ -1,22 +1,24 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.*; public class _1740 { public static class Solution1 { - /** + /* * My completely original solution on 6/30/2024. */ public int findDistance(TreeNode root, int p, int q) { - //dfs to find either p or q first, then add it into a queue, also form a child to parent mapping + // dfs to find either p or q first, then add it into a queue, also form a child to + // parent mapping Queue queue = new LinkedList<>(); Map childToParent = new HashMap<>(); dfs(root, p, q, queue, childToParent); int target = queue.peek().val == p ? q : p; int distance = 0; - Set visited = new HashSet<>();//this visited collection is often very essential to prevent infinite loop. + Set visited = + new HashSet<>(); // this visited collection is often very essential to prevent + // infinite loop. visited.add(queue.peek().val); while (!queue.isEmpty()) { int size = queue.size(); @@ -34,7 +36,8 @@ public int findDistance(TreeNode root, int p, int q) { if (curr.right != null && visited.add(curr.right.val)) { queue.offer(curr.right); } - if (childToParent.containsKey(curr) && visited.add(childToParent.get(curr).val)) { + if (childToParent.containsKey(curr) + && visited.add(childToParent.get(curr).val)) { queue.offer(childToParent.get(curr)); } } @@ -43,7 +46,12 @@ public int findDistance(TreeNode root, int p, int q) { return distance; } - private void dfs(TreeNode root, int p, int q, Queue queue, Map childToParent) { + private void dfs( + TreeNode root, + int p, + int q, + Queue queue, + Map childToParent) { if (root == null) { return; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1743.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1743.java index 4edcf96187..baa5cf663f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1743.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1743.java @@ -2,9 +2,9 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.HashSet; import java.util.Set; public class _1743 { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1745.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1745.java index 371e005125..09d8f787a1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1745.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1745.java @@ -2,7 +2,7 @@ public class _1745 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/palindrome-partitioning-iv/discuss/1042910/Java-Detailed-Explanation-DP-O(N2) * * check whether substring(i, j) is a palindrome becomes checking whether substring(i + 1, j -1) is a palindrome @@ -31,6 +31,5 @@ public boolean checkPartitioning(String s) { } return false; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1746.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1746.java index 3ab2ae7c04..2e3c223f21 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1746.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1746.java @@ -2,24 +2,29 @@ public class _1746 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/maximum-subarray-sum-after-one-operation/discuss/1049224/Java-O(n)-Time-O(n)-Space-DP-solution */ public int maxSumAfterOperation(int[] nums) { int len = nums.length; - //dp[i][0] means the sum of all elements in the subarray up to index i without any number squared - //dp[i][1] means the sum of all elements in the subarray up to index i with nums[i] squared - //esentially, there are three dimensions: - //1. the element nums[i] squared itself might be the biggest sum of subarray itself; - //2. the subarray sum without any elemtns squared + nums[i] squared - //3. the subarray sum with one element prior to i square + nums[i] + // dp[i][0] means the sum of all elements in the subarray up to index i without any + // number squared + // dp[i][1] means the sum of all elements in the subarray up to index i with nums[i] + // squared + // esentially, there are three dimensions: + // 1. the element nums[i] squared itself might be the biggest sum of subarray itself; + // 2. the subarray sum without any elemtns squared + nums[i] squared + // 3. the subarray sum with one element prior to i square + nums[i] int[][] dp = new int[len][2]; dp[0][0] = nums[0]; dp[0][1] = nums[0] * nums[0]; int maxSum = dp[0][1]; for (int i = 1; i < len; i++) { dp[i][0] = Math.max(dp[i - 1][0] + nums[i], nums[i]); - dp[i][1] = Math.max(nums[i] * nums[i], Math.max(dp[i - 1][0] + nums[i] * nums[i], dp[i - 1][1] + nums[i])); + dp[i][1] = + Math.max( + nums[i] * nums[i], + Math.max(dp[i - 1][0] + nums[i] * nums[i], dp[i - 1][1] + nums[i])); maxSum = Math.max(maxSum, dp[i][1]); } return maxSum; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1753.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1753.java index c20da7f31e..ebd3aa06ed 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1753.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1753.java @@ -5,7 +5,7 @@ public class _1753 { public static class Solution1 { public int maximumScore(int a, int b, int c) { - int[] nums = new int[]{a, b, c}; + int[] nums = new int[] {a, b, c}; Arrays.sort(nums); if (nums[0] + nums[1] < nums[2]) { return nums[0] + nums[1]; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1756.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1756.java index 921964cc3a..f980b6ccb0 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1756.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1756.java @@ -21,6 +21,5 @@ public int fetch(int k) { return fetched; } } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1758.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1758.java index 657e6aaea1..8e17380493 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1758.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1758.java @@ -4,27 +4,27 @@ public class _1758 { public static class Solution1 { public int minOperations(String s) { int ops1 = 0; - //start with 0 + // start with 0 boolean isZero = true; for (int i = 0; i < s.length(); i++) { if (i % 2 == 0) { - //should be zero, if not, change it to zero and increase ops1 by one + // should be zero, if not, change it to zero and increase ops1 by one if (s.charAt(i) != '0') { ops1++; } } else { - //should be one, if not, increase ops1 by one + // should be one, if not, increase ops1 by one if (s.charAt(i) != '1') { ops1++; } } } - //start with 1 + // start with 1 int ops2 = 0; for (int i = 0; i < s.length(); i++) { if (i % 2 == 0) { - //should be one, if not, increase ops2 by one + // should be one, if not, increase ops2 by one if (s.charAt(i) != '1') { ops2++; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1759.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1759.java index 08c7f37ab9..cbd639a837 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1759.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1759.java @@ -2,7 +2,7 @@ public class _1759 { public static class Solution1 { - /** + /* * a -> 1 * aa -> 3 * aaa -> 6 diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1763.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1763.java index 61bef6f9c0..99f5a7e7f9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1763.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1763.java @@ -27,7 +27,8 @@ private boolean isNiceString(String str) { } } for (int i = 0; i < uppercount.length; i++) { - if (uppercount[i] > 0 && lowercount[i] > 0 || (uppercount[i] == 0 && lowercount[i] == 0)) { + if (uppercount[i] > 0 && lowercount[i] > 0 + || (uppercount[i] == 0 && lowercount[i] == 0)) { continue; } else { return false; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1764.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1764.java index a929405942..dd40c1da58 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1764.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1764.java @@ -19,7 +19,9 @@ public boolean canChoose(int[][] groups, int[] nums) { for (int num : group) { groupInt.add(num); } - int index = Collections.indexOfSubList(numsInt.subList(prevIndex, numsInt.size()), groupInt); + int index = + Collections.indexOfSubList( + numsInt.subList(prevIndex, numsInt.size()), groupInt); if (index != -1) { prevIndex = index + group.length; } else { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1765.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1765.java index 96554a23a9..3f0f1fab20 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1765.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1765.java @@ -13,11 +13,11 @@ public int[][] highestPeak(int[][] isWater) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (isWater[i][j] == 1) { - queue.offer(new int[]{i, j}); + queue.offer(new int[] {i, j}); } } } - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; int height = 1; while (!queue.isEmpty()) { int size = queue.size(); @@ -26,9 +26,13 @@ public int[][] highestPeak(int[][] isWater) { for (int i = 0; i < directions.length - 1; i++) { int newx = directions[i] + curr[0]; int newy = directions[i + 1] + curr[1]; - if (newx >= 0 && newx < m && newy >= 0 && newy < n && result[newx][newy] == 0) { + if (newx >= 0 + && newx < m + && newy >= 0 + && newy < n + && result[newx][newy] == 0) { result[newx][newy] = height; - queue.offer(new int[]{newx, newy}); + queue.offer(new int[] {newx, newy}); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1772.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1772.java index 980089b37c..b7af9c1347 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1772.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1772.java @@ -23,7 +23,9 @@ public String[] sortFeatures(String[] features, String[] responses) { } } } - PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> a.freq != b.freq ? b.freq - a.freq : a.index - b.index); + PriorityQueue maxHeap = + new PriorityQueue<>( + (a, b) -> a.freq != b.freq ? b.freq - a.freq : a.index - b.index); for (String key : map.keySet()) { maxHeap.offer(new Node(key, countMap.getOrDefault(key, 0), map.get(key))); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1774.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1774.java index dfe47619d0..e81956f238 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1774.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1774.java @@ -13,7 +13,9 @@ public int closestCost(int[] baseCosts, int[] toppingCosts, int target) { } private void recursion(int currentCost, int[] toppingCosts, int index, int target) { - if (Math.abs(currentCost - target) < Math.abs(result - target) || (Math.abs(currentCost - target) < Math.abs(result - target) && currentCost == result)) { + if (Math.abs(currentCost - target) < Math.abs(result - target) + || (Math.abs(currentCost - target) < Math.abs(result - target) + && currentCost == result)) { result = currentCost; } if (index == toppingCosts.length || currentCost == target) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1775.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1775.java index 044db6a7e0..47d3a7e311 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1775.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1775.java @@ -8,7 +8,7 @@ public int minOperations(int[] nums1, int[] nums2) { int[] longer = nums1.length > nums2.length ? nums1 : nums2; int[] shorter = nums1.length > nums2.length ? nums2 : nums1; if (longer.length > shorter.length * 6) { - /**This is the impossible case that we'll rule out first.*/ + /*This is the impossible case that we'll rule out first.*/ return -1; } Arrays.sort(longer); @@ -28,7 +28,7 @@ public int minOperations(int[] nums1, int[] nums2) { i = 0; j = shorter.length - 1; if (diff < 0) { - /**if diff is negative, this means we'll need to decrease numbers in the shorter array and increase the numbers in the longer array to make the diff to be zero + /*if diff is negative, this means we'll need to decrease numbers in the shorter array and increase the numbers in the longer array to make the diff to be zero * and each time, we'll be greedy: take the bigger delta from two of the arrays.*/ while (diff < 0) { if (i < longer.length && j >= 0) { @@ -46,7 +46,7 @@ public int minOperations(int[] nums1, int[] nums2) { } return minOps; } else if (diff > 0) { - /**if diff is positive, this means we'll need to decrease the numbers in the longer array and increase the numbers in the shorter array to make the diff to be zero + /*if diff is positive, this means we'll need to decrease the numbers in the longer array and increase the numbers in the shorter array to make the diff to be zero * and each time, we'll be greedy: take the bigger delta from two of the arrays.*/ i = longer.length - 1; j = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1781.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1781.java index bc930c7e97..0a970ffb0e 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1781.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1781.java @@ -2,7 +2,7 @@ public class _1781 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/sum-of-beauty-of-all-substrings/discuss/1096380/Java-or-T%3A-O(N2)-or-S%3A-O(1)-Get-the-beauty-of-all-substrings-and-sum-them */ public int beautySum(String s) { @@ -11,7 +11,7 @@ public int beautySum(String s) { int[] charCount = new int[26]; for (int j = i; j < s.length(); j++) { charCount[s.charAt(j) - 'a']++; - //get beauty of s.substring(i, j) + // get beauty of s.substring(i, j) int beauty = getMaxCount(charCount) - getMinCount(charCount); sum += beauty; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1792.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1792.java index 03df9845b5..36c7765cb5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1792.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1792.java @@ -4,13 +4,17 @@ public class _1792 { public static class Solution1 { - /** + /* * We use the change size to order the elements in the maxHeap. */ public double maxAverageRatio(int[][] classes, int extraStudents) { - PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> -Double.compare(a[0], b[0])); + PriorityQueue maxHeap = + new PriorityQueue<>((a, b) -> -Double.compare(a[0], b[0])); for (int[] c : classes) { - maxHeap.offer(new double[]{(double) (c[0] + 1) / (c[1] + 1) - (double) c[0] / c[1], c[0], c[1]}); + maxHeap.offer( + new double[] { + (double) (c[0] + 1) / (c[1] + 1) - (double) c[0] / c[1], c[0], c[1] + }); } while (extraStudents-- > 0) { double[] curr = maxHeap.poll(); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1797.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1797.java index cf35d7ac69..b86882e751 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1797.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1797.java @@ -9,7 +9,7 @@ public static class AuthenticationManager { int timeToLive; int currentTime; - Map map;//tokenId -> expireTime + Map map; // tokenId -> expireTime public AuthenticationManager(int timeToLive) { this.timeToLive = timeToLive; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1813.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1813.java index 618750e6f5..8187dab2e1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1813.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1813.java @@ -24,10 +24,11 @@ public boolean areSentencesSimilar(String sentence1, String sentence2) { } } } - if ((breaks == 1 && i == shortWords.length && j == longWords.length) || (i == shortWords.length && breaks == 0)) { + if ((breaks == 1 && i == shortWords.length && j == longWords.length) + || (i == shortWords.length && breaks == 0)) { return true; } - //we'll check from the left side and move towards the right side + // we'll check from the left side and move towards the right side i = shortWords.length - 1; j = longWords.length - 1; breaks = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1823.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1823.java index 5bfb252d1e..ae5ee4926c 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1823.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1823.java @@ -23,7 +23,7 @@ public int findTheWinner(int n, int k) { } public static class Solution2 { - /** + /* * My completely original solution: use a double linked list to keep moving (k - 1) people from * the tail of the queue to the head of the queue, and then remove the kth person, * until there's only one person in the queue who is the winner. diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1826.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1826.java index 6b9f4f8626..38a29dc045 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1826.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1826.java @@ -3,7 +3,7 @@ public class _1826 { public static class Solution1 { public int badSensor(int[] sensor1, int[] sensor2) { - //check if sensor2 is faulty + // check if sensor2 is faulty int i = 0; int j = 0; for (; i < sensor1.length && j < sensor2.length - 1; ) { @@ -18,7 +18,7 @@ public int badSensor(int[] sensor1, int[] sensor2) { if (j == sensor2.length - 1 && i == sensor1.length) { sensor2Faulty = true; } - //check sensor1 + // check sensor1 i = 0; j = 0; for (; i < sensor1.length - 1 && j < sensor2.length; ) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1828.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1828.java index 70eb788752..ab7d99a310 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1828.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1828.java @@ -8,7 +8,9 @@ public int[] countPoints(int[][] points, int[][] queries) { for (int[] query : queries) { int pts = 0; for (int[] point : points) { - if ((point[0] - query[0]) * (point[0] - query[0]) + (point[1] - query[1]) * (point[1] - query[1]) <= query[2] * query[2]) { + if ((point[0] - query[0]) * (point[0] - query[0]) + + (point[1] - query[1]) * (point[1] - query[1]) + <= query[2] * query[2]) { pts++; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1836.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1836.java index a9665fc1ef..401c206d71 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1836.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1836.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.secondthousand; import com.fishercoder.common.classes.ListNode; - import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1860.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1860.java index 08891c410b..8e798a9bfd 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1860.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1860.java @@ -12,7 +12,7 @@ public int[] memLeak(int memory1, int memory2) { } time++; } - return new int[]{time, memory1, memory2}; + return new int[] {time, memory1, memory2}; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1861.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1861.java index a35c23c9f0..d44a229cb8 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1861.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1861.java @@ -19,7 +19,6 @@ public char[][] rotateTheBox(char[][] box) { box[i][empty - 1] = '#'; box[i][j] = '.'; } - } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1862.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1862.java index 9b2eb1b152..fe8001bab2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1862.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1862.java @@ -6,7 +6,7 @@ public class _1862 { public static class Solution1 { - /** + /* * TODO: this results in TLE, fix it. */ public int sumOfFlooredPairs(int[] nums) { @@ -19,7 +19,10 @@ public int sumOfFlooredPairs(int[] nums) { long sum = 0L; for (int i = list.size() - 1; i >= 0; i--) { for (int j = i; j >= 0; j--) { - sum += (list.get(i) / list.get(j)) * map.get(list.get(j)) * map.get(list.get(i)); + sum += + (list.get(i) / list.get(j)) + * map.get(list.get(j)) + * map.get(list.get(i)); sum %= mod; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1868.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1868.java index 2352c235a6..8e2c3273e2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1868.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1868.java @@ -6,15 +6,15 @@ public class _1868 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/product-of-two-run-length-encoded-arrays/ */ public List> findRLEArray(int[][] encoded1, int[][] encoded2) { - //local progress in the current intervals + // local progress in the current intervals int pointer1 = 0; int pointer2 = 0; - //global progress in the overall encoded arrays + // global progress in the overall encoded arrays int index1 = 0; int index2 = 0; @@ -22,24 +22,25 @@ public List> findRLEArray(int[][] encoded1, int[][] encoded2) { while (index1 < encoded1.length && index2 < encoded2.length) { int freq1 = encoded1[index1][1] - pointer1; int freq2 = encoded2[index2][1] - pointer2; - //choose smaller one as the step size + // choose smaller one as the step size int freq = Math.min(freq1, freq2); - //update the local progress in the intervals + // update the local progress in the intervals pointer1 += freq; pointer2 += freq; int product = encoded1[index1][0] * encoded2[index2][0]; int size = result.size(); - // if the current product is the same as the most recent one in the result, concatenate it + // if the current product is the same as the most recent one in the result, + // concatenate it if (size > 0 && result.get(size - 1).get(0) == product) { freq += result.get(size - 1).get(1); result.remove(size - 1); } result.add(Arrays.asList(product, freq)); - //check if global progress is moving forward + // check if global progress is moving forward if (pointer1 == encoded1[index1][1]) { index1++; pointer1 = 0; diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1876.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1876.java index d15eda0493..3026aeb265 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1876.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1876.java @@ -6,7 +6,9 @@ public int countGoodSubstrings(String s) { int count = 0; for (int i = 0; i < s.length() - 2; i++) { String candidate = s.substring(i, i + 3); - if (candidate.charAt(0) != candidate.charAt(1) && candidate.charAt(0) != candidate.charAt(2) && candidate.charAt(1) != candidate.charAt(2)) { + if (candidate.charAt(0) != candidate.charAt(1) + && candidate.charAt(0) != candidate.charAt(2) + && candidate.charAt(1) != candidate.charAt(2)) { count++; } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1886.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1886.java index c5bd634051..4c79684a5f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1886.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1886.java @@ -19,7 +19,7 @@ public boolean findRotation(int[][] mat, int[][] target) { } } - //rotate 90 degrees once + // rotate 90 degrees once for (int i = 0, k = n - 1; i < m; i++, k--) { int j = 0; for (; j < n; j++) { @@ -40,7 +40,7 @@ public boolean findRotation(int[][] mat, int[][] target) { } } - //rotate 90 degrees the second time + // rotate 90 degrees the second time for (int i = 0, k = n - 1; i < m; i++, k--) { int j = 0; for (; j < n; j++) { @@ -62,7 +62,7 @@ public boolean findRotation(int[][] mat, int[][] target) { } } - //rotate 90 degrees the third time + // rotate 90 degrees the third time for (int i = 0, k = n - 1; i < m; i++, k--) { int j = 0; for (; j < n; j++) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1891.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1891.java index e3cf150113..b017d793a1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1891.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1891.java @@ -4,7 +4,7 @@ public class _1891 { public static class Solution1 { - /** + /* * My completely original solution on 1/27/2022. */ public int maxLength(int[] ribbons, int k) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1899.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1899.java index c98e372140..2855f2856f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1899.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1899.java @@ -32,12 +32,16 @@ public boolean mergeTriplets(int[][] triplets, int[] target) { } private int[] mergeTriplets(int[] triplet, int[] base) { - return new int[]{Math.max(triplet[0], base[0]), Math.max(triplet[1], base[1]), Math.max(triplet[2], base[2])}; + return new int[] { + Math.max(triplet[0], base[0]), + Math.max(triplet[1], base[1]), + Math.max(triplet[2], base[2]) + }; } private boolean shouldMerge(int[] triplet, int[] target, int i) { if (triplet[i] == target[i]) { - //check the other two indexes not exceeding target + // check the other two indexes not exceeding target if (i == 0) { return triplet[1] <= target[1] && triplet[2] <= target[2]; } else if (i == 1) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1904.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1904.java index 379f1f2cbf..6409ecdbb6 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1904.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1904.java @@ -25,7 +25,7 @@ public int numberOfRounds(String startTime, String finishTime) { } return rounds; } else { - //compute all full rounds in the start hour + // compute all full rounds in the start hour if (startMin == 0) { rounds += 4; } else if (startMin <= 15) { @@ -36,7 +36,7 @@ public int numberOfRounds(String startTime, String finishTime) { rounds++; } - //compute all full rounds in the finish hour + // compute all full rounds in the finish hour if (endMin >= 45) { rounds += 3; } else if (endMin >= 30) { @@ -45,7 +45,7 @@ public int numberOfRounds(String startTime, String finishTime) { rounds++; } - //compute all full rounds in the all full hours between finishHour and startHour + // compute all full rounds in the all full hours between finishHour and startHour rounds += (endHour - startHour - 1) * 4; return rounds; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1909.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1909.java index bb509baa3d..04e94e67f5 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1909.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1909.java @@ -2,7 +2,7 @@ public class _1909 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing/discuss/1298827/Java-Short */ public boolean canBeIncreasing(int[] nums) { diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1926.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1926.java index 879dd75982..2263654ab7 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1926.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1926.java @@ -8,9 +8,9 @@ public static class Solution1 { public int nearestExit(char[][] maze, int[] entrance) { int m = maze.length; int n = maze[0].length; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; Queue queue = new LinkedList<>(); - queue.offer(new int[]{entrance[0], entrance[1], 0}); + queue.offer(new int[] {entrance[0], entrance[1], 0}); boolean[][] visited = new boolean[m][n]; visited[entrance[0]][entrance[1]] = true; int shortestSteps = m * n; @@ -19,12 +19,17 @@ public int nearestExit(char[][] maze, int[] entrance) { for (int i = 0; i < directions.length - 1; i++) { int nextX = curr[0] + directions[i]; int nextY = curr[1] + directions[i + 1]; - if (nextX >= 0 && nextX < m && nextY >= 0 && nextY < n && maze[nextX][nextY] == '.' && !visited[nextX][nextY]) { + if (nextX >= 0 + && nextX < m + && nextY >= 0 + && nextY < n + && maze[nextX][nextY] == '.' + && !visited[nextX][nextY]) { visited[nextX][nextY] = true; if (nextX == 0 || nextX == m - 1 || nextY == 0 || nextY == n - 1) { shortestSteps = Math.min(shortestSteps, curr[2] + 1); } else { - queue.offer(new int[]{nextX, nextY, curr[2] + 1}); + queue.offer(new int[] {nextX, nextY, curr[2] + 1}); } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1941.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1941.java index 7932c38abe..180b658bc9 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1941.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1941.java @@ -11,7 +11,12 @@ public boolean areOccurrencesEqual(String s) { for (char c : charArray) { counts[c - 'a']++; } - return Arrays.stream(counts).filter(i -> i != 0).boxed().collect(Collectors.toSet()).size() == 1; + return Arrays.stream(counts) + .filter(i -> i != 0) + .boxed() + .collect(Collectors.toSet()) + .size() + == 1; } } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1966.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1966.java index 6a33fe9228..43863644e1 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1966.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1966.java @@ -5,7 +5,7 @@ public class _1966 { public static class Solution1 { - /** + /* * Brute force: this ends in TLE on LeetCode. * The idea is: for every single number in the array, check if there's any number on its right side that's smaller than it * and if there's any number on its left side that's bigger than it. @@ -37,7 +37,7 @@ public int binarySearchableNumbers(int[] nums) { } public static class Solution2 { - /** + /* * My completely original solution. */ public int binarySearchableNumbers(int[] nums) { @@ -60,7 +60,7 @@ public int binarySearchableNumbers(int[] nums) { } public static class Solution3 { - /** + /* * Using monotonic stack: * 1. we only add the ones that are greater than those already on the stack onto the stack. * 2. if the existing ones on the stack are greater than the current one, diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1971.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1971.java index 14d1149f83..0e52df5835 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1971.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1971.java @@ -44,6 +44,5 @@ public boolean validPath(int n, int[][] edges, int start, int end) { } return false; } - } } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1973.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1973.java index 072efa3c3c..6f3a2d54bf 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1973.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1973.java @@ -4,7 +4,7 @@ public class _1973 { public static class Solution1 { - /** + /* * This problem is almost identical to: * https://leetcode.com/problems/count-nodes-equal-to-average-of-subtree/description/ * https://leetcode.com/problems/maximum-average-subtree/description/ diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1981.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1981.java index b7e90c70f6..571bced18f 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1981.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1981.java @@ -2,14 +2,17 @@ public class _1981 { public static class Solution1 { - /** + /* * creidt: https://leetcode.com/problems/minimize-the-difference-between-target-and-chosen-elements/discuss/1418614/Java-dp-code-with-proper-comments-and-explanation */ int ans = Integer.MAX_VALUE; boolean[][] dp; public int minimizeTheDifference(int[][] mat, int target) { - dp = new boolean[mat.length][4900];//we use 4900 due to the contraints in this problem: 70 * 70 = 4900 + dp = + new boolean[mat.length] + [4900]; // we use 4900 due to the contraints in this problem: 70 * 70 = + // 4900 memo(mat, 0, 0, target); return ans; } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1985.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1985.java index fdebe54084..396548d3d7 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1985.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1985.java @@ -5,7 +5,12 @@ public class _1985 { public static class Solution1 { public String kthLargestNumber(String[] nums, int k) { - PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> (a.length() != b.length() ? b.length() - a.length() : b.compareTo(a))); + PriorityQueue maxHeap = + new PriorityQueue<>( + (a, b) -> + (a.length() != b.length() + ? b.length() - a.length() + : b.compareTo(a))); for (String num : nums) { maxHeap.offer(num); } diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1992.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1992.java index 9515ea069f..055170eba2 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1992.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1992.java @@ -12,14 +12,14 @@ public int[][] findFarmland(int[][] land) { int m = land.length; int n = land[0].length; boolean[][] visited = new boolean[m][n]; - int[] directions = new int[]{0, 1, 0, -1, 0}; + int[] directions = new int[] {0, 1, 0, -1, 0}; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (land[i][j] == 1 && !visited[i][j]) { visited[i][j] = true; Queue queue = new LinkedList<>(); - queue.offer(new int[]{i, j}); - int[] coords = new int[]{i, j, i, j}; + queue.offer(new int[] {i, j}); + int[] coords = new int[] {i, j, i, j}; while (!queue.isEmpty()) { int size = queue.size(); for (int k = 0; k < size; k++) { @@ -27,9 +27,14 @@ public int[][] findFarmland(int[][] land) { for (int p = 0; p < directions.length - 1; p++) { int newX = directions[p] + curr[0]; int newY = directions[p + 1] + curr[1]; - if (newX >= 0 && newY >= 0 && newX < m && newY < n && land[newX][newY] == 1 && !visited[newX][newY]) { + if (newX >= 0 + && newY >= 0 + && newX < m + && newY < n + && land[newX][newY] == 1 + && !visited[newX][newY]) { visited[newX][newY] = true; - queue.offer(new int[]{newX, newY}); + queue.offer(new int[] {newX, newY}); coords[0] = Math.min(coords[0], newX); coords[1] = Math.min(coords[1], newY); coords[2] = Math.max(coords[2], newX); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1993.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1993.java index 9ab5cd48b8..5b336fa469 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1993.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1993.java @@ -7,7 +7,7 @@ public class _1993 { public static class Solution1 { - /** + /* * My completely original solution: * 1. use hashmap1 to store num to node mapping; * 2. use hashmap2 to store num to user lock mapping; @@ -39,7 +39,10 @@ public LockingTree(int[] parent) { this.lockMap = new HashMap<>(); } - private void constructTree(int[] parent, Map map, Map childToParentMap) { + private void constructTree( + int[] parent, + Map map, + Map childToParentMap) { for (int i = 1; i < parent.length; i++) { TreeNode parentNode = map.getOrDefault(parent[i], new TreeNode(parent[i])); TreeNode childNode = map.getOrDefault(i, new TreeNode(i)); diff --git a/src/main/java/com/fishercoder/solutions/secondthousand/_1996.java b/src/main/java/com/fishercoder/solutions/secondthousand/_1996.java index b6f9195a52..3639935634 100644 --- a/src/main/java/com/fishercoder/solutions/secondthousand/_1996.java +++ b/src/main/java/com/fishercoder/solutions/secondthousand/_1996.java @@ -6,7 +6,7 @@ public class _1996 { public static class Solution1 { public int numberOfWeakCharacters(int[][] properties) { int count = 0; - /**sort them based on: + /*sort them based on: * if attack values equal, then sort by defense value ascendingly * if not, sort by attack values descendingly. * */ diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2001.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2001.java index f79bd3ca73..12394eec2a 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2001.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2001.java @@ -5,7 +5,7 @@ public class _2001 { public static class Solution1 { - /** + /* * credit: https://github.com/fishercoder1534/Leetcode/blob/master/python3/2001.py */ public long interchangeableRectangles(int[][] rectangles) { @@ -24,7 +24,7 @@ public long interchangeableRectangles(int[][] rectangles) { } public static class Solution2 { - /** + /* * credit: https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles/discuss/1458404/Java-or-HashMap *

* This is an even smarter way to solve this problem: diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2007.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2007.java index 7508916fca..16a1afc8bd 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2007.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2007.java @@ -6,12 +6,12 @@ public class _2007 { public static class Solution1 { - /** + /* * My completely original, but a bit lengthy solution. */ public int[] findOriginalArray(int[] changed) { if (changed.length % 2 != 0) { - return new int[]{}; + return new int[] {}; } Arrays.sort(changed); int[] ans = new int[changed.length / 2]; @@ -25,8 +25,10 @@ public int[] findOriginalArray(int[] changed) { if (map.containsKey(doubledNumber)) { int doubledNumberCount = map.get(doubledNumber); int halfNumber = doubledNumber / 2; - if (!map.containsKey(halfNumber) || map.get(halfNumber) < doubledNumberCount || halfNumber * 2 != doubledNumber) { - return new int[]{}; + if (!map.containsKey(halfNumber) + || map.get(halfNumber) < doubledNumberCount + || halfNumber * 2 != doubledNumber) { + return new int[] {}; } else { if (doubledNumber == halfNumber && map.get(halfNumber) % 2 == 0) { doubledNumberCount /= 2; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2017.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2017.java index 0b29660201..d2b26815e0 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2017.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2017.java @@ -2,7 +2,7 @@ public class _2017 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/uwi/ */ public long gridGame(int[][] grid) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2018.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2018.java index ab913c7211..9bbadc9200 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2018.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2018.java @@ -8,8 +8,10 @@ public boolean placeWordInCrossword(char[][] board, String word) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == ' ' || board[i][j] == word.charAt(0)) { - if (canPlaceTopDown(word, board, i, j) || canPlaceLeftRight(word, board, i, j) - || canPlaceBottomUp(word, board, i, j) || canPlaceRightLeft(word, board, i, j)) { + if (canPlaceTopDown(word, board, i, j) + || canPlaceLeftRight(word, board, i, j) + || canPlaceBottomUp(word, board, i, j) + || canPlaceRightLeft(word, board, i, j)) { return true; } } @@ -19,7 +21,8 @@ public boolean placeWordInCrossword(char[][] board, String word) { } private boolean canPlaceRightLeft(String word, char[][] board, int row, int col) { - if (col + 1 < board[0].length && (Character.isLowerCase(board[row][col + 1]) || board[row][col + 1] == ' ')) { + if (col + 1 < board[0].length + && (Character.isLowerCase(board[row][col + 1]) || board[row][col + 1] == ' ')) { return false; } int k = 0; @@ -35,7 +38,8 @@ private boolean canPlaceRightLeft(String word, char[][] board, int row, int col) } private boolean canPlaceBottomUp(String word, char[][] board, int row, int col) { - if (row + 1 < board.length && (Character.isLowerCase(board[row + 1][col]) || board[row + 1][col] == ' ')) { + if (row + 1 < board.length + && (Character.isLowerCase(board[row + 1][col]) || board[row + 1][col] == ' ')) { return false; } int k = 0; @@ -51,7 +55,8 @@ private boolean canPlaceBottomUp(String word, char[][] board, int row, int col) } private boolean canPlaceLeftRight(String word, char[][] board, int row, int col) { - if (col > 0 && (Character.isLowerCase(board[row][col - 1]) || board[row][col - 1] == ' ')) { + if (col > 0 + && (Character.isLowerCase(board[row][col - 1]) || board[row][col - 1] == ' ')) { return false; } int k = 0; @@ -67,7 +72,8 @@ private boolean canPlaceLeftRight(String word, char[][] board, int row, int col) } private boolean canPlaceTopDown(String word, char[][] board, int row, int col) { - if (row > 0 && (Character.isLowerCase(board[row - 1][col]) || board[row - 1][col] == ' ')) { + if (row > 0 + && (Character.isLowerCase(board[row - 1][col]) || board[row - 1][col] == ' ')) { return false; } int k = 0; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2022.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2022.java index fc623db4df..79e128d4c6 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2022.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2022.java @@ -4,7 +4,7 @@ public class _2022 { public static class Solution1 { public int[][] construct2DArray(int[] original, int m, int n) { if (m * n != original.length) { - return new int[][]{}; + return new int[][] {}; } int[][] ans = new int[m][n]; int k = 0; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2024.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2024.java index 6f76ebedb4..b13a0c5117 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2024.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2024.java @@ -4,7 +4,7 @@ public class _2024 { public static class Solution1 { public int maxConsecutiveAnswers(String answerKey, int k) { int max; - //change T to F and count number of Fs + // change T to F and count number of Fs int right = 0; int originalK = k; while (k > 0 && right < answerKey.length()) { @@ -28,7 +28,7 @@ public int maxConsecutiveAnswers(String answerKey, int k) { } } - //change F to T + // change F to T right = 0; k = originalK; while (k > 0 && right < answerKey.length()) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2027.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2027.java index c2de267339..c8c17b40de 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2027.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2027.java @@ -19,6 +19,5 @@ public int minimumMoves(String s) { } return moves; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2028.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2028.java index 0af698bc41..29d163e437 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2028.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2028.java @@ -9,8 +9,11 @@ public int[] missingRolls(int[] rolls, int mean, int n) { } long totalSum = (rolls.length + n) * mean; long remainder = totalSum - sum; - if (remainder / n > 6 || (remainder / n == 6 && remainder % n != 0) || remainder / n < 0 || remainder < n) { - return new int[]{}; + if (remainder / n > 6 + || (remainder / n == 6 && remainder % n != 0) + || remainder / n < 0 + || remainder < n) { + return new int[] {}; } int ave = (int) (remainder / n); int remain = (int) (remainder % n); diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2038.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2038.java index a3c96b7672..47f79e5a95 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2038.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2038.java @@ -5,7 +5,8 @@ public static class Solution1 { public boolean winnerOfGame(String colors) { int ans = 0; for (int i = 1; i < colors.length() - 1; i++) { - if (colors.charAt(i) == colors.charAt(i - 1) && colors.charAt(i) == colors.charAt(i + 1)) { + if (colors.charAt(i) == colors.charAt(i - 1) + && colors.charAt(i) == colors.charAt(i + 1)) { if (colors.charAt(i) == 'A') { ans++; } else { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2039.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2039.java index 8ed3c0a4ad..6d091532d6 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2039.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2039.java @@ -10,7 +10,7 @@ public class _2039 { public static class Solution1 { - /** + /* * My completely original solution, again, using a pen and paper to visualize my thought process helps out greatly! */ public int networkBecomesIdle(int[][] edges, int[] patience) { @@ -22,7 +22,11 @@ public int networkBecomesIdle(int[][] edges, int[] patience) { int numberOfMessages = roundTripTime / patience[i]; int lastMessageArriveTime = roundTripTime; if (roundTripTime > patience[i]) { - lastMessageArriveTime += patience[i] * (roundTripTime % patience[i] == 0 ? (numberOfMessages - 1) : numberOfMessages); + lastMessageArriveTime += + patience[i] + * (roundTripTime % patience[i] == 0 + ? (numberOfMessages - 1) + : numberOfMessages); } seconds = Math.max(seconds, lastMessageArriveTime); } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2043.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2043.java index 4dfca31a4d..ab27899c9c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2043.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2043.java @@ -54,6 +54,5 @@ public boolean withdraw(int account, long money) { } } } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2047.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2047.java index fa28961bdb..448a87e8fd 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2047.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2047.java @@ -15,11 +15,17 @@ public int countValidWords(String sentence) { for (int i = 0; i < token.length(); i++) { if (token.charAt(i) == '-') { hyphenCount++; - if (hyphenCount > 1 || i == 0 || i == token.length() - 1 || !Character.isAlphabetic(token.charAt(i - 1)) || !Character.isAlphabetic(token.charAt(i + 1))) { + if (hyphenCount > 1 + || i == 0 + || i == token.length() - 1 + || !Character.isAlphabetic(token.charAt(i - 1)) + || !Character.isAlphabetic(token.charAt(i + 1))) { valid = false; break; } - } else if (token.charAt(i) == '!' || token.charAt(i) == '.' || token.charAt(i) == ',') { + } else if (token.charAt(i) == '!' + || token.charAt(i) == '.' + || token.charAt(i) == ',') { punctuationMarkCount++; if (punctuationMarkCount > 1 || i != token.length() - 1) { valid = false; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2049.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2049.java index b5e415e942..e8f9f54d11 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2049.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2049.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -9,7 +8,7 @@ public class _2049 { public static class Solution1 { - /** + /* * My completely original solution. * Practice makes perfect! */ @@ -17,14 +16,18 @@ public int countHighestScoreNodes(int[] parents) { Map valToNodeMap = new HashMap<>(); TreeNode root = buildBinaryTree(parents, valToNodeMap); - //it'll be handy if we can cache the number of children each node has as we'll do this many times, so we can quickly calculate the score for each node - //key is the node since each node's value is unique, value if the number of children this node has + // it'll be handy if we can cache the number of children each node has as we'll do this + // many times, so we can quickly calculate the score for each node + // key is the node since each node's value is unique, value if the number of children + // this node has Map nodeCountMap = new HashMap<>(); - //naturally we should use post-order traversal since we need to count the children for each child first, then we can roll up to add one to get the number of children for the root node + // naturally we should use post-order traversal since we need to count the children for + // each child first, then we can roll up to add one to get the number of children for + // the root node long allNodeCount = postOrder(root, nodeCountMap); nodeCountMap.put(root.val, allNodeCount); - //now calculate the score of each node + // now calculate the score of each node List scoreList = new ArrayList<>(); long highestScore = 0; for (int i = 0; i < parents.length; i++) { @@ -41,8 +44,10 @@ public int countHighestScoreNodes(int[] parents) { return count; } - private Long computeScore(int nodeVal, Map nodeCountMap, Map nodeValueMap) { - //since this is a binary tree, so, at most, removing a node, it'll split the original tree into three disjoint trees + private Long computeScore( + int nodeVal, Map nodeCountMap, Map nodeValueMap) { + // since this is a binary tree, so, at most, removing a node, it'll split the original + // tree into three disjoint trees TreeNode node = nodeValueMap.get(nodeVal); Long leftSubtree = 1L; Long rightSubtree = 1L; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2050.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2050.java index 77d903af96..5e88aa0bd2 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2050.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2050.java @@ -10,7 +10,7 @@ public class _2050 { public static class Solution1 { - /** + /* * My original solution, but results in TLE on LeetCode at 39/40 test cases... */ public int minimumTime(int n, int[][] relations, int[] time) { @@ -55,6 +55,5 @@ public int minimumTime(int n, int[][] relations, int[] time) { } return minTime; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2054.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2054.java index 34e57cdb52..35eac2762e 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2054.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2054.java @@ -5,7 +5,7 @@ public class _2054 { public static class Solution1 { public int maxTwoEvents(int[][] events) { - /**Credit: https://leetcode.com/nevergiveup/ on https://leetcode.com/contest/biweekly-contest-64/ranking/*/ + /*Credit: https://leetcode.com/nevergiveup/ on https://leetcode.com/contest/biweekly-contest-64/ranking/*/ Arrays.sort(events, (a, b) -> a[0] - b[0]); int[] max = new int[events.length]; for (int i = events.length - 1; i >= 0; i--) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2058.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2058.java index 67698580fd..621edad7c1 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2058.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2058.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; @@ -22,19 +21,19 @@ public int[] nodesBetweenCriticalPoints(ListNode head) { } } if (criticalPts.size() < 2) { - return new int[]{-1, -1}; + return new int[] {-1, -1}; } int min = Integer.MAX_VALUE; for (int i = 0; i < criticalPts.size() - 1; i++) { min = Math.min(min, criticalPts.get(i + 1) - criticalPts.get(i)); } int size = criticalPts.size(); - return new int[]{min, criticalPts.get(size - 1) - criticalPts.get(0)}; + return new int[] {min, criticalPts.get(size - 1) - criticalPts.get(0)}; } } public static class Solution2 { - /** + /* * Without using an extra list of size N to hold all values. */ public int[] nodesBetweenCriticalPoints(ListNode head) { @@ -53,7 +52,10 @@ public int[] nodesBetweenCriticalPoints(ListNode head) { } if (criticalPoints.size() > 1) { int len = criticalPoints.size(); - result[0] = Math.min(result[0], criticalPoints.get(len - 1) - criticalPoints.get(len - 2)); + result[0] = + Math.min( + result[0], + criticalPoints.get(len - 1) - criticalPoints.get(len - 2)); } prev = head.val; head = head.next; @@ -61,10 +63,11 @@ public int[] nodesBetweenCriticalPoints(ListNode head) { } if (criticalPoints.size() > 1) { int len = criticalPoints.size(); - result[1] = Math.max(result[1], criticalPoints.get(len - 1) - criticalPoints.get(0)); + result[1] = + Math.max(result[1], criticalPoints.get(len - 1) - criticalPoints.get(0)); return result; } else { - return new int[]{-1, -1}; + return new int[] {-1, -1}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2063.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2063.java index b505944fc0..3c8e40e6e3 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2063.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2063.java @@ -2,7 +2,7 @@ public class _2063 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/nevergiveup/ */ public long countVowels(String word) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2070.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2070.java index b3e87d295b..133ba33ae0 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2070.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2070.java @@ -9,7 +9,7 @@ public int[] maximumBeauty(int[][] items, int[] queries) { Arrays.sort(items, (a, b) -> Integer.compare(a[0], b[0])); int[][] queryPairs = new int[len][2]; for (int i = 0; i < len; i++) { - queryPairs[i] = new int[]{queries[i], i}; + queryPairs[i] = new int[] {queries[i], i}; } Arrays.sort(queryPairs, (a, b) -> Integer.compare(a[0], b[0])); int[] ans = new int[len]; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2073.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2073.java index cd65e84935..446d7a1803 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2073.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2073.java @@ -9,12 +9,12 @@ public int timeRequiredToBuy(int[] tickets, int k) { int time = 0; Deque queue = new LinkedList<>(); for (int i = 0; i < tickets.length; i++) { - queue.addLast(new int[]{tickets[i], i}); + queue.addLast(new int[] {tickets[i], i}); } while (!queue.isEmpty()) { int[] curr = queue.pollFirst(); if (curr[0] - 1 > 0) { - queue.addLast(new int[]{curr[0] - 1, curr[1]}); + queue.addLast(new int[] {curr[0] - 1, curr[1]}); } time++; if (curr[1] == k && curr[0] - 1 == 0) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2074.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2074.java index efe0abc6d1..e5d609c17a 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2074.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2074.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2076.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2076.java index fac566fa71..e82671d4fc 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2076.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2076.java @@ -5,7 +5,7 @@ public class _2076 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/SaveVMK/ on https://leetcode.com/contest/weekly-contest-267/ranking/ */ public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) { @@ -46,6 +46,5 @@ public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) { } return ans; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2080.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2080.java index 02c84cefad..0c28cbcdfb 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2080.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2080.java @@ -6,7 +6,7 @@ public class _2080 { public static class Solution1 { public static class RangeFreqQuery { - /** + /* * This post explains it well: https://leetcode.com/problems/range-frequency-queries/discuss/1589019/Java-or-Binary-Search-or-Log(n)-for-every-query */ diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2086.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2086.java index c18d40cb4e..570b120160 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2086.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2086.java @@ -35,7 +35,9 @@ public int minimumBuckets(String street) { minBuckets++; buckets[i - 1] = 1; } - } else if (i + 1 >= street.length() && i - 1 >= 0 && street.charAt(i - 1) == 'H') { + } else if (i + 1 >= street.length() + && i - 1 >= 0 + && street.charAt(i - 1) == 'H') { return -1; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2095.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2095.java index 52508a31cc..5b3b6d092c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2095.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2095.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2096.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2096.java index e500732dcc..32f1b85832 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2096.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2096.java @@ -4,7 +4,7 @@ public class _2096 { public static class Solution1 { - /** + /* * Steps for this problem: * 1. find the path from root the start and dest respectively, mark them using two directions: 'L' and 'R', i.e. you can only go down from root, so there's no up, 'U' direction; * 2. the LCA (the lowest common ancestor) of start and dest will be the joint of the shortest path; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2115.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2115.java index 4a01d89c72..2c6848ecc3 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2115.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2115.java @@ -12,10 +12,11 @@ public class _2115 { public static class Solution1 { - /** + /* * My completely original solution, topological sort template comes in pretty handy. */ - public List findAllRecipes(String[] recipes, List> ingredients, String[] supplies) { + public List findAllRecipes( + String[] recipes, List> ingredients, String[] supplies) { Set allRecipes = new HashSet<>(); Collections.addAll(allRecipes, recipes); @@ -40,7 +41,8 @@ public List findAllRecipes(String[] recipes, List> ingredie } Queue q = new LinkedList<>(); for (Map.Entry entry : indegree.entrySet()) { - if (entry.getValue() == 0 && allSupplies.containsAll(ingredientMap.get(entry.getKey()))) { + if (entry.getValue() == 0 + && allSupplies.containsAll(ingredientMap.get(entry.getKey()))) { q.offer(entry.getKey()); } } @@ -57,6 +59,5 @@ public List findAllRecipes(String[] recipes, List> ingredie } return result; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2116.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2116.java index 8a172b48d4..5050d71ebb 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2116.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2116.java @@ -2,7 +2,7 @@ public class _2116 { public static class Solution1 { - /** + /* * credit: https://leetcode.com/problems/check-if-a-parentheses-string-can-be-valid/discuss/1646594/Left-to-right-and-right-to-left */ public boolean canBeValid(String s, String locked) { @@ -14,7 +14,9 @@ private boolean valid(String s, String locked, char op) { int wildcards = 0; int direction = op == '(' ? 1 : -1; int start = op == '(' ? 0 : s.length() - 1; - for (int i = start; i < s.length() && i >= 0 && balance + wildcards >= 0; i += direction) { + for (int i = start; + i < s.length() && i >= 0 && balance + wildcards >= 0; + i += direction) { if (locked.charAt(i) == '1') { balance += s.charAt(i) == op ? 1 : -1; } else { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2126.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2126.java index 91ba0e3102..05b9954a55 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2126.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2126.java @@ -1,11 +1,8 @@ package com.fishercoder.solutions.thirdthousand; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.Set; public class _2126 { public static class Solution1 { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2130.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2130.java index 2fab2c9390..3c3ae43128 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2130.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2130.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2134.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2134.java index 0a0f17c8df..34c26a5e9b 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2134.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2134.java @@ -5,7 +5,7 @@ public class _2134 { public static class Solution1 { - /** + /* * Connect the original array with itself to simulate the circular property of this array. * Then use a sliding window to find the minimum swaps. */ @@ -16,16 +16,20 @@ public int minSwaps(int[] nums) { ones += num; list.add(num); } - //add it again to simulate the circular list + // add it again to simulate the circular list for (int num : nums) { list.add(num); } int minSwaps = nums.length; int zeroes = 0; - //as long as the size of the sliding window is smaller than 1s' count, we keep moving right pointer to the right - //as soon as the size of the sliding window is equal to 1s' count, we take the 0s count in this window against minSwaps to update it if possible - //then if the size of the sliding window is greater than 1s' count, we move the left pointer to the right - //One caveat: you don't really need to make the swaps to solve this problem, just counting the numbers is enough + // as long as the size of the sliding window is smaller than 1s' count, we keep moving + // right pointer to the right + // as soon as the size of the sliding window is equal to 1s' count, we take the 0s count + // in this window against minSwaps to update it if possible + // then if the size of the sliding window is greater than 1s' count, we move the left + // pointer to the right + // One caveat: you don't really need to make the swaps to solve this problem, just + // counting the numbers is enough for (int left = 0, right = 0; right < list.size(); right++) { if (list.get(right) == 0) { zeroes++; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2135.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2135.java index fde28ba251..7a8cae6c68 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2135.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2135.java @@ -1,6 +1,5 @@ package com.fishercoder.solutions.thirdthousand; - import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -20,7 +19,8 @@ public int wordCount(String[] startWords, String[] targetWords) { Arrays.sort(charArray); String sortedTarget = new String(charArray); for (int i = 0; i < sortedTarget.length(); i++) { - String formedTargetByOmittingOneLetter = sortedTarget.substring(0, i) + sortedTarget.substring(i + 1); + String formedTargetByOmittingOneLetter = + sortedTarget.substring(0, i) + sortedTarget.substring(i + 1); if (startSet.contains(formedTargetByOmittingOneLetter)) { count++; break; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2156.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2156.java index cb5d3ef202..c1988af4b4 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2156.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2156.java @@ -2,7 +2,7 @@ public class _2156 { public static class Solution1 { - /** + /* * Credit: https://leetcode.com/problems/find-substring-with-given-hash-value/discuss/1730100/Java-rolling-hash(back-to-front)/1242659 *

* We start from the right side and compute rolling hash when moving the window of size k towards the left. @@ -13,12 +13,14 @@ public String subStrHash(String s, int power, int modulo, int k, int hashValue) long weight = 1; for (int j = 0; j < k - 1; j++) { // calculate the weight which will be the power to the k-1 - // this will be used when we start shifting our window of size k to the left from the end of the string + // this will be used when we start shifting our window of size k to the left from + // the end of the string weight = (weight * power) % modulo; } - /**We'll have to use the above for loop to calculate weight instead of using Math.pow(power, k - 1) which will render wrong results when power and k are big enough.*/ + /*We'll have to use the above for loop to calculate weight instead of using Math.pow(power, k - 1) which will render wrong results when power and k are big enough.*/ - // initialize the result string to empty string and keep updating it as we start from the end of the string, and we need to find the first substring that has the hashvalue + // initialize the result string to empty string and keep updating it as we start from + // the end of the string, and we need to find the first substring that has the hashvalue String result = ""; // right bound of the sliding window which starts at the end of the string @@ -34,17 +36,19 @@ public String subStrHash(String s, int power, int modulo, int k, int hashValue) hash = (hash * power % modulo + val) % modulo; // when window is at size k, we need to check if we find a matching hash value - // and update the result, and remove the right most char out of the window to prepare for next iteration + // and update the result, and remove the right most char out of the window to + // prepare for next iteration if (right - i + 1 == k) { if (hash == hashValue) { result = s.substring(i, right + 1); } - hash = (hash + modulo - (s.charAt(right--) - 'a' + 1) * weight % modulo) % modulo; + hash = + (hash + modulo - (s.charAt(right--) - 'a' + 1) * weight % modulo) + % modulo; } } return result; } } - } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2169.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2169.java index cf0a60a15d..31fd7095da 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2169.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2169.java @@ -14,7 +14,6 @@ public int countOperations(int num1, int num2) { num2 -= num1; } ops++; - } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2177.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2177.java index 97b35bab43..83c3a29c5f 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2177.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2177.java @@ -6,9 +6,9 @@ public long[] sumOfThree(long num) { long remainder = num % 3; long ave = num / 3; if (remainder == 0) { - return new long[]{ave - 1, ave, ave + 1}; + return new long[] {ave - 1, ave, ave + 1}; } else { - return new long[]{}; + return new long[] {}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2181.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2181.java index d15537c473..09024ea8ac 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2181.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2181.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; @@ -29,7 +28,7 @@ public ListNode mergeNodes(ListNode head) { } public static class Solution2 { - /** + /* * Without using an extra list, do sum on the fly. */ public ListNode mergeNodes(ListNode head) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2192.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2192.java index c9e0e2ae09..91dc7601f8 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2192.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2192.java @@ -9,7 +9,7 @@ public class _2192 { public static class Solution1 { - /** + /* * My completely original solution: * topological sort template comes in handy here. */ diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2196.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2196.java index 379ae8fd89..cdaae24b2f 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2196.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2196.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -9,7 +8,7 @@ public class _2196 { public static class Solution1 { - /** + /* * My completely original solution. */ public TreeNode createBinaryTree(int[][] descriptions) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2215.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2215.java index 59ecf9ea61..091c676042 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2215.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2215.java @@ -15,8 +15,10 @@ public List> findDifference(int[] nums1, int[] nums2) { Set set2 = Arrays.stream(nums2).boxed().collect(Collectors.toSet()); set1.removeAll(set2); set2.removeAll(set1Copy); - List list1 = set1.stream().mapToInt(n -> n).boxed().collect(Collectors.toList()); - List list2 = set2.stream().mapToInt(n -> n).boxed().collect(Collectors.toList()); + List list1 = + set1.stream().mapToInt(n -> n).boxed().collect(Collectors.toList()); + List list2 = + set2.stream().mapToInt(n -> n).boxed().collect(Collectors.toList()); return new ArrayList<>(Arrays.asList(list1, list2)); } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2224.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2224.java index 358c9abac2..89df27831c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2224.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2224.java @@ -8,10 +8,14 @@ public int convertTime(String current, String correct) { } int ops = 0; String[] startHourAndMinute = current.split(":"); - int start = 60 * Integer.parseInt(startHourAndMinute[0]) + Integer.parseInt(startHourAndMinute[1]); + int start = + 60 * Integer.parseInt(startHourAndMinute[0]) + + Integer.parseInt(startHourAndMinute[1]); String[] endHourAndMinute = correct.split(":"); - int end = 60 * Integer.parseInt(endHourAndMinute[0]) + Integer.parseInt(endHourAndMinute[1]); - int[] addons = new int[]{1, 5, 15, 60}; + int end = + 60 * Integer.parseInt(endHourAndMinute[0]) + + Integer.parseInt(endHourAndMinute[1]); + int[] addons = new int[] {1, 5, 15, 60}; int index = 3; while (start < end) { if (start + addons[index] == end) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2248.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2248.java index 73618209b6..e8959db007 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2248.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2248.java @@ -32,6 +32,5 @@ public int[] intersection(int[] nums1, int[] nums2) { } return intersection; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2265.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2265.java index 2c425861e9..5fde576569 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2265.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2265.java @@ -4,7 +4,7 @@ public class _2265 { public static class Solution1 { - /** + /* * When it comes to process all subtrees first, and then process the root, it's a good candidate to use post-order traversal recursion. * Credit: https://leetcode.com/problems/count-nodes-equal-to-average-of-subtree/editorial/ */ @@ -27,7 +27,7 @@ private int[] postOrder(TreeNode root) { if (root.val == nodeSum / nodeCount) { count++; } - return new int[]{nodeSum, nodeCount}; + return new int[] {nodeSum, nodeCount}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2288.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2288.java index b9b8f6ec8b..f28f5c15d7 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2288.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2288.java @@ -9,7 +9,8 @@ public String discountPrices(String sentence, int discount) { if (word.charAt(0) == '$') { try { long num = Long.parseLong(word.substring(1)); - double newNum = Math.round(num * (1 - ((discount * 1.0) / 100)) * 100.00) / 100.00; + double newNum = + Math.round(num * (1 - ((discount * 1.0) / 100)) * 100.00) / 100.00; sb.append("$"); sb.append(String.format("%.2f", newNum)); } catch (Exception e) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2300.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2300.java index 62bf7f363c..50d1644cec 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2300.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2300.java @@ -25,7 +25,9 @@ private int binarySearch(int[] potions, long success, int spell) { left = mid + 1; } } - if (left == right && left == potions.length - 1 && (long) spell * potions[left] < success) { + if (left == right + && left == potions.length - 1 + && (long) spell * potions[left] < success) { return potions.length; } return right; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2316.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2316.java index fccf66adae..94a329ac9f 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2316.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2316.java @@ -7,12 +7,14 @@ public class _2316 { public static class Solution1 { public long countPairs(int n, int[][] edges) { UnionFind uf = new UnionFind(n); - //this union is a first pass which doesn't union all nodes completely, if you set a debug point, you can clearly see that + // this union is a first pass which doesn't union all nodes completely, if you set a + // debug point, you can clearly see that for (int[] edge : edges) { uf.union(edge[0], edge[1]); } Map countMap = new HashMap<>(); - //run i = 0 through to n - 1 again, and call find(), this will completely union all connected nodes + // run i = 0 through to n - 1 again, and call find(), this will completely union all + // connected nodes for (int i = 0; i < n; i++) { int id = uf.find(i); countMap.put(id, countMap.getOrDefault(id, 0) + 1); diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2325.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2325.java index 6cce217794..ae51f0ae1d 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2325.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2325.java @@ -35,7 +35,8 @@ public String decodeMessage(String key, String message) { public static class Solution2 { public String decodeMessage(String key, String message) { - // put first occurrence of each char of key in hashmap, where k = char in key, v = incremental a - z alphabets + // put first occurrence of each char of key in hashmap, where k = char in key, v = + // incremental a - z alphabets Map bucket = new HashMap<>(); char ch = 'a'; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2326.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2326.java index 471bcc9329..32a851194c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2326.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2326.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.List; @@ -23,7 +22,7 @@ public int[][] spiralMatrix(int m, int n, ListNode head) { int top = 1; int count = 0; while (index < m * n) { - //go right + // go right while (j <= rightBorder) { matrix[i][j++] = index < list.size() ? list.get(index++) : -1; count++; @@ -34,7 +33,7 @@ public int[][] spiralMatrix(int m, int n, ListNode head) { rightBorder--; j--; - //go down + // go down i++; while (i <= bottom) { matrix[i++][j] = index < list.size() ? list.get(index++) : -1; @@ -46,7 +45,7 @@ public int[][] spiralMatrix(int m, int n, ListNode head) { i--; bottom--; - //go left + // go left j--; while (j >= leftBorder) { matrix[i][j--] = index < list.size() ? list.get(index++) : -1; @@ -58,7 +57,7 @@ public int[][] spiralMatrix(int m, int n, ListNode head) { j++; leftBorder++; - //go top + // go top i--; while (i >= top) { matrix[i--][j] = index < list.size() ? list.get(index++) : -1; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2335.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2335.java index fbf6838a57..8b98c4edf9 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2335.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2335.java @@ -33,6 +33,5 @@ public int fillCups(int[] amount) { } return seconds; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2340.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2340.java index 715d5185a7..712e2988f2 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2340.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2340.java @@ -17,7 +17,7 @@ public int minimumSwaps(int[] nums) { } } int minSwaps = 0; - //now move the leftmost smallest index to the beginning of the array + // now move the leftmost smallest index to the beginning of the array for (int i = minIndex; i > 0; i--) { swap(nums, i, i - 1); minSwaps++; @@ -31,9 +31,9 @@ public int minimumSwaps(int[] nums) { } } - //now move the leftmost smallest index to the beginning of the array + // now move the leftmost smallest index to the beginning of the array for (int i = maxIndex; i < nums.length - 1; i++) { - swap(nums, i, i + 1);//this line is optional at this point + swap(nums, i, i + 1); // this line is optional at this point minSwaps++; } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2341.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2341.java index eeed2f0835..b6be558282 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2341.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2341.java @@ -20,7 +20,7 @@ public int[] numberOfPairs(int[] nums) { leftover++; } } - return new int[]{pairs, leftover}; + return new int[] {pairs, leftover}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2385.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2385.java index 125a72eac4..de6255ec64 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2385.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2385.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.*; public class _2385 { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2389.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2389.java index 0653ac09b1..46f2f2c386 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2389.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2389.java @@ -5,7 +5,7 @@ public class _2389 { public static class Solution1 { - /** + /* * My completely original solution, not sure why it's labeled EASY, IMHO, it should be a soft MEDIUM. */ public int[] answerQueries(int[] nums, int[] queries) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2392.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2392.java index c6b5e33b98..c3a4602bfa 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2392.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2392.java @@ -7,7 +7,7 @@ public class _2392 { public static class Solution1 { - /** + /* * I figured out I needed to use Kahn's algorithm to topologically sort both rowConditions and colConditions, * but unsure how to fill the matrix. * https://leetcode.com/problems/build-a-matrix-with-conditions/editorial/ is brilliant as of how to build the matrix: @@ -17,7 +17,7 @@ public int[][] buildMatrix(int k, int[][] rowConditions, int[][] colConditions) int[] topologicallySortedRows = topologicalSort(rowConditions, k); int[] topologicallySortedCols = topologicalSort(colConditions, k); if (topologicallySortedRows.length == 0 || topologicallySortedCols.length == 0) { - return new int[][]{}; + return new int[][] {}; } int[][] matrix = new int[k][k]; for (int i = 0; i < k; i++) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2399.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2399.java index c1e5aa749e..83265af33c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2399.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2399.java @@ -10,7 +10,7 @@ public boolean checkDistances(String s, int[] distance) { int i = 0; for (char c : s.toCharArray()) { if (!map.containsKey(c)) { - map.put(c, new int[]{-1, -1}); + map.put(c, new int[] {-1, -1}); } int[] indices = map.get(c); if (indices[0] == -1) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2409.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2409.java index 485baa0873..b54c031419 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2409.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2409.java @@ -2,11 +2,12 @@ public class _2409 { public static class Solution1 { - /** + /* * Brute force: check each day of the 365 days if both of them are in Rome. */ - public int countDaysTogether(String arriveAlice, String leaveAlice, String arriveBob, String leaveBob) { - int[] monthToDays = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + public int countDaysTogether( + String arriveAlice, String leaveAlice, String arriveBob, String leaveBob) { + int[] monthToDays = new int[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int days = 0; String[] arriveAliceParts = arriveAlice.split("-"); String[] leaveAliceParts = leaveAlice.split("-"); @@ -15,7 +16,13 @@ public int countDaysTogether(String arriveAlice, String leaveAlice, String arriv for (int i = 1; i < monthToDays.length; i++) { int daysInMonth = monthToDays[i]; for (int j = 1; j <= daysInMonth; j++) { - if (bothInRome(i, j, arriveAliceParts, leaveAliceParts, arriveBobParts, leaveBobParts)) { + if (bothInRome( + i, + j, + arriveAliceParts, + leaveAliceParts, + arriveBobParts, + leaveBobParts)) { days++; } } @@ -23,7 +30,13 @@ public int countDaysTogether(String arriveAlice, String leaveAlice, String arriv return days; } - private boolean bothInRome(int month, int day, String[] arriveAliceParts, String[] leaveAliceParts, String[] arriveBobParts, String[] leaveBobParts) { + private boolean bothInRome( + int month, + int day, + String[] arriveAliceParts, + String[] leaveAliceParts, + String[] arriveBobParts, + String[] leaveBobParts) { int aliceArriveMonth = Integer.parseInt(arriveAliceParts[0]); int aliceArriveDay = Integer.parseInt(arriveAliceParts[1]); int aliceLeaveMonth = Integer.parseInt(leaveAliceParts[0]); @@ -34,10 +47,18 @@ private boolean bothInRome(int month, int day, String[] arriveAliceParts, String int bobLeaveMonth = Integer.parseInt(leaveBobParts[0]); int bobLeaveDay = Integer.parseInt(leaveBobParts[1]); - return inRome(aliceArriveMonth, aliceArriveDay, aliceLeaveMonth, aliceLeaveDay, month, day) && inRome(bobArriveMonth, bobArriveDay, bobLeaveMonth, bobLeaveDay, month, day); + return inRome( + aliceArriveMonth, + aliceArriveDay, + aliceLeaveMonth, + aliceLeaveDay, + month, + day) + && inRome(bobArriveMonth, bobArriveDay, bobLeaveMonth, bobLeaveDay, month, day); } - private boolean inRome(int arriveMonth, int arriveDay, int leaveMonth, int leaveDay, int month, int day) { + private boolean inRome( + int arriveMonth, int arriveDay, int leaveMonth, int leaveDay, int month, int day) { if (month < arriveMonth || month > leaveMonth) { return false; } @@ -51,7 +72,7 @@ private boolean inRome(int arriveMonth, int arriveDay, int leaveMonth, int leave return arriveDay <= day; } } - //now, only this case: month == leaveMonth + // now, only this case: month == leaveMonth return day <= leaveDay; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2418.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2418.java index 631f1ebaac..a4f28b1f55 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2418.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2418.java @@ -7,7 +7,7 @@ public static class Solution1 { public String[] sortPeople(String[] names, int[] heights) { PriorityQueue maxHeap = new PriorityQueue<>((a, b) -> b[1] - a[1]); for (int i = 0; i < names.length; i++) { - maxHeap.offer(new int[]{i, heights[i]}); + maxHeap.offer(new int[] {i, heights[i]}); } String[] res = new String[names.length]; int i = 0; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2423.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2423.java index 59ade33b79..f89c491c22 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2423.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2423.java @@ -4,7 +4,7 @@ public class _2423 { public static class Solution1 { - /** + /* * This is my original, but unnecessarily verbose solution. * Instead, you can just brute force each one of the 26 letters, as long as any one of them makes it meet the requirement, it returns true. */ diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2437.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2437.java index 05bd0c1531..b83420b045 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2437.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2437.java @@ -3,7 +3,7 @@ public class _2437 { public static class Solution1 { public int countTime(String time) { - int[] count = new int[]{2, 10, 0, 6, 10}; + int[] count = new int[] {2, 10, 0, 6, 10}; int times = 1; for (int i = 0; i < time.length(); i++) { if (time.charAt(i) == '?') { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2446.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2446.java index c280522282..a1b876ef62 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2446.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2446.java @@ -10,7 +10,8 @@ public boolean haveConflict(String[] event1, String[] event2) { for (int h = 0; h <= 23; h++) { for (int m = 0; m <= 59; m++) { int currentTime = h * 60 + m; - if (inTime(currentTime, startMinute1, endMinute1) && inTime(currentTime, startMinute2, endMinute2)) { + if (inTime(currentTime, startMinute1, endMinute1) + && inTime(currentTime, startMinute2, endMinute2)) { return true; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2460.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2460.java index a2e791d3e9..4825a7a406 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2460.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2460.java @@ -9,7 +9,8 @@ public int[] applyOperations(int[] nums) { nums[i + 1] = 0; } } - //i points at the first zero element, j keeps moving and bypassing zeroes to find the next non-zero element + // i points at the first zero element, j keeps moving and bypassing zeroes to find the + // next non-zero element for (int i = 0, j = 0; i < nums.length && j < nums.length; ) { while (i < nums.length && nums[i] != 0) { i++; @@ -27,6 +28,5 @@ public int[] applyOperations(int[] nums) { } return nums; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2469.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2469.java index ce03cfd482..19344acfdd 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2469.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2469.java @@ -3,7 +3,7 @@ public class _2469 { public static class Solution1 { public double[] convertTemperature(double celsius) { - return new double[]{celsius + 273.15, celsius * 1.80 + 32.00}; + return new double[] {celsius + 273.15, celsius * 1.80 + 32.00}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2473.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2473.java index b4a91eaa1b..b2812773f1 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2473.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2473.java @@ -7,7 +7,7 @@ public class _2473 { public static class Solution1 { - /** + /* * My completely original solution, Dijkstra algorithm! */ public long[] minCost(int n, int[][] roads, int[] appleCost, int k) { @@ -16,8 +16,8 @@ public long[] minCost(int n, int[][] roads, int[] appleCost, int k) { graph[i] = new ArrayList<>(); } for (int[] road : roads) { - graph[road[0] - 1].add(new int[]{road[1] - 1, road[2]}); - graph[road[1] - 1].add(new int[]{road[0] - 1, road[2]}); + graph[road[0] - 1].add(new int[] {road[1] - 1, road[2]}); + graph[road[1] - 1].add(new int[] {road[0] - 1, road[2]}); } long[] ans = new long[n]; for (int i = 1; i <= n; i++) { @@ -31,7 +31,7 @@ private long dijkstra(List[] graph, int[] appleCost, int k, int startCity Arrays.fill(minCostEachCity, Integer.MAX_VALUE); minCostEachCity[startCity - 1] = 0; PriorityQueue minHeap = new PriorityQueue<>((a, b) -> a[1] - b[1]); - minHeap.offer(new int[]{startCity - 1, 0}); + minHeap.offer(new int[] {startCity - 1, 0}); while (!minHeap.isEmpty()) { int[] curr = minHeap.poll(); int currCity = curr[0]; @@ -45,7 +45,8 @@ private long dijkstra(List[] graph, int[] appleCost, int k, int startCity int neighborTotalCost = currCost + neighborCost * (k + 1); if (neighborTotalCost < minCostEachCity[neighborCity]) { minCostEachCity[neighborCity] = neighborTotalCost; - minHeap.offer(new int[]{neighborCity, (int) minCostEachCity[neighborCity]}); + minHeap.offer( + new int[] {neighborCity, (int) minCostEachCity[neighborCity]}); } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2487.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2487.java index 144e633801..e4b6ddcddd 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2487.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2487.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.ListNode; - import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; @@ -9,7 +8,7 @@ public class _2487 { public static class Solution1 { - /** + /* * This is sort of cheating, i.e. transforming the linked list into an array instead of operating on the linked list itself. */ public ListNode removeNodes(ListNode head) { @@ -49,6 +48,6 @@ private List getList(ListNode head) { } public static class Solution2 { - //TODO: use stack to solve this problem + // TODO: use stack to solve this problem } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2490.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2490.java index 130cf672f6..414e9e9015 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2490.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2490.java @@ -9,7 +9,8 @@ public boolean isCircularSentence(String sentence) { return false; } } - return words[0].charAt(0) == words[words.length - 1].charAt(words[words.length - 1].length() - 1); + return words[0].charAt(0) + == words[words.length - 1].charAt(words[words.length - 1].length() - 1); } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2492.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2492.java index 91953bdb08..f14ae78f5c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2492.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2492.java @@ -7,15 +7,15 @@ public class _2492 { public static class Solution1 { public int minScore(int n, int[][] roads) { UnionFind uf = new UnionFind(n); - //union all roads first + // union all roads first for (int[] road : roads) { uf.union(road[0], road[1]); } - //now call find() to completely union all connected cities + // now call find() to completely union all connected cities for (int i = 1; i <= n; i++) { uf.find(i); } - //now we'd like to find all cities that are connected to city 1 + // now we'd like to find all cities that are connected to city 1 Set nodes = new HashSet<>(); int startIndex = uf.find(1); for (int i = 2; i <= n; i++) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2511.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2511.java index c79c200af0..a2ce9daeba 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2511.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2511.java @@ -7,10 +7,12 @@ public int captureForts(int[] forts) { for (int i = 0; i < forts.length; i++) { if (forts[i] == 1 || forts[i] == -1) { for (int j = i + 1; j < forts.length; j++) { - if ((forts[i] == 1 && forts[j] == -1) || (forts[i] == -1 && forts[j] == 1)) { + if ((forts[i] == 1 && forts[j] == -1) + || (forts[i] == -1 && forts[j] == 1)) { max = Math.max(max, j - i - 1); break; - } else if ((forts[j] == 1 && forts[i] == 1) || forts[j] == -1 && forts[i] == -1) { + } else if ((forts[j] == 1 && forts[i] == 1) + || forts[j] == -1 && forts[i] == -1) { break; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2515.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2515.java index f94fe84c74..05d15f7912 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2515.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2515.java @@ -7,18 +7,22 @@ public int closetTarget(String[] words, String target, int startIndex) { if (words[startIndex].equals(target)) { return 0; } - //move forward + // move forward int forwardSteps = 1; - for (int i = (startIndex + 1) % words.length; i != startIndex; i = ((i + 1) % words.length)) { + for (int i = (startIndex + 1) % words.length; + i != startIndex; + i = ((i + 1) % words.length)) { if (words[i].equals(target)) { ans = Math.min(ans, forwardSteps); break; } forwardSteps++; } - //move backward + // move backward int backwardSteps = 1; - for (int i = (startIndex - 1 + words.length) % words.length; i != startIndex; i = ((i - 1 + words.length) % words.length)) { + for (int i = (startIndex - 1 + words.length) % words.length; + i != startIndex; + i = ((i - 1 + words.length) % words.length)) { if (words[i].equals(target)) { ans = Math.min(ans, backwardSteps); break; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2525.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2525.java index 9b28a54b1c..841e86c6c4 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2525.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2525.java @@ -7,7 +7,10 @@ public String categorizeBox(int length, int width, int height, int mass) { int volumeLimit = 1000000000; boolean isBulky = false; long volume = (long) length * width * height; - if (length >= dimensionLimit || width >= dimensionLimit || height >= dimensionLimit || volume >= volumeLimit) { + if (length >= dimensionLimit + || width >= dimensionLimit + || height >= dimensionLimit + || volume >= volumeLimit) { isBulky = true; } boolean isHeavy = mass >= 100; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2559.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2559.java index aeed520145..b208cbd6a4 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2559.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2559.java @@ -16,7 +16,8 @@ public int[] vowelStrings(String[] words, int[][] queries) { if (set.contains(word.charAt(0))) { vowels[i] = true; } - } else if (set.contains(word.charAt(0)) && set.contains(word.charAt(word.length() - 1))) { + } else if (set.contains(word.charAt(0)) + && set.contains(word.charAt(word.length() - 1))) { vowels[i] = true; } i++; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2570.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2570.java index 9c0b8818ec..967eddd18a 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2570.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2570.java @@ -13,23 +13,23 @@ public int[][] mergeArrays(int[][] nums1, int[][] nums2) { int id1 = nums1[i1][0]; int id2 = nums2[i2][0]; if (id2 == id1) { - mergedList.add(new int[]{id1, nums1[i1][1] + nums2[i2][1]}); + mergedList.add(new int[] {id1, nums1[i1][1] + nums2[i2][1]}); i1++; i2++; } else if (id1 < id2) { - mergedList.add(new int[]{id1, nums1[i1][1]}); + mergedList.add(new int[] {id1, nums1[i1][1]}); i1++; } else { - mergedList.add(new int[]{id2, nums2[i2][1]}); + mergedList.add(new int[] {id2, nums2[i2][1]}); i2++; } } while (i1 < nums1.length) { - mergedList.add(new int[]{nums1[i1][0], nums1[i1][1]}); + mergedList.add(new int[] {nums1[i1][0], nums1[i1][1]}); i1++; } while (i2 < nums2.length) { - mergedList.add(new int[]{nums2[i2][0], nums2[i2][1]}); + mergedList.add(new int[] {nums2[i2][0], nums2[i2][1]}); i2++; } int[][] ans = new int[mergedList.size()][2]; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2583.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2583.java index 543bdbcbf3..2416814e6c 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2583.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2583.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.*; public class _2583 { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2595.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2595.java index b21c82fdfd..a45d9543c0 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2595.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2595.java @@ -18,7 +18,7 @@ public int[] evenOddBit(int n) { } } } - return new int[]{even, odd}; + return new int[] {even, odd}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2596.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2596.java index b5c70ff6c9..2a3982aa96 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2596.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2596.java @@ -4,16 +4,17 @@ public class _2596 { public static class Solution1 { public boolean checkValidGrid(int[][] grid) { int n = grid.length; - int[][] offsets = new int[][]{ - {-2, 1}, - {-1, 2}, - {1, 2}, - {2, 1}, - {2, -1}, - {1, -2}, - {-1, -2}, - {-2, -1} - }; + int[][] offsets = + new int[][] { + {-2, 1}, + {-1, 2}, + {1, 2}, + {2, 1}, + {2, -1}, + {1, -2}, + {-1, -2}, + {-2, -1} + }; int x = 0; int y = 0; int currentVal = 0; @@ -22,7 +23,11 @@ public boolean checkValidGrid(int[][] grid) { for (int[] offset : offsets) { int newX = x + offset[0]; int newY = y + offset[1]; - if (newX >= 0 && newX < n && newY >= 0 && newY < n && grid[newX][newY] == currentVal + 1) { + if (newX >= 0 + && newX < n + && newY >= 0 + && newY < n + && grid[newX][newY] == currentVal + 1) { currentVal++; x = newX; y = newY; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2614.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2614.java index 1b52f1182a..cfb6f318ee 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2614.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2614.java @@ -19,7 +19,7 @@ public int diagonalPrime(int[][] nums) { private boolean[] generatePrimes(int n) { boolean[] nonPrimes = new boolean[n]; - //1 is not a prime number + // 1 is not a prime number nonPrimes[1] = true; for (int i = 2; i < n; i++) { if (!nonPrimes[i]) { @@ -30,6 +30,5 @@ private boolean[] generatePrimes(int n) { } return nonPrimes; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2641.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2641.java index 2c65e22b51..3934637926 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2641.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2641.java @@ -1,7 +1,6 @@ package com.fishercoder.solutions.thirdthousand; import com.fishercoder.common.classes.TreeNode; - import java.util.HashMap; import java.util.LinkedList; import java.util.Map; @@ -9,7 +8,7 @@ public class _2641 { public static class Solution1 { - /** + /* * My completely original solution. * Note: It's not really replacing the values in the original tree nodes, instead, I'm building a new tree with updated values. */ diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2673.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2673.java index 8fbb49e026..fac8e68f90 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2673.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2673.java @@ -2,7 +2,7 @@ public class _2673 { public static class Solution1 { - /** + /* * My completely original solution, although verbose and could be further optimized. * Practice makes perfect! */ @@ -28,9 +28,11 @@ public int minIncrements(int n, int[] cost) { TreeNodeWithCost root = new TreeNodeWithCost(1, cost[0]); preOrderBuildTree(root, n, cost, 1); inOrderFindMaxCostPath(root); - // in order to do the minimum increments, we want to increment as many times as possible on the nodes as close to the root as possible + // in order to do the minimum increments, we want to increment as many times as possible + // on the nodes as close to the root as possible // but to how many? - // then we need to know the maximum cost of all paths from each node to all of its possible leaf nodes + // then we need to know the maximum cost of all paths from each node to all of its + // possible leaf nodes // the difference is the number of increments we can do on this node postOrderFindMaxCostForEachNode(root); preOrderToIncrementCost(root); @@ -68,11 +70,12 @@ private int postOrderFindMaxCostForEachNode(TreeNodeWithCost node) { int leftMaxCost = postOrderFindMaxCostForEachNode(node.left); int rightMaxCost = postOrderFindMaxCostForEachNode(node.right); if (leftMaxCost == 0 && rightMaxCost == 0) { - //this means this node is a leaf node + // this means this node is a leaf node node.maxCostFromThisNodeToAllPossibleLeafNodes = node.costSumFromRootToThisNode; } else { - //if it's not leaf node, then we take the bigger one from left and right - node.maxCostFromThisNodeToAllPossibleLeafNodes = Math.max(leftMaxCost, rightMaxCost); + // if it's not leaf node, then we take the bigger one from left and right + node.maxCostFromThisNodeToAllPossibleLeafNodes = + Math.max(leftMaxCost, rightMaxCost); } return node.maxCostFromThisNodeToAllPossibleLeafNodes; } @@ -83,7 +86,8 @@ private void inOrderFindMaxCostPath(TreeNodeWithCost root) { } inOrderFindMaxCostPath(root.left); if (root.left == null && root.right == null) { - maxCostFromRootToLeaf = Math.max(maxCostFromRootToLeaf, root.costSumFromRootToThisNode); + maxCostFromRootToLeaf = + Math.max(maxCostFromRootToLeaf, root.costSumFromRootToThisNode); } inOrderFindMaxCostPath(root.right); } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2689.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2689.java index 509d851f21..3e5181a197 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2689.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2689.java @@ -8,8 +8,7 @@ public static class RopeTreeNode { public RopeTreeNode left; public RopeTreeNode right; - public RopeTreeNode() { - } + public RopeTreeNode() {} public RopeTreeNode(String val) { this.len = 0; @@ -30,7 +29,7 @@ public RopeTreeNode(int len, RopeTreeNode left, RopeTreeNode right) { } public static class Solution1 { - /** + /* * My completely original solution. */ public char getKthCharacter(RopeTreeNode root, int k) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2717.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2717.java index 1eef1ab64a..ec05a258a8 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2717.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2717.java @@ -3,8 +3,8 @@ public class _2717 { public static class Solution1 { public int semiOrderedPermutation(int[] nums) { - int[] max = new int[]{nums[0], 0}; - int[] min = new int[]{nums[0], 0}; + int[] max = new int[] {nums[0], 0}; + int[] min = new int[] {nums[0], 0}; for (int i = 1; i < nums.length; i++) { if (nums[i] > max[0]) { max[0] = nums[i]; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2728.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2728.java index 901ed153db..6de8772523 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2728.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2728.java @@ -2,40 +2,30 @@ public class _2728 { public static class Street { - //dummy class to make compilation possible - public Street(int[] doors) { + // dummy class to make compilation possible + public Street(int[] doors) {} - } - - public void openDoor() { - - } - - public void closeDoor() { + public void openDoor() {} - } + public void closeDoor() {} public boolean isDoorOpen() { return false; } - public void moveRight() { + public void moveRight() {} - } - - public void moveLeft() { - - } + public void moveLeft() {} } public static class Solution1 { public int houseCount(Street street, int k) { - //close all doors + // close all doors for (int i = 0; i < k; i++) { street.closeDoor(); street.moveRight(); } - //open one door + // open one door street.openDoor(); int houses = 1; for (int i = 0; i < k; i++) { @@ -47,6 +37,5 @@ public int houseCount(Street street, int k) { } return houses; } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2748.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2748.java index e59952c726..e40c416d45 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2748.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2748.java @@ -8,7 +8,10 @@ public int countBeautifulPairs(int[] nums) { for (int j = i + 1; j < nums.length; j++) { String iStr = String.valueOf(nums[i]); String jStr = String.valueOf(nums[j]); - if (gcd(Integer.parseInt(iStr.charAt(0) + ""), Integer.parseInt(jStr.charAt(jStr.length() - 1) + "")) == 1) { + if (gcd( + Integer.parseInt(iStr.charAt(0) + ""), + Integer.parseInt(jStr.charAt(jStr.length() - 1) + "")) + == 1) { pairs++; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2751.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2751.java index 66cd05148a..c80cd72a60 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2751.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2751.java @@ -8,10 +8,11 @@ public class _2751 { public static class Solution1 { - /** + /* * My completely original solution. */ - public List survivedRobotsHealths(int[] positions, int[] healths, String directions) { + public List survivedRobotsHealths( + int[] positions, int[] healths, String directions) { List list = new ArrayList<>(); for (int i = 0; i < positions.length; i++) { list.add(new Robot(positions[i], healths[i], directions.charAt(i), i)); @@ -43,7 +44,8 @@ public List survivedRobotsHealths(int[] positions, int[] healths, Strin break; } } - if (stack.isEmpty() || stack.peekLast().direction == 'L' && curr.health > 0) { + if (stack.isEmpty() + || stack.peekLast().direction == 'L' && curr.health > 0) { stack.addLast(curr); } } else { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2760.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2760.java index 93dea5d5f1..7826f3fa41 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2760.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2760.java @@ -9,7 +9,9 @@ public int longestAlternatingSubarray(int[] nums, int threshold) { int start = i; int j = i; for (; j < nums.length - 1; j++) { - if (nums[j] % 2 != nums[j + 1] % 2 && nums[j] <= threshold && nums[j + 1] <= threshold) { + if (nums[j] % 2 != nums[j + 1] % 2 + && nums[j] <= threshold + && nums[j + 1] <= threshold) { continue; } else { break; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2806.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2806.java index aedb1582a2..e77f3b8625 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2806.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2806.java @@ -17,5 +17,4 @@ public int accountBalanceAfterPurchase(int purchaseAmount) { return balance; } } - } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2812.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2812.java index c6d6f5d195..a2e750b3ee 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2812.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2812.java @@ -6,14 +6,14 @@ public class _2812 { public static class Solution1 { - /** + /* * A great problem, credit: https://leetcode.com/problems/find-the-safest-path-in-a-grid/editorial/ *

* BFS twice: * 1. once: to build the safeness factor for each cell; * 2. second time: check if there's a valid path from that cell; */ - final int[] dirs = new int[]{0, 1, 0, -1, 0}; + final int[] dirs = new int[] {0, 1, 0, -1, 0}; public int maximumSafenessFactor(List> grid) { int n = grid.size(); @@ -25,7 +25,7 @@ public int maximumSafenessFactor(List> grid) { for (int j = 0; j < n; j++) { if (grid.get(i).get(j) == 1) { // Push thief coordinates to the queue - multiSourceQueue.add(new int[]{i, j}); + multiSourceQueue.add(new int[] {i, j}); // Mark thief cell with 0 mat[i][j] = 0; } else { @@ -49,7 +49,7 @@ public int maximumSafenessFactor(List> grid) { if (isValidCell(mat, di, dj) && mat[di][dj] == -1) { // Update safeness factor and push to the queue mat[di][dj] = val + 1; - multiSourceQueue.add(new int[]{di, dj}); + multiSourceQueue.add(new int[] {di, dj}); } } } @@ -89,7 +89,7 @@ private boolean isValidSafeness(int[][] grid, int minSafeness) { } Queue traversalQueue = new LinkedList<>(); - traversalQueue.add(new int[]{0, 0}); + traversalQueue.add(new int[] {0, 0}); boolean[][] visited = new boolean[n][n]; visited[0][0] = true; @@ -103,10 +103,13 @@ private boolean isValidSafeness(int[][] grid, int minSafeness) { for (int k = 0; k < dirs.length - 1; k++) { int di = curr[0] + dirs[k]; int dj = curr[1] + dirs[k + 1]; - // Check if the neighboring cell is valid, unvisited and satisfying minimum safeness - if (isValidCell(grid, di, dj) && !visited[di][dj] && grid[di][dj] >= minSafeness) { + // Check if the neighboring cell is valid, unvisited and satisfying minimum + // safeness + if (isValidCell(grid, di, dj) + && !visited[di][dj] + && grid[di][dj] >= minSafeness) { visited[di][dj] = true; - traversalQueue.add(new int[]{di, dj}); + traversalQueue.add(new int[] {di, dj}); } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2815.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2815.java index fa91083a89..17d9873dcf 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2815.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2815.java @@ -21,7 +21,8 @@ public int maxSum(int[] nums) { List list = entry.getValue(); if (list.size() > 1) { Collections.sort(list); - maxSum = Math.max(maxSum, list.get(list.size() - 1) + list.get(list.size() - 2)); + maxSum = + Math.max(maxSum, list.get(list.size() - 1) + list.get(list.size() - 2)); } } return maxSum; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2839.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2839.java index 59d746c77c..7a8619f575 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2839.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2839.java @@ -4,7 +4,7 @@ public class _2839 { public static class Solution1 { - /** + /* * Only a total of 6 possibilities, try them all. */ public boolean canBeEqual(String s1, String s2) { @@ -21,7 +21,7 @@ public boolean canBeEqual(String s1, String s2) { } c1 = s1.toCharArray(); c2 = s2.toCharArray(); - //swap only (1,3) for c1 now + // swap only (1,3) for c1 now swap(c1, 1); if (Arrays.equals(c1, c2)) { return true; @@ -37,7 +37,7 @@ public boolean canBeEqual(String s1, String s2) { } c1 = s1.toCharArray(); c2 = s2.toCharArray(); - //swap only (1,3) for c2 now + // swap only (1,3) for c2 now swap(c2, 1); if (Arrays.equals(c1, c2)) { return true; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2903.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2903.java index 1461afa47a..a88abc1eef 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2903.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2903.java @@ -5,12 +5,13 @@ public static class Solution1 { public int[] findIndices(int[] nums, int indexDifference, int valueDifference) { for (int i = 0; i < nums.length - indexDifference; i++) { for (int j = i + indexDifference; j < nums.length; j++) { - if (j - i >= indexDifference && Math.abs(nums[i] - nums[j]) >= valueDifference) { - return new int[]{i, j}; + if (j - i >= indexDifference + && Math.abs(nums[i] - nums[j]) >= valueDifference) { + return new int[] {i, j}; } } } - return new int[]{-1, -1}; + return new int[] {-1, -1}; } } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2937.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2937.java index 21e286644b..858761aec0 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2937.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2937.java @@ -3,7 +3,9 @@ public class _2937 { public static class Solution1 { public int findMinimumOperations(String s1, String s2, String s3) { - if (s1.charAt(0) != s2.charAt(0) || s1.charAt(0) != s3.charAt(0) || s2.charAt(0) != s3.charAt(0)) { + if (s1.charAt(0) != s2.charAt(0) + || s1.charAt(0) != s3.charAt(0) + || s2.charAt(0) != s3.charAt(0)) { return -1; } int minOps = 0; diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2946.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2946.java index c09958f9e5..17896706cc 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2946.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2946.java @@ -14,7 +14,7 @@ public boolean areSimilar(int[][] mat, int k) { int[][] updated = new int[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { - //regardless i is even or odd, it's the same formula below! + // regardless i is even or odd, it's the same formula below! updated[i][(j + k) % n] = mat[i][j]; } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2956.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2956.java index 2164eaa6a9..614c5cf377 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2956.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2956.java @@ -5,7 +5,7 @@ public class _2956 { public static class Solution1 { - /** + /* * Although verbose, this is more efficient and faster than using Java.streams */ public int[] findIntersectionValues(int[] nums1, int[] nums2) { diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2976.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2976.java index a79d7b3e5f..ac0ec0a231 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2976.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2976.java @@ -10,24 +10,26 @@ public class _2976 { public static class Solution1 { - /** + /* * My completely original solution to use Dijkstra's algorithm. * Dijkstra's algorithm is the way to go for finding * the shortest path in a weighted (non-negative) graph. */ - public long minimumCost(String source, String target, char[] original, char[] changed, int[] cost) { + public long minimumCost( + String source, String target, char[] original, char[] changed, int[] cost) { int alphabetSize = 26; List[] graph = new ArrayList[alphabetSize]; for (int i = 0; i < alphabetSize; i++) { graph[i] = new ArrayList<>(); } for (int i = 0; i < original.length; i++) { - graph[original[i] - 'a'].add(new int[]{changed[i] - 'a', cost[i]}); + graph[original[i] - 'a'].add(new int[] {changed[i] - 'a', cost[i]}); } long minCost = 0L; Map cache = new HashMap<>(); for (int i = 0; i < source.length(); i++) { - long thisCost = dijkstra(source.charAt(i) - 'a', target.charAt(i) - 'a', graph, cache); + long thisCost = + dijkstra(source.charAt(i) - 'a', target.charAt(i) - 'a', graph, cache); if (thisCost != -1) { minCost += thisCost; } else { @@ -37,7 +39,8 @@ public long minimumCost(String source, String target, char[] original, char[] ch return minCost; } - private long dijkstra(int source, int target, List[] graph, Map cache) { + private long dijkstra( + int source, int target, List[] graph, Map cache) { if (cache.containsKey(source + "->" + target)) { return cache.get(source + "->" + target); } @@ -45,7 +48,7 @@ private long dijkstra(int source, int target, List[] graph, Map q = new LinkedList<>(); - q.offer(new int[]{source, 0}); + q.offer(new int[] {source, 0}); while (!q.isEmpty()) { int[] curr = q.poll(); int currNode = curr[0]; @@ -58,7 +61,7 @@ private long dijkstra(int source, int target, List[] graph, Map[] graph, Map" + target, (long) minCosts[target]); return cache.getOrDefault(source + "->" + target, -1L); } - } } diff --git a/src/main/java/com/fishercoder/solutions/thirdthousand/_2980.java b/src/main/java/com/fishercoder/solutions/thirdthousand/_2980.java index 28b60e29df..5e1f114ff3 100644 --- a/src/main/java/com/fishercoder/solutions/thirdthousand/_2980.java +++ b/src/main/java/com/fishercoder/solutions/thirdthousand/_2980.java @@ -2,7 +2,7 @@ public class _2980 { public static class Solution1 { - /** + /* * 1. bitwise OR can never unset a bit, so if the solution exists, there must be a pair of elements; * 2. as the rightmost bit must stay unset, it's essentially looking for a pair of two even numbers. */ diff --git a/src/test/java/com/fishercoder/firstthousand/_100Test.java b/src/test/java/com/fishercoder/firstthousand/_100Test.java index b96fba8fa7..7db12e7592 100644 --- a/src/test/java/com/fishercoder/firstthousand/_100Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_100Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.*; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._100; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.*; - public class _100Test { private _100.Solution1 solution1; private static TreeNode p; diff --git a/src/test/java/com/fishercoder/firstthousand/_101Test.java b/src/test/java/com/fishercoder/firstthousand/_101Test.java index 844cb859d3..0a22aa4c11 100644 --- a/src/test/java/com/fishercoder/firstthousand/_101Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_101Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._101; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _101Test { private _101.Solution1 solution1; private _101.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_102Test.java b/src/test/java/com/fishercoder/firstthousand/_102Test.java index b4d7576d4f..5a553907ba 100644 --- a/src/test/java/com/fishercoder/firstthousand/_102Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_102Test.java @@ -4,11 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._102; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _102Test { private _102.Solution1 solution1; private static TreeNode treeRoot; @@ -31,5 +30,4 @@ public void test2() { TreeUtils.printBinaryTree(treeRoot); CommonUtils.printListList(solution1.levelOrder(treeRoot)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_103Test.java b/src/test/java/com/fishercoder/firstthousand/_103Test.java index 03cc0adc40..b769365e40 100644 --- a/src/test/java/com/fishercoder/firstthousand/_103Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_103Test.java @@ -4,11 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._103; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _103Test { private _103.Solution1 solution1; private static TreeNode root; @@ -24,5 +23,4 @@ public void test1() { TreeUtils.printBinaryTree(root); CommonUtils.printListList(solution1.zigzagLevelOrder(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_104Test.java b/src/test/java/com/fishercoder/firstthousand/_104Test.java index 3fde71eae6..deae3cc5a7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_104Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_104Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._104; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _104Test { private _104.Solution1 solution1; private _104.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_105Test.java b/src/test/java/com/fishercoder/firstthousand/_105Test.java index 2e83619a64..4c6a5951dc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_105Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_105Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._105; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _105Test { private _105.Solution1 solution1; private static TreeNode expected; @@ -25,8 +23,8 @@ public void setup() { @Test public void test1() { - preorder = new int[]{1, 2, 3}; - inorder = new int[]{2, 1, 3}; + preorder = new int[] {1, 2, 3}; + inorder = new int[] {2, 1, 3}; actual = solution1.buildTree(preorder, inorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3)); assertEquals(expected, actual); @@ -34,8 +32,8 @@ public void test1() { @Test public void test2() { - preorder = new int[]{1, 2, 4, 5, 3}; - inorder = new int[]{4, 2, 5, 1, 3}; + preorder = new int[] {1, 2, 4, 5, 3}; + inorder = new int[] {4, 2, 5, 1, 3}; actual = solution1.buildTree(preorder, inorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5)); assertEquals(expected, actual); @@ -43,8 +41,8 @@ public void test2() { @Test public void test3() { - preorder = new int[]{3, 9, 20, 15, 7}; - inorder = new int[]{9, 3, 15, 20, 7}; + preorder = new int[] {3, 9, 20, 15, 7}; + inorder = new int[] {9, 3, 15, 20, 7}; actual = solution1.buildTree(preorder, inorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 9, 20, null, null, 15, 7)); assertEquals(expected, actual); @@ -52,8 +50,8 @@ public void test3() { @Test public void test4() { - preorder = new int[]{3, 1, 2, 4}; - inorder = new int[]{1, 2, 3, 4}; + preorder = new int[] {3, 1, 2, 4}; + inorder = new int[] {1, 2, 3, 4}; actual = solution1.buildTree(preorder, inorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, 4, null, 2)); TreeUtils.printBinaryTree(expected); diff --git a/src/test/java/com/fishercoder/firstthousand/_106Test.java b/src/test/java/com/fishercoder/firstthousand/_106Test.java index ab975cf3a5..ad7a652a55 100644 --- a/src/test/java/com/fishercoder/firstthousand/_106Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_106Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._106; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _106Test { private _106.Solution1 solution1; private _106.Solution2 solution2; @@ -26,15 +25,9 @@ public void setup() { @Test public void test1() { - /**it should be a tree like this: - * 3 - * / - * 1 - * \ - * 2 - */ - postorder = new int[]{2, 1, 3}; - inorder = new int[]{1, 2, 3}; + /** it should be a tree like this: 3 / 1 \ 2 */ + postorder = new int[] {2, 1, 3}; + inorder = new int[] {1, 2, 3}; actual = solution1.buildTree(inorder, postorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, null, null, 2)); assertEquals(expected, actual); @@ -44,33 +37,20 @@ public void test1() { @Test public void test2() { - /**it should be a tree like this: - * 3 - * / - * 1 - * \ - * 5 - * / - * 2 - * \ - * 4 - */ - postorder = new int[]{4, 2, 5, 1, 3}; - inorder = new int[]{1, 2, 4, 5, 3}; + /** it should be a tree like this: 3 / 1 \ 5 / 2 \ 4 */ + postorder = new int[] {4, 2, 5, 1, 3}; + inorder = new int[] {1, 2, 4, 5, 3}; actual = solution1.buildTree(inorder, postorder); - expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, null, null, 5, 2, null, null, 4)); + expected = + TreeUtils.constructBinaryTree(Arrays.asList(3, 1, null, null, 5, 2, null, null, 4)); assertEquals(expected, actual); } @Test public void test3() { - /**it should be a tree like this: - * 2 - * / - * 1 - */ - inorder = new int[]{1, 2}; - postorder = new int[]{1, 2}; + /** it should be a tree like this: 2 / 1 */ + inorder = new int[] {1, 2}; + postorder = new int[] {1, 2}; actual = solution1.buildTree(inorder, postorder); expected = TreeUtils.constructBinaryTree(Arrays.asList(2, 1)); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_107Test.java b/src/test/java/com/fishercoder/firstthousand/_107Test.java index f69793ec62..b72ea5973d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_107Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_107Test.java @@ -4,11 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._107; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _107Test { private _107.Solution1 solution1; private static TreeNode root; @@ -24,5 +23,4 @@ public void test1() { TreeUtils.printBinaryTree(root); CommonUtils.printListList(solution1.levelOrderBottom(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_108Test.java b/src/test/java/com/fishercoder/firstthousand/_108Test.java index 78b039357e..3d87820873 100644 --- a/src/test/java/com/fishercoder/firstthousand/_108Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_108Test.java @@ -16,20 +16,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; TreeUtils.printBinaryTree(solution1.sortedArrayToBST(nums)); } @Test public void test2() { - nums = new int[]{}; + nums = new int[] {}; TreeUtils.printBinaryTree(solution1.sortedArrayToBST(nums)); } @Test public void test3() { - nums = new int[]{-10, -3, 0, 5, 9}; + nums = new int[] {-10, -3, 0, 5, 9}; TreeUtils.printBinaryTree(solution1.sortedArrayToBST(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_109Test.java b/src/test/java/com/fishercoder/firstthousand/_109Test.java index 934f91e668..afc14569e5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_109Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_109Test.java @@ -5,11 +5,10 @@ import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._109; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _109Test { private _109.Solution1 solution1; private static ListNode head; @@ -22,10 +21,9 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, 4, null, 2, null, 5)); - /**as long as it's a height-balanced tree, it's good for this problem requirement*/ + /** as long as it's a height-balanced tree, it's good for this problem requirement */ TreeUtils.printBinaryTree(solution1.sortedListToBST(head)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_10Test.java b/src/test/java/com/fishercoder/firstthousand/_10Test.java index b400d73511..c40a983339 100644 --- a/src/test/java/com/fishercoder/firstthousand/_10Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_10Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._10; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _10Test { private _10.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(true, solution1.isMatch("aab", "c*a*b")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_110Test.java b/src/test/java/com/fishercoder/firstthousand/_110Test.java index 03d9a4a6f8..2e26d0cb27 100644 --- a/src/test/java/com/fishercoder/firstthousand/_110Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_110Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._110; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _110Test { private _110.Solution1 solution1; private _110.Solution2 solution2; @@ -44,6 +43,4 @@ public void test4() { treeNode = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 2, 3, 3, null, null, 4, 4)); assertEquals(false, solution2.isBalanced(treeNode)); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_113Test.java b/src/test/java/com/fishercoder/firstthousand/_113Test.java index 6806ee5047..45472c4fd2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_113Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_113Test.java @@ -1,16 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._113; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _113Test { private _113.Solution1 solution1; @@ -28,7 +27,9 @@ public void setup() { @Test public void test1() { sum = 22; - root = TreeUtils.constructBinaryTree(Arrays.asList(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1)); TreeUtils.printBinaryTree(root); expected = new ArrayList<>(); expected.add(Arrays.asList(5, 4, 11, 2)); @@ -36,5 +37,4 @@ public void test1() { assertEquals(expected, solution1.pathSum(root, sum)); assertEquals(expected, solution2.pathSum(root, sum)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_114Test.java b/src/test/java/com/fishercoder/firstthousand/_114Test.java index 5ff6418397..9ee847a21c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_114Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_114Test.java @@ -3,25 +3,24 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._114; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _114Test { - private _114.Solution1 solution1; - private static TreeNode root; + private _114.Solution1 solution1; + private static TreeNode root; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _114.Solution1(); - } + solution1 = new _114.Solution1(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 5, 3, 4, null, 6)); - TreeUtils.printBinaryTree(root); - solution1.flatten(root); - TreeUtils.printBinaryTree(root); - } + @Test + public void test1() { + root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 5, 3, 4, null, 6)); + TreeUtils.printBinaryTree(root); + solution1.flatten(root); + TreeUtils.printBinaryTree(root); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_115Test.java b/src/test/java/com/fishercoder/firstthousand/_115Test.java index b83a1eebc9..3a94e823e8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_115Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_115Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._115; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _115Test { - private _115.Solution1 solution1; + private _115.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _115.Solution1(); - } + solution1 = new _115.Solution1(); + } - @Test - public void test1() { - assertEquals(3, solution1.numDistinct("rabbbit", "rabbit")); - } + @Test + public void test1() { + assertEquals(3, solution1.numDistinct("rabbbit", "rabbit")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_118Test.java b/src/test/java/com/fishercoder/firstthousand/_118Test.java index 327fc3e1c3..5746084ac2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_118Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_118Test.java @@ -31,5 +31,4 @@ public void test2() { public void test3() { CommonUtils.printListList(solution3.generate(5)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_119Test.java b/src/test/java/com/fishercoder/firstthousand/_119Test.java index c6fef35dc6..3a1cbe92c5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_119Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_119Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._119; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _119Test { private _119.Solution1 solution1; private _119.Solution2 solution2; @@ -23,5 +22,4 @@ public void test1() { assertEquals(Arrays.asList(1, 3, 3, 1), solution1.getRow(3)); assertEquals(Arrays.asList(1, 3, 3, 1), solution2.getRow(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_11Test.java b/src/test/java/com/fishercoder/firstthousand/_11Test.java index 9b7d6f890e..7b26115275 100644 --- a/src/test/java/com/fishercoder/firstthousand/_11Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_11Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._11; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _11Test { private _11.Solution1 solution1; private _11.Solution2 solution2; @@ -20,10 +20,9 @@ public void setup() { @Test public void test1() { - height = new int[]{1, 1}; + height = new int[] {1, 1}; expected = 1; assertEquals(expected, solution1.maxArea(height)); assertEquals(expected, solution2.maxArea(height)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_120Test.java b/src/test/java/com/fishercoder/firstthousand/_120Test.java index e0e9ae3574..d6a284f760 100644 --- a/src/test/java/com/fishercoder/firstthousand/_120Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_120Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._120; import java.util.ArrayList; import java.util.Arrays; @@ -7,22 +9,20 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _120Test { - private _120.Solution1 solution1; - private static List> triangle; + private _120.Solution1 solution1; + private static List> triangle; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _120.Solution1(); - } + solution1 = new _120.Solution1(); + } - @Test - public void test1() { - triangle = new ArrayList(); - triangle.add(Arrays.asList(1)); - triangle.add(Arrays.asList(2, 3)); - assertEquals(3, solution1.minimumTotal(triangle)); - } + @Test + public void test1() { + triangle = new ArrayList(); + triangle.add(Arrays.asList(1)); + triangle.add(Arrays.asList(2, 3)); + assertEquals(3, solution1.minimumTotal(triangle)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_121Test.java b/src/test/java/com/fishercoder/firstthousand/_121Test.java index adccd3e4b6..f7da7d7c18 100644 --- a/src/test/java/com/fishercoder/firstthousand/_121Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_121Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._121; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _121Test { private _121.Solution1 solution1; private _121.Solution2 solution2; @@ -19,28 +19,28 @@ public void setup() { @Test public void test1() { - prices = new int[]{7, 1, 5, 3, 6, 4}; + prices = new int[] {7, 1, 5, 3, 6, 4}; assertEquals(5, solution1.maxProfit(prices)); assertEquals(5, solution2.maxProfit(prices)); } @Test public void test2() { - prices = new int[]{7, 6, 4, 3, 1}; + prices = new int[] {7, 6, 4, 3, 1}; assertEquals(0, solution1.maxProfit(prices)); assertEquals(0, solution2.maxProfit(prices)); } @Test public void test3() { - prices = new int[]{2, 4, 1}; + prices = new int[] {2, 4, 1}; assertEquals(2, solution1.maxProfit(prices)); assertEquals(2, solution2.maxProfit(prices)); } @Test public void test4() { - prices = new int[]{1, 2}; + prices = new int[] {1, 2}; assertEquals(1, solution1.maxProfit(prices)); assertEquals(1, solution2.maxProfit(prices)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_122Test.java b/src/test/java/com/fishercoder/firstthousand/_122Test.java index c4c06b28bd..3f386d61ea 100644 --- a/src/test/java/com/fishercoder/firstthousand/_122Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_122Test.java @@ -1,26 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._122; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _122Test { - private _122.Solution1 solution1; - private _122.Solution2 solution2; - private static int[] prices; + private _122.Solution1 solution1; + private _122.Solution2 solution2; + private static int[] prices; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _122.Solution1(); - solution2 = new _122.Solution2(); - } + solution1 = new _122.Solution1(); + solution2 = new _122.Solution2(); + } - @Test - public void test1() { - prices = new int[] {1, 2, 4}; - assertEquals(3, solution1.maxProfit(prices)); - assertEquals(3, solution2.maxProfit(prices)); - } + @Test + public void test1() { + prices = new int[] {1, 2, 4}; + assertEquals(3, solution1.maxProfit(prices)); + assertEquals(3, solution2.maxProfit(prices)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_123Test.java b/src/test/java/com/fishercoder/firstthousand/_123Test.java index 13474cf22b..5212feb7d1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_123Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_123Test.java @@ -1,23 +1,23 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._123; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _123Test { - private _123.Solution1 solution1; - private static int[] prices; + private _123.Solution1 solution1; + private static int[] prices; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _123.Solution1(); - } + solution1 = new _123.Solution1(); + } - @Test - public void test1() { - prices = new int[] {1}; - assertEquals(0, solution1.maxProfit(prices)); - } + @Test + public void test1() { + prices = new int[] {1}; + assertEquals(0, solution1.maxProfit(prices)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_125Test.java b/src/test/java/com/fishercoder/firstthousand/_125Test.java index fecfe069f3..e0fa636817 100644 --- a/src/test/java/com/fishercoder/firstthousand/_125Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_125Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._125; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _125Test { private _125.Solution1 solution1; private static String s; diff --git a/src/test/java/com/fishercoder/firstthousand/_127Test.java b/src/test/java/com/fishercoder/firstthousand/_127Test.java index a3f76b282a..1d0510e6f2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_127Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_127Test.java @@ -1,33 +1,32 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._127; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._127; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _127Test { - private _127.Solution1 solution1; - private static List wordList; + private _127.Solution1 solution1; + private static List wordList; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _127.Solution1(); - } + solution1 = new _127.Solution1(); + } - @Test - public void test1() { - wordList = new ArrayList<>(Arrays.asList("hot", "dot", "dog", "lot", "log")); - assertEquals(0, solution1.ladderLength("hit", "cog", wordList)); - } + @Test + public void test1() { + wordList = new ArrayList<>(Arrays.asList("hot", "dot", "dog", "lot", "log")); + assertEquals(0, solution1.ladderLength("hit", "cog", wordList)); + } - @Test - public void test2() { - wordList = new ArrayList<>(Arrays.asList("hot", "dot", "dog", "lot", "log", "cog")); - assertEquals(5, solution1.ladderLength("hit", "cog", wordList)); - } + @Test + public void test2() { + wordList = new ArrayList<>(Arrays.asList("hot", "dot", "dog", "lot", "log", "cog")); + assertEquals(5, solution1.ladderLength("hit", "cog", wordList)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_128Test.java b/src/test/java/com/fishercoder/firstthousand/_128Test.java index 2a567a2ab3..d57256dd0f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_128Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_128Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._128; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _128Test { private _128.Solution3 solution3; private _128.Solution4 solution4; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{100, 4, 200, 1, 3, 2}; + nums = new int[] {100, 4, 200, 1, 3, 2}; assertEquals(4, solution3.longestConsecutive(nums)); assertEquals(4, solution4.longestConsecutive(nums)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_129Test.java b/src/test/java/com/fishercoder/firstthousand/_129Test.java index cb589e3378..8b3c4a658f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_129Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_129Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._129; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _129Test { private _129.Solution1 solution1; private _129.Solution2 solution2; @@ -26,5 +25,4 @@ public void test1() { assertEquals(25, (solution1.sumNumbers(root))); assertEquals(25, (solution2.sumNumbers(root))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_12Test.java b/src/test/java/com/fishercoder/firstthousand/_12Test.java index 0f511d5595..f487244d57 100644 --- a/src/test/java/com/fishercoder/firstthousand/_12Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_12Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._12; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _12Test { private _12.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_130Test.java b/src/test/java/com/fishercoder/firstthousand/_130Test.java index 8b8a7f1293..bb45dd573e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_130Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_130Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._130; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _130Test { private _130.Solution1 solution1; private _130.Solution2 solution2; @@ -21,29 +21,36 @@ public void setup() { @Test public void test1() { - board = CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," - + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"X\",\"O\",\"X\",\"O\"]," - + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); - expected = CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," - + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"]," - + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); + board = + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," + + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"X\",\"O\",\"X\",\"O\"]," + + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); + expected = + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," + + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"]," + + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); solution1.solve(board); assertArrayEquals(expected, board); } @Test public void test2() { - board = CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," - + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"X\",\"O\",\"X\",\"O\"]," - + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); - expected = CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," - + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"]," - + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); + board = + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," + + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"X\",\"O\",\"X\",\"O\"]," + + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); + expected = + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"X\",\"O\",\"X\",\"O\",\"X\",\"O\",\"O\",\"O\",\"X\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"O\",\"O\",\"X\",\"O\",\"O\",\"X\"]," + + "[\"O\",\"O\",\"X\",\"X\",\"O\",\"X\",\"X\",\"O\",\"O\",\"O\"],[\"X\",\"O\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\"],[\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"],[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"X\"],[\"O\",\"O\",\"O\",\"O\",\"X\",\"X\",\"X\",\"O\",\"X\",\"O\"]," + + "[\"X\",\"X\",\"O\",\"X\",\"X\",\"X\",\"X\",\"O\",\"O\",\"O\"]"); CommonUtils.print2DCharArray(board); solution2.solve(board); CommonUtils.print2DCharArray(board); CommonUtils.print2DCharArray(expected); assertArrayEquals(expected, board); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_131Test.java b/src/test/java/com/fishercoder/firstthousand/_131Test.java index 0cdf7b117d..64497de0b9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_131Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_131Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._131; import java.util.ArrayList; import java.util.Arrays; @@ -7,22 +9,20 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _131Test { - private _131.Solution1 solution1; - private static List> expected; + private _131.Solution1 solution1; + private static List> expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _131.Solution1(); - } + solution1 = new _131.Solution1(); + } - @Test - public void test1() { - expected = new ArrayList(); - expected.add(Arrays.asList("a", "a", "b")); - expected.add(Arrays.asList("aa", "b")); - assertEquals(expected, solution1.partition("aab")); - } + @Test + public void test1() { + expected = new ArrayList(); + expected.add(Arrays.asList("a", "a", "b")); + expected.add(Arrays.asList("aa", "b")); + assertEquals(expected, solution1.partition("aab")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_132Test.java b/src/test/java/com/fishercoder/firstthousand/_132Test.java index 37d29ae235..a0aba295f4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_132Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_132Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._132; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _132Test { - private _132.Solution1 solution1; + private _132.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _132.Solution1(); - } + solution1 = new _132.Solution1(); + } - @Test - public void test1() { - assertEquals(1, solution1.minCut("aab")); - } + @Test + public void test1() { + assertEquals(1, solution1.minCut("aab")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_133Test.java b/src/test/java/com/fishercoder/firstthousand/_133Test.java index ebefd35c20..539581ea80 100644 --- a/src/test/java/com/fishercoder/firstthousand/_133Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_133Test.java @@ -3,7 +3,6 @@ import com.fishercoder.solutions.firstthousand._133; import com.fishercoder.solutions.firstthousand._133.Solution1.Node; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class _133Test { @@ -24,6 +23,6 @@ public void setupForEachTest() { @Test public void test1() { - //TODO: implement it + // TODO: implement it } } diff --git a/src/test/java/com/fishercoder/firstthousand/_134Test.java b/src/test/java/com/fishercoder/firstthousand/_134Test.java index bf01cd6330..c061fefe9c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_134Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_134Test.java @@ -1,39 +1,39 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._134; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _134Test { - private _134.Solution1 solution1; - private static int[] gas; - private static int[] cost; + private _134.Solution1 solution1; + private static int[] gas; + private static int[] cost; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _134.Solution1(); - } + solution1 = new _134.Solution1(); + } - @Test - public void test1() { - gas = new int[] {4}; - cost = new int[] {5}; - assertEquals(-1, solution1.canCompleteCircuit(gas, cost)); - } + @Test + public void test1() { + gas = new int[] {4}; + cost = new int[] {5}; + assertEquals(-1, solution1.canCompleteCircuit(gas, cost)); + } - @Test - public void test2() { - gas = new int[] {5}; - cost = new int[] {4}; - assertEquals(0, solution1.canCompleteCircuit(gas, cost)); - } + @Test + public void test2() { + gas = new int[] {5}; + cost = new int[] {4}; + assertEquals(0, solution1.canCompleteCircuit(gas, cost)); + } - @Test - public void test3() { - gas = new int[] {2}; - cost = new int[] {2}; - assertEquals(0, solution1.canCompleteCircuit(gas, cost)); - } + @Test + public void test3() { + gas = new int[] {2}; + cost = new int[] {2}; + assertEquals(0, solution1.canCompleteCircuit(gas, cost)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_136Test.java b/src/test/java/com/fishercoder/firstthousand/_136Test.java index c518c60143..e0089f7a8b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_136Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_136Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._136; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _136Test { private _136.Solution1 solution1; private _136.Solution2 solution2; @@ -18,8 +18,7 @@ public void setup() { @Test public void test1() { - assertEquals(1, (solution1.singleNumber(new int[]{2, 2, 1}))); - assertEquals(1, (solution2.singleNumber(new int[]{2, 2, 1}))); + assertEquals(1, (solution1.singleNumber(new int[] {2, 2, 1}))); + assertEquals(1, (solution2.singleNumber(new int[] {2, 2, 1}))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_139Test.java b/src/test/java/com/fishercoder/firstthousand/_139Test.java index a87beec83d..f7190ff024 100644 --- a/src/test/java/com/fishercoder/firstthousand/_139Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_139Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._139; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._139; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _139Test { private _139.Solution1 solution1; @@ -47,23 +46,61 @@ public void test3() { @Test public void test4() { - s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; - wordDict = new ArrayList<>(Arrays.asList("a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa", "aaaaaaaaaa")); + s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; + wordDict = + new ArrayList<>( + Arrays.asList( + "a", + "aa", + "aaa", + "aaaa", + "aaaaa", + "aaaaaa", + "aaaaaaa", + "aaaaaaaa", + "aaaaaaaaa", + "aaaaaaaaaa")); assertEquals(false, solution1.wordBreak(s, wordDict)); } @Test public void test5() { - s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; - wordDict = new ArrayList<>(Arrays.asList("a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa", "aaaaaaaaaa")); + s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; + wordDict = + new ArrayList<>( + Arrays.asList( + "a", + "aa", + "aaa", + "aaaa", + "aaaaa", + "aaaaaa", + "aaaaaaa", + "aaaaaaaa", + "aaaaaaaaa", + "aaaaaaaaaa")); assertEquals(false, solution2.wordBreak(s, wordDict)); } @Test public void test6() { - s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; - wordDict = new ArrayList<>(Arrays.asList("a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa", "aaaaaaaaaa")); + s = + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; + wordDict = + new ArrayList<>( + Arrays.asList( + "a", + "aa", + "aaa", + "aaaa", + "aaaaa", + "aaaaaa", + "aaaaaaa", + "aaaaaaaa", + "aaaaaaaaa", + "aaaaaaaaaa")); assertEquals(false, solution3.wordBreak(s, wordDict)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_13Test.java b/src/test/java/com/fishercoder/firstthousand/_13Test.java index 0dbb3ea6fc..1dbb3968af 100644 --- a/src/test/java/com/fishercoder/firstthousand/_13Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_13Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._13; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _13Test { private _13.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_140Test.java b/src/test/java/com/fishercoder/firstthousand/_140Test.java index 727477c1c8..d00d9b96a7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_140Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_140Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._140; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import com.fishercoder.solutions.firstthousand._140; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertTrue; - +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _140Test { private _140.Solution1 solution1; @@ -27,8 +25,11 @@ public void test1() { wordDict = new ArrayList<>(Arrays.asList("cat", "cats", "and", "sand", "dog")); List actual = solution1.wordBreak(s, wordDict); List expected = Arrays.asList("cats and dog", "cat sand dog"); - //assert equals ignoring order - assertTrue(expected.size() == actual.size() && actual.containsAll(expected) && expected.containsAll(actual)); + // assert equals ignoring order + assertTrue( + expected.size() == actual.size() + && actual.containsAll(expected) + && expected.containsAll(actual)); } @Test @@ -36,9 +37,13 @@ public void test2() { s = "pineapplepenapple"; wordDict = new ArrayList<>(Arrays.asList("apple", "pen", "applepen", "pine", "pineapple")); List actual = solution1.wordBreak(s, wordDict); - List expected = Arrays.asList("pine apple pen apple", "pineapple pen apple", "pine applepen apple"); - //assert equals ignoring order - assertTrue(expected.size() == actual.size() && actual.containsAll(expected) && expected.containsAll(actual)); + List expected = + Arrays.asList("pine apple pen apple", "pineapple pen apple", "pine applepen apple"); + // assert equals ignoring order + assertTrue( + expected.size() == actual.size() + && actual.containsAll(expected) + && expected.containsAll(actual)); } @Test @@ -47,8 +52,10 @@ public void test3() { wordDict = new ArrayList<>(Arrays.asList("cats", "dog", "sand", "and", "cat")); List actual = solution1.wordBreak(s, wordDict); List expected = Arrays.asList(); - //assert equals ignoring order - assertTrue(expected.size() == actual.size() && actual.containsAll(expected) && expected.containsAll(actual)); + // assert equals ignoring order + assertTrue( + expected.size() == actual.size() + && actual.containsAll(expected) + && expected.containsAll(actual)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_141Test.java b/src/test/java/com/fishercoder/firstthousand/_141Test.java index 1bbc312cf7..8f2fcdfee7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_141Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_141Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._141; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _141Test { private _141.Solution1 solution1; private _141.Solution2 solution2; @@ -19,11 +19,15 @@ public void setup() { @Test public void test1() { - assertEquals(false, solution1.hasCycle(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}))); + assertEquals( + false, + solution1.hasCycle(LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}))); } @Test public void test2() { - assertEquals(false, solution2.hasCycle(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}))); + assertEquals( + false, + solution2.hasCycle(LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}))); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_143Test.java b/src/test/java/com/fishercoder/firstthousand/_143Test.java index 9353fd5fd3..b8a864afd3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_143Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_143Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._143; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _143Test { private _143.Solution1 solution1; private _143.Solution2 solution2; @@ -37,4 +36,4 @@ public void test2() { solution2.reorderList(head); assertEquals(expected, head); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_144Test.java b/src/test/java/com/fishercoder/firstthousand/_144Test.java index 74f6b88e48..14dc5bef30 100644 --- a/src/test/java/com/fishercoder/firstthousand/_144Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_144Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._144; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _144Test { private _144.Solution1 solution1; @@ -34,7 +33,10 @@ public void test1() { @Test public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); TreeUtils.printBinaryTree(root); inorder = solution1.preorderTraversal(root); assertEquals(Arrays.asList(1, 2, 4, 7, 8, 9, 3, 5, 6), inorder); @@ -49,7 +51,10 @@ public void test3() { @Test public void test4() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); TreeUtils.printBinaryTree(root); inorder = solution2.preorderTraversal(root); assertEquals(Arrays.asList(1, 2, 4, 7, 8, 9, 3, 5, 6), inorder); @@ -70,5 +75,4 @@ public void test6() { inorder = solution3.preorderTraversal(root); assertEquals(Arrays.asList(1, 2, 4, 6, 3, 5), inorder); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_145Test.java b/src/test/java/com/fishercoder/firstthousand/_145Test.java index ffec375327..d445a9ded1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_145Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_145Test.java @@ -1,17 +1,16 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._145; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _145Test { private _145.Solution1 solution1; @@ -29,7 +28,10 @@ public void setup() { @Test public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); TreeUtils.printBinaryTree(root); CommonUtils.printList(solution1.postorderTraversal(root)); CommonUtils.printList(solution2.postorderTraversal(root)); diff --git a/src/test/java/com/fishercoder/firstthousand/_148Test.java b/src/test/java/com/fishercoder/firstthousand/_148Test.java index e9274d1240..f9d71c1112 100644 --- a/src/test/java/com/fishercoder/firstthousand/_148Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_148Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._148; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _148Test { private _148.Solution1 solution1; private _148.Solution2 solution2; @@ -26,30 +26,29 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{4, 2, 1, 3}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); + head = LinkedListUtils.contructLinkedList(new int[] {4, 2, 1, 3}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); assertEquals(expected, solution1.sortList(head)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{4, 2, 1, 3}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); + head = LinkedListUtils.contructLinkedList(new int[] {4, 2, 1, 3}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); assertEquals(expected, solution2.sortList(head)); } @Test public void test3() { - head = LinkedListUtils.contructLinkedList(new int[]{4, 2, 1, 3}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); + head = LinkedListUtils.contructLinkedList(new int[] {4, 2, 1, 3}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); assertEquals(expected, solution3.sortList(head)); } @Test public void test4() { - head = LinkedListUtils.contructLinkedList(new int[]{4, 2, 1, 3}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); + head = LinkedListUtils.contructLinkedList(new int[] {4, 2, 1, 3}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); assertEquals(expected, solution4.sortList(head)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_149Test.java b/src/test/java/com/fishercoder/firstthousand/_149Test.java index a5b4ab8aea..a90f70fb86 100644 --- a/src/test/java/com/fishercoder/firstthousand/_149Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_149Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._149; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _149Test { private _149.Solution1 solution1; private static int[][] points; @@ -17,11 +17,12 @@ public void setup() { @Test public void test1() { - points = new int[][]{ - {1, 1}, - {2, 2}, - {3, 3} - }; + points = + new int[][] { + {1, 1}, + {2, 2}, + {3, 3} + }; assertEquals(3, solution1.maxPoints(points)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_14Test.java b/src/test/java/com/fishercoder/firstthousand/_14Test.java index 47509060a5..c603f497e3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_14Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_14Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._14; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _14Test { private _14.Solution1 solution1; private _14.Solution2 solution2; @@ -19,51 +19,50 @@ public void setup() { @Test public void test1() { - strs = new String[]{"a", "b"}; + strs = new String[] {"a", "b"}; assertEquals("", solution1.longestCommonPrefix(strs)); assertEquals("", solution2.longestCommonPrefix(strs)); } @Test public void test2() { - strs = new String[]{"leetcode", "lead"}; + strs = new String[] {"leetcode", "lead"}; assertEquals("le", solution1.longestCommonPrefix(strs)); assertEquals("le", solution2.longestCommonPrefix(strs)); } @Test public void test3() { - strs = new String[]{"leetcode", "code"}; + strs = new String[] {"leetcode", "code"}; assertEquals("", solution1.longestCommonPrefix(strs)); assertEquals("", solution2.longestCommonPrefix(strs)); } @Test public void test4() { - strs = new String[]{"flower", "flow", "flight"}; + strs = new String[] {"flower", "flow", "flight"}; assertEquals("fl", solution1.longestCommonPrefix(strs)); assertEquals("fl", solution2.longestCommonPrefix(strs)); } @Test public void test5() { - strs = new String[]{}; + strs = new String[] {}; assertEquals("", solution1.longestCommonPrefix(strs)); assertEquals("", solution2.longestCommonPrefix(strs)); } @Test public void test6() { - strs = new String[]{"a"}; + strs = new String[] {"a"}; assertEquals("a", solution1.longestCommonPrefix(strs)); assertEquals("a", solution2.longestCommonPrefix(strs)); } @Test public void test7() { - strs = new String[]{"c", "c"}; + strs = new String[] {"c", "c"}; assertEquals("c", solution1.longestCommonPrefix(strs)); assertEquals("c", solution2.longestCommonPrefix(strs)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_150Test.java b/src/test/java/com/fishercoder/firstthousand/_150Test.java index 5b0bda25a8..aaba7ebe91 100644 --- a/src/test/java/com/fishercoder/firstthousand/_150Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_150Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._150; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _150Test { private _150.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(9, solution1.evalRPN(new String[]{"2", "1", "+", "3", "*"})); + assertEquals(9, solution1.evalRPN(new String[] {"2", "1", "+", "3", "*"})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_151Test.java b/src/test/java/com/fishercoder/firstthousand/_151Test.java index e46e9233a8..fe246f6ee5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_151Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_151Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._151; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _151Test { private _151.Solution1 solution1; private _151.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_153Test.java b/src/test/java/com/fishercoder/firstthousand/_153Test.java index 99e34cbf3a..2784b4aea7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_153Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_153Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._153; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _153Test { private _153.Solution1 solution1; private static int expected; @@ -18,49 +18,49 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 5, 6, 7, 0, 1, 2}; + nums = new int[] {4, 5, 6, 7, 0, 1, 2}; expected = 0; assertEquals(expected, solution1.findMin(nums)); } @Test public void test2() { - nums = new int[]{1}; + nums = new int[] {1}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } @Test public void test3() { - nums = new int[]{2, 1}; + nums = new int[] {2, 1}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } @Test public void test4() { - nums = new int[]{2, 3, 4, 5, 1}; + nums = new int[] {2, 3, 4, 5, 1}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } @Test public void test5() { - nums = new int[]{3, 1, 2}; + nums = new int[] {3, 1, 2}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } @Test public void test6() { - nums = new int[]{3, 4, 5, 1, 2}; + nums = new int[] {3, 4, 5, 1, 2}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } @Test public void test7() { - nums = new int[]{5, 1, 2, 3, 4}; + nums = new int[] {5, 1, 2, 3, 4}; expected = 1; assertEquals(expected, solution1.findMin(nums)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_154Test.java b/src/test/java/com/fishercoder/firstthousand/_154Test.java index 8f15067006..c08c83cfc5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_154Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_154Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._154; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _154Test { private _154.Solution1 solution1; private static int[] nums; @@ -17,19 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 1}; + nums = new int[] {1, 1, 1}; assertEquals(1, solution1.findMin(nums)); } @Test public void test2() { - nums = new int[]{4, 5, 6, 7, 0, 1, 4}; + nums = new int[] {4, 5, 6, 7, 0, 1, 4}; assertEquals(0, solution1.findMin(nums)); } @Test public void test3() { - nums = new int[]{1, 3, 5}; + nums = new int[] {1, 3, 5}; assertEquals(1, solution1.findMin(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_155Test.java b/src/test/java/com/fishercoder/firstthousand/_155Test.java index a94489c4cd..6ec570fb2e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_155Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_155Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._155; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _155Test { private _155.Solution1.MinStack minStack1; private _155.Solution2.MinStack minStack2; @@ -37,5 +37,4 @@ public void test2() { assertEquals(0, minStack2.top()); assertEquals(-2, minStack2.getMin()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_156Test.java b/src/test/java/com/fishercoder/firstthousand/_156Test.java index 35c863d311..3c89354776 100644 --- a/src/test/java/com/fishercoder/firstthousand/_156Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_156Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._156; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _156Test { private _156.Solution1 solution1; private static TreeNode root; @@ -26,5 +25,4 @@ public void test1() { expected = TreeUtils.constructBinaryTree(Arrays.asList(4, 5, 2, null, null, 3, 1)); assertEquals(expected, solution1.upsideDownBinaryTree(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_159Test.java b/src/test/java/com/fishercoder/firstthousand/_159Test.java index 02c9e44b1b..d5be0ee448 100644 --- a/src/test/java/com/fishercoder/firstthousand/_159Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_159Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._159; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _159Test { private _159.Solution1 solution1; private _159.Solution2 solution2; @@ -26,7 +26,6 @@ public void test1() { assertEquals(expected, solution2.lengthOfLongestSubstringTwoDistinct(s)); } - @Test public void test2() { s = "ccaabbb"; @@ -34,5 +33,4 @@ public void test2() { assertEquals(expected, solution1.lengthOfLongestSubstringTwoDistinct(s)); assertEquals(expected, solution2.lengthOfLongestSubstringTwoDistinct(s)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_15Test.java b/src/test/java/com/fishercoder/firstthousand/_15Test.java index dee7739f87..0c7437f30c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_15Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_15Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._15; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._15; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _15Test { private _15.Solution1 solution1; @@ -22,7 +21,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{-1, 0, 1, 2, -1, -4}; + nums = new int[] {-1, 0, 1, 2, -1, -4}; expected = new ArrayList<>(); expected.add(Arrays.asList(-1, -1, 2)); expected.add(Arrays.asList(-1, 0, 1)); @@ -31,9 +30,8 @@ public void test1() { @Test public void test2() { - nums = new int[]{1, 2, -2, -1}; + nums = new int[] {1, 2, -2, -1}; expected = new ArrayList<>(); assertEquals(expected, solution1.threeSum(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_160Test.java b/src/test/java/com/fishercoder/firstthousand/_160Test.java index 2851bddd01..1e4511ec37 100644 --- a/src/test/java/com/fishercoder/firstthousand/_160Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_160Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.solutions.firstthousand._160; - -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _160Test { private _160.Solution1 solution1; private _160.Solution2 solution2; @@ -31,7 +30,10 @@ public void test1() { headB = new ListNode(2); headB.next = new ListNode(3); expected = new ListNode(3); - /**TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in this unit test.*/ + /** + * TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in + * this unit test. + */ assertEquals(expected, solution1.getIntersectionNode(headA, headB)); } @@ -42,7 +44,10 @@ public void test2() { headB = new ListNode(2); headB.next = new ListNode(3); expected = new ListNode(3); - /**TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in this unit test.*/ + /** + * TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in + * this unit test. + */ assertEquals(expected, solution2.getIntersectionNode(headA, headB)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_161Test.java b/src/test/java/com/fishercoder/firstthousand/_161Test.java index f37da3e98e..d99baf6fe9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_161Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_161Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._161; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _161Test { - private _161.Solution1 solution1; + private _161.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _161.Solution1(); - } + solution1 = new _161.Solution1(); + } - @Test - public void test1() { - assertEquals(true, solution1.isOneEditDistance("a", "ac")); - } + @Test + public void test1() { + assertEquals(true, solution1.isOneEditDistance("a", "ac")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_162Test.java b/src/test/java/com/fishercoder/firstthousand/_162Test.java index 6637472d87..d22ee58aa9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_162Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_162Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._162; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _162Test { private _162.Solution1 solution1; private _162.Solution2 solution2; @@ -19,28 +19,28 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2}; + nums = new int[] {1, 2}; assertEquals(1, solution1.findPeakElement(nums)); assertEquals(1, solution2.findPeakElement(nums)); } @Test public void test2() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(0, solution1.findPeakElement(nums)); assertEquals(0, solution2.findPeakElement(nums)); } @Test public void test3() { - nums = new int[]{1, 2, 3, 1}; + nums = new int[] {1, 2, 3, 1}; assertEquals(2, solution1.findPeakElement(nums)); assertEquals(2, solution2.findPeakElement(nums)); } @Test public void test4() { - nums = new int[]{1, 2, 1, 3, 5, 6, 4}; + nums = new int[] {1, 2, 1, 3, 5, 6, 4}; assertEquals(5, solution1.findPeakElement(nums)); assertEquals(1, solution2.findPeakElement(nums)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_163Test.java b/src/test/java/com/fishercoder/firstthousand/_163Test.java index 53b9ba26d9..90bcc88fce 100644 --- a/src/test/java/com/fishercoder/firstthousand/_163Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_163Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._163; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._163; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _163Test { @@ -29,7 +28,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2147483647}; + nums = new int[] {2147483647}; expected.add(Arrays.asList(0, 2147483646)); actual = solution1.findMissingRanges(nums, 0, 2147483647); assertEquals(expected, actual); @@ -37,7 +36,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{-2147483648, 0, 2147483647}; + nums = new int[] {-2147483648, 0, 2147483647}; expected.add(Arrays.asList(-2147483647, -1)); expected.add(Arrays.asList(1, 2147483646)); actual = solution1.findMissingRanges(nums, -2147483648, 2147483647); @@ -46,7 +45,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{}; + nums = new int[] {}; expected.add(Arrays.asList(-2147483648, 2147483647)); actual = solution1.findMissingRanges(nums, -2147483648, 2147483647); assertEquals(expected, actual); @@ -54,7 +53,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{2147483647}; + nums = new int[] {2147483647}; expected.add(Arrays.asList(-2147483648, 2147483646)); actual = solution1.findMissingRanges(nums, -2147483648, 2147483647); assertEquals(expected, actual); @@ -62,7 +61,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{}; + nums = new int[] {}; expected.add(Arrays.asList(0, 2147483647)); actual = solution1.findMissingRanges(nums, 0, 2147483647); assertEquals(expected, actual); @@ -70,7 +69,7 @@ public void test5() { @Test public void test6() { - nums = new int[]{-2147483648}; + nums = new int[] {-2147483648}; expected.add(Arrays.asList(-2147483647, 2147483647)); actual = solution1.findMissingRanges(nums, -2147483648, 2147483647); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_164Test.java b/src/test/java/com/fishercoder/firstthousand/_164Test.java index bfddab32c3..0b75beb5a4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_164Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_164Test.java @@ -1,35 +1,35 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._164; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _164Test { - private _164.Solution1 solution1; - private static int[] nums; + private _164.Solution1 solution1; + private static int[] nums; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _164.Solution1(); - } + solution1 = new _164.Solution1(); + } - @Test - public void test1() { - nums = new int[] {}; - assertEquals(0, solution1.maximumGap(nums)); - } + @Test + public void test1() { + nums = new int[] {}; + assertEquals(0, solution1.maximumGap(nums)); + } - @Test - public void test2() { - nums = new int[] {1, 3, 6, 5}; - assertEquals(2, solution1.maximumGap(nums)); - } + @Test + public void test2() { + nums = new int[] {1, 3, 6, 5}; + assertEquals(2, solution1.maximumGap(nums)); + } - @Test - public void test3() { - nums = new int[] {1, 100000}; - assertEquals(99999, solution1.maximumGap(nums)); - } + @Test + public void test3() { + nums = new int[] {1, 100000}; + assertEquals(99999, solution1.maximumGap(nums)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_165Test.java b/src/test/java/com/fishercoder/firstthousand/_165Test.java index e7b225a00c..81e77f3e24 100644 --- a/src/test/java/com/fishercoder/firstthousand/_165Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_165Test.java @@ -1,31 +1,31 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._165; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _165Test { - private _165.Solution1 solution1; + private _165.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _165.Solution1(); - } + solution1 = new _165.Solution1(); + } - @Test - public void test1() { - assertEquals(-1, solution1.compareVersion("1.1", "1.2")); - } + @Test + public void test1() { + assertEquals(-1, solution1.compareVersion("1.1", "1.2")); + } - @Test - public void test2() { - assertEquals(1, solution1.compareVersion("1.0.1", "1")); - } + @Test + public void test2() { + assertEquals(1, solution1.compareVersion("1.0.1", "1")); + } - @Test - public void test3() { - assertEquals(-0, solution1.compareVersion("1.0", "1")); - } + @Test + public void test3() { + assertEquals(-0, solution1.compareVersion("1.0", "1")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_166Test.java b/src/test/java/com/fishercoder/firstthousand/_166Test.java index ae7a33b098..6cd4307e08 100644 --- a/src/test/java/com/fishercoder/firstthousand/_166Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_166Test.java @@ -1,56 +1,57 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._166; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _166Test { - private _166.Solution1 solution1; + private _166.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _166.Solution1(); - } - - @Test - public void test1() { - assertEquals("0.5", solution1.fractionToDecimal(1, 2)); - } - - @Test - public void test2() { - assertEquals("2", solution1.fractionToDecimal(2, 1)); - } - - @Test - public void test3() { - assertEquals("0.(6)", solution1.fractionToDecimal(2, 3)); - } - - @Test - public void test4() { - assertEquals("-6.25", solution1.fractionToDecimal(-50, 8)); - } - - @Test - public void test5() { - assertEquals("-0.58(3)", solution1.fractionToDecimal(7, -12)); - } - - @Test - public void test6() { - assertEquals("0.0000000004656612873077392578125", solution1.fractionToDecimal(-1, -2147483648)); - } - - @Test - public void test7() { - assertEquals("0", solution1.fractionToDecimal(0, -5)); - } - - @Test - public void test8() { - assertEquals("-2147483648", solution1.fractionToDecimal(-2147483648, 1)); - } + solution1 = new _166.Solution1(); + } + + @Test + public void test1() { + assertEquals("0.5", solution1.fractionToDecimal(1, 2)); + } + + @Test + public void test2() { + assertEquals("2", solution1.fractionToDecimal(2, 1)); + } + + @Test + public void test3() { + assertEquals("0.(6)", solution1.fractionToDecimal(2, 3)); + } + + @Test + public void test4() { + assertEquals("-6.25", solution1.fractionToDecimal(-50, 8)); + } + + @Test + public void test5() { + assertEquals("-0.58(3)", solution1.fractionToDecimal(7, -12)); + } + + @Test + public void test6() { + assertEquals( + "0.0000000004656612873077392578125", solution1.fractionToDecimal(-1, -2147483648)); + } + + @Test + public void test7() { + assertEquals("0", solution1.fractionToDecimal(0, -5)); + } + + @Test + public void test8() { + assertEquals("-2147483648", solution1.fractionToDecimal(-2147483648, 1)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_167Test.java b/src/test/java/com/fishercoder/firstthousand/_167Test.java index 359261a3d3..46c2e97e8f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_167Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_167Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._167; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _167Test { private _167.Solution1 solution1; private _167.Solution2 solution2; @@ -23,8 +23,8 @@ public void setup() { @Test public void test1() { - numbers = new int[]{-3, 3, 4, 90}; - expected = new int[]{1, 2}; + numbers = new int[] {-3, 3, 4, 90}; + expected = new int[] {1, 2}; target = 0; assertArrayEquals(expected, solution1.twoSum(numbers, target)); assertArrayEquals(expected, solution2.twoSum(numbers, target)); @@ -33,17 +33,17 @@ public void test1() { @Test public void test2() { - expected = new int[]{2, 3}; + expected = new int[] {2, 3}; target = 100; - assertArrayEquals(expected, solution1.twoSum(new int[]{5, 25, 75}, target)); - assertArrayEquals(expected, solution2.twoSum(new int[]{5, 25, 75}, target)); - assertArrayEquals(expected, solution3.twoSum(new int[]{5, 25, 75}, target)); + assertArrayEquals(expected, solution1.twoSum(new int[] {5, 25, 75}, target)); + assertArrayEquals(expected, solution2.twoSum(new int[] {5, 25, 75}, target)); + assertArrayEquals(expected, solution3.twoSum(new int[] {5, 25, 75}, target)); } @Test public void test3() { - numbers = new int[]{1, 2, 3, 4, 4, 9, 56, 90}; - expected = new int[]{4, 5}; + numbers = new int[] {1, 2, 3, 4, 4, 9, 56, 90}; + expected = new int[] {4, 5}; target = 8; assertArrayEquals(expected, solution1.twoSum(numbers, target)); assertArrayEquals(expected, solution2.twoSum(numbers, target)); @@ -52,8 +52,8 @@ public void test3() { @Test public void test4() { - numbers = new int[]{2, 3, 4}; - expected = new int[]{1, 3}; + numbers = new int[] {2, 3, 4}; + expected = new int[] {1, 3}; target = 6; assertArrayEquals(expected, solution1.twoSum(numbers, target)); assertArrayEquals(expected, solution2.twoSum(numbers, target)); diff --git a/src/test/java/com/fishercoder/firstthousand/_168Test.java b/src/test/java/com/fishercoder/firstthousand/_168Test.java index 0d0750b487..a238196a45 100644 --- a/src/test/java/com/fishercoder/firstthousand/_168Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_168Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._168; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _168Test { - private _168.Solution1 solution1; + private _168.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _168.Solution1(); - } + solution1 = new _168.Solution1(); + } - @Test - public void test1() { - assertEquals("APSM", solution1.convertToTitle(28899)); - } + @Test + public void test1() { + assertEquals("APSM", solution1.convertToTitle(28899)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_169Test.java b/src/test/java/com/fishercoder/firstthousand/_169Test.java index e45d16212d..7ddc8df811 100644 --- a/src/test/java/com/fishercoder/firstthousand/_169Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_169Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._169; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _169Test { private _169.Solution1 solution1; private _169.Solution2 solution2; @@ -20,9 +20,11 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.majorityElement(new int[]{1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); - assertEquals(1, solution2.majorityElement(new int[]{1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); - assertEquals(1, solution3.majorityElement(new int[]{1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); + assertEquals( + 1, solution1.majorityElement(new int[] {1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); + assertEquals( + 1, solution2.majorityElement(new int[] {1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); + assertEquals( + 1, solution3.majorityElement(new int[] {1, 3, 1, 1, 4, 1, 1, 5, 1, 1, 6, 2, 2})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_16Test.java b/src/test/java/com/fishercoder/firstthousand/_16Test.java index 57aeea40a0..891b6a7dc8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_16Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_16Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._16; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _16Test { private _16.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{-1, 2, 1, -4}; + nums = new int[] {-1, 2, 1, -4}; assertEquals(2, solution1.threeSumClosest(nums, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_171Test.java b/src/test/java/com/fishercoder/firstthousand/_171Test.java index 9f514ddd09..b8e6b491ca 100644 --- a/src/test/java/com/fishercoder/firstthousand/_171Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_171Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._171; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _171Test { - private _171.Solution1 solution1; + private _171.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _171.Solution1(); - } + solution1 = new _171.Solution1(); + } - @Test - public void test1() { - assertEquals(28, solution1.titleToNumber("AB")); - } + @Test + public void test1() { + assertEquals(28, solution1.titleToNumber("AB")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_174Test.java b/src/test/java/com/fishercoder/firstthousand/_174Test.java index 9f7b9a8e6d..596da26997 100644 --- a/src/test/java/com/fishercoder/firstthousand/_174Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_174Test.java @@ -1,33 +1,29 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._174; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _174Test { - private _174.Solution1 solution1; - private int[][] dungeon; + private _174.Solution1 solution1; + private int[][] dungeon; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _174.Solution1(); - } + solution1 = new _174.Solution1(); + } - @Test - public void test1() { - dungeon = new int[][] { - {0} - }; - assertEquals(1, solution1.calculateMinimumHP(dungeon)); - } + @Test + public void test1() { + dungeon = new int[][] {{0}}; + assertEquals(1, solution1.calculateMinimumHP(dungeon)); + } - @Test - public void test2() { - dungeon = new int[][] { - {-200} - }; - assertEquals(201, solution1.calculateMinimumHP(dungeon)); - } + @Test + public void test2() { + dungeon = new int[][] {{-200}}; + assertEquals(201, solution1.calculateMinimumHP(dungeon)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_179Test.java b/src/test/java/com/fishercoder/firstthousand/_179Test.java index 3351a18df3..d88ec952ad 100644 --- a/src/test/java/com/fishercoder/firstthousand/_179Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_179Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._179; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _179Test { private _179.Solution1 solution1; private _179.Solution2 solution2; @@ -20,7 +20,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{34323, 3432}; + nums = new int[] {34323, 3432}; expected = "343234323"; assertEquals(expected, solution1.largestNumber(nums)); assertEquals(expected, solution2.largestNumber(nums)); @@ -28,7 +28,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{111311, 1113}; + nums = new int[] {111311, 1113}; expected = "1113111311"; assertEquals(expected, solution1.largestNumber(nums)); assertEquals(expected, solution2.largestNumber(nums)); @@ -36,7 +36,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{3, 30, 34, 5, 9}; + nums = new int[] {3, 30, 34, 5, 9}; expected = "9534330"; assertEquals(expected, solution1.largestNumber(nums)); assertEquals(expected, solution2.largestNumber(nums)); @@ -44,10 +44,9 @@ public void test3() { @Test public void test4() { - nums = new int[]{0, 0}; + nums = new int[] {0, 0}; expected = "0"; assertEquals(expected, solution1.largestNumber(nums)); assertEquals(expected, solution2.largestNumber(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_17Test.java b/src/test/java/com/fishercoder/firstthousand/_17Test.java index ac26ea4e19..7162fe2070 100644 --- a/src/test/java/com/fishercoder/firstthousand/_17Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_17Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._17; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._17; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _17Test { private _17.Solution1 solution1; @@ -37,7 +36,9 @@ public void test1() { @Test public void test2() { digits = "23"; - expected = new ArrayList<>(Arrays.asList("ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf")); + expected = + new ArrayList<>( + Arrays.asList("ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf")); Collections.sort(expected); List actual = solution1.letterCombinations(digits); Collections.sort(actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_186Test.java b/src/test/java/com/fishercoder/firstthousand/_186Test.java index 14e52bf8f7..ace3cefd34 100644 --- a/src/test/java/com/fishercoder/firstthousand/_186Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_186Test.java @@ -1,26 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._186; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _186Test { - private _186.Solution1 solution1; - private static char[] s; - private static char[] expected; + private _186.Solution1 solution1; + private static char[] s; + private static char[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _186.Solution1(); - } + solution1 = new _186.Solution1(); + } - @Test - public void test1() { - s = new char[] {'h', 'i', '!'}; - solution1.reverseWords(s); - expected = new char[] {'h', 'i', '!'}; - assertArrayEquals(expected, s); - } + @Test + public void test1() { + s = new char[] {'h', 'i', '!'}; + solution1.reverseWords(s); + expected = new char[] {'h', 'i', '!'}; + assertArrayEquals(expected, s); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_187Test.java b/src/test/java/com/fishercoder/firstthousand/_187Test.java index 333be29f9c..cf1de8891f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_187Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_187Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._187; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._187; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _187Test { private _187.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_189Test.java b/src/test/java/com/fishercoder/firstthousand/_189Test.java index 736b2f7cc1..64ee2469dc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_189Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_189Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._189; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _189Test { private _189.Solution1 solution1; private _189.Solution2 solution2; @@ -23,37 +23,36 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; solution1.rotate(nums, 1); - assertArrayEquals(new int[]{3, 1, 2}, nums); + assertArrayEquals(new int[] {3, 1, 2}, nums); } @Test public void test2() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; solution2.rotate(nums, 1); - assertArrayEquals(new int[]{3, 1, 2}, nums); + assertArrayEquals(new int[] {3, 1, 2}, nums); } @Test public void test3() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; solution3.rotate(nums, 1); - assertArrayEquals(new int[]{3, 1, 2}, nums); + assertArrayEquals(new int[] {3, 1, 2}, nums); } @Test public void test4() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; solution4.rotate(nums, 1); - assertArrayEquals(new int[]{3, 1, 2}, nums); + assertArrayEquals(new int[] {3, 1, 2}, nums); } @Test public void test5() { - nums = new int[]{-1, -100, 3, 99}; + nums = new int[] {-1, -100, 3, 99}; solution4.rotate(nums, 2); - assertArrayEquals(new int[]{3, 99, -1, -100}, nums); + assertArrayEquals(new int[] {3, 99, -1, -100}, nums); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_18Test.java b/src/test/java/com/fishercoder/firstthousand/_18Test.java index 75f234b57a..11b8702e87 100644 --- a/src/test/java/com/fishercoder/firstthousand/_18Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_18Test.java @@ -16,8 +16,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 0, -1, 0, -2, 2}; + nums = new int[] {1, 0, -1, 0, -2, 2}; CommonUtils.printListList(solution1.fourSum(nums, 0)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_190Test.java b/src/test/java/com/fishercoder/firstthousand/_190Test.java index 1725ba6ef9..0336b87f90 100644 --- a/src/test/java/com/fishercoder/firstthousand/_190Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_190Test.java @@ -1,27 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._190; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _190Test { - private _190.Solution1 solution1; + private _190.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _190.Solution1(); - } - - @Test - public void test1() { - assertEquals(536870912, solution1.reverseBits(4)); - } + solution1 = new _190.Solution1(); + } + @Test + public void test1() { + assertEquals(536870912, solution1.reverseBits(4)); + } - @Test - public void test2() { - assertEquals(964176192, solution1.reverseBits( 43261596)); - } + @Test + public void test2() { + assertEquals(964176192, solution1.reverseBits(43261596)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_191Test.java b/src/test/java/com/fishercoder/firstthousand/_191Test.java index cbc1cefaa3..7c6f7362ad 100644 --- a/src/test/java/com/fishercoder/firstthousand/_191Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_191Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._191; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _191Test { private _191.Solution1 solution1; private _191.Solution2 solution2; @@ -30,8 +30,7 @@ public void test1() { @Test public void test2() { -// System.out.println(Integer.MAX_VALUE); -// assertEquals(2147483648, Integer.MAX_VALUE); + // System.out.println(Integer.MAX_VALUE); + // assertEquals(2147483648, Integer.MAX_VALUE); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_198Test.java b/src/test/java/com/fishercoder/firstthousand/_198Test.java index e0154d370a..a1b6a501d4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_198Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_198Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._198; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _198Test { private _198.Solution1 solution1; private _198.Solution2 solution2; @@ -18,13 +18,12 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.rob(new int[]{1, 2, 3, 1})); - assertEquals(4, solution2.rob(new int[]{1, 2, 3, 1})); + assertEquals(4, solution1.rob(new int[] {1, 2, 3, 1})); + assertEquals(4, solution2.rob(new int[] {1, 2, 3, 1})); } @Test public void test2() { - assertEquals(4, solution1.rob(new int[]{2, 1, 1, 2})); + assertEquals(4, solution1.rob(new int[] {2, 1, 1, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_199Test.java b/src/test/java/com/fishercoder/firstthousand/_199Test.java index 6cb83364ad..ebaca8ba46 100644 --- a/src/test/java/com/fishercoder/firstthousand/_199Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_199Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._199; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _199Test { private _199.Solution1 solution1; private _199.Solution2 solution2; @@ -27,5 +26,4 @@ public void test1() { assertEquals(Arrays.asList(1, 3), solution1.rightSideView(root)); assertEquals(Arrays.asList(1, 3), solution2.rightSideView(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_19Test.java b/src/test/java/com/fishercoder/firstthousand/_19Test.java index 0f94159bdd..74d8c64967 100644 --- a/src/test/java/com/fishercoder/firstthousand/_19Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_19Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._19; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _19Test { private _19.Solution1 solution1; private _19.Solution3 solution3; @@ -22,23 +22,22 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 5}); assertEquals(expected, solution1.removeNthFromEnd(head, 2)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 5}); assertEquals(expected, solution3.removeNthFromEnd(head, 2)); } @Test public void test3() { - head = LinkedListUtils.contructLinkedList(new int[]{1}); - expected = LinkedListUtils.contructLinkedList(new int[]{}); + head = LinkedListUtils.contructLinkedList(new int[] {1}); + expected = LinkedListUtils.contructLinkedList(new int[] {}); assertEquals(expected, solution1.removeNthFromEnd(head, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_1Test.java b/src/test/java/com/fishercoder/firstthousand/_1Test.java index 4110faea4c..97f07191ca 100644 --- a/src/test/java/com/fishercoder/firstthousand/_1Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_1Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._1; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1Test { private _1.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 7, 11, 15}; - assertArrayEquals(new int[]{0, 1}, solution1.twoSum(nums, 9)); + nums = new int[] {2, 7, 11, 15}; + assertArrayEquals(new int[] {0, 1}, solution1.twoSum(nums, 9)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_200Test.java b/src/test/java/com/fishercoder/firstthousand/_200Test.java index 504c5cd42a..197751aa1a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_200Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_200Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._200; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _200Test { private _200.Solution1 solution1; private _200.Solution2 solution2; @@ -19,57 +19,62 @@ public void setup() { @Test public void test1() { - grid = new char[][]{ - {'1', '1', '1'}, - {'0', '1', '0'}, - {'1', '1', '1'}, - }; + grid = + new char[][] { + {'1', '1', '1'}, + {'0', '1', '0'}, + {'1', '1', '1'}, + }; assertEquals(1, solution1.numIslands(grid)); - grid = new char[][]{ - {'1', '1', '1'}, - {'0', '1', '0'}, - {'1', '1', '1'}, - }; + grid = + new char[][] { + {'1', '1', '1'}, + {'0', '1', '0'}, + {'1', '1', '1'}, + }; assertEquals(1, solution2.numIslands(grid)); } @Test public void test2() { - grid = new char[][]{ - {'1', '1', '1', '1', '0'}, - {'1', '1', '0', '1', '0'}, - {'1', '1', '0', '0', '0'}, - {'0', '0', '0', '0', '0'}, - }; + grid = + new char[][] { + {'1', '1', '1', '1', '0'}, + {'1', '1', '0', '1', '0'}, + {'1', '1', '0', '0', '0'}, + {'0', '0', '0', '0', '0'}, + }; assertEquals(1, solution1.numIslands(grid)); - grid = new char[][]{ - {'1', '1', '1', '1', '0'}, - {'1', '1', '0', '1', '0'}, - {'1', '1', '0', '0', '0'}, - {'0', '0', '0', '0', '0'}, - }; + grid = + new char[][] { + {'1', '1', '1', '1', '0'}, + {'1', '1', '0', '1', '0'}, + {'1', '1', '0', '0', '0'}, + {'0', '0', '0', '0', '0'}, + }; assertEquals(1, solution2.numIslands(grid)); } @Test public void test3() { - grid = new char[][]{ - {'1', '1', '0', '0', '0'}, - {'1', '1', '0', '0', '0'}, - {'0', '0', '1', '0', '0'}, - {'0', '0', '0', '1', '1'}, - }; + grid = + new char[][] { + {'1', '1', '0', '0', '0'}, + {'1', '1', '0', '0', '0'}, + {'0', '0', '1', '0', '0'}, + {'0', '0', '0', '1', '1'}, + }; assertEquals(3, solution1.numIslands(grid)); - grid = new char[][]{ - {'1', '1', '0', '0', '0'}, - {'1', '1', '0', '0', '0'}, - {'0', '0', '1', '0', '0'}, - {'0', '0', '0', '1', '1'}, - }; + grid = + new char[][] { + {'1', '1', '0', '0', '0'}, + {'1', '1', '0', '0', '0'}, + {'0', '0', '1', '0', '0'}, + {'0', '0', '0', '1', '1'}, + }; assertEquals(3, solution2.numIslands(grid)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_201Test.java b/src/test/java/com/fishercoder/firstthousand/_201Test.java index f12fce970c..0365709fe2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_201Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_201Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._201; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _201Test { private _201.Solution1 solution1; private static int left; diff --git a/src/test/java/com/fishercoder/firstthousand/_202Test.java b/src/test/java/com/fishercoder/firstthousand/_202Test.java index 63bc0642e9..053e1f0c5b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_202Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_202Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._202; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _202Test { private _202.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_203Test.java b/src/test/java/com/fishercoder/firstthousand/_203Test.java index afba0284ad..8b36ac4d82 100644 --- a/src/test/java/com/fishercoder/firstthousand/_203Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_203Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._203; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _203Test { private _203.Solution1 solution1; private static ListNode head; @@ -20,9 +20,8 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 6, 3, 4, 5, 6}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 6, 3, 4, 5, 6}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); assertEquals(expected, solution1.removeElements(head, 6)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_204Test.java b/src/test/java/com/fishercoder/firstthousand/_204Test.java index a83f73c63f..764e57e7f2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_204Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_204Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._204; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _204Test { private _204.Solution1 solution1; @@ -58,5 +58,4 @@ public void test8() { public void test9() { assertEquals(15, solution1.countPrimes(50)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_206Test.java b/src/test/java/com/fishercoder/firstthousand/_206Test.java index a75a921c31..4123862854 100644 --- a/src/test/java/com/fishercoder/firstthousand/_206Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_206Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._206; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _206Test { private _206.Solution1 solution1; private _206.Solution2 solution2; @@ -23,19 +23,25 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{4, 3, 2, 1}), solution1.reverseList(head)); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {4, 3, 2, 1}), + solution1.reverseList(head)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{4, 3, 2, 1}), solution2.reverseList(head)); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {4, 3, 2, 1}), + solution2.reverseList(head)); } @Test public void test3() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4}); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{4, 3, 2, 1}), solution3.reverseList(head)); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4}); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {4, 3, 2, 1}), + solution3.reverseList(head)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_207Test.java b/src/test/java/com/fishercoder/firstthousand/_207Test.java index ff7aaca555..d4976e021a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_207Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_207Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._207; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _207Test { private _207.Solution1 solution1; private _207.Solution2 solution2; @@ -25,7 +25,7 @@ public void setup() { @Test public void test1() { numCourses = 2; - prerequisites = new int[][]{{0, 1}}; + prerequisites = new int[][] {{0, 1}}; assertEquals(true, solution1.canFinish(numCourses, prerequisites)); assertEquals(true, solution2.canFinish(numCourses, prerequisites)); assertEquals(true, solution3.canFinish(numCourses, prerequisites)); @@ -35,18 +35,18 @@ public void test1() { @Test public void test2() { numCourses = 8; - prerequisites = new int[][]{ - {3, 0}, - {3, 1}, - {5, 3}, - {5, 2}, - {6, 3}, - {6, 1}, - {7, 3}, - {7, 4}, - {4, 2}, - - }; + prerequisites = + new int[][] { + {3, 0}, + {3, 1}, + {5, 3}, + {5, 2}, + {6, 3}, + {6, 1}, + {7, 3}, + {7, 4}, + {4, 2}, + }; assertEquals(true, solution1.canFinish(numCourses, prerequisites)); assertEquals(true, solution2.canFinish(numCourses, prerequisites)); assertEquals(true, solution3.canFinish(numCourses, prerequisites)); @@ -56,18 +56,18 @@ public void test2() { @Test public void test3() { numCourses = 8; - prerequisites = new int[][]{ - {3, 2}, - {3, 0}, - {5, 3}, - {5, 1}, - {7, 3}, - {7, 0}, - {6, 3}, - {6, 4}, - {4, 1}, - - }; + prerequisites = + new int[][] { + {3, 2}, + {3, 0}, + {5, 3}, + {5, 1}, + {7, 3}, + {7, 0}, + {6, 3}, + {6, 4}, + {4, 1}, + }; assertEquals(true, solution1.canFinish(numCourses, prerequisites)); assertEquals(true, solution2.canFinish(numCourses, prerequisites)); assertEquals(true, solution3.canFinish(numCourses, prerequisites)); diff --git a/src/test/java/com/fishercoder/firstthousand/_208Test.java b/src/test/java/com/fishercoder/firstthousand/_208Test.java index e46aa29594..bddde5f4eb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_208Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_208Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._208; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _208Test { private _208.Solution1.Trie trie; @@ -33,5 +33,4 @@ public void test2() { assertEquals(true, trie.search("april")); assertEquals(true, trie.search("cad")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_209Test.java b/src/test/java/com/fishercoder/firstthousand/_209Test.java index e0c89a4548..3b01e9f856 100644 --- a/src/test/java/com/fishercoder/firstthousand/_209Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_209Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._209; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _209Test { private _209.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 3, 1, 2, 4, 3}; + nums = new int[] {2, 3, 1, 2, 4, 3}; assertEquals(2, solution1.minSubArrayLen(7, nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_20Test.java b/src/test/java/com/fishercoder/firstthousand/_20Test.java index 6b857da163..bf88f1e36a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_20Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_20Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._20; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _20Test { private _20.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(true, solution1.isValid("()")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_210Test.java b/src/test/java/com/fishercoder/firstthousand/_210Test.java index aed40155cf..f7fa981ef0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_210Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_210Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._210; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _210Test { private _210.Solution1 solution1; private _210.Solution2 solution2; @@ -18,12 +18,7 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{0, 1}, solution1.findOrder(2, new int[][]{ - {1, 0} - })); - assertArrayEquals(new int[]{0, 1}, solution2.findOrder(2, new int[][]{ - {1, 0} - })); + assertArrayEquals(new int[] {0, 1}, solution1.findOrder(2, new int[][] {{1, 0}})); + assertArrayEquals(new int[] {0, 1}, solution2.findOrder(2, new int[][] {{1, 0}})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_211Test.java b/src/test/java/com/fishercoder/firstthousand/_211Test.java index ad5d19f95b..250e09c6bb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_211Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_211Test.java @@ -1,27 +1,27 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._211; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _211Test { - private _211.Solution1.WordDictionary wordDictionarySolution1; + private _211.Solution1.WordDictionary wordDictionarySolution1; - @BeforeEach + @BeforeEach public void setUp() { - wordDictionarySolution1 = new _211.Solution1.WordDictionary(); - } + wordDictionarySolution1 = new _211.Solution1.WordDictionary(); + } - @Test - public void test1() { - wordDictionarySolution1.addWord("bad"); - wordDictionarySolution1.addWord("dad"); - wordDictionarySolution1.addWord("mad"); - assertEquals(false, wordDictionarySolution1.search("pad")); - assertEquals(true, wordDictionarySolution1.search("bad")); - assertEquals(true, wordDictionarySolution1.search(".ad")); - assertEquals(true, wordDictionarySolution1.search("b..")); - } + @Test + public void test1() { + wordDictionarySolution1.addWord("bad"); + wordDictionarySolution1.addWord("dad"); + wordDictionarySolution1.addWord("mad"); + assertEquals(false, wordDictionarySolution1.search("pad")); + assertEquals(true, wordDictionarySolution1.search("bad")); + assertEquals(true, wordDictionarySolution1.search(".ad")); + assertEquals(true, wordDictionarySolution1.search("b..")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_212Test.java b/src/test/java/com/fishercoder/firstthousand/_212Test.java index f557147ecf..919219ae5a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_212Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_212Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._212; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _212Test { private _212.Solution1 solution1; private _212.Solution2 solution2; @@ -21,22 +20,33 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("oa", "oaa"), solution1.findWords(CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( - "[\"o\",\"a\",\"b\",\"n\"],[\"o\",\"t\",\"a\",\"e\"],[\"a\",\"h\",\"k\",\"r\"],[\"a\",\"f\",\"l\",\"v\"]"), - new String[]{"oa", "oaa"})); - assertEquals(Arrays.asList("oa", "oaa"), solution2.findWords(CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( - "[\"o\",\"a\",\"b\",\"n\"],[\"o\",\"t\",\"a\",\"e\"],[\"a\",\"h\",\"k\",\"r\"],[\"a\",\"f\",\"l\",\"v\"]"), - new String[]{"oa", "oaa"})); + assertEquals( + Arrays.asList("oa", "oaa"), + solution1.findWords( + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"o\",\"a\",\"b\",\"n\"],[\"o\",\"t\",\"a\",\"e\"],[\"a\",\"h\",\"k\",\"r\"],[\"a\",\"f\",\"l\",\"v\"]"), + new String[] {"oa", "oaa"})); + assertEquals( + Arrays.asList("oa", "oaa"), + solution2.findWords( + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"o\",\"a\",\"b\",\"n\"],[\"o\",\"t\",\"a\",\"e\"],[\"a\",\"h\",\"k\",\"r\"],[\"a\",\"f\",\"l\",\"v\"]"), + new String[] {"oa", "oaa"})); } @Test public void test2() { - assertEquals(Arrays.asList("oath", "eat"), solution1.findWords(CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( - "[\"o\",\"a\",\"a\",\"n\"],[\"e\",\"t\",\"a\",\"e\"],[\"i\",\"h\",\"k\",\"r\"],[\"i\",\"f\",\"l\",\"v\"]"), - new String[]{"oath", "pea", "eat", "rain"})); - assertEquals(Arrays.asList("oath", "eat"), solution2.findWords(CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( - "[\"o\",\"a\",\"a\",\"n\"],[\"e\",\"t\",\"a\",\"e\"],[\"i\",\"h\",\"k\",\"r\"],[\"i\",\"f\",\"l\",\"v\"]"), - new String[]{"oath", "pea", "eat", "rain"})); + assertEquals( + Arrays.asList("oath", "eat"), + solution1.findWords( + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"o\",\"a\",\"a\",\"n\"],[\"e\",\"t\",\"a\",\"e\"],[\"i\",\"h\",\"k\",\"r\"],[\"i\",\"f\",\"l\",\"v\"]"), + new String[] {"oath", "pea", "eat", "rain"})); + assertEquals( + Arrays.asList("oath", "eat"), + solution2.findWords( + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"o\",\"a\",\"a\",\"n\"],[\"e\",\"t\",\"a\",\"e\"],[\"i\",\"h\",\"k\",\"r\"],[\"i\",\"f\",\"l\",\"v\"]"), + new String[] {"oath", "pea", "eat", "rain"})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_213Test.java b/src/test/java/com/fishercoder/firstthousand/_213Test.java index 4450fffbe6..aa4b1e6724 100644 --- a/src/test/java/com/fishercoder/firstthousand/_213Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_213Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._213; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _213Test { private _213.Solution1 solution1; private _213.Solution2 solution2; @@ -18,32 +18,31 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.rob(new int[]{2, 3, 2})); - assertEquals(3, solution2.rob(new int[]{2, 3, 2})); + assertEquals(3, solution1.rob(new int[] {2, 3, 2})); + assertEquals(3, solution2.rob(new int[] {2, 3, 2})); } @Test public void test2() { - assertEquals(4, solution1.rob(new int[]{1, 2, 3, 1})); - assertEquals(4, solution2.rob(new int[]{1, 2, 3, 1})); + assertEquals(4, solution1.rob(new int[] {1, 2, 3, 1})); + assertEquals(4, solution2.rob(new int[] {1, 2, 3, 1})); } @Test public void test3() { - assertEquals(0, solution1.rob(new int[]{0})); - assertEquals(0, solution2.rob(new int[]{0})); + assertEquals(0, solution1.rob(new int[] {0})); + assertEquals(0, solution2.rob(new int[] {0})); } @Test public void test4() { - assertEquals(0, solution1.rob(new int[]{0, 0})); - assertEquals(0, solution2.rob(new int[]{0, 0})); + assertEquals(0, solution1.rob(new int[] {0, 0})); + assertEquals(0, solution2.rob(new int[] {0, 0})); } @Test public void test5() { - assertEquals(340, solution1.rob(new int[]{200, 3, 140, 20, 10})); - assertEquals(340, solution2.rob(new int[]{200, 3, 140, 20, 10})); + assertEquals(340, solution1.rob(new int[] {200, 3, 140, 20, 10})); + assertEquals(340, solution2.rob(new int[] {200, 3, 140, 20, 10})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_215Test.java b/src/test/java/com/fishercoder/firstthousand/_215Test.java index b590a255e0..bad7ec40d1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_215Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_215Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._215; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _215Test { private _215.Solution1 solution1; private _215.Solution2 solution2; @@ -24,7 +24,7 @@ public void setup() { @Test public void test1() { k = 2; - nums = new int[]{3, 2, 1, 5, 6, 4}; + nums = new int[] {3, 2, 1, 5, 6, 4}; expected = 5; assertEquals(expected, solution1.findKthLargest(nums, k)); assertEquals(expected, solution2.findKthLargest(nums, k)); @@ -34,7 +34,7 @@ public void test1() { @Test public void test2() { k = 1; - nums = new int[]{1}; + nums = new int[] {1}; expected = 1; assertEquals(expected, solution1.findKthLargest(nums, k)); assertEquals(expected, solution2.findKthLargest(nums, k)); @@ -44,7 +44,7 @@ public void test2() { @Test public void test3() { k = 2; - nums = new int[]{2, 1}; + nums = new int[] {2, 1}; expected = 1; assertEquals(expected, solution1.findKthLargest(nums, k)); assertEquals(expected, solution2.findKthLargest(nums, k)); diff --git a/src/test/java/com/fishercoder/firstthousand/_216Test.java b/src/test/java/com/fishercoder/firstthousand/_216Test.java index 276d59d5d6..7f0e6cba5c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_216Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_216Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._216; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _216Test { private _216.Solution1 solution1; private static int k; @@ -24,5 +23,4 @@ public void test1() { n = 7; assertEquals(Arrays.asList(Arrays.asList(1, 2, 4)), solution1.combinationSum3(k, n)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_217Test.java b/src/test/java/com/fishercoder/firstthousand/_217Test.java index c131003c23..f84763f6bd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_217Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_217Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._217; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _217Test { private _217.Solution1 solution1; private static int[] nums; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 4, 3}; + nums = new int[] {1, 2, 3, 4, 3}; assertEquals(true, solution1.containsDuplicate(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_219Test.java b/src/test/java/com/fishercoder/firstthousand/_219Test.java index 8bdbf62ad0..f2515396dd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_219Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_219Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._219; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _219Test { private _219.Solution1 solution1; private _219.Solution2 solution2; @@ -19,20 +19,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 1}; + nums = new int[] {1, 2, 3, 1}; assertEquals(true, solution1.containsNearbyDuplicate(nums, 3)); } @Test public void test2() { - nums = new int[]{1, 2, 3, 1}; + nums = new int[] {1, 2, 3, 1}; assertEquals(true, solution2.containsNearbyDuplicate(nums, 3)); } @Test public void test3() { - nums = new int[]{1, 2, 3, 1, 2, 3}; + nums = new int[] {1, 2, 3, 1, 2, 3}; assertEquals(false, solution2.containsNearbyDuplicate(nums, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_21Test.java b/src/test/java/com/fishercoder/firstthousand/_21Test.java index 082fdc07ad..175f2bd608 100644 --- a/src/test/java/com/fishercoder/firstthousand/_21Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_21Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._21; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _21Test { private _21.Solution1 solution1; private _21.Solution2 solution2; @@ -26,14 +25,17 @@ public void setup() { public void test1() { l1 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 3, 5)); l2 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(2, 4, 6)); - assertEquals(LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 3, 4, 5, 6)), solution1.mergeTwoLists(l1, l2)); + assertEquals( + LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 3, 4, 5, 6)), + solution1.mergeTwoLists(l1, l2)); } @Test public void test2() { l1 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 3, 5)); l2 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(2, 4, 6)); - assertEquals(LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 3, 4, 5, 6)), solution2.mergeTwoLists(l1, l2)); + assertEquals( + LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 3, 4, 5, 6)), + solution2.mergeTwoLists(l1, l2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_220Test.java b/src/test/java/com/fishercoder/firstthousand/_220Test.java index 916ebd3a71..10db7e3175 100644 --- a/src/test/java/com/fishercoder/firstthousand/_220Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_220Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._220; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _220Test { private _220.Solution1 solution1; private static int[] nums; @@ -17,44 +17,43 @@ public void setup() { @Test public void test1() { - nums = new int[]{-1, -1}; + nums = new int[] {-1, -1}; assertEquals(true, solution1.containsNearbyAlmostDuplicate(nums, 1, 0)); } @Test public void test2() { - nums = new int[]{1, 2}; + nums = new int[] {1, 2}; assertEquals(false, solution1.containsNearbyAlmostDuplicate(nums, 0, 1)); } @Test public void test3() { - nums = new int[]{4, 2}; + nums = new int[] {4, 2}; assertEquals(false, solution1.containsNearbyAlmostDuplicate(nums, 2, 1)); } @Test public void test4() { - nums = new int[]{2, 2}; + nums = new int[] {2, 2}; assertEquals(true, solution1.containsNearbyAlmostDuplicate(nums, 3, 0)); } @Test public void test5() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(false, solution1.containsNearbyAlmostDuplicate(nums, 1, 1)); } @Test public void test6() { - nums = new int[]{2147483647, -2147483647}; + nums = new int[] {2147483647, -2147483647}; assertEquals(false, solution1.containsNearbyAlmostDuplicate(nums, 1, 2147483647)); } @Test public void test7() { - nums = new int[]{-1, 2147483647}; + nums = new int[] {-1, 2147483647}; assertEquals(false, solution1.containsNearbyAlmostDuplicate(nums, 1, 2147483647)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_221Test.java b/src/test/java/com/fishercoder/firstthousand/_221Test.java index aa0c574d83..ade37c7596 100644 --- a/src/test/java/com/fishercoder/firstthousand/_221Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_221Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._221; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _221Test { private _221.Solution1 solution1; private static char[][] matrix; @@ -17,12 +17,13 @@ public void setup() { @Test public void test1() { - matrix = new char[][]{ - {'1', '0', '1', '0', '0'}, - {'1', '0', '1', '1', '1'}, - {'1', '1', '1', '1', '1'}, - {'1', '0', '0', '1', '0'}, - }; + matrix = + new char[][] { + {'1', '0', '1', '0', '0'}, + {'1', '0', '1', '1', '1'}, + {'1', '1', '1', '1', '1'}, + {'1', '0', '0', '1', '0'}, + }; assertEquals(4, solution1.maximalSquare(matrix)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_222Test.java b/src/test/java/com/fishercoder/firstthousand/_222Test.java index 5ac7830304..cc92163013 100644 --- a/src/test/java/com/fishercoder/firstthousand/_222Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_222Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._222; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _222Test { private _222.Solution1 solution1; private _222.Solution2 solution2; @@ -48,5 +47,4 @@ public void test3() { assertEquals(expected, solution1.countNodes(root)); assertEquals(expected, solution2.countNodes(root)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_224Test.java b/src/test/java/com/fishercoder/firstthousand/_224Test.java index fbd8725126..18ac8459fd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_224Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_224Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._224; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _224Test { private _224.Solution1 solution1; private _224.Solution2 solution2; @@ -41,7 +41,7 @@ public void test3() { expected = 23; assertEquals(expected, solution1.calculate(s)); assertEquals(expected, solution2.calculate(s)); - //assertEquals(expected, solution3.calculate(s));//TODO: fix this + // assertEquals(expected, solution3.calculate(s));//TODO: fix this } @Test @@ -51,5 +51,4 @@ public void test4() { assertEquals(expected, solution1.calculate(s)); assertEquals(expected, solution2.calculate(s)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_227Test.java b/src/test/java/com/fishercoder/firstthousand/_227Test.java index 9f8f1a8987..07ca81c72d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_227Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_227Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._227; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _227Test { private _227.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(27, solution1.calculate("100000000/1/2/3/4/5/6/7/8/9/10")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_228Test.java b/src/test/java/com/fishercoder/firstthousand/_228Test.java index c2f3420bbf..9fde401f52 100644 --- a/src/test/java/com/fishercoder/firstthousand/_228Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_228Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._228; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._228; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _228Test { private _228.Solution1 solution1; @@ -21,7 +20,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{0, 1, 2, 4, 5, 7}; + nums = new int[] {0, 1, 2, 4, 5, 7}; expected = Arrays.asList("0->2", "4->5", "7"); assertEquals(expected, solution1.summaryRanges(nums)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_229Test.java b/src/test/java/com/fishercoder/firstthousand/_229Test.java index f3471be0dc..0fd4af04ad 100644 --- a/src/test/java/com/fishercoder/firstthousand/_229Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_229Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._229; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _229Test { private _229.Solution1 solution1; private static int[] nums; @@ -19,50 +18,49 @@ public void setup() { @Test public void test1() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(Arrays.asList(1), solution1.majorityElement(nums)); } @Test public void test2() { - nums = new int[]{1, 2}; + nums = new int[] {1, 2}; assertEquals(Arrays.asList(2, 1), solution1.majorityElement(nums)); } @Test public void test3() { - nums = new int[]{2, 2}; + nums = new int[] {2, 2}; assertEquals(Arrays.asList(2), solution1.majorityElement(nums)); } @Test public void test4() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; assertEquals(Arrays.asList(), solution1.majorityElement(nums)); } @Test public void test5() { - nums = new int[]{3, 2, 3}; + nums = new int[] {3, 2, 3}; assertEquals(Arrays.asList(3), solution1.majorityElement(nums)); } @Test public void test6() { - nums = new int[]{3, 3, 4}; + nums = new int[] {3, 3, 4}; assertEquals(Arrays.asList(3), solution1.majorityElement(nums)); } @Test public void test7() { - nums = new int[]{2, 2, 1, 3}; + nums = new int[] {2, 2, 1, 3}; assertEquals(Arrays.asList(2), solution1.majorityElement(nums)); } @Test public void test8() { - nums = new int[]{2, 2, 3, 3, 2, 4}; + nums = new int[] {2, 2, 3, 3, 2, 4}; assertEquals(Arrays.asList(2), solution1.majorityElement(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_22Test.java b/src/test/java/com/fishercoder/firstthousand/_22Test.java index 886989c7e5..a440353778 100644 --- a/src/test/java/com/fishercoder/firstthousand/_22Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_22Test.java @@ -24,5 +24,4 @@ public void test1() { public void test2() { CommonUtils.printList(solution2.generateParenthesis(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_230Test.java b/src/test/java/com/fishercoder/firstthousand/_230Test.java index 03f4d3e9c0..72b615e25a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_230Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_230Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._230; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/19/17. - */ +/** Created by fishercoder on 5/19/17. */ public class _230Test { private _230.Solution1 solution1; private static TreeNode root; diff --git a/src/test/java/com/fishercoder/firstthousand/_234Test.java b/src/test/java/com/fishercoder/firstthousand/_234Test.java index 16293c096f..902c1c2e56 100644 --- a/src/test/java/com/fishercoder/firstthousand/_234Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_234Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._234; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _234Test { private _234.Solution1 solution1; private _234.Solution2 solution2; @@ -21,20 +21,19 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 2, 1}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 2, 1}); assertEquals(true, solution1.isPalindrome(head)); - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 2, 1}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 2, 1}); assertEquals(true, solution2.isPalindrome(head)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 2, 1}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 2, 1}); assertEquals(true, solution1.isPalindrome(head)); - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 2, 1}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 2, 1}); assertEquals(true, solution2.isPalindrome(head)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_235Test.java b/src/test/java/com/fishercoder/firstthousand/_235Test.java index 3c65dadeed..7e7ddef330 100644 --- a/src/test/java/com/fishercoder/firstthousand/_235Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_235Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._235; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _235Test { private _235.Solution1 solution1; private static TreeNode root; diff --git a/src/test/java/com/fishercoder/firstthousand/_237Test.java b/src/test/java/com/fishercoder/firstthousand/_237Test.java index d049f6203a..d9227f14b6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_237Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_237Test.java @@ -4,11 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._237; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _237Test { private _237.Solution1 solution1; private static ListNode head; @@ -25,5 +24,4 @@ public void test1() { solution1.deleteNode(head.next); CommonUtils.printList(head); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_238Test.java b/src/test/java/com/fishercoder/firstthousand/_238Test.java index 09db8ac6a1..93f8f2daa8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_238Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_238Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._238; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _238Test { private _238.Solution1 solution1; private static int[] expected; @@ -15,30 +15,30 @@ public class _238Test { @BeforeEach public void setup() { solution1 = new _238.Solution1(); - expected = new int[]{}; - actual = new int[]{}; + expected = new int[] {}; + actual = new int[] {}; } @Test public void test1() { - nums = new int[]{0, 0}; - expected = new int[]{0, 0}; + nums = new int[] {0, 0}; + expected = new int[] {0, 0}; actual = solution1.productExceptSelf(nums); assertArrayEquals(expected, actual); } @Test public void test2() { - nums = new int[]{1, 0}; - expected = new int[]{0, 1}; + nums = new int[] {1, 0}; + expected = new int[] {0, 1}; actual = solution1.productExceptSelf(nums); assertArrayEquals(expected, actual); } @Test public void test3() { - nums = new int[]{1, 2, 3, 4}; - expected = new int[]{24, 12, 8, 6}; + nums = new int[] {1, 2, 3, 4}; + expected = new int[] {24, 12, 8, 6}; actual = solution1.productExceptSelf(nums); assertArrayEquals(expected, actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_239Test.java b/src/test/java/com/fishercoder/firstthousand/_239Test.java index 65006107cd..c01f892336 100644 --- a/src/test/java/com/fishercoder/firstthousand/_239Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_239Test.java @@ -3,7 +3,6 @@ import com.fishercoder.solutions.firstthousand._239; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class _239Test { @@ -20,20 +19,19 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new int[]{}; - actual = new int[]{}; - nums = new int[]{}; + expected = new int[] {}; + actual = new int[] {}; + nums = new int[] {}; k = 0; } @Test public void test1() { - nums = new int[]{1, 3, -1, -3, 5, 3, 6, 7}; + nums = new int[] {1, 3, -1, -3, 5, 3, 6, 7}; k = 3; - expected = new int[]{3, 3, 5, 5, 6, 7}; + expected = new int[] {3, 3, 5, 5, 6, 7}; actual = solution1.maxSlidingWindow(nums, k); Assertions.assertArrayEquals(expected, actual); - } } diff --git a/src/test/java/com/fishercoder/firstthousand/_23Test.java b/src/test/java/com/fishercoder/firstthousand/_23Test.java index 60333e71d0..5638e46c81 100644 --- a/src/test/java/com/fishercoder/firstthousand/_23Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_23Test.java @@ -4,12 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._23; - +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _23Test { private _23.Solution1 solution1; private static ListNode[] lists; @@ -24,8 +22,7 @@ public void test1() { ListNode head1 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 3, 5, 7, 11)); ListNode head2 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(2, 8, 12)); ListNode head3 = LinkedListUtils.createSinglyLinkedList(Arrays.asList(4, 6, 9, 10)); - lists = new ListNode[]{head1, head2, head3}; + lists = new ListNode[] {head1, head2, head3}; CommonUtils.printList(solution1.mergeKLists(lists)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_240Test.java b/src/test/java/com/fishercoder/firstthousand/_240Test.java index c01d027812..1479abce4c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_240Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_240Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._240; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _240Test { private _240.Solution1 solution1; private static boolean actual; @@ -20,19 +19,19 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { target = 5; - matrix = new int[][]{ - {1, 4, 7, 11, 15}, - {2, 5, 8, 12, 19}, - {3, 6, 9, 16, 22}, - {10, 13, 14, 17, 24}, - {18, 21, 23, 26, 30} - }; + matrix = + new int[][] { + {1, 4, 7, 11, 15}, + {2, 5, 8, 12, 19}, + {3, 6, 9, 16, 22}, + {10, 13, 14, 17, 24}, + {18, 21, 23, 26, 30} + }; expected = true; actual = solution1.searchMatrix(matrix, target); assertEquals(expected, actual); @@ -41,7 +40,7 @@ public void test1() { @Test public void test2() { target = 0; - matrix = new int[][]{}; + matrix = new int[][] {}; expected = false; actual = solution1.searchMatrix(matrix, target); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_242Test.java b/src/test/java/com/fishercoder/firstthousand/_242Test.java index 345c0dd9b3..082b84ff7e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_242Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_242Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._242; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _242Test { private _242.Solution1 solution1; private _242.Solution2 solution2; @@ -33,8 +33,8 @@ public void test2() { s = "代码写开心"; t = "开心写代码"; assertEquals(true, solution1.isAnagram(s, t)); - //assertEquals(true, solution3.isAnagram(s, t));//solution2 won't work for unicode character input + // assertEquals(true, solution3.isAnagram(s, t));//solution2 won't work for unicode + // character input assertEquals(true, solution3.isAnagram(s, t)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_247Test.java b/src/test/java/com/fishercoder/firstthousand/_247Test.java index c68c03ff23..e76780a148 100644 --- a/src/test/java/com/fishercoder/firstthousand/_247Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_247Test.java @@ -1,27 +1,25 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._247; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._247; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _247Test { - private _247.Solution1 solution1; - private static List expected; + private _247.Solution1 solution1; + private static List expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _247.Solution1(); - } - - @Test - public void test1() { - expected = Arrays.asList("11","69","88","96"); - assertEquals(expected, solution1.findStrobogrammatic(2)); - } + solution1 = new _247.Solution1(); + } + @Test + public void test1() { + expected = Arrays.asList("11", "69", "88", "96"); + assertEquals(expected, solution1.findStrobogrammatic(2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_249Test.java b/src/test/java/com/fishercoder/firstthousand/_249Test.java index 32bd73379c..cb714d73ae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_249Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_249Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._249; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import com.fishercoder.solutions.firstthousand._249; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _249Test { private _249.Solution1 solution1; @@ -19,8 +18,15 @@ public void setup() { @Test public void test1() { - List> expected = Arrays.asList(Arrays.asList("acef"), Arrays.asList("a", "z"), Arrays.asList("abc", "bcd", "xyz"), Arrays.asList("az", "ba")); - List> actual = solution1.groupStrings(new String[]{"abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"}); + List> expected = + Arrays.asList( + Arrays.asList("acef"), + Arrays.asList("a", "z"), + Arrays.asList("abc", "bcd", "xyz"), + Arrays.asList("az", "ba")); + List> actual = + solution1.groupStrings( + new String[] {"abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"}); assertTrue(expected.containsAll(actual)); assertTrue(actual.containsAll(expected)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_24Test.java b/src/test/java/com/fishercoder/firstthousand/_24Test.java index 25ba2513a0..0366344f9f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_24Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_24Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._24; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _24Test { private _24.Solution1 solution1; private _24.Solution2 solution2; @@ -35,5 +34,4 @@ public void test2() { expected = LinkedListUtils.createSinglyLinkedList(Arrays.asList(2, 1, 4, 3)); assertEquals(expected, solution2.swapPairs(head)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_256Test.java b/src/test/java/com/fishercoder/firstthousand/_256Test.java index 56fa79e915..e1b252bcee 100644 --- a/src/test/java/com/fishercoder/firstthousand/_256Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_256Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._256; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _256Test { private _256.Solution1 solution1; @@ -16,9 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(10, solution1.minCost(new int[][]{ - {17, 2, 17}, {16, 16, 5}, {14, 3, 19} - })); + assertEquals(10, solution1.minCost(new int[][] {{17, 2, 17}, {16, 16, 5}, {14, 3, 19}})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_25Test.java b/src/test/java/com/fishercoder/firstthousand/_25Test.java index 6559bf9c89..e624f15d05 100644 --- a/src/test/java/com/fishercoder/firstthousand/_25Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_25Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._25; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _25Test { private _25.Solution1 solution1; private _25.Solution2 solution2; @@ -25,23 +25,23 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); k = 2; - expected = LinkedListUtils.contructLinkedList(new int[]{2, 1, 4, 3, 5}); + expected = LinkedListUtils.contructLinkedList(new int[] {2, 1, 4, 3, 5}); assertEquals(expected, solution1.reverseKGroup(head, k)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7}); - expected = LinkedListUtils.contructLinkedList(new int[]{4, 3, 2, 1, 5, 6, 7}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5, 6, 7}); + expected = LinkedListUtils.contructLinkedList(new int[] {4, 3, 2, 1, 5, 6, 7}); assertEquals(expected, solution2.reverseKGroup(head, 4)); } @Test public void test3() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7}); - expected = LinkedListUtils.contructLinkedList(new int[]{4, 3, 2, 1, 5, 6, 7}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5, 6, 7}); + expected = LinkedListUtils.contructLinkedList(new int[] {4, 3, 2, 1, 5, 6, 7}); assertEquals(expected, solution3.reverseKGroup(head, 4)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_264Test.java b/src/test/java/com/fishercoder/firstthousand/_264Test.java index 84aa03906f..17c64b999f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_264Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_264Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._264; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _264Test { private _264.Solution1 solution1; private _264.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_269Test.java b/src/test/java/com/fishercoder/firstthousand/_269Test.java index cbeeb2f737..948f17a8d6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_269Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_269Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._269; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _269Test { private _269.Solution1 solution1; private static String[] words; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - words = new String[]{"wrt", "wrf", "er", "ett", "rftt"}; + words = new String[] {"wrt", "wrf", "er", "ett", "rftt"}; assertEquals("wertf", solution1.alienOrder(words)); } @Test public void test2() { - words = new String[]{"abc", "ab"}; + words = new String[] {"abc", "ab"}; assertEquals("", solution1.alienOrder(words)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_26Test.java b/src/test/java/com/fishercoder/firstthousand/_26Test.java index 19ecd71ce6..7b778eacbd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_26Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_26Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._26; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _26Test { private _26.Solution1 solution1; private _26.Solution2 solution2; @@ -19,20 +19,20 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 2}; + nums = new int[] {1, 1, 2}; assertEquals(2, solution1.removeDuplicates(nums)); assertEquals(2, solution2.removeDuplicates(nums)); } @Test public void test2() { - nums = new int[]{1, 1, 2, 2, 3}; + nums = new int[] {1, 1, 2, 2, 3}; assertEquals(3, solution1.removeDuplicates(nums)); } @Test public void test3() { - nums = new int[]{1, 1}; + nums = new int[] {1, 1}; assertEquals(1, solution1.removeDuplicates(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_270Test.java b/src/test/java/com/fishercoder/firstthousand/_270Test.java index 8fa827135f..0e27f3dcea 100644 --- a/src/test/java/com/fishercoder/firstthousand/_270Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_270Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._270; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _270Test { private _270.Solution1 solution1; private static int expected; @@ -28,5 +27,4 @@ public void test1() { target = 3.714286; assertEquals(expected, solution1.closestValue(root, target)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_273Test.java b/src/test/java/com/fishercoder/firstthousand/_273Test.java index 6d2917722f..8014734e40 100644 --- a/src/test/java/com/fishercoder/firstthousand/_273Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_273Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._273; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _273Test { private _273.Solution1 solution1; private static int num; @@ -30,6 +30,8 @@ public void test2() { @Test public void test3() { num = 1234567; - assertEquals("One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven", solution1.numberToWords(num)); + assertEquals( + "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven", + solution1.numberToWords(num)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_276Test.java b/src/test/java/com/fishercoder/firstthousand/_276Test.java index beeaf2f8e6..fa410fe71f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_276Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_276Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._276; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _276Test { private _276.Solution1 solution1; private _276.Solution2 solution2; @@ -21,5 +21,4 @@ public void test1() { assertEquals(6, solution1.numWays(3, 2)); assertEquals(6, solution2.numWays(3, 2)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_279Test.java b/src/test/java/com/fishercoder/firstthousand/_279Test.java index 84708d587a..8244e94a4a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_279Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_279Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._279; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _279Test { private _279.Solution1 solution1; private _279.Solution2 solution2; @@ -26,5 +26,4 @@ public void test1() { assertEquals(expected, solution2.numSquares(n)); assertEquals(expected, solution3.numSquares(n)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_27Test.java b/src/test/java/com/fishercoder/firstthousand/_27Test.java index 61e3d9f092..b25c33b739 100644 --- a/src/test/java/com/fishercoder/firstthousand/_27Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_27Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._27; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _27Test { private _27.Solution1 solution1; private static int[] nums; @@ -17,19 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 2, 2, 3}; + nums = new int[] {3, 2, 2, 3}; assertEquals(2, solution1.removeElement(nums, 3)); } @Test public void test2() { - nums = new int[]{2, 2, 3}; + nums = new int[] {2, 2, 3}; assertEquals(1, solution1.removeElement(nums, 2)); } @Test public void test3() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(0, solution1.removeElement(nums, 1)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_283Test.java b/src/test/java/com/fishercoder/firstthousand/_283Test.java index 969ee7652c..e395566102 100644 --- a/src/test/java/com/fishercoder/firstthousand/_283Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_283Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._283; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _283Test { private _283.Solution1 solution1; private _283.Solution2 solution2; @@ -24,113 +24,113 @@ public void setup() { @Test public void test1() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution1.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test2() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution2.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test3() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution3.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test4() { - nums = new int[]{1, 0}; + nums = new int[] {1, 0}; solution1.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test5() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution1.moveZeroes(nums); - assertArrayEquals(new int[]{1, 3, 12, 0, 0}, nums); + assertArrayEquals(new int[] {1, 3, 12, 0, 0}, nums); } @Test public void test6() { - nums = new int[]{1, 0, 0}; + nums = new int[] {1, 0, 0}; solution1.moveZeroes(nums); - assertArrayEquals(new int[]{1, 0, 0}, nums); + assertArrayEquals(new int[] {1, 0, 0}, nums); } @Test public void test7() { - nums = new int[]{1, 0}; + nums = new int[] {1, 0}; solution2.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test8() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution2.moveZeroes(nums); - assertArrayEquals(new int[]{1, 3, 12, 0, 0}, nums); + assertArrayEquals(new int[] {1, 3, 12, 0, 0}, nums); } @Test public void test9() { - nums = new int[]{1, 0, 0}; + nums = new int[] {1, 0, 0}; solution2.moveZeroes(nums); - assertArrayEquals(new int[]{1, 0, 0}, nums); + assertArrayEquals(new int[] {1, 0, 0}, nums); } @Test public void test10() { - nums = new int[]{1, 0}; + nums = new int[] {1, 0}; solution3.moveZeroes(nums); CommonUtils.printArray(nums); } @Test public void test11() { - nums = new int[]{0, 1, 0, 3, 12}; + nums = new int[] {0, 1, 0, 3, 12}; solution3.moveZeroes(nums); - assertArrayEquals(new int[]{1, 3, 12, 0, 0}, nums); + assertArrayEquals(new int[] {1, 3, 12, 0, 0}, nums); } @Test public void test12() { - nums = new int[]{1, 0, 0}; + nums = new int[] {1, 0, 0}; solution3.moveZeroes(nums); - assertArrayEquals(new int[]{1, 0, 0}, nums); + assertArrayEquals(new int[] {1, 0, 0}, nums); } @Test public void test13() { - nums = new int[]{0}; + nums = new int[] {0}; solution3.moveZeroes(nums); - assertArrayEquals(new int[]{0}, nums); + assertArrayEquals(new int[] {0}, nums); } @Test public void test14() { - nums = new int[]{0, 0, 1}; + nums = new int[] {0, 0, 1}; solution3.moveZeroes(nums); - assertArrayEquals(new int[]{1, 0, 0}, nums); + assertArrayEquals(new int[] {1, 0, 0}, nums); } @Test public void test15() { - nums = new int[]{1, 0, 1}; + nums = new int[] {1, 0, 1}; solution3.moveZeroes(nums); - assertArrayEquals(new int[]{1, 1, 0}, nums); + assertArrayEquals(new int[] {1, 1, 0}, nums); } @Test public void test16() { - nums = new int[]{2, 1}; + nums = new int[] {2, 1}; solution4.moveZeroes(nums); - assertArrayEquals(new int[]{2, 1}, nums); + assertArrayEquals(new int[] {2, 1}, nums); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_289Test.java b/src/test/java/com/fishercoder/firstthousand/_289Test.java index 2c0d75923b..1d0471a640 100644 --- a/src/test/java/com/fishercoder/firstthousand/_289Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_289Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._289; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _289Test { private _289.Solution1 solution1; private int[][] board; @@ -17,20 +17,21 @@ public void setup() { @Test public void test1() { - board = new int[][]{ - {0, 1, 0}, - {0, 0, 1}, - {1, 1, 1}, - {0, 0, 0} - }; + board = + new int[][] { + {0, 1, 0}, + {0, 0, 1}, + {1, 1, 1}, + {0, 0, 0} + }; solution1.gameOfLife(board); - int[][] expected = new int[][]{ - {0, 0, 0}, - {1, 0, 1}, - {0, 1, 1}, - {0, 1, 0} - }; + int[][] expected = + new int[][] { + {0, 0, 0}, + {1, 0, 1}, + {0, 1, 1}, + {0, 1, 0} + }; assertArrayEquals(expected, board); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_28Test.java b/src/test/java/com/fishercoder/firstthousand/_28Test.java index 0203cf2b99..2a11a0222a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_28Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_28Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._28; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _28Test { private _28.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_291Test.java b/src/test/java/com/fishercoder/firstthousand/_291Test.java index df7ca436eb..dc7ecf8c26 100644 --- a/src/test/java/com/fishercoder/firstthousand/_291Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_291Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._291; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _291Test { private _291.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_294Test.java b/src/test/java/com/fishercoder/firstthousand/_294Test.java index 85904c1c98..97c63aa744 100644 --- a/src/test/java/com/fishercoder/firstthousand/_294Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_294Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._294; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _294Test { - private _294.Solution1 solution1; + private _294.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _294.Solution1(); - } + solution1 = new _294.Solution1(); + } - @Test - public void test1() { - assertEquals(true, solution1.canWin("++++")); - } + @Test + public void test1() { + assertEquals(true, solution1.canWin("++++")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_295Test.java b/src/test/java/com/fishercoder/firstthousand/_295Test.java index 9c36b590de..a64334002f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_295Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_295Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._295; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/27/17. - */ +/** Created by fishercoder on 5/27/17. */ public class _295Test { private _295.Solution1.MedianFinder solution1; private _295.Solution2.MedianFinder solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_297Test.java b/src/test/java/com/fishercoder/firstthousand/_297Test.java index 66aabb0335..bce7dab061 100644 --- a/src/test/java/com/fishercoder/firstthousand/_297Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_297Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._297; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _297Test { private _297.Solution1 solution1; @@ -20,12 +19,12 @@ public void setup() { @Test public void test1() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, null, 4, 5, 6, 7)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, null, 4, 5, 6, 7)); TreeUtils.printBinaryTree(root); String str = solution1.serialize(root); System.out.println(str); TreeUtils.printBinaryTree(solution1.deserialize(str)); assertEquals(root, solution1.deserialize(str)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_298Test.java b/src/test/java/com/fishercoder/firstthousand/_298Test.java index e483848da0..fea815149d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_298Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_298Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._298; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _298Test { private _298.Solution1 solution1; @@ -17,7 +16,8 @@ public class _298Test { public void test1() { solution1 = new _298.Solution1(); solution2 = new _298.Solution2(); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 3, 2, 4, null, null, null, 5)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(1, null, 3, 2, 4, null, null, null, 5)); assertEquals(3, solution1.longestConsecutive(root)); assertEquals(3, solution2.longestConsecutive(root)); } @@ -36,10 +36,11 @@ public void test2() { public void test3() { solution1 = new _298.Solution1(); solution2 = new _298.Solution2(); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, null, 4, 4, null, 5, null, null, 6)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(1, 2, 3, null, null, 4, 4, null, 5, null, null, 6)); TreeUtils.printBinaryTree(root); assertEquals(4, solution1.longestConsecutive(root)); assertEquals(4, solution2.longestConsecutive(root)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_29Test.java b/src/test/java/com/fishercoder/firstthousand/_29Test.java index 2960f4fb7a..5b7a73c4dc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_29Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_29Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._29; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _29Test { private _29.Solution1 solution1; private _29.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_2Test.java b/src/test/java/com/fishercoder/firstthousand/_2Test.java index 9278e1320d..03d4225345 100644 --- a/src/test/java/com/fishercoder/firstthousand/_2Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_2Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._2; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2Test { private _2.Solution1 solution1; private static ListNode l1; @@ -21,25 +21,25 @@ public void setup() { @Test public void test1() { - l1 = LinkedListUtils.contructLinkedList(new int[]{2, 4, 3}); - l2 = LinkedListUtils.contructLinkedList(new int[]{5, 6, 4}); - expected = LinkedListUtils.contructLinkedList(new int[]{7, 0, 8}); + l1 = LinkedListUtils.contructLinkedList(new int[] {2, 4, 3}); + l2 = LinkedListUtils.contructLinkedList(new int[] {5, 6, 4}); + expected = LinkedListUtils.contructLinkedList(new int[] {7, 0, 8}); assertEquals(expected, solution1.addTwoNumbers(l1, l2)); } @Test public void test2() { - l1 = LinkedListUtils.contructLinkedList(new int[]{1, 8}); - l2 = LinkedListUtils.contructLinkedList(new int[]{0}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 8}); + l1 = LinkedListUtils.contructLinkedList(new int[] {1, 8}); + l2 = LinkedListUtils.contructLinkedList(new int[] {0}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 8}); assertEquals(expected, solution1.addTwoNumbers(l1, l2)); } @Test public void test3() { - l1 = LinkedListUtils.contructLinkedList(new int[]{5}); - l2 = LinkedListUtils.contructLinkedList(new int[]{5}); - expected = LinkedListUtils.contructLinkedList(new int[]{0, 1}); + l1 = LinkedListUtils.contructLinkedList(new int[] {5}); + l2 = LinkedListUtils.contructLinkedList(new int[] {5}); + expected = LinkedListUtils.contructLinkedList(new int[] {0, 1}); assertEquals(expected, solution1.addTwoNumbers(l1, l2)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_300Test.java b/src/test/java/com/fishercoder/firstthousand/_300Test.java index f3d6a7f2e3..623619a989 100644 --- a/src/test/java/com/fishercoder/firstthousand/_300Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_300Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._300; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _300Test { private _300.Solution1 solution1; @@ -24,7 +24,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{10, 9, 2, 5, 3, 7, 101, 18}; + nums = new int[] {10, 9, 2, 5, 3, 7, 101, 18}; assertEquals(4, solution1.lengthOfLIS(nums)); assertEquals(4, solution2.lengthOfLIS(nums)); assertEquals(4, solution3.lengthOfLIS(nums)); @@ -33,7 +33,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{0, 1, 0, 3, 2, 3}; + nums = new int[] {0, 1, 0, 3, 2, 3}; assertEquals(4, solution1.lengthOfLIS(nums)); assertEquals(4, solution2.lengthOfLIS(nums)); assertEquals(4, solution3.lengthOfLIS(nums)); @@ -42,11 +42,10 @@ public void test2() { @Test public void test3() { - nums = new int[]{7, 7, 7, 7, 7, 7, 7}; + nums = new int[] {7, 7, 7, 7, 7, 7, 7}; assertEquals(1, solution1.lengthOfLIS(nums)); assertEquals(1, solution2.lengthOfLIS(nums)); assertEquals(1, solution3.lengthOfLIS(nums)); assertEquals(1, solution3.lengthOfLIS(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_304Test.java b/src/test/java/com/fishercoder/firstthousand/_304Test.java index b6176e8476..fe023fe906 100644 --- a/src/test/java/com/fishercoder/firstthousand/_304Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_304Test.java @@ -1,27 +1,29 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._304; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _304Test { private _304.Solution1.NumMatrix numMatrix; private static int[][] matrix; @BeforeEach - public void setup() { - - } + public void setup() {} @Test public void test1() { - matrix = new int[][]{ - {3, 0, 1, 4, 2}, {5, 6, 3, 2, 1}, {1, 2, 0, 1, 5}, {4, 1, 0, 1, 7}, {1, 0, 3, 0, 5} - }; + matrix = + new int[][] { + {3, 0, 1, 4, 2}, + {5, 6, 3, 2, 1}, + {1, 2, 0, 1, 5}, + {4, 1, 0, 1, 7}, + {1, 0, 3, 0, 5} + }; numMatrix = new _304.Solution1.NumMatrix(matrix); assertEquals(8, numMatrix.sumRegion(2, 1, 4, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_306Test.java b/src/test/java/com/fishercoder/firstthousand/_306Test.java index 6439712e50..bde8f71d29 100644 --- a/src/test/java/com/fishercoder/firstthousand/_306Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_306Test.java @@ -1,35 +1,35 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._306; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _306Test { - private _306.Solution1 solution1; - private static String num; + private _306.Solution1 solution1; + private static String num; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _306.Solution1(); - } + solution1 = new _306.Solution1(); + } - @Test - public void test1() { - num = "0235813"; - assertEquals(false, solution1.isAdditiveNumber(num)); - } + @Test + public void test1() { + num = "0235813"; + assertEquals(false, solution1.isAdditiveNumber(num)); + } - @Test - public void test2() { - num = "000"; - assertEquals(true, solution1.isAdditiveNumber(num)); - } + @Test + public void test2() { + num = "000"; + assertEquals(true, solution1.isAdditiveNumber(num)); + } - @Test - public void test3() { - num = "011235"; - assertEquals(true, solution1.isAdditiveNumber(num)); - } + @Test + public void test3() { + num = "011235"; + assertEquals(true, solution1.isAdditiveNumber(num)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_30Test.java b/src/test/java/com/fishercoder/firstthousand/_30Test.java index 4c009467fc..2f4598d187 100644 --- a/src/test/java/com/fishercoder/firstthousand/_30Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_30Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._30; +import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _30Test { private _30.Solution1 solution1; private static String[] words; @@ -23,7 +22,7 @@ public void setup() { @Test @Disabled public void test1() { - words = new String[]{"foo", "bar"}; + words = new String[] {"foo", "bar"}; expected = Arrays.asList(0, 9); assertEquals(expected, solution1.findSubstring("barfoothefoobarman", words)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_312Test.java b/src/test/java/com/fishercoder/firstthousand/_312Test.java index 599ad92377..b86dd8dc28 100644 --- a/src/test/java/com/fishercoder/firstthousand/_312Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_312Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._312; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _312Test { private _312.Solution1 solution1; private static int[] nums; @@ -18,16 +18,15 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 1, 5, 8}; + nums = new int[] {3, 1, 5, 8}; expected = 167; assertEquals(expected, solution1.maxCoins(nums)); } @Test public void test2() { - nums = new int[]{1, 5}; + nums = new int[] {1, 5}; expected = 10; assertEquals(expected, solution1.maxCoins(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_316Test.java b/src/test/java/com/fishercoder/firstthousand/_316Test.java index 420f2ce8b4..4786da7c1f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_316Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_316Test.java @@ -1,30 +1,30 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._316; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _316Test { - private _316.Solution1 solution1; - private _316.Solution2 solution2; + private _316.Solution1 solution1; + private _316.Solution2 solution2; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _316.Solution1(); - solution2 = new _316.Solution2(); - } + solution1 = new _316.Solution1(); + solution2 = new _316.Solution2(); + } - @Test - public void test1() { - assertEquals("abc", solution1.removeDuplicateLetters("bcabc")); - assertEquals("abc", solution2.removeDuplicateLetters("bcabc")); - } + @Test + public void test1() { + assertEquals("abc", solution1.removeDuplicateLetters("bcabc")); + assertEquals("abc", solution2.removeDuplicateLetters("bcabc")); + } - @Test - public void test2() { - assertEquals("acdb", solution1.removeDuplicateLetters("cbacdcbc")); - assertEquals("acdb", solution2.removeDuplicateLetters("cbacdcbc")); - } + @Test + public void test2() { + assertEquals("acdb", solution1.removeDuplicateLetters("cbacdcbc")); + assertEquals("acdb", solution2.removeDuplicateLetters("cbacdcbc")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_319Test.java b/src/test/java/com/fishercoder/firstthousand/_319Test.java index 41bca52064..06e1110ba9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_319Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_319Test.java @@ -1,71 +1,71 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._319; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _319Test { - private _319.Solution1 solution1; + private _319.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _319.Solution1(); - } + solution1 = new _319.Solution1(); + } - @Test - public void test1() { - assertEquals(1, solution1.bulbSwitch(2)); - } + @Test + public void test1() { + assertEquals(1, solution1.bulbSwitch(2)); + } - @Test - public void test2() { - assertEquals(1, solution1.bulbSwitch(3)); - } + @Test + public void test2() { + assertEquals(1, solution1.bulbSwitch(3)); + } - @Test - public void test3() { - assertEquals(2, solution1.bulbSwitch(4)); - } + @Test + public void test3() { + assertEquals(2, solution1.bulbSwitch(4)); + } - @Test - public void test4() { - assertEquals(2, solution1.bulbSwitch(5)); - } + @Test + public void test4() { + assertEquals(2, solution1.bulbSwitch(5)); + } - @Test - public void test5() { - assertEquals(2, solution1.bulbSwitch(6)); - } + @Test + public void test5() { + assertEquals(2, solution1.bulbSwitch(6)); + } - @Test - public void test6() { - assertEquals(2, solution1.bulbSwitch(7)); - } + @Test + public void test6() { + assertEquals(2, solution1.bulbSwitch(7)); + } - @Test - public void test7() { - assertEquals(2, solution1.bulbSwitch(8)); - } + @Test + public void test7() { + assertEquals(2, solution1.bulbSwitch(8)); + } - @Test - public void test8() { - assertEquals(3, solution1.bulbSwitch(9)); - } + @Test + public void test8() { + assertEquals(3, solution1.bulbSwitch(9)); + } - @Test - public void test11() { - assertEquals(3, solution1.bulbSwitch(15)); - } + @Test + public void test11() { + assertEquals(3, solution1.bulbSwitch(15)); + } - @Test - public void test9() { - assertEquals(4, solution1.bulbSwitch(17)); - } + @Test + public void test9() { + assertEquals(4, solution1.bulbSwitch(17)); + } - @Test - public void test10() { - assertEquals(4, solution1.bulbSwitch(16)); - } + @Test + public void test10() { + assertEquals(4, solution1.bulbSwitch(16)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_31Test.java b/src/test/java/com/fishercoder/firstthousand/_31Test.java index 7b355cada2..cb033e3898 100644 --- a/src/test/java/com/fishercoder/firstthousand/_31Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_31Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._31; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _31Test { private _31.Solution1 solution1; private static int[] nums; @@ -17,36 +17,36 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; solution1.nextPermutation(nums); - assertArrayEquals(new int[]{1, 3, 2}, nums); + assertArrayEquals(new int[] {1, 3, 2}, nums); } @Test public void test2() { - nums = new int[]{1, 2, 4, 6, 3}; + nums = new int[] {1, 2, 4, 6, 3}; solution1.nextPermutation(nums); - assertArrayEquals(new int[]{1, 2, 6, 3, 4}, nums); + assertArrayEquals(new int[] {1, 2, 6, 3, 4}, nums); } @Test public void test3() { - nums = new int[]{1, 2, 4, 6, 3, 2, 1}; + nums = new int[] {1, 2, 4, 6, 3, 2, 1}; solution1.nextPermutation(nums); - assertArrayEquals(new int[]{1, 2, 6, 1, 2, 3, 4}, nums); + assertArrayEquals(new int[] {1, 2, 6, 1, 2, 3, 4}, nums); } @Test public void test4() { - nums = new int[]{1, 2, 5, 4, 3}; + nums = new int[] {1, 2, 5, 4, 3}; solution1.nextPermutation(nums); - assertArrayEquals(new int[]{1, 3, 2, 4, 5}, nums); + assertArrayEquals(new int[] {1, 3, 2, 4, 5}, nums); } @Test public void test5() { - nums = new int[]{3, 2, 1}; + nums = new int[] {3, 2, 1}; solution1.nextPermutation(nums); - assertArrayEquals(new int[]{1, 2, 3}, nums); + assertArrayEquals(new int[] {1, 2, 3}, nums); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_320Test.java b/src/test/java/com/fishercoder/firstthousand/_320Test.java index b6411a97ae..35427ba927 100644 --- a/src/test/java/com/fishercoder/firstthousand/_320Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_320Test.java @@ -1,39 +1,39 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._320; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import com.fishercoder.solutions.firstthousand._320; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _320Test { - private _320.Solution1 solution1; - private static List expected; - private static List actual; - private static String word; + private _320.Solution1 solution1; + private static List expected; + private static List actual; + private static String word; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _320.Solution1(); - } + solution1 = new _320.Solution1(); + } - @BeforeEach + @BeforeEach public void setupForEachTest() { - expected = new ArrayList<>(); - actual = new ArrayList<>(); - } + expected = new ArrayList<>(); + actual = new ArrayList<>(); + } - @Test - public void test1() { - word = "word"; - expected = - Arrays.asList("word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", - "w1r1", "1o2", "2r1", "3d", "w3", "4"); - actual = solution1.generateAbbreviations(word); - assertTrue(expected.containsAll(actual) && actual.containsAll(expected)); - } + @Test + public void test1() { + word = "word"; + expected = + Arrays.asList( + "word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", + "w1r1", "1o2", "2r1", "3d", "w3", "4"); + actual = solution1.generateAbbreviations(word); + assertTrue(expected.containsAll(actual) && actual.containsAll(expected)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_325Test.java b/src/test/java/com/fishercoder/firstthousand/_325Test.java index ca89615c28..d0686e6836 100644 --- a/src/test/java/com/fishercoder/firstthousand/_325Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_325Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._325; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _325Test { private _325.Solution1 solution1; private static int[] nums; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{-2, -1, 2, 1}; + nums = new int[] {-2, -1, 2, 1}; assertEquals(2, solution1.maxSubArrayLen(nums, 1)); } @Test public void test2() { - nums = new int[]{1, -1, 5, -2, 3}; + nums = new int[] {1, -1, 5, -2, 3}; assertEquals(4, solution1.maxSubArrayLen(nums, 3)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_326Test.java b/src/test/java/com/fishercoder/firstthousand/_326Test.java index a7eef368a1..5895ba97d4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_326Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_326Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._326; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _326Test { private _326.Solution1 solution1; private _326.Solution2 solution2; @@ -24,5 +24,4 @@ public void test1() { assertEquals(false, solution2.isPowerOfThree(12)); assertEquals(false, solution3.isPowerOfThree(12)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_327Test.java b/src/test/java/com/fishercoder/firstthousand/_327Test.java index 9efc55b4d4..fbde2e23c7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_327Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_327Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._327; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _327Test { private _327.Solution1 solution1; private _327.Solution2 solution2; @@ -19,43 +19,521 @@ public void setup() { @Test public void test1() { - nums = new int[]{-2, 5, -1}; + nums = new int[] {-2, 5, -1}; assertEquals(3, solution1.countRangeSum(nums, -2, 2)); assertEquals(3, solution2.countRangeSum(nums, -2, 2)); } @Test public void test2() { - nums = new int[]{-1, 1}; + nums = new int[] {-1, 1}; assertEquals(1, solution1.countRangeSum(nums, 0, 0)); assertEquals(1, solution2.countRangeSum(nums, 0, 0)); } @Test public void test3() { - nums = new int[]{0}; + nums = new int[] {0}; assertEquals(1, solution1.countRangeSum(nums, 0, 0)); assertEquals(1, solution2.countRangeSum(nums, 0, 0)); } @Test public void test4() { - nums = new int[]{0, 0}; + nums = new int[] {0, 0}; assertEquals(3, solution1.countRangeSum(nums, 0, 0)); assertEquals(3, solution2.countRangeSum(nums, 0, 0)); } @Test public void test5() { - nums = new int[]{-2147483647, 0, -2147483647, 2147483647}; + nums = new int[] {-2147483647, 0, -2147483647, 2147483647}; assertEquals(3, solution1.countRangeSum(nums, -564, 3864)); assertEquals(3, solution2.countRangeSum(nums, -564, 3864)); } @Test public void test6() { - nums = new int[]{28, 26, 22, 7, 12, -26, 25, 11, -14, 0, 0, 6, 20, 4, 17, -7, 4, -14, -19, -16, 8, -21, -26, 24, -29, -18, -13, 2, -16, -14, -26, -14, -7, -14, -30, -3, 9, -16, 28, 3, -26, -5, 4, -28, -3, 11, 26, 14, 20, 15, -4, -12, -18, -21, -28, 22, -4, 0, 2, 22, 16, -10, -14, -5, 2, -3, -16, -23, -26, -5, 21, 17, 4, 29, 19, -2, -8, 5, -14, 13, 10, -15, 2, 25, -5, -21, 13, -28, 7, -12, 9, -1, 15, -26, -9, -3, 3, 14, -25, -8, 12, -4, 0, -28, -30, -13, -11, 16, -3, 5, 5, 22, 7, -5, 20, -9, -29, 29, -25, -27, -6, -22, 22, 11, -18, 3, -18, -21, -8, 6, -20, -22, -2, 25, 25, -4, 19, 13, 9, 18, -25, -9, 16, -30, -30, 18, 29, 27, -26, 11, 28, -6, 4, 29, -18, 28, 9, 23, 13, -22, -10, 21, 23, -13, -22, 8, -7, -6, 24, 11, 27, 8, 15, 23, -11, -28, 7, -11, -2, -26, -21, -13, 22, 2, 6, 18, -17, 12, 11, -28, -3, -15, -5, -14, -21, -9, -30, 12, 22, 1, 2, -8, 24, 22, 5, 29, -11, 25, -13, 1, -22, -1, 11, 11, 12, 5, 14, 20, 13, 9, 2, 16, 10, 8, -30, -18, 8, 18, 23, -3, -11, 5, -30, -7, -12, 23, -19, 9, 13, -4, 29, 14, 2, 29, -30, 6, -14, 16, 26, 28, -9, -8, -4, 9, -7, 28, 20, -27, -13, 12, 13, -17, -14, 19, 7, 17, 14, -3, 15, 24, -25, 6, 29, 24, 21, -20, 12, -24, -21, -30, -18, -2, 22, 5, 2, 27, 4, 24, -21, 18, -4, 8, 11, -18, -2, -9, -22, 21, -6, 7, 10, 20, 9, -7, 15, -26, -4, 3, -24, -26, 29, -28, -8, -3, -6, 4, -28, 12, -19, 17, 2, -30, 14, 8, -1, 6, 19, -20, -30, 5, 5, 16, -9, 11, 25, 0, -24, 1, 18, 28, -5, -14, 7, -3, 18, -26, 26, 1, -19, -19, 14, 29, 25, 13, 6, 2, 19, 28, -10, 26, -29, -12, 7, -11, -18, 28, 1, 0, 19, 12, 20, -19, -7, -10, 5, 25, 19, 25, 2, 8, -5, -21, -7, -29, -19, -22, 7, -20, -8, 7, -28, -10, 25, -29, -13, 2, -1, -21, -1, 11, -20, 28, 18, -28, -22, 25, -29, -11, -20, 1, 3, -16, 20, -11, 20, -3, 9, -2, 25, 0, -27, 27, 11, -5, 24, -18, 18, 28, -2, 29, -7, 21, -5, 9, -13, -25, -14, 23, -15, 8, 15, 3, -28, 15, -23, 3, 13, -9, -7, 8, -6, -25, -16, 24, -23, 29, -7, -28, 15, 9, -18, -8, 17, 29, 25, -2, -17, -9, -12, 20, 15, -17, -18, 23, 2, -9, -7, 1, 18, 13, -11, -26, -13, 29, 7, -22, -16, -19, 7, 18, 19, 29, 0, 10, 21, -1, 25, 0, -13, 0, -3, 16, 13, -19, 1, -23, 13, -10, -18, -1, 13, -27, -30, 21, 7, -18, 27, 21, -30, -22, -29, 4, 21, 26, 12, -22, -12, -20, -20, 7, 7, -22, 17, -20, 19, -22, -22, -24, -16, 2, 6, -11, -19, 24, -25, 28, -12, -30, 20, -18, 29, 17, -20, -27, 18, -5, -11, -20, -15, 3, -4, 15, 2, -23, 16, -18, 21, 27, 7, 16, -24, -16, -14, 28, 29, -24, 20, -19, -18, 5, 17, 0, -29, 1, 26, 6, 17, -8, -7, -24, -30, -7, -29, -13, -20, 4, -7, 20, -13, -8, 19, 23, 20, 0, 2, -2, 27, 16, 2, -15, -10, -18, -24, 2, 10, -2, -23, -29, -9, 4, -10, -10, -10, -11, -28, -5, -21, 5, 6, -7, 17, 3, -25, 27, 28, -14, -2, -7, 18, 5, 16, -16, -29, 15, -25, -6, -16, -15, 5, -21, -12, 17, 17, 10, 16, 11, -28, 1, -16, -13, 9, -3, 3, 2, -15, 16, 10, -10, -27, 16, -18, 14, 6, 9, -6, -26, 23, 24, 28, 1, 27, -29, -13, -27, -22, -19, -10, -4, -26, 3, -26, 9, -6, -16, -15, -7, -21, 11, -5, 24, 28, 27, -13, 11, -12, 1, 15, -19, 20, 6, -11, 15, -10, 27, -8, 1, -12, -30, -9, -25, 26, 13, 6, -4, -13, -5, 0, 23, -4, -24, 14, 24, -13, -29, 24, 29, 19, 3, -15, 26, -23, -27, -23, 14, -17, 14, 0, 5, -19, -3, 27, 4, 20, 25, 15, 1, 26, -8, 22, 16, 9, 11, -16, 17, -6, 26, -21, -21, 14, 28, 28, 18, -9, -14, -9, -17, -4, -27, -5, -10, 23, -10, -22, -28, 25, 1, -2, 22, -3, 21, -4, 5, 17, 11, 20, -27, -24, 2, -21, -10, 1, -16, 13, -10, 2, -20, -21, 13, -5, 16, 4, -3, 27, 25, -12, -13, -5, -3, -22, 0, -18, 13, 23, -19, 4, 29, -20, -10, -26, 26, 20, -7, -16, -17, 0, -28, 10, -17, 24, 0, -17, 26, 15, -19, 28, 14, -19, 27, -7, -6, -19, -17, 29, 20, 9, 4, 22, -23, 0, 18, 12, -2, 6, -27, -28, -20, 8, -23, -1, 23, -16, 25, 25, 4, -30, 21, 12, -22, 17, -1, -28, -16, 3, 11, 8, -14, 11, -17, -4, -30, -23, 11, -10, 10, -27, 0, -4, -21, -26, -4, -20, 24, 2, 7, 28, 29, -6, -19, 29, 27, -28, 0, 2, -29, -3, -4, -15, 19, 18, 13, 21, -15, 18, 6, 8, 26, -23, -23, 13, -22, -11, -25, 3, -9, -22, -26, 12, 3, -27, -24, 0, 7, -10, -8, 6, -6, 10, -15, -11, 20, -28, 19, 1, 29, 24, -25, -3, -10, 26, 29, -19, 27, -14, -27, -27, -18, -8, -25, -7, 20, 11, -12, 9, -15, -1, -1, 8, -2, -1, -4, -20, 0, 3, 4, -24, 0, 15, 22, 15, 19, 8, -25, -30, -5, -24, 29, -19, 19, -28, 17, -8, 12, 28, 3, -25, -7, 7, 15, 13, -25, -12, -5, -18, -18, -3, 25, -25, -9, 22, -17, -29, 16, 28, 16, -24, 5, -8, -19, -10, 9, 14, -7, 12, 12, 6, -1, 0, 20, 18, -29, 11, -16, 0, 8, 6, -8, 8, 29, 29, 21, 29, 2, -8, 12, -16, 26, 21, 14, 13, 23, 7, -20, -26, -18, -23, 4, -12, 10, -30, -8, -20, -8, -19, -30, -16, -23, 25, -27, -10, -4, 27, 12, -30, 26, -15, -19, -27, -16, 23, -30, -28, 12, 9, 28, -28, 25, -1, 28, -4, -11, 6, 15, -22, -24, -12, 28, -17, -13, -29, 18, 9, -25, -21, -19, 6, 17, 29, -17, -1, -5, 29, -20, 16, 13, -12, 21, -4, 13, -17, -1, -26, 20, -29, -24, -14, 19, -30, 16, 5, 11, -20, 29, 23, -3, 7, -1, -21, -7, -19, -4, 22, -2, -5, 5, -2, 4, 4, -20, -13, -10, -28, 22, 27, -25, 11, -6, -11, 8, -10, -9, -16, -25, -28, 24, 2, -25, -10, -28, 25, -12, -11, 17, -9, -2, 2, 21, -30, -14, 8, 19, -9, 5, 2, 20, 26, -18, -4, 28, -4, 19, 20, 28, 17, 24, -18, 26, 1, -12, -23, -7, 3, 16, -7, -29, -16, 10, 21, 11, -9, 3, -7, -8, -3, 13, 22, -6, 24, -23, -25, -5, 13, -19, 9, 5, 23, 1, 11, 22, -4, -12, -26, 17, 22, 22, -20, -11, -10, 10, 4, -28, -11, -5, -25, -18, 17, -13, 23, 0, -19, 23, -24, 12, -19, -15, -1, 7, 3, -8, -25, -30, -22, 4, -9, -26, -23, 22, -17, -1, -10, 11, -25, -16, 25, -23, -30, 13, 3, 14, 9, 21, -4, -2, 27, 8, 17, 15, -12, -23, -8, 24, 2, 26, 13, 3, 20, 25, 17, 16, -22, 29, -22, -24, -5, -14, -1, -21, -30, -14, 4, -2, 24, -6, -7, 8, -29, -23, -13, 4, 8, 4, -12, 1, 19, 4, -16, -2, 11, 13, -15, -28, 9, -17, -4, -6, -17, 15, 22, -21, -6, -5, -18, 20, -15, -29, 10, -17, 25, -19, 17, 27, -7, 16, -13, -26, 11, -10, -25, -4, -18, -13, 26, -6, 28, 14, 22, -12, -17, 7, 19, 15, -21, 22, -30, 11, 11, -4, 4, -7, -15, 11, -11, 21, 21, -23, 18, -4, -30, 10, 10, -7, -16, 19, -24, -2, -26, -4, -10, 2, 24, 13, 5, -27, 29, -14, 13, 24, 26, -20, 21, -17, -25, 15, 1, 5, 0, -22, -8, 12, 28, 22, 1, 26, 22, -8, 22, -12, -28, -21, -26, -23, 21, -22, -15, 14, 28, -26, -27, -14, 3, -1, 13, -23, -14, 2, 23, 16, -24, 12, -10, -20, 17, -27, 15, 18, -26, 27, 24, 3, 26, 6, -16, -28, 26, -7, -22, -5, -1, 24, 16, -3, 5, -21, -25, 7, 8, 22, 25, -8, -25, -2, 4, -19, 16, -25, 14, 26, -26, 8, 27, 21, 16, 29, 22, 12, -9, 28, 1, 18, -5, 16, -28, 18, 20, 10, -24, 13, 7, -11, -3, -4, 8, 21, 17, -17, -14, 5, 1, 29, 10, 2, 15, 0, 25, -12, 14, 16, -15, -19, -19, -24, 28, 24, 23, 24, 28, 24, -5, -17, -29, -30, 29, -11, -25, 21, 25, 10, -17, -23, 12, -9, -20, -2, -13, 29, -2, 8, -17, 16, 7, -4, 27, -3, -10, -30, 3, -4, -6, 27, -11, 25, -18, 9, -12, 10, 25, 25, -7, 6, -13, 9, 0, 25, -26, 24, 15, 1, -17, 3, -4, -19, 17, 2, 22, 28, -23, 24, -30, -11, 25, -15, 2, 27, 10, -18, -3, 12, 13, -2, 9, -29, -11, -13, -1, -26, 23, 23, 21, -14, -4, -21, -17, -6, -8, 7, -29, 11, -28, 28, -2, -8, -3, 10, -23, 12, 9, -19, 2, -15, -13, 24, -24, 28, 14, -11, 14, 19, 8, 12, 6, -19, -27, -13, -17, -12, 19, 23, -7, -27, -12, -11, 13, 3, -5, 24, -26, -30, -15, -10, -22, -24, 12, -10, -17, 7, 22, -22, -3, -29, 11, -1, -12, -7, 21, -21, 8, 22, -10, 1, -27, -11, 13, -1, -2, 9, 10, 1, -10, -5, 22, -2, -27, 6, 14, 13, 17, -2, 29, -13, 8, 15, -26, -21, -5, 20, -19, -17, 22, 28, 9, 26, 7, 21, 27, 15, 21, -13, 2, -23, 28, -16, -6, 16, -21, -22, -1, -19, -13, -5, 11, -14, -9, 25, 16, 21, -18, -3, 13, -5, -24, 19, -15, 13, 14, -21, -30, -17, 5, 19, 27, -14, -6, 29, -5, 12, 3, -15, 3, 1, 4, -20, 3, 25, 3, -8, 22, -19, 6, -8, 13, 0, 20, -2, -11, 15, 10, -20, 5, -23, -8, -27, -30, 14, -27, -22, -10, 14, -17, -22, 12, -14, -23, -30, 2, -6, 14, 29, 27, 14, -13, -16, -24, 16, -11, -14, -19, 8, 12, -12, -3, -28, 9, -12, -6, -19, 15, 19, 27, -22, -2, -27, -8, 16, 25, 25, -12, 11, -11, 7, 3, -3, -13, -5, 4, 25, -21, 26, -30, -20, -12, 23, -2, -8, 20, 4, -25, -4, -4, 28, 26, 4, 0, -13, 26, -26, 25, 17, -7, 15, 29, -29, 18, 6, 17, -1, 3, -6, 6, -5, 15, -26, -11, -15, -1, -23, -27, -10, 9, -29, 23, -11, -18, -3, -7, 23, 19, 21, -27, -2, -7, -26, -8, -29, 29, 0, 23, -19, 1, -29, 26, -9, 12, -10, 0, 6, 14, 7, 19, -23, -19, -22, 21, -18, 13, -25, 9, -10, 6, -23, -16, -20, 27, -11, -9, 26, -25, -8, 5, -3, 12, 12, -17, 1, 25, -6, -20, 26, -19, 2, 20, -7, -26, 12, -19, -2, -3, -4, -20, 15, -9, -19, -22, 2, 28, -2, 11, -3, -20, -11, 24, -29, -10, 22, -19, 10, 7, 28, -22, -12, 5, 19, -9, -21, 5, 2, -28, 23, 18, -17, 18, -2, 26, -26, -20, -18, 16, 3, 6, 7, -16, 24, -20, 27, 1, -13, -4, -7, -27, 1, -11, -26, -10, 9, -24, 23, 24, 19, 17, -9, 22, -28, 0, -4, -29, 11, -18, -13, 11, 11, -26, 21, -28, -19, 16, 17, -1, 21, -3, -1, 11, -12, -18, -18, -1, 27, -9, -13, -7, 29, -11, 28, -29, -20, 16, -24, -1, 26, 7, 16, 28, -18, -3, -18, -13, 24, -12, 21, -12, 27, -14, 22, 1, 26, 24, 22, 13, -28, 12, 6, 15, 29, -29, -16, -10, 1, -9, 27, -23, 8, 23, 10, -20, -20, 29, -6, 26, 8, 17, -5, 14, 17, -20, 21, -28, 11, -8, 20, 17, 1, 7, 25, 3, -18, 28, 0, 27, -11, 17, 12, -26, -28, 3, 2, 7, -11, 29, -2, -21, 26, 23, -22, 23, 19, -5, -27, 15, -2, 13, 25, -20, -29, -15, 18, 8, 14, -21, -24, -30, -29, -6, -9, -20, -28, 3, -14, -3, 25, 12, 1, -16, 1, 1, -20, 8, 21, -1, -23, -18, 8, -12, 1, 5, 15, -12, -27, -30, -14, -3, -4, 14, -22, -17, 29, 21, -3, -22, -13, 5, -11, 16, -9, -20, 18, -16, 19, 29, -16, 17, -26, 10, -19, -15, -12, 11, -17, -11, -20, 21, 21, -26, 12, 5, 25, -18, 29, 17, -29, 25, -27, -7, 8, 11, -15, -12, -19, 27, -19, 6, -1, 3, 23, -6, -8, 23, -2, -15, -3, -20, -11, -23, -28, -7, 12, -15, 1, -8, -16, 22, 9, 3, -16, 11, 10, -25, -25, -26, -14, 11, 0, -22, -7, 18, -12, 26, -14, -2, 19, -28, 4, 29, -16, 15, 11, -22, -13, 11, 7, -2, -23, 18, 3, -7, -17, -16, 23, -29, 16, -8, -28, -21, 17, 14, -24, -13, 18, 3, -25, -5, -17, -1, 20, -19, 28, -2, 6, -22, -13, -30, 16, -22, 9, 28, -25, 14, 16, 27, 7, -13, -16, -14, -20, -28, -12, -14, 4, 16, -16, 7, -18, 26, -30, -4, -7, -30, -7, 19, -12, 1, -26, 0, -18, -10, -22, -19, 27, -21, 18, -22, -22, 7, -29, -18, -27, -11, 1, 14, -5, 19, 15, 20, -20, 18, -13, -23, -4, -23, -16, 21, -18, 26, -14, -25, -17, -12, -25, -5, 28, -29, 28, -21, 1, -10, -30, -2, 4, -5, 28, -14, 2, -22, -14, 26, -23, -28, -4, -20, 3, -13, -12, 12, 15, 26, -7, 12, -6, -23, -7, 0, -11, -13, 8, 7, -22, 22, 13, 25, 5, 18, 0, 13, 14, 15, 29, 15, 12, 3, -5, 14, -20, -26, 6, -12, -28, -28, 4, -2, 27, -2, -17, -13, 7, -25, -28, 6, -13, -10, -5, -8, 11, -3, 23, -16, 10, -24, -15, -15, 6, 28, 13, -18, 22, -25, -7, -3, -23, 16, -25, 7, -29, 2, -14, -27, -22, -2, 21, -17, -5, -6, -12, -27, -9, -8, 24, -21, 22, -13, 29, 3, 19, 10, -22, -29, 21, -13, -6, -24, -3, -20, 22, 9, 8, -28, 8, -11, 6, -4, 3, -4, -10, -2, -23, -14, -3, -24, 26, 6, 6, -22, 10, 18, -2, -22, 14, -20, 29, -28, -25, -16, -23, 29, -15, 21, 8, -22, 0, -5, -26, 10, -30, -29, -19, -14, -15, -5, -8, -27, 18, 4, 26, -9, -29, 24, -8, 11, -19, 6, 3, -4, 3, -6, 1, 22, -12, 15, 18, -26, 11, -1, 2, 20, 14, -11, -18, -26, -8, 14, 13, 22, 5, -14, -22, -7, -4, -21, 20, 6, 7, 29, -7, 13, 19, 5, -28, 13, -17, -1, 6, -26, -16, -18, 16, 9, -1, -26, 3, 10, -5, 13, -16, 19, -11, 16, 19, -17, -6, -13, 3, 22, 8, 20, -15, 21, 21, 13, 7, -10, -3, 20, -20, -19, 28, 27, -6, -14, 25, -15, 3, 18, -27, 15, -4, 25, -25, 2, -17, -17, -28, -30, -27, 28, -24, 25, -22, 3, 13, 10, 6, 18, -12, -5, -12, -29, -26, -22, -8, -18, -9, 7, 14, -22, -13, 5, 26, -28, -1, -24, -4, 8, 7, 14, -30, -21, -10, -30, 12, 18, 14, 4, 8, 24, -6, -8, 22, -21, -2, -13, -28, -3, -25, 4, 20, -21, -28, 25, -26, -25, -23, 5, 1, -30, -6, -22, -15, -28, 4, 4, -1, -24, -12, 8, -2, 13, 1, 7, 19, -9, 17, -5, -20, -7, -21, -12, 25, 19, -24, -27, 27, -29, -19, -2, -18, 20, 13, -17, 23, -29, 12, -30, -9, -28, 8, 5, 24, 17, 19, 12, 6, 2, -10, 9, -8, -1, 1, 27, 9, -17, -8, 8, -2, 11, -2, -5, 0, -28, 25, -29, 19, -25, -24, -30, 29, 1, 17, 16, 13, -5, 29, -26, 15, 24, -3, 25, -30, 2, 15, 12, 5, 23, 24, -17, -21, -4, 14, 12, 9, 13, 17, 12, -2, 24, 2, -6, 12, 5, 11, -17, -18, -29, -5, 10, 18, -11, 15, -20, -4, 16, 26, 28, 24, 0, -22, 17, -15, 25, -4, 28, -17, 3, -2, -23, -28, 27, -5, -25, -13, 11, -25, 0, -18, 22, -27, -12, 11, 21, -4, -3, 2, -27, -18, -17, -7, -8, -8, -22, 25, 7, -9, 5, -19, 14, 7, 27, 9, 8, 19, -7, -20, 15, 24, -18, -9, -8, 19, 28, 18, 28, 11, -28, -30, -26, 7, -11, -22, -24, 26, 14, -22, -2, 20, -27, 18, 26, -3, 13, 20, -26, 18, -12, 2, 29, -9, 26, -25, 12, 21, 17, 16, 26, -12, -14, 2, 26, 17, -10, 11, -27, 23, -18, -30, -11, 0, -3, 1, -9, -18, 23, 10, -22, 4, 11, -30, 13, 7, -21, -26, 11, 15, 24, -5, 11, -21, 1, 26, 18, -24, 25, -2, 1, -29, -23, -13, -16, -11, -20, -21, -23, -11, -15, 14, 3, -12, -1, 22, -1, -11, 21, 13, 12, -4, 17, 9, 27, 29, -13, 3, 10, 28, -1, -24, 14, 23, -21, -23, 28, -20, 16, -15, 28, -9, -4, -15, 26, -12, 4, 20, 6, 16, -12, 16, 16, 22, 4, -7, -2, -10, 4, 21, -19, 12, 16, 18, 6, -14, -24, 25, 12, -3, -5, -4, 8, -5, 11, -17, -6, -17, 2, -2, 20, -28, -15, 23, -2, 23, -23, 19, 8, 1, 26, -28, 15, 18, 23, 23, -14, 20, -7, 27, -27, 8, -22, 3, 5, -30, 10, -9, 4, 24, -7, -6, 25, -18, -17, 1, -5, 25, 3, 20, 5, -14, 7, -25, -15, 20, -10, 7, -25, -2, 9, 19, -17, 20, -24, -3, 4, 22, -18, -26, 23, 9, 24, -25, -29, -19, -30, 27, -2, 18, 15, -26, -19, 29, -30, 23, 7, -20, 15, -6, -8, 24, -27, -20, -27, -13, 7, 24, 7, 10, -7, -8, 28, 4, -8, -3, 3, -7, -30, -4, 12, 19, -7, 23, -3, 11, 12, 16, -8, 12, -13, -16, 4, 17, -1, 11, -8, 4, 13, -12, -29, 7, 13, -12, -25, 22, 13, 13, 29, -29, 8, 29, 17, 28, 5, 14, 23, 8, 19, -19, 13, -27, -30, -6, 13, 25, -27, -1, -21, 10, 15, -17, -4, -8, -18, -25, 2, 11, 10, -11, 29, 3, -25, -18, -4, 5, -30, -10, -24, -1, 1, -29, 25, 23, 19, -10, -19, 28, -18, 29, -1, -1, 5, 18, -29, 10, 26, 29, -20, -21, 9, 15, 19, -4, -25, -9, -23, -2, -3, 26, 0, 0, -19, 29, -24, -10, 12, 22, -26, -9, 15, 29, -9, 9, -1, 14, -6, 20, -13, 9, -13, 18, 20, 14, -25, 22, -23, 27, 25, -21, -2, -29, -8, -16, 8, 20, 16, -6, 7, 13, 11, -26, -14, 15, -24, 1, 0, -26, 26, -2, -8, 8, 23, 0, 20, -10, 2, 29, 4, -17, -13, -17, 13, 10, -6, 6, -23, 20, 18, -9, -11, 27, -16, -5, 14, -2, 29, -1, 18, 18, -8, -15, -2, 2, -23, -7, -11, -1, -22, -26, 24, -18, 17, -8, -30, -16, 20, 14, 20, 17, -15, 20, 9, 20, -20, 13, -12, -10, 15, -17, -17, 10, 6, -4, 16, -10, -7, 16, -22, 25, -4, 9, 25, -3, 8, 12, 12, 27, 16, -15, 9, 18, -25, -25, 1, 16, 25, 13, 17, 29, -11, 5, 23, -30, 14, 28, 22, 9, -30, 3, -15, 29, 24, -11, 28, -8, 26, -11, -24, -27, -5, -14, 29, -5, -4, -10, -25, -28, -6, -15, 18, -11, -16, 25, -20, 19, 26, 16, 28, -5, -15, -28, -4, -15, 7, 22, 0, 22, -21, -19, -18, 9, 26, -2, -1, 10, -27, 11, 12, 15, 19, -27, 22, 23, -25, -13, -28, 19, 24, 20, 3, -17, 25, 1, -8, 3, -17, -20, 5, 12, 18, 25, -2, -9, -13, 4, 11, 17, -15, 4, -28, -7, -12, -17, 14, 18, -1, 2, -4, -16, -26, -11, 1, 18, 15, 8, -8, 18, -10, 8, -8, -26, 8, 17, -5, -4, -12, -27, -18, -19, -27, 26, 10, -30, 29, 10, -15, -17, -8, 28, -24, -27, -30, -14, -15, 8, 2, 18, -14, 26, 14, 10, -4, -13, -4, -7, 15, -18, -24, -16, -10, 9, 5, 21, -28, 18, -18, -1, 2, -26, 9, -17, -12, 18, 22, 4, -16, 0, 27, -21, -20, -21, 5, -3, 21, -24, -21, 25, -8, 11, -22, 29, 10, 2, 8, 17, 8, 21, -13, -28, 12, 14, -30, -23, 23, -29, 12, -10, -20, -29, -11, 15, -29, -6, 17, -11, -5, 9, 0, -23, -5, -22, -8, 13, -29, 28, -2, 14, 27, -21, 20, -11, 20, -16, -16, -24, -17, 1, 19, -28, 16, -4, 21, -30, 3, -7, 24, -1, 27, 9, 20, 13, 19, 11, 13, 23, 15, 18, 17, -4, 24, -19, 17, -27, 16, 20, -13, 5, 14, -14, -2, 7, 12, -11, 26, 20, -28, -22, 16, -26, 4, 9, 14, 16, -10, 18, -8, 11, 12, -19, 2, 19, 17, -26, 10, -24, 11, 21, -18, 12, 28, -4, -17, -14, 4, -21, -19, 16, -7, -28, 7, -2, -30, 25, -29, 28, -6, -21, -21, 18, -7, 29, -13, -29, 16, -30, 23, 27, 22, -8, -2, -11, -1, 6, 5, 14, -7, -7, 13, 24, 19, -13, 8, -24, 6, 20, -9, 11, -4, -14, 25, 15, -5, -27, -20, 11, -18, -15, 20, 17, -25, -15, 6, -28, -19, 28, -4, -22, -2, 13, 23, -22, -18, 15, 10, -25, 3, -13, 17, 7, 16, 24, -6, 7, -16, 14, -16, -23, -9, 19, 6, -2, -4, -9, -21, 13, -25, 14, 15, -2, -28, 16, 23, 16, 10, 4, 27, -8, -19, -6, 1, -22, -23, 20, 21, 13, -25, 16, -16, -29, -13, 4, -25, 3, -4, 7, -16, 4, -23, 8, -16, 3, 26, -19, -8, 4, 10, 7, 2, -18, -12, -4, 28, -27, -11, -18, -24, -26, -4, 10, 11, 10, -15, -19, 8, -13, -20, -15, 2, -8, -13, -21, 26, -24, -13, -30, -30, 15, -8, -22, -6, -23, -11, 2, 18, -24, -2, 10, 6, 5, -12, -11, 10, 18, 18, -19, -11, 15, -9, -4, -12, 23, 1, -27, -23, 10, -10, 0, -25, 22, -2, -9, -19, -10, 27, 28, -18, -5, 28, 8, 11, 22, -2, 5, -16, -9, 18, 24, 3, 2, -3, 29, -21, 27, -14, 0, 29, 8, 12, -14, -8, 3, -4, 17, -30, -19, -18, -7, 8, -18, 5, 16, 15, -22, -22, -23, 2, 21, 21, -22, -12, -3, 22, -1, 2, 26, -5, -9, 22, -1, -13, -22, 23, 3, -28, -12, -27, 8, -18, 18, -26, 1, -8, 27, 2, -8, 8, 26, -16, 24, -26, -5, -11, -21, -1, 8, -6, 26, 24, -30, 28, 6, 26, -3, -8, -19, 24, 4, 6, -18, -20, -25, -3, -16, 24, -9, -12, -11, -23, 24, -7, -16, 11, 19, 15, 0, -5, 1, -25, -12, -28, 5, -9, -19, -22, -22, -6, 15, -26, 14, 5, 0, -21, -17, 19, 14, -22, 14, -19, 8, 0, -18, -27, -7, -2, -25, 28, -23, -14, -19, -12, 24, -27, 5, 19, -27, -27, 14, 22, 24, 0, 8, 6, -16, -4, -1, 8, 5, -26, 7, 25, 13, 1, 29, -7, -26, 12, 25, 18, 5, -20, 14, -19, 2, -23, 24, 8, -27, -27, 9, 11, -25, -6, -24, -7, 13, -7, 14, 19, 27, -1, 14, -28, -3, -23, -23, -27, 29, -20, -21, 11, -12, -18, 1, 3, -26, -15, 8, 26, -19, 17, -6, -26, 14, -18, 9, -6, 28, -20, 1, 1, 5, 23, 16, -9, 15, 23, -11, -16, 12, 20, -4, 29, -13, -25, -2, -6, 0, 9, -24, -6, -22, -26, -10, 2, -1, -10, -5, 25, 12, -24, -8, 26, -8, -4, 7, -16, -20, 11, -10, -22, -11, -18, 8, -22, -2, 16, -20, 25, 4, -24, -4, -26, 15, 15, -19, 12, -1, -1, -30, -14, -18, -6, 11, 12, -10, -9, -3, -20, 19, 13, -1, -4, 2, -21, 27, 20, 15, 3, 12, 25, 21, -1, 20, -25, 25, 4, 22, 20, -25, 29, 23, 25, 17, 9, -3, 18, 28, 15, 16, -17, 8, -30, -7, -26, 16, 23, -30, -26, 12, 18, -11, -19, 29, 11, -28, 29, -9, 9, -26, 29, 17, 24, -24, 14, -15, 29, -17, -22, 2, 22, -10, 6, -20, -19, 20, -29, -9, -3, 15, 11, -11, -16, 16, -15, 22, 25, 25, 21, -6, -17, -27, -5, -18, -17, -9, 9, 15, -2, -28, -4, 20, 6, 22, 15, -10, 6, 12, -20, -1, 19, 16, -3, -11, -18, 1, -17, -19, 12, 18, -3, 9, 4, -30, 23, 14, 11, -6, 2, 22, 16, 13, 9, 9, 20, -3, 23, 11, 6, -24, 8, 0, 19, 28, 7, 24, 6, 19, -20, -1, 2, 18, 10, 16, -25, 18, -28, 21, -28, 27, -22, 15, -8, 6, 5, -17, 12, -27, -5, 22, 24, 29, -20, -18, 14, -1, 24, 11, 3, 7, 3, 18, 21, 7, 1, -16, -7, 17, 8, 18, -30, -30, 27, 1, -7, 26, -25, 5, -27, 8, 5, 8, 24, 14, -21, -12, 27, 25, 14, -19, -22, 5, 6, -29, -1, 12, -12, 24, 28, 18, 12, 7, -7, -19, 26, 28, 12, -10, -21, -30, 25, 0, 14, -12, 22, 0, -18, 12, -8, 7, 28, 11, 28, -19, -27, -30, -16, -30, 13, 21, -5, -30, 22, -30, -20, 9, 16, 25, -8, -18, 7, -20, -6, -17, 7, -30, 19, -5, 13, 1, -5, -17, 18, 16, 2, 14, 1, 2, -6, -5, 18, -18, -18, -7, -30, 13, -16, 3, -29, -1, 21, 26, 28, -27, 13, 24, -22, 27, 18, -29, 6, 26, -23, -29, 8, 24, 7, -4, 21, -11, 19, -19, 5, -25, -2, 18, -1, 2, 13, -6, 4, 7, 3, -7, 20, 22, -6, 11, 5, -2, 15, -9, -8, 16, -10, 6, -30, -16, 28, -3, 14, 22, 16, 19, 16, -27, -10, -18, 2, 6, -1, 6, 20, -12, -21, -29, -29, -5, 12, -19, 6, 3, -22, 3, -27, -9, -23, 12, -12, -17, 4, 19, 0, -8, -7, 28, -19, -9, 2, -23, -10, -18, -23, -5, 13, 10, -17, -26, -20, 28, -20, 8, 11, -5, -20, 29, 29, -12, -8, -11, 6, -2, 14, 23, -26, 21, 26, 23, 22, 6, 26, 22, 20, -20, -11, -7, -27, -6, -19, 28, -8, -23, 2, -18, 23, -7, -28, 23, -23, 1, -3, -15, 20, 20, -3, -12, 12, -17, 2, 5, 13, -7, -29, 22, -25, 21, 13, -12, 14, -29, 5, 29, -26, -6, 10, -22, 5, -2, -21, -2, 17, -30, -7, -3, 22, 22, 6, -9, -9, 0, -5, -25, -3, 28, 8, -28, 20, -19, 17, 21, -6, 6, -26, 27, -17, -1, 20, -12, 23, 13, 3, 21, 8, 1, -29, 7, -20, -6, 3, -28, 11, -26, -5, 14, -15, -24, -7, -6, 6, -9, -29, 27, -17, -22, -20, 4, -17, 3, 15, 4, 8, 11, 18, 17, 19, 1, -27, 29, 6, -21, -25, 22, 19, -30, -6, -20, -21, 28, 23, 5, -10, -27, -27, 25, 27, -17, 11, -20, 1, 4, 5, 14, -9, 27, -17, -14, -27, 22, -23, 6, 28, 18, -1, 22, -4, 28, 26, -1, 14, -7, -19, 28, 16, -14, 29, 5, 29, -14, 11, 9, -27, -4, 12, 18, -30, -15, -25, -17, -25, -1, 16, 10, -6, 13, -23, 4, 5, -24, 29, 26, -30, -6, -17, 25, 27, -7, 4, 11, -16, 15, 13, 13, 20, 17, -24, 25, 12, -26, 21, -3, 12, -30, -18, -11, -28, 16, -9, -29, 19, 18, 29, 21, -6, -5, 21, 9, 3, 4, 13, 25, -2, 0, 24, -12, 13, -11, 15, -26, 5, -11, -23, 8, 9, 13, -5, -20, 22, -10, 0, -8, -19, -19, -24, -7, -8, 1, -4, -4, -11, -11, 19, 16, -30, -1, -11, -4, -23, 17, -29, -11, 13, -2, 27, 3, 9, 5, -22, -11, 25, -1, -15, 26, 28, 19, -18, -8, 3, -25, -29, 21, 21, -7, 29, -15, -8, 24, 14, 19, -16, -7, 13, -22, 20, 10, 8, 3, 1, -13, 0, 26, 11, -16, 21, -29, -1, -14, 1, -12, -17, 22, 14, -24, -10, 20, -8, 23, -9, 14, 5, 29, -23, 5, -7, -11, 18, 29, -10, 8, 16, 25, -3, 18, -11, 4, -20, 17, 19, -12, -29, -8, 28, 29, 2, -21, -28, 6, -28, -6, -3, -19, -27, -13, -3, 1, -1, 6, -9, -26, 20, 9, 11, 24, -27, -7, -16, -9, 26, 24, -13, -1, -7, 27, -2, 29, 5, 24, 20, 19, -24, 14, 1, -22, 7, -15, -9, 25, -22, 10, -29, -3, -17, -5, 13, -25, 7, -29, 14, -26, 16, -27, -20, 0, 27, -4, 5, 29, -3, 4, -6, -1, 18, -21, -13, -28, 10, 19, -24, 13, -13, 27, -14, 10, -3, 25, 27, 20, -19, 24, 8, 13, 29, -28, -6, 12, 28, -4, 29, 25, 14, 2, -27, 14, -12, 5, 15, 11, -22, -28, -13, -28, -2, -13, -12, 26, 29, 17, 1, -10, 17, -15, 15, -6, 13, 21, 16, -3, -10, 12, 10, 18, -14, -29, -14, 27, 15, 13, -19, -12, 15, 21, -3, -12, 11, -19, 17, -23, 27, -23, -18, -3, -16, 21, 29, 24, -23, 27, -10, -4, -17, -19, -8, 11, -13, 27, 8, 8, 27, 6, 21, 19, -30, -27, 17, 23, -6, 13, 17, -14, -8, -3, 18, 28, -23, 7, 28, 24, 19, 7, -3, -24, 8, 9, 3, -28, 17, 17, 4, 19, 27, -28, -29, 6, -18, -30, -8, 26, -18, -4, -28, -15, -13, 22, -18, 9, 22, -3, -30, 0, -23, 28, 17, -25, 25, -6, -24, 10, 6, -30, -23, 6, 25, -9, 23, 3, -21, -11, -27, -10, -24, -20, -14, -18, -12, -16, 6, -6, -7, -30, 17, -5, 11, 4, -19, -20, 1, -25, -11, 20, 4, -26, -8, -9, 15, -9, 9, -30, 9, -3, -3, -27, 20, 11, 19, -17, -17, -25, -7, -20, -1, -25, 12, 18, -13, -20, -11, -17, -6, -27, 11, -21, -26, 17, -19, -17, 14, -24, -11, -2, -23, -16, -1, -4, 26, -9, -24, 5, -27, 10, -4, 3, -20, -14, -30, 0, -1, -17, 15, 11, -6, 10, 6, -14, -24, 22, 11, -6, 21, 11, -1, 27, -30, 23, 8, 27, 21, 14, -5, 2, 21, 26, -10, 11, -1, -11, 21, 26, -18, 23, 4, -15, -22, -9, -9, 18, 15, 21, 6, -16, 22, -30, -5, -10, -4, 21, 16, -26, -17, -21, 21, 9, 11, 6, -12, 0, 9, 14, -4, 15, 25, 17, 3, -10, -27, 25, -28, -2, -6, 12, -13, -23, -5, 7, 2, 26, 28, -24, -30, 20, 10, -1, 27, -13, 8, 15, -3, 10, -13, -21, 18, 11, -5, -28, 1, -4, 9, -1, -18, -18, 9, 5, 18, -7, 13, -11, -2, 12, -27, -11, -26, -9, -2, -24, -5, 11, -6, -27, -10, 17, -22, -21, -3, 19, -24, -27, -11, -4, 16, -11, 10, -1, 8, 12, -26, -16, 0, 0, -4, 15, 19, -17, -19, -10, -19, -24, -14, 13, 27, 16, 18, -27, 5, -1, 28, -30, -8, -24, 24, -6, 3, -29, -26, -24, -28, -21, 3, -18, -25, -11, 13, -25, -14, 12, 23, 28, 25, -7, 5, 6, -5, 15, 2, 1, 27, 5, -9, 21, 3, -23, -11, -22, -2, -19, 27, -10, 24, 19, -26, -22, 12, -2, 19, -27, -21, 25, 27, -6, -12, -19, 22, 21, 25, -1, 5, -9, 23, 18, 6, -13, 26, -5, -18, 24, 12, -8, -18, -8, 8, -21, -17, 22, -15, 13, -29, -4, 29, -11, 10, 25, 12, 23, 11, -1, -16, -29, 8, 21, -22, 23, 20, 16, 0, -22, 15, -16, 2, -14, 29, 2, -23, 1, -11, 20, 7, 20, -18, -11, 20, 25, -17, 19, -15, -17, -10, 27, 3, -4, 3, -16, -4, -25, 11, 21, -18, 24, 5, -11, -19, 5, 2, 21, -22, 10, 25, 25, 25, 17, -26, -29, 5, -11, 2, 5, 13, -26, 1, 2, -1, -22, 24, 29, -4, 6, -26, -3, -1, 3, 15, -15, -22, -12, -20, 28, -1, -26, 2, 17, 21, -5, -8, 6, 23, -28, -27, 19, 6, -6, 27, -1, -2, 12, -2, -2, -9, 24, 5, 21, 3, -25, 27, -2, -16, -17, -10, -16, -4, -12, 9, 24, 21, -17, 21, -21, 18, 3, -23, -7, 5, -19, -5, -10, 7, 3, -21, 8, 6, 29, -4, 8, -6, 2, 22, -18, -10, 6, 14, 16, -2, -3, -15, 2, -26, -17, -9, -15, 18, 22, -3, -13, -14, -2, 15, -24, 6, -1, 20, 15, -5, 14, -21, -10, -24, 2, -6, -9, -29, -2, -1, 4, 24, 21, -17, 3, 12, 5, 20, 1, -16, -4, 19, -23, -23, 17, -7, -12, -20, -16, 24, 18, -22, -19, -14, -12, -26, 19, -9, 14, 4, -7, 8, 9, 10, 27, 2, -13, 10, -1, 7, 26, 27, -2, -9, 6, -7, -26, 27, -6, -12, -23, 19, 15, 5, 12, 9, 18, -13, 15, 12, -9, -27, -7, -9, 10, 29, -28, 7, -2, -6, 7, -25, 13, 23, 4, 26, 8, -9, -11, 20, 23, 2, -6, 2, -15, -14, 22, -27, 26, 12, -16, -2, -2, -23, 17, 3, 12, 24, 15, 22, 15, -18, -4, -26, 1, -11, -3, -9, -7, -17, 10, 12, 15, 3, -19, -3, 3, 2, 15, 28, -30, -1, 26, -4, -1, -30, 5, 23, -10, -21, -15, 10, -4, -5, -2, 3, 18, 24, -18, 23, -17, -15, -18, -9, -4, -19, -16, -25, -21, 25, -20, 23, -18, -2, -13, 14, -6, -2, -19, -23, -28, 18, 14, -21, -21, 25, -10, 5, 20, 0, 11, 26, -12, -4, -4, 28, 28, -2, -1, 9, 19, -2, -9, 2, -15, 5, -19, 2, 23, -30, -27, -28, -21, -22, 10, -26, -18, 7, -6, -2, -11, 9, -9, -1, -3, -26, 16, -27, 7, -30, 24, 2, 4, -29, 21, 1, -17, -22, -16, -2, 13, 5, 22, -28, 10, -18, -16, -25, -25, 6, -8, 17, 18, 16, 23, -2, -30, 29, 10, -23, 8, 27, -15, 15, 3, -26, -25, 29, 1, 3, -14, 18, 26, 5, -26, -19, -30, -30, 29, -7, -17, 14, -18, 26, -11, 20, -9, 20, 23, 6, 14, -16, -21, 27, -6, 24, -26, 20, -24, -4, 6, -9, 4, 3, 28, 0, 7, -29, -18, -9, -16, 12, 2, -17, -18, -16, -23, 25, 6, 9, -28, -24, 4, -14, 1, -7, 4, -17, -26, 17, 28, -17, 22, -18, -3, -28, 1, -9, -24, -10, -17, 16, -2, 13, -16, -3, 24, -27, 11, 19, -11, 20, -27, 21, 21, 3, -23, 18, 3, -17, 3, 24, -1, 27, 18, -15, 7, -6, -29, -10, -3, 10, -16, -3, -5, 4, -15, -29, 6, 20, 22, -5, -9, 18, 17, -17, -25, 19, 16, 21, 15, -26, -24, -30, -10, 6, -23, 7, 3, -4, 19, -27, -10, -9, -15, 10, 14, -24, 12, 6, 9, 5, 15, 20, 13, -26, -22, -17, -4, 22, -15, 6, -1, 0, 7, 20, -21, -26, 4, 28, 29, 7, 29, 23, 16, -15, 11, -12, 28, -6, -13, 14, 2, 8, 29, -25, 7, 13, -21, -23, 15, -4, -16, 17, -4, 10, 23, 11, 24, 9, 6, 13, 20, -21, -23, -11, 21, 4, -7, -2, -27, 25, 13, 3, 27, -19, 12, -22, 25, -18, 11, -12, -16, -19, 6, -6, -30, -12, 19, -22, 28, 9, 28, -8, 25, 15, -29, -9, -17, 16, -9, -4, 21, -30, 5, 25, 2, 28, 17, -1, -2, 6, -13, -22, 20, 18, -18, 10, 20, 9, -11, 15, 10, 4, 17, 27, -13, 28, -13, 5, -3, 29, 14, -18, -9, -4, -3, 15, 14, 17, 3, -11, 3, -28, -16, 9, -23, -7, 21, 8, -21, 25, -17, -28, -11, -4, -7, -26, -5, -3, -4, 22, 3, -16, 9, -3, -9, -28, 11, -6, 16, -24, 6, -7, 19, 25, 28, -14, 9, 27, -14, -15, -18, -26, -14, -25, -10, -9, 13, 23, 5, 2, -8, 16, -19, -5, -27, 20, -21, -10, 24, 26, 2, -23, 3, 10, 15, 1, 20, 25, -26, -24, 1, -16, -29, -23, -26, 4, -22, 7, -12, -8, -19, 16, -19, 21, 19, 7, -11, 7, 9, -15, 28, -5, -19, 12, -6, -20, 11, -6, -20, -11, 26, 28, 19, -3, -21, 0, 11, 13, 14, -9, -5, 28, -2, -17, -11, -26, -18, -24, -18, -17, -23, -3, -9, -4, 14, -30, 25, 15, 15, -9, 12, 15, 4, -20, -16, 16, 21, -9, 25, 12, 21, 14, 5, 4, -27, -2, -14, 2, 25, 7, -9, -21, -15, 15, -15, -2, -16, 5, 11, 3, -2, -30, -5, -17, 21, 26, 14, -11, -5, -7, -20, 2, -5, 22, -6, 11, -27, -6, 29, 15, -1, -30, -12, -25, -5, 11, 6, 13, 11, -2, -15, 13, -23, 23, 27, 5, 27, -29, -29, -27, 18, -5, 8, -29, -20, 26, 15, 13, 19, -30, -5, 19, 6, -5, -14, 20, -5, -16, 18, -15, -5, -19, -19, 13, -17, -8, 11, -11, -28, -12, -25, -1, -3, 9, 13, 11, -28, 2, -5, 2, -17, -13, -26, -21, -19, 16, 24, 4, 3, 6, 4, 14, 20, -29, 11, -11, -27, -22, 22, 18, 10, 7, -7, -20, 22, -23, -26, 13, -29, -27, -5, 14, -8, 13, 26, 7, 9, -10, -13, -23, 21, 26, -18, -21, -17, 6, -7, -29, -25, 11, 9, 29, -5, 14, -7, 10, 18, -26, -23, -9, -2, -15, 6, -6, 7, -18, -11, 22, 12, -2, 6, 19, 9, 0, 10, 9, 2, 19, 2, -30, -24, -13, -23, -22, 14, -21, 24, 23, -8, 6, -24, 19, 19, -7, -16, -23, -8, 13, -2, -18, 16, 22, 29, 24, -24, -13, -6, -24, 11, 19, -1, -14, 13, 17, -4, -11, 23, 28, 17, -26, -30, 5, -23, -3, -16, 17, -22, -8, -25, 4, -11, 21, 12, -24, -15, 18, 6, 16, 8, 8, -27, -20, -22, 8, 10, 22, 3, 29, 11, -1, 8, -28, 5, -16, 18, -5, -20, -3, -1, 22, 15, 19, 1, -12, 15, 11, 25, 4, 19, 2, -11, 0, -28, -16, 19, 14, -14, -15, 2, -24, 8, -14, 14, -12, 28, -17, 0, 15, -1, 17, 20, -21, 24, 19, -12, -18, -29, -14, 14, -25, 26, -26, -19, -11, 12, -27, -3, -6, -21, -13, 17, 20, -20, -8, -14, -6, 20, -15, -13, -1, 2, -19, 28, 27, -20, -8, 16, 29, 8, -9, -25, 5, 4, -1, 12, -1, -26, -23, 16, 12, 14, 11, -20, -26, -2, -8, -15, -26, -27, -10, -17, 0, 19, -15, -1, 10, 25, -7, 18, 27, 24, 24, -12, 28, -3, 26, 10, 10, 16, -10, -8, 27, -18, -18, 6, -27, -30, -16, -26, 9, -26, -1, 12, 1, 24, -15, -6, 29, 7, 15, 23, -3, 29, -1, -2, 20, 0, -10, -17, 2, 20, -10, -2, 11, -7, -13, 9, 23, 20, 23, 14, -26, -20, 12, -23, 13, 3, 5, -12, 23, -20, -19, 21, 7, -7, 3, -12, 15, 26, 0, -6, -26, -3, -9, 14, 16, 27, -9, -24, -18, 12, -20, 24, 13, 15, 28, -20, -25, -26, -3, 10, -19, -14, -1, -19, -24, -14, 16, 7, -29, 22, 24, 13, 7, -13, -1, -1, 6, -11, 22, -18, -1, -10, -7, -4, 22, -6, -24, -28, 4, 5, -27, -29, -27, 13, -25, -9, -2, -13, 29, -26, -25, 25, -11, 10, 21, -2, 21, 25, -18, -13, 7, 16, 26, 23, -19, -29, -30, -22, -5, -4, 0, -2, -6, 0, 13, 23, -30, 10, -5, 12, -28, -3, 4, -29, 27, 23, 28, 2, -16, -11, -17, -15, 6, -13, -2, 6, 12, 0, -12, -21, -2, -19, -22, 6, 26, -25, 17, -19, 11, -12, -20, -14, 28, -19, -12, 12, -5, 6, -9, -16, -14, -22, -30, -30, -20, 29, -8, -29, 14, 20, -23, 8, 8, -8, 16, -18, 10, 7, -5, 2, -21, -12, -24, -25, -7, -18, 21, -1, 1, 4, -24, 26, 2, 4, -27, -21, -3, -25, -12, 22, -29, 6, -29, -10, -14, -17, 24, -24, 22, 17, 13, 28, -23, -11, 13, -11, -29, -22, -29, -15, -12, -6, -3, -18, -28, 28, -18, 16, -24, 17, -26, -29, 15, -18, -4, 13, 19, 3, 11, 6, -29, -21, 6, 20, -10, -15, -11, 18, -14, -25, 28, 5, 12, 18, 15, -25, -12, -22, 28, -8, 9, -17, -26, 14, -19, -23, 15, -20, 12, 4, -19, 15, -21, 13, -2, -2, 29, 10, 29, 16, -18, 5, 14, -24, 11, -12, 1, -27, 21, -20, 16, -8, 22, 13, 7, -24, -29, 18, 29, 0, 4, 6, 21, 23, -13, 2, 26, 17, -12, -15, -19, 26, -9, -1, -12, 10, 22, 18, -27, 17, -7, -16, 1, -12, 4, -10, -17, 15, 17, -7, 4, -7, -16, -7, -12, 11, 4, -30, 29, -26, -13, 22, 21, -15, 5, -27, -18, 14, 19, 27, 5, -11, -1, -10, -9, -25, 29, 16, 4, 29, -7, -21, -14, -2, -4, 12, 2, -3, -28, -26, -5, 29, 3, 17, 24, -5, -12, -4, 29, -15, 10, -25, 18, -10, 15, -19, -30, -18, -27, -19, -26, 9, 4, 0, -1, 4, -21, 13, 19, -17, 9, 29, -27, -19, -12, -30, 19, -2, -16, -1, 24, -13, -26, -19, -12, -11, 13, -11, 3, 24, -17, 15, -25, -21, 14, -5, 29, -10, -27, -2, 7, 28, -3, -8, -23, -9, 5, 13, -14, -20, 21, 26, 19, 28, -28, -17, -14, 5, -23, 11, 25, 14, -20, 0, 17, -8, 11, -16, 22, -14, 11, -19, -23, 28, 6, 18, -27, 22, -18, 2, 13, -5, -9, -22, 3, 3, 28, 15, 17, -22, -29, -30, 16, 4, 8, 1, 6, 2, 11, 8, -27, -7, -27, 20, 19, 15, -26, -1, 5, -1, -4, 29, 28, 22, 19, 23, 26, 24, -12, -6, -15, 0, -5, 23, 12, 2, 9, -29, 3, 27, -26, -10, 27, 10, -30, -20, 3, 29, -25, 28, -1, 26, -13, -3, -2, 2, -5, 23, 14, 9, -21, 21, -22, 12, 10, 17, 2, 19, -26, 12, -29, -19, 21, -2, 26, -1, 23, -6, 1, 19, -16, 24, 17, -9, 22, -28, -8, 1, -20, 8, 19, 16, 19, -6, 28, -12, -6, -20, 13, 24, 13, 9, 29, 6, -18, -3, 24, -19, -1, -20, -9, -5, 28, -17, 2, -27, -14, 28, 2, -4, -6, -26, 27, 29, 0, 10, -18, -2, 16, 1, -19, -20, -30, 17, 8, -11, 2, -14, 13, 20, 7, 11, -17, 11, -27, -10, 7, -8, -26, 7, 23, -16, -10, 0, 0, 22, 11, 9, -22, -3, 0, 15, -17, 16, -22, -10, -27, -21, 10, 18, -9, 7, -26, -18, -6, -22, 18, 25, 27, -18, -1, -21, -11, 16, -18, -14, 17, -3, 8, -26, -18, -23, 6, 11, -10, -24, -27, -21, 28, 22, 20, 4, -28, -9, -7, 3, -24, -24, 10, 19, -30, 17, -4, 29, 26, -20, -13, -15, -25, 14, -10, -21, 2, 18, -9, 7, 14, -5, 26, -17, 16, 8, -3, 24, -25, 11, 19, 29, -27, -23, -17, -24, -28, -26, 22, 17, -5, -24, -14, 20, -27, -1, -3, -9, -20, 12, -15, 2, -1, -17, 9, 16, -13, -17, 14, -29, -8, 4, -11, 24, -28, 9, 16, -16, 9, -8, 28, 15, -4, -24, 29, 20, 11, 22, -26, 13, -14, 20, -19, -22, -30, -15, 8, 4, -29, -11, 21, 28, -4, 22, 10, 7, -1, 21, 25, 0, 14, 24, 3, 3, 20, -7, -22, 24, 17, -25, 13, 7, -11, -24, 16, -25, 26, -28, -20, -7, -3, 1, 4, 24, -2, 8, -1, -25, 0, 28, 22, 4, 6, -26, -17, 12, -27, -11, -9, -12, 8, -4, 9, 23, 9, -14, -12, 6, -5, 14, -5, -27, 1, -21, 1, -26, 6, -17, 4, -27, 3, -7, -9, -13, 2, 25, -21, 8, 9, 2, 14, 5, 14, -26, 15, -26, -26, 13, 10, -14, -22, -25, 9, -15, -22, 24, 10, -5, 13, -25, 20, 7, -14, 18, 20, 21, 29, 22, -1, -14, 25, -17, 29, -30, 26, 28, -14, -19, -13, 13, -9, -13, 10, -7, -7, -15, -7, 14, 13, 10, -15, 28, 19, -26, -13, -21, -3, -6, 15, -11, -8, 25, 8, 8, 10, 24, -3, -20, 23, -2, -18, -18, -7, -14, 15, 10, -8, -19, 2, -9, 12, 15, 1, 9, -26, -30, -29, 2, 18, 24, 8, -11, 22, 27, -16, 29, -24, -30, -3, 11, -7, 6, -11, -12, -14, 18, -15, 15, 21, -15, -3, 6, 10, 7, -18, 26, -3, 19, 2, -28, -1, -4, -28, -28, -4, -6, 11, -25, 22, -12, 25, -7, 13, 29, -27, -28, -4, 20, 5, 3, -23, 8, -2, -25, -22, 1, -2, 1, 7, -3, 28, -6, 24, -20, -24, -9, 22, 19, 22, 24, -10, -5, -15, 29, 6, 10, 1, 21, 13, 19, 14, -9, 28, -4, -4, 2, 14, -27, 27, 28, -8, -12, 24, 15, 9, -9, -29, -4, -15, 26, -23, -26, -13, -2, -2, -12, -15, -25, 7, -21, -16, -25, 12, -17, -23, -4, 4, 7, 1, -12, -12, 3, 6, 15, -16, 15, 18, 22, -14, 11, -7, 27, -1, -4, 25, 26, -6, 29, -14, -13, -19, -22, -8, -7, -24, 14, 20, -5, 6, 10, -5, -18, 2, 8, -10, -20, -18, -30, -29, 20, -9, 24, 29, 18, 6, -22, 27, 10, -1, -7, 4, -3, -12, 18, 19, 12, -3, 9, 26, 22, 10, 8, -17, -27, -13, 25, -17, -23, -25, -20, -24, 17, 4, 26, -6, -5, 28, -24, -5, -18, -27, 24, -29, 23, -5, -5, 0, 1, -13, -21, -2, -14, 8, 8, 19, -16, -14, -10, 26, 20, 6, 17, -10, -2, 17, -26, -5, 10, -18, -30, 12, -29, 23, 6, -12, 7, -28, 2, -14, 3, -22, 22, 5, 5, -21, -6, 22, -24, 23, -23, -6, -17, -7, -14, -25, -10, 12, 8, 21, -14, 12, 9, 14, 25, 1, 22, 7, 14, 13, -7, 7, 27, 11, -12, -1, -4, -4, -22, 20, -17, 11, 24, -12, -5, -26, -30, 12, -26, -5, -25, -25, 13, -11, -1, 29, -30, 7, 29, -25, -12, 15, -30, 6, 20, -11, 1, 7, -5, 11, -16, -3, 4, -19, -1, -21, -16, 6, -23, 29, -11, -27, 16, -10, 9, -18, 14, 29, 28, 1, 18, -28, -15, 6, -4, 19, 6, 4, 26, -14, 2, -28, -4, -27, 12, -23, -16, 17, 18, -28, 15, -21, -20, 26, 11, -14, -29, 7, 1, 22, -13, 12, -10, 20, 5, -18, -1, 26, -14, -20, 27, -29, 13, -14, 3, -4, 22, -1, -27, 26, -7, -18, -4, 0, 6, -9, 19, 22, 28, -12, 24, -28, 10, -25, 25, 28, 24, 14, -25, -25, 11, 10, 16, 19, -29, -10, 7, -10, -29, -20, -18, -17, 1, -10, -8, 6, -29, 27, 29, 2, -22, -7, -21, -17, 29, 23, 3, -14, -22, 11, -23, -6, -15, 9, 12, -23, 10, 20, -30, -9, 18, -25, 20, 19, -3, -7, 24, 15, 16, 14, 16, 23, -30, -3, -21, 7, -19, 6, 19, -30, 26, -15, 19, 22, 29, 2, -16, -3, 16, -12, 15, 7, 11, 8, 15, -9, 11, -21, -18, -24, -16, -23, 26, 5, -28, 9, 10, 16, 21, 6, -7, 11, 14, 8, -1, -11, -22, -9, -20, 1, 23, 22, 6, 26, -21, 16, -9, -5, -26, -28, 0, -30, -25, -22, 0, -29, 4, 1, 18, -10, 17, -14, 11, 2, -28, -25, 12, -30, 17, 14, -5, -13, 29, 29, 20, 16, -3, 18, -21, 6, 13, 19, -23, -4, -14, 11, -3, 25, 14, -27, 6, 5, -18, 11, 27, 3, -2, -16, -10, -14, 9, 14, 18, -25, 19, -14, -29, -2, -2, -14, -4, 21, 29, 9, 25, 25, -7, 12, 15, -4, -19, 5, 10, 6, 12, 12, 21, -20, -22, -15, 17, -17, 3, -20, 4, -2, -6, -11, 5, 18, 29, 12, -26, -21, -17, 6, 12, -29, -6, -17, 15, 12, -5, -28, 2, -25, -11, -11, -1, 24, 13, 3, 9, 26, -22, -13, -30, -29, -4, -22, -16, 13, 11, -15, -12, 28, -23, 10, -13, 20, -24, -26, 8, 0, 2, 3, 2, -27, -1, 26, -17, -27, 23, 5, -9, 11, 26, -1, -4, 19, 9, -16, 18, -5, -10, -24, -9, 22, 28, 29, 4, -18, 24, 12, 20, -11, -24, 6, -9, 8, 10, 4, 2, 3, -12, -23, -6, 10, 24, 4, -7, 26, -25, -8, -14, -7, 1, 25, 6, 22, -8, 14, -23, -20, 24, 26, -8, 18, -9, 25, 7, 29, 17, -18, -21, 3, 24, -11, -11, -29, 11, -14, -1, 11, 1, 27, 17, 5, 29, 17, 22, -9, -15, -10, 9, 21, -20, -29, -9, 20, -12, -9, 24, 14, 4, 28, 27, 29, 27, 2, 26, 23, -20, -26, 27, -2, -1, 18, 25, -8, 0, 27, -17, 2, 22, 17, -16, 19, 22, 27, 19, -14, -9, -3, 25, 4, 16, -18, -22, 28, 1, 8, 29, -20, -14, -8, 20, -8, 12, -4, -16, -1, -26, 23, 29, 22, -11, 15, 26, 1, 29, -18, -27, -3, -20, -13, -6, 0, 12, 21, -9, -24, 10, 18, 8, -1, -23, 18, 8, 29, -30, -1, 24, -12, 26, -23, -13, 28, 5, -29, -28, -13, 6, -4, 16, 16, 11, -19, 20, -4, 9, 4, -5, 14, 9, -2, -20, -28, -30, -22, 20, 12, 19, 8, -5, 29, -16, -6, 25, 7, -27, 26, 4, 29, 7, 18, -11, -8, 28, -18, -15, 22, 2, -13, -11, -14, 11, -14, -22, 28, 28, 11, 19, -26, -23, 11, -20, -12, -23, -15, 5, -3, -13, -28, 12, -6, -12, 7, 12, -15, -1, -20, -21, 0, -17, -9, -5, -25, -23, 3, -11, -11, 24, -11, -6, 26, 2, -20, 15, -1, 8, 26, 21, 26, 1, 1, 23, 28, -13, 4, 4, -27, -8, 29, 24, -24, 13, 23, 3, 18, -15, -8, 17, 9, 25, 29, -7, -8, 7, 7, -15, 4, -3, 13, -30, -9, 0, 5, 25, 2, 23, -28, -26, -1, -10, 6, -26, 24, 19, 27, 17, 26, -4, -25, -2, -2, -5, 17, -17, -2, 16, 7, 16, 17, -7, -9, -29, -4, -24, 23, 14, 28, 13, 23, 22, 17, 15, -9, -12, 6, 10, 3, -18, 28, -2, -18, 20, 22, 3, -16, -11, -19, -3, -15, -10, 28, -4, 15, -27, -8, 29, 4, 2, -6, 15, 17, 27, -4, -7, 15, -13, 9, -11, -20, 18, 3, -29, -22, -17, -1, -4, -29, 19, 4, -22, -7, -14, -25, 24, -2, 28, 19, 7, 8, -6, -12, 29, 6, -26, 7, -19, -25, -19, -20, 28, 25, -11, -4, -25, -21, 8, -9, 19, 20, 0, -15, -30, 10, 28, 17, -29, 6, 7, 2, -22, 3, -8, -14, 6, 23, -1, -6, -29, -29, 28, 21, 16, -14, -22, 15, -26, 29, 17, -16, -29, 18, 13, -12, 15, 18, 8, 22, -19, 17, -5, -27, 26, -12, -6, -15, 22, -25, -3, -26, -1, -9, 18, -9, -28, 8, -6, -6, -16, 7, -16, 28, -7, 1, -22, -18, 0, -1, 18, -15, 5, 14, -16, 19, -18, 9, 27, -17, 2, 19, 9, -21, -3, -13, -23, 18, 9, -2, -4, 16, -16, 18, -24, 1, 11, 29, 2, -18, 16, -30, -10, -16, -13, -14, 1, 17, 16, -12, -21, -3, -27, -19, 23, 24, 25, 22, 12, -11, -2, 0, 10, -9, -16, 26, 13, 9, -28, 19, 14, -3, -4, -21, 1, -22, 8, 4, 19, 10, 22, 6, 6, -1, -29, -13, -14, 18, -17, -19, 3, -26, 7, -22, -27, 3, 10, -1, 16, -25, -3, 6, -26, 11, -7, -15, -14, -25, 15, 20, -18, -17, 10, -2, -27, -7, -7, 9, 7, -8, 27, -8, -9, -20, -11, 25, -8, 5, 3, 12, 19, -9, 28, 19, -27, 27, 29, 14, -3, -21, 13, -26, -19, -29, 18, -7, 2, -29, -2, -7, 22, 7, 25, -25, -26, -13, -16, 20, 9, -7, 12, -30, -8, 28, 13, -8, 16, -3, -15, -24, -22, -11, -3, -1, 9, 11, 27, 24, -13, -26, -1, -23, 6, 10, 24, 5, -10, -21, 22, -1, 1, 14, -13, -26, 2, 20, 11}; + nums = + new int[] { + 28, 26, 22, 7, 12, -26, 25, 11, -14, 0, 0, 6, 20, 4, 17, -7, 4, -14, -19, -16, + 8, -21, -26, 24, -29, -18, -13, 2, -16, -14, -26, -14, -7, -14, -30, -3, 9, -16, + 28, 3, -26, -5, 4, -28, -3, 11, 26, 14, 20, 15, -4, -12, -18, -21, -28, 22, -4, + 0, 2, 22, 16, -10, -14, -5, 2, -3, -16, -23, -26, -5, 21, 17, 4, 29, 19, -2, -8, + 5, -14, 13, 10, -15, 2, 25, -5, -21, 13, -28, 7, -12, 9, -1, 15, -26, -9, -3, 3, + 14, -25, -8, 12, -4, 0, -28, -30, -13, -11, 16, -3, 5, 5, 22, 7, -5, 20, -9, + -29, 29, -25, -27, -6, -22, 22, 11, -18, 3, -18, -21, -8, 6, -20, -22, -2, 25, + 25, -4, 19, 13, 9, 18, -25, -9, 16, -30, -30, 18, 29, 27, -26, 11, 28, -6, 4, + 29, -18, 28, 9, 23, 13, -22, -10, 21, 23, -13, -22, 8, -7, -6, 24, 11, 27, 8, + 15, 23, -11, -28, 7, -11, -2, -26, -21, -13, 22, 2, 6, 18, -17, 12, 11, -28, -3, + -15, -5, -14, -21, -9, -30, 12, 22, 1, 2, -8, 24, 22, 5, 29, -11, 25, -13, 1, + -22, -1, 11, 11, 12, 5, 14, 20, 13, 9, 2, 16, 10, 8, -30, -18, 8, 18, 23, -3, + -11, 5, -30, -7, -12, 23, -19, 9, 13, -4, 29, 14, 2, 29, -30, 6, -14, 16, 26, + 28, -9, -8, -4, 9, -7, 28, 20, -27, -13, 12, 13, -17, -14, 19, 7, 17, 14, -3, + 15, 24, -25, 6, 29, 24, 21, -20, 12, -24, -21, -30, -18, -2, 22, 5, 2, 27, 4, + 24, -21, 18, -4, 8, 11, -18, -2, -9, -22, 21, -6, 7, 10, 20, 9, -7, 15, -26, -4, + 3, -24, -26, 29, -28, -8, -3, -6, 4, -28, 12, -19, 17, 2, -30, 14, 8, -1, 6, 19, + -20, -30, 5, 5, 16, -9, 11, 25, 0, -24, 1, 18, 28, -5, -14, 7, -3, 18, -26, 26, + 1, -19, -19, 14, 29, 25, 13, 6, 2, 19, 28, -10, 26, -29, -12, 7, -11, -18, 28, + 1, 0, 19, 12, 20, -19, -7, -10, 5, 25, 19, 25, 2, 8, -5, -21, -7, -29, -19, -22, + 7, -20, -8, 7, -28, -10, 25, -29, -13, 2, -1, -21, -1, 11, -20, 28, 18, -28, + -22, 25, -29, -11, -20, 1, 3, -16, 20, -11, 20, -3, 9, -2, 25, 0, -27, 27, 11, + -5, 24, -18, 18, 28, -2, 29, -7, 21, -5, 9, -13, -25, -14, 23, -15, 8, 15, 3, + -28, 15, -23, 3, 13, -9, -7, 8, -6, -25, -16, 24, -23, 29, -7, -28, 15, 9, -18, + -8, 17, 29, 25, -2, -17, -9, -12, 20, 15, -17, -18, 23, 2, -9, -7, 1, 18, 13, + -11, -26, -13, 29, 7, -22, -16, -19, 7, 18, 19, 29, 0, 10, 21, -1, 25, 0, -13, + 0, -3, 16, 13, -19, 1, -23, 13, -10, -18, -1, 13, -27, -30, 21, 7, -18, 27, 21, + -30, -22, -29, 4, 21, 26, 12, -22, -12, -20, -20, 7, 7, -22, 17, -20, 19, -22, + -22, -24, -16, 2, 6, -11, -19, 24, -25, 28, -12, -30, 20, -18, 29, 17, -20, -27, + 18, -5, -11, -20, -15, 3, -4, 15, 2, -23, 16, -18, 21, 27, 7, 16, -24, -16, -14, + 28, 29, -24, 20, -19, -18, 5, 17, 0, -29, 1, 26, 6, 17, -8, -7, -24, -30, -7, + -29, -13, -20, 4, -7, 20, -13, -8, 19, 23, 20, 0, 2, -2, 27, 16, 2, -15, -10, + -18, -24, 2, 10, -2, -23, -29, -9, 4, -10, -10, -10, -11, -28, -5, -21, 5, 6, + -7, 17, 3, -25, 27, 28, -14, -2, -7, 18, 5, 16, -16, -29, 15, -25, -6, -16, -15, + 5, -21, -12, 17, 17, 10, 16, 11, -28, 1, -16, -13, 9, -3, 3, 2, -15, 16, 10, + -10, -27, 16, -18, 14, 6, 9, -6, -26, 23, 24, 28, 1, 27, -29, -13, -27, -22, + -19, -10, -4, -26, 3, -26, 9, -6, -16, -15, -7, -21, 11, -5, 24, 28, 27, -13, + 11, -12, 1, 15, -19, 20, 6, -11, 15, -10, 27, -8, 1, -12, -30, -9, -25, 26, 13, + 6, -4, -13, -5, 0, 23, -4, -24, 14, 24, -13, -29, 24, 29, 19, 3, -15, 26, -23, + -27, -23, 14, -17, 14, 0, 5, -19, -3, 27, 4, 20, 25, 15, 1, 26, -8, 22, 16, 9, + 11, -16, 17, -6, 26, -21, -21, 14, 28, 28, 18, -9, -14, -9, -17, -4, -27, -5, + -10, 23, -10, -22, -28, 25, 1, -2, 22, -3, 21, -4, 5, 17, 11, 20, -27, -24, 2, + -21, -10, 1, -16, 13, -10, 2, -20, -21, 13, -5, 16, 4, -3, 27, 25, -12, -13, -5, + -3, -22, 0, -18, 13, 23, -19, 4, 29, -20, -10, -26, 26, 20, -7, -16, -17, 0, + -28, 10, -17, 24, 0, -17, 26, 15, -19, 28, 14, -19, 27, -7, -6, -19, -17, 29, + 20, 9, 4, 22, -23, 0, 18, 12, -2, 6, -27, -28, -20, 8, -23, -1, 23, -16, 25, 25, + 4, -30, 21, 12, -22, 17, -1, -28, -16, 3, 11, 8, -14, 11, -17, -4, -30, -23, 11, + -10, 10, -27, 0, -4, -21, -26, -4, -20, 24, 2, 7, 28, 29, -6, -19, 29, 27, -28, + 0, 2, -29, -3, -4, -15, 19, 18, 13, 21, -15, 18, 6, 8, 26, -23, -23, 13, -22, + -11, -25, 3, -9, -22, -26, 12, 3, -27, -24, 0, 7, -10, -8, 6, -6, 10, -15, -11, + 20, -28, 19, 1, 29, 24, -25, -3, -10, 26, 29, -19, 27, -14, -27, -27, -18, -8, + -25, -7, 20, 11, -12, 9, -15, -1, -1, 8, -2, -1, -4, -20, 0, 3, 4, -24, 0, 15, + 22, 15, 19, 8, -25, -30, -5, -24, 29, -19, 19, -28, 17, -8, 12, 28, 3, -25, -7, + 7, 15, 13, -25, -12, -5, -18, -18, -3, 25, -25, -9, 22, -17, -29, 16, 28, 16, + -24, 5, -8, -19, -10, 9, 14, -7, 12, 12, 6, -1, 0, 20, 18, -29, 11, -16, 0, 8, + 6, -8, 8, 29, 29, 21, 29, 2, -8, 12, -16, 26, 21, 14, 13, 23, 7, -20, -26, -18, + -23, 4, -12, 10, -30, -8, -20, -8, -19, -30, -16, -23, 25, -27, -10, -4, 27, 12, + -30, 26, -15, -19, -27, -16, 23, -30, -28, 12, 9, 28, -28, 25, -1, 28, -4, -11, + 6, 15, -22, -24, -12, 28, -17, -13, -29, 18, 9, -25, -21, -19, 6, 17, 29, -17, + -1, -5, 29, -20, 16, 13, -12, 21, -4, 13, -17, -1, -26, 20, -29, -24, -14, 19, + -30, 16, 5, 11, -20, 29, 23, -3, 7, -1, -21, -7, -19, -4, 22, -2, -5, 5, -2, 4, + 4, -20, -13, -10, -28, 22, 27, -25, 11, -6, -11, 8, -10, -9, -16, -25, -28, 24, + 2, -25, -10, -28, 25, -12, -11, 17, -9, -2, 2, 21, -30, -14, 8, 19, -9, 5, 2, + 20, 26, -18, -4, 28, -4, 19, 20, 28, 17, 24, -18, 26, 1, -12, -23, -7, 3, 16, + -7, -29, -16, 10, 21, 11, -9, 3, -7, -8, -3, 13, 22, -6, 24, -23, -25, -5, 13, + -19, 9, 5, 23, 1, 11, 22, -4, -12, -26, 17, 22, 22, -20, -11, -10, 10, 4, -28, + -11, -5, -25, -18, 17, -13, 23, 0, -19, 23, -24, 12, -19, -15, -1, 7, 3, -8, + -25, -30, -22, 4, -9, -26, -23, 22, -17, -1, -10, 11, -25, -16, 25, -23, -30, + 13, 3, 14, 9, 21, -4, -2, 27, 8, 17, 15, -12, -23, -8, 24, 2, 26, 13, 3, 20, 25, + 17, 16, -22, 29, -22, -24, -5, -14, -1, -21, -30, -14, 4, -2, 24, -6, -7, 8, + -29, -23, -13, 4, 8, 4, -12, 1, 19, 4, -16, -2, 11, 13, -15, -28, 9, -17, -4, + -6, -17, 15, 22, -21, -6, -5, -18, 20, -15, -29, 10, -17, 25, -19, 17, 27, -7, + 16, -13, -26, 11, -10, -25, -4, -18, -13, 26, -6, 28, 14, 22, -12, -17, 7, 19, + 15, -21, 22, -30, 11, 11, -4, 4, -7, -15, 11, -11, 21, 21, -23, 18, -4, -30, 10, + 10, -7, -16, 19, -24, -2, -26, -4, -10, 2, 24, 13, 5, -27, 29, -14, 13, 24, 26, + -20, 21, -17, -25, 15, 1, 5, 0, -22, -8, 12, 28, 22, 1, 26, 22, -8, 22, -12, + -28, -21, -26, -23, 21, -22, -15, 14, 28, -26, -27, -14, 3, -1, 13, -23, -14, 2, + 23, 16, -24, 12, -10, -20, 17, -27, 15, 18, -26, 27, 24, 3, 26, 6, -16, -28, 26, + -7, -22, -5, -1, 24, 16, -3, 5, -21, -25, 7, 8, 22, 25, -8, -25, -2, 4, -19, 16, + -25, 14, 26, -26, 8, 27, 21, 16, 29, 22, 12, -9, 28, 1, 18, -5, 16, -28, 18, 20, + 10, -24, 13, 7, -11, -3, -4, 8, 21, 17, -17, -14, 5, 1, 29, 10, 2, 15, 0, 25, + -12, 14, 16, -15, -19, -19, -24, 28, 24, 23, 24, 28, 24, -5, -17, -29, -30, 29, + -11, -25, 21, 25, 10, -17, -23, 12, -9, -20, -2, -13, 29, -2, 8, -17, 16, 7, -4, + 27, -3, -10, -30, 3, -4, -6, 27, -11, 25, -18, 9, -12, 10, 25, 25, -7, 6, -13, + 9, 0, 25, -26, 24, 15, 1, -17, 3, -4, -19, 17, 2, 22, 28, -23, 24, -30, -11, 25, + -15, 2, 27, 10, -18, -3, 12, 13, -2, 9, -29, -11, -13, -1, -26, 23, 23, 21, -14, + -4, -21, -17, -6, -8, 7, -29, 11, -28, 28, -2, -8, -3, 10, -23, 12, 9, -19, 2, + -15, -13, 24, -24, 28, 14, -11, 14, 19, 8, 12, 6, -19, -27, -13, -17, -12, 19, + 23, -7, -27, -12, -11, 13, 3, -5, 24, -26, -30, -15, -10, -22, -24, 12, -10, + -17, 7, 22, -22, -3, -29, 11, -1, -12, -7, 21, -21, 8, 22, -10, 1, -27, -11, 13, + -1, -2, 9, 10, 1, -10, -5, 22, -2, -27, 6, 14, 13, 17, -2, 29, -13, 8, 15, -26, + -21, -5, 20, -19, -17, 22, 28, 9, 26, 7, 21, 27, 15, 21, -13, 2, -23, 28, -16, + -6, 16, -21, -22, -1, -19, -13, -5, 11, -14, -9, 25, 16, 21, -18, -3, 13, -5, + -24, 19, -15, 13, 14, -21, -30, -17, 5, 19, 27, -14, -6, 29, -5, 12, 3, -15, 3, + 1, 4, -20, 3, 25, 3, -8, 22, -19, 6, -8, 13, 0, 20, -2, -11, 15, 10, -20, 5, + -23, -8, -27, -30, 14, -27, -22, -10, 14, -17, -22, 12, -14, -23, -30, 2, -6, + 14, 29, 27, 14, -13, -16, -24, 16, -11, -14, -19, 8, 12, -12, -3, -28, 9, -12, + -6, -19, 15, 19, 27, -22, -2, -27, -8, 16, 25, 25, -12, 11, -11, 7, 3, -3, -13, + -5, 4, 25, -21, 26, -30, -20, -12, 23, -2, -8, 20, 4, -25, -4, -4, 28, 26, 4, 0, + -13, 26, -26, 25, 17, -7, 15, 29, -29, 18, 6, 17, -1, 3, -6, 6, -5, 15, -26, + -11, -15, -1, -23, -27, -10, 9, -29, 23, -11, -18, -3, -7, 23, 19, 21, -27, -2, + -7, -26, -8, -29, 29, 0, 23, -19, 1, -29, 26, -9, 12, -10, 0, 6, 14, 7, 19, -23, + -19, -22, 21, -18, 13, -25, 9, -10, 6, -23, -16, -20, 27, -11, -9, 26, -25, -8, + 5, -3, 12, 12, -17, 1, 25, -6, -20, 26, -19, 2, 20, -7, -26, 12, -19, -2, -3, + -4, -20, 15, -9, -19, -22, 2, 28, -2, 11, -3, -20, -11, 24, -29, -10, 22, -19, + 10, 7, 28, -22, -12, 5, 19, -9, -21, 5, 2, -28, 23, 18, -17, 18, -2, 26, -26, + -20, -18, 16, 3, 6, 7, -16, 24, -20, 27, 1, -13, -4, -7, -27, 1, -11, -26, -10, + 9, -24, 23, 24, 19, 17, -9, 22, -28, 0, -4, -29, 11, -18, -13, 11, 11, -26, 21, + -28, -19, 16, 17, -1, 21, -3, -1, 11, -12, -18, -18, -1, 27, -9, -13, -7, 29, + -11, 28, -29, -20, 16, -24, -1, 26, 7, 16, 28, -18, -3, -18, -13, 24, -12, 21, + -12, 27, -14, 22, 1, 26, 24, 22, 13, -28, 12, 6, 15, 29, -29, -16, -10, 1, -9, + 27, -23, 8, 23, 10, -20, -20, 29, -6, 26, 8, 17, -5, 14, 17, -20, 21, -28, 11, + -8, 20, 17, 1, 7, 25, 3, -18, 28, 0, 27, -11, 17, 12, -26, -28, 3, 2, 7, -11, + 29, -2, -21, 26, 23, -22, 23, 19, -5, -27, 15, -2, 13, 25, -20, -29, -15, 18, 8, + 14, -21, -24, -30, -29, -6, -9, -20, -28, 3, -14, -3, 25, 12, 1, -16, 1, 1, -20, + 8, 21, -1, -23, -18, 8, -12, 1, 5, 15, -12, -27, -30, -14, -3, -4, 14, -22, -17, + 29, 21, -3, -22, -13, 5, -11, 16, -9, -20, 18, -16, 19, 29, -16, 17, -26, 10, + -19, -15, -12, 11, -17, -11, -20, 21, 21, -26, 12, 5, 25, -18, 29, 17, -29, 25, + -27, -7, 8, 11, -15, -12, -19, 27, -19, 6, -1, 3, 23, -6, -8, 23, -2, -15, -3, + -20, -11, -23, -28, -7, 12, -15, 1, -8, -16, 22, 9, 3, -16, 11, 10, -25, -25, + -26, -14, 11, 0, -22, -7, 18, -12, 26, -14, -2, 19, -28, 4, 29, -16, 15, 11, + -22, -13, 11, 7, -2, -23, 18, 3, -7, -17, -16, 23, -29, 16, -8, -28, -21, 17, + 14, -24, -13, 18, 3, -25, -5, -17, -1, 20, -19, 28, -2, 6, -22, -13, -30, 16, + -22, 9, 28, -25, 14, 16, 27, 7, -13, -16, -14, -20, -28, -12, -14, 4, 16, -16, + 7, -18, 26, -30, -4, -7, -30, -7, 19, -12, 1, -26, 0, -18, -10, -22, -19, 27, + -21, 18, -22, -22, 7, -29, -18, -27, -11, 1, 14, -5, 19, 15, 20, -20, 18, -13, + -23, -4, -23, -16, 21, -18, 26, -14, -25, -17, -12, -25, -5, 28, -29, 28, -21, + 1, -10, -30, -2, 4, -5, 28, -14, 2, -22, -14, 26, -23, -28, -4, -20, 3, -13, + -12, 12, 15, 26, -7, 12, -6, -23, -7, 0, -11, -13, 8, 7, -22, 22, 13, 25, 5, 18, + 0, 13, 14, 15, 29, 15, 12, 3, -5, 14, -20, -26, 6, -12, -28, -28, 4, -2, 27, -2, + -17, -13, 7, -25, -28, 6, -13, -10, -5, -8, 11, -3, 23, -16, 10, -24, -15, -15, + 6, 28, 13, -18, 22, -25, -7, -3, -23, 16, -25, 7, -29, 2, -14, -27, -22, -2, 21, + -17, -5, -6, -12, -27, -9, -8, 24, -21, 22, -13, 29, 3, 19, 10, -22, -29, 21, + -13, -6, -24, -3, -20, 22, 9, 8, -28, 8, -11, 6, -4, 3, -4, -10, -2, -23, -14, + -3, -24, 26, 6, 6, -22, 10, 18, -2, -22, 14, -20, 29, -28, -25, -16, -23, 29, + -15, 21, 8, -22, 0, -5, -26, 10, -30, -29, -19, -14, -15, -5, -8, -27, 18, 4, + 26, -9, -29, 24, -8, 11, -19, 6, 3, -4, 3, -6, 1, 22, -12, 15, 18, -26, 11, -1, + 2, 20, 14, -11, -18, -26, -8, 14, 13, 22, 5, -14, -22, -7, -4, -21, 20, 6, 7, + 29, -7, 13, 19, 5, -28, 13, -17, -1, 6, -26, -16, -18, 16, 9, -1, -26, 3, 10, + -5, 13, -16, 19, -11, 16, 19, -17, -6, -13, 3, 22, 8, 20, -15, 21, 21, 13, 7, + -10, -3, 20, -20, -19, 28, 27, -6, -14, 25, -15, 3, 18, -27, 15, -4, 25, -25, 2, + -17, -17, -28, -30, -27, 28, -24, 25, -22, 3, 13, 10, 6, 18, -12, -5, -12, -29, + -26, -22, -8, -18, -9, 7, 14, -22, -13, 5, 26, -28, -1, -24, -4, 8, 7, 14, -30, + -21, -10, -30, 12, 18, 14, 4, 8, 24, -6, -8, 22, -21, -2, -13, -28, -3, -25, 4, + 20, -21, -28, 25, -26, -25, -23, 5, 1, -30, -6, -22, -15, -28, 4, 4, -1, -24, + -12, 8, -2, 13, 1, 7, 19, -9, 17, -5, -20, -7, -21, -12, 25, 19, -24, -27, 27, + -29, -19, -2, -18, 20, 13, -17, 23, -29, 12, -30, -9, -28, 8, 5, 24, 17, 19, 12, + 6, 2, -10, 9, -8, -1, 1, 27, 9, -17, -8, 8, -2, 11, -2, -5, 0, -28, 25, -29, 19, + -25, -24, -30, 29, 1, 17, 16, 13, -5, 29, -26, 15, 24, -3, 25, -30, 2, 15, 12, + 5, 23, 24, -17, -21, -4, 14, 12, 9, 13, 17, 12, -2, 24, 2, -6, 12, 5, 11, -17, + -18, -29, -5, 10, 18, -11, 15, -20, -4, 16, 26, 28, 24, 0, -22, 17, -15, 25, -4, + 28, -17, 3, -2, -23, -28, 27, -5, -25, -13, 11, -25, 0, -18, 22, -27, -12, 11, + 21, -4, -3, 2, -27, -18, -17, -7, -8, -8, -22, 25, 7, -9, 5, -19, 14, 7, 27, 9, + 8, 19, -7, -20, 15, 24, -18, -9, -8, 19, 28, 18, 28, 11, -28, -30, -26, 7, -11, + -22, -24, 26, 14, -22, -2, 20, -27, 18, 26, -3, 13, 20, -26, 18, -12, 2, 29, -9, + 26, -25, 12, 21, 17, 16, 26, -12, -14, 2, 26, 17, -10, 11, -27, 23, -18, -30, + -11, 0, -3, 1, -9, -18, 23, 10, -22, 4, 11, -30, 13, 7, -21, -26, 11, 15, 24, + -5, 11, -21, 1, 26, 18, -24, 25, -2, 1, -29, -23, -13, -16, -11, -20, -21, -23, + -11, -15, 14, 3, -12, -1, 22, -1, -11, 21, 13, 12, -4, 17, 9, 27, 29, -13, 3, + 10, 28, -1, -24, 14, 23, -21, -23, 28, -20, 16, -15, 28, -9, -4, -15, 26, -12, + 4, 20, 6, 16, -12, 16, 16, 22, 4, -7, -2, -10, 4, 21, -19, 12, 16, 18, 6, -14, + -24, 25, 12, -3, -5, -4, 8, -5, 11, -17, -6, -17, 2, -2, 20, -28, -15, 23, -2, + 23, -23, 19, 8, 1, 26, -28, 15, 18, 23, 23, -14, 20, -7, 27, -27, 8, -22, 3, 5, + -30, 10, -9, 4, 24, -7, -6, 25, -18, -17, 1, -5, 25, 3, 20, 5, -14, 7, -25, -15, + 20, -10, 7, -25, -2, 9, 19, -17, 20, -24, -3, 4, 22, -18, -26, 23, 9, 24, -25, + -29, -19, -30, 27, -2, 18, 15, -26, -19, 29, -30, 23, 7, -20, 15, -6, -8, 24, + -27, -20, -27, -13, 7, 24, 7, 10, -7, -8, 28, 4, -8, -3, 3, -7, -30, -4, 12, 19, + -7, 23, -3, 11, 12, 16, -8, 12, -13, -16, 4, 17, -1, 11, -8, 4, 13, -12, -29, 7, + 13, -12, -25, 22, 13, 13, 29, -29, 8, 29, 17, 28, 5, 14, 23, 8, 19, -19, 13, + -27, -30, -6, 13, 25, -27, -1, -21, 10, 15, -17, -4, -8, -18, -25, 2, 11, 10, + -11, 29, 3, -25, -18, -4, 5, -30, -10, -24, -1, 1, -29, 25, 23, 19, -10, -19, + 28, -18, 29, -1, -1, 5, 18, -29, 10, 26, 29, -20, -21, 9, 15, 19, -4, -25, -9, + -23, -2, -3, 26, 0, 0, -19, 29, -24, -10, 12, 22, -26, -9, 15, 29, -9, 9, -1, + 14, -6, 20, -13, 9, -13, 18, 20, 14, -25, 22, -23, 27, 25, -21, -2, -29, -8, + -16, 8, 20, 16, -6, 7, 13, 11, -26, -14, 15, -24, 1, 0, -26, 26, -2, -8, 8, 23, + 0, 20, -10, 2, 29, 4, -17, -13, -17, 13, 10, -6, 6, -23, 20, 18, -9, -11, 27, + -16, -5, 14, -2, 29, -1, 18, 18, -8, -15, -2, 2, -23, -7, -11, -1, -22, -26, 24, + -18, 17, -8, -30, -16, 20, 14, 20, 17, -15, 20, 9, 20, -20, 13, -12, -10, 15, + -17, -17, 10, 6, -4, 16, -10, -7, 16, -22, 25, -4, 9, 25, -3, 8, 12, 12, 27, 16, + -15, 9, 18, -25, -25, 1, 16, 25, 13, 17, 29, -11, 5, 23, -30, 14, 28, 22, 9, + -30, 3, -15, 29, 24, -11, 28, -8, 26, -11, -24, -27, -5, -14, 29, -5, -4, -10, + -25, -28, -6, -15, 18, -11, -16, 25, -20, 19, 26, 16, 28, -5, -15, -28, -4, -15, + 7, 22, 0, 22, -21, -19, -18, 9, 26, -2, -1, 10, -27, 11, 12, 15, 19, -27, 22, + 23, -25, -13, -28, 19, 24, 20, 3, -17, 25, 1, -8, 3, -17, -20, 5, 12, 18, 25, + -2, -9, -13, 4, 11, 17, -15, 4, -28, -7, -12, -17, 14, 18, -1, 2, -4, -16, -26, + -11, 1, 18, 15, 8, -8, 18, -10, 8, -8, -26, 8, 17, -5, -4, -12, -27, -18, -19, + -27, 26, 10, -30, 29, 10, -15, -17, -8, 28, -24, -27, -30, -14, -15, 8, 2, 18, + -14, 26, 14, 10, -4, -13, -4, -7, 15, -18, -24, -16, -10, 9, 5, 21, -28, 18, + -18, -1, 2, -26, 9, -17, -12, 18, 22, 4, -16, 0, 27, -21, -20, -21, 5, -3, 21, + -24, -21, 25, -8, 11, -22, 29, 10, 2, 8, 17, 8, 21, -13, -28, 12, 14, -30, -23, + 23, -29, 12, -10, -20, -29, -11, 15, -29, -6, 17, -11, -5, 9, 0, -23, -5, -22, + -8, 13, -29, 28, -2, 14, 27, -21, 20, -11, 20, -16, -16, -24, -17, 1, 19, -28, + 16, -4, 21, -30, 3, -7, 24, -1, 27, 9, 20, 13, 19, 11, 13, 23, 15, 18, 17, -4, + 24, -19, 17, -27, 16, 20, -13, 5, 14, -14, -2, 7, 12, -11, 26, 20, -28, -22, 16, + -26, 4, 9, 14, 16, -10, 18, -8, 11, 12, -19, 2, 19, 17, -26, 10, -24, 11, 21, + -18, 12, 28, -4, -17, -14, 4, -21, -19, 16, -7, -28, 7, -2, -30, 25, -29, 28, + -6, -21, -21, 18, -7, 29, -13, -29, 16, -30, 23, 27, 22, -8, -2, -11, -1, 6, 5, + 14, -7, -7, 13, 24, 19, -13, 8, -24, 6, 20, -9, 11, -4, -14, 25, 15, -5, -27, + -20, 11, -18, -15, 20, 17, -25, -15, 6, -28, -19, 28, -4, -22, -2, 13, 23, -22, + -18, 15, 10, -25, 3, -13, 17, 7, 16, 24, -6, 7, -16, 14, -16, -23, -9, 19, 6, + -2, -4, -9, -21, 13, -25, 14, 15, -2, -28, 16, 23, 16, 10, 4, 27, -8, -19, -6, + 1, -22, -23, 20, 21, 13, -25, 16, -16, -29, -13, 4, -25, 3, -4, 7, -16, 4, -23, + 8, -16, 3, 26, -19, -8, 4, 10, 7, 2, -18, -12, -4, 28, -27, -11, -18, -24, -26, + -4, 10, 11, 10, -15, -19, 8, -13, -20, -15, 2, -8, -13, -21, 26, -24, -13, -30, + -30, 15, -8, -22, -6, -23, -11, 2, 18, -24, -2, 10, 6, 5, -12, -11, 10, 18, 18, + -19, -11, 15, -9, -4, -12, 23, 1, -27, -23, 10, -10, 0, -25, 22, -2, -9, -19, + -10, 27, 28, -18, -5, 28, 8, 11, 22, -2, 5, -16, -9, 18, 24, 3, 2, -3, 29, -21, + 27, -14, 0, 29, 8, 12, -14, -8, 3, -4, 17, -30, -19, -18, -7, 8, -18, 5, 16, 15, + -22, -22, -23, 2, 21, 21, -22, -12, -3, 22, -1, 2, 26, -5, -9, 22, -1, -13, -22, + 23, 3, -28, -12, -27, 8, -18, 18, -26, 1, -8, 27, 2, -8, 8, 26, -16, 24, -26, + -5, -11, -21, -1, 8, -6, 26, 24, -30, 28, 6, 26, -3, -8, -19, 24, 4, 6, -18, + -20, -25, -3, -16, 24, -9, -12, -11, -23, 24, -7, -16, 11, 19, 15, 0, -5, 1, + -25, -12, -28, 5, -9, -19, -22, -22, -6, 15, -26, 14, 5, 0, -21, -17, 19, 14, + -22, 14, -19, 8, 0, -18, -27, -7, -2, -25, 28, -23, -14, -19, -12, 24, -27, 5, + 19, -27, -27, 14, 22, 24, 0, 8, 6, -16, -4, -1, 8, 5, -26, 7, 25, 13, 1, 29, -7, + -26, 12, 25, 18, 5, -20, 14, -19, 2, -23, 24, 8, -27, -27, 9, 11, -25, -6, -24, + -7, 13, -7, 14, 19, 27, -1, 14, -28, -3, -23, -23, -27, 29, -20, -21, 11, -12, + -18, 1, 3, -26, -15, 8, 26, -19, 17, -6, -26, 14, -18, 9, -6, 28, -20, 1, 1, 5, + 23, 16, -9, 15, 23, -11, -16, 12, 20, -4, 29, -13, -25, -2, -6, 0, 9, -24, -6, + -22, -26, -10, 2, -1, -10, -5, 25, 12, -24, -8, 26, -8, -4, 7, -16, -20, 11, + -10, -22, -11, -18, 8, -22, -2, 16, -20, 25, 4, -24, -4, -26, 15, 15, -19, 12, + -1, -1, -30, -14, -18, -6, 11, 12, -10, -9, -3, -20, 19, 13, -1, -4, 2, -21, 27, + 20, 15, 3, 12, 25, 21, -1, 20, -25, 25, 4, 22, 20, -25, 29, 23, 25, 17, 9, -3, + 18, 28, 15, 16, -17, 8, -30, -7, -26, 16, 23, -30, -26, 12, 18, -11, -19, 29, + 11, -28, 29, -9, 9, -26, 29, 17, 24, -24, 14, -15, 29, -17, -22, 2, 22, -10, 6, + -20, -19, 20, -29, -9, -3, 15, 11, -11, -16, 16, -15, 22, 25, 25, 21, -6, -17, + -27, -5, -18, -17, -9, 9, 15, -2, -28, -4, 20, 6, 22, 15, -10, 6, 12, -20, -1, + 19, 16, -3, -11, -18, 1, -17, -19, 12, 18, -3, 9, 4, -30, 23, 14, 11, -6, 2, 22, + 16, 13, 9, 9, 20, -3, 23, 11, 6, -24, 8, 0, 19, 28, 7, 24, 6, 19, -20, -1, 2, + 18, 10, 16, -25, 18, -28, 21, -28, 27, -22, 15, -8, 6, 5, -17, 12, -27, -5, 22, + 24, 29, -20, -18, 14, -1, 24, 11, 3, 7, 3, 18, 21, 7, 1, -16, -7, 17, 8, 18, + -30, -30, 27, 1, -7, 26, -25, 5, -27, 8, 5, 8, 24, 14, -21, -12, 27, 25, 14, + -19, -22, 5, 6, -29, -1, 12, -12, 24, 28, 18, 12, 7, -7, -19, 26, 28, 12, -10, + -21, -30, 25, 0, 14, -12, 22, 0, -18, 12, -8, 7, 28, 11, 28, -19, -27, -30, -16, + -30, 13, 21, -5, -30, 22, -30, -20, 9, 16, 25, -8, -18, 7, -20, -6, -17, 7, -30, + 19, -5, 13, 1, -5, -17, 18, 16, 2, 14, 1, 2, -6, -5, 18, -18, -18, -7, -30, 13, + -16, 3, -29, -1, 21, 26, 28, -27, 13, 24, -22, 27, 18, -29, 6, 26, -23, -29, 8, + 24, 7, -4, 21, -11, 19, -19, 5, -25, -2, 18, -1, 2, 13, -6, 4, 7, 3, -7, 20, 22, + -6, 11, 5, -2, 15, -9, -8, 16, -10, 6, -30, -16, 28, -3, 14, 22, 16, 19, 16, + -27, -10, -18, 2, 6, -1, 6, 20, -12, -21, -29, -29, -5, 12, -19, 6, 3, -22, 3, + -27, -9, -23, 12, -12, -17, 4, 19, 0, -8, -7, 28, -19, -9, 2, -23, -10, -18, + -23, -5, 13, 10, -17, -26, -20, 28, -20, 8, 11, -5, -20, 29, 29, -12, -8, -11, + 6, -2, 14, 23, -26, 21, 26, 23, 22, 6, 26, 22, 20, -20, -11, -7, -27, -6, -19, + 28, -8, -23, 2, -18, 23, -7, -28, 23, -23, 1, -3, -15, 20, 20, -3, -12, 12, -17, + 2, 5, 13, -7, -29, 22, -25, 21, 13, -12, 14, -29, 5, 29, -26, -6, 10, -22, 5, + -2, -21, -2, 17, -30, -7, -3, 22, 22, 6, -9, -9, 0, -5, -25, -3, 28, 8, -28, 20, + -19, 17, 21, -6, 6, -26, 27, -17, -1, 20, -12, 23, 13, 3, 21, 8, 1, -29, 7, -20, + -6, 3, -28, 11, -26, -5, 14, -15, -24, -7, -6, 6, -9, -29, 27, -17, -22, -20, 4, + -17, 3, 15, 4, 8, 11, 18, 17, 19, 1, -27, 29, 6, -21, -25, 22, 19, -30, -6, -20, + -21, 28, 23, 5, -10, -27, -27, 25, 27, -17, 11, -20, 1, 4, 5, 14, -9, 27, -17, + -14, -27, 22, -23, 6, 28, 18, -1, 22, -4, 28, 26, -1, 14, -7, -19, 28, 16, -14, + 29, 5, 29, -14, 11, 9, -27, -4, 12, 18, -30, -15, -25, -17, -25, -1, 16, 10, -6, + 13, -23, 4, 5, -24, 29, 26, -30, -6, -17, 25, 27, -7, 4, 11, -16, 15, 13, 13, + 20, 17, -24, 25, 12, -26, 21, -3, 12, -30, -18, -11, -28, 16, -9, -29, 19, 18, + 29, 21, -6, -5, 21, 9, 3, 4, 13, 25, -2, 0, 24, -12, 13, -11, 15, -26, 5, -11, + -23, 8, 9, 13, -5, -20, 22, -10, 0, -8, -19, -19, -24, -7, -8, 1, -4, -4, -11, + -11, 19, 16, -30, -1, -11, -4, -23, 17, -29, -11, 13, -2, 27, 3, 9, 5, -22, -11, + 25, -1, -15, 26, 28, 19, -18, -8, 3, -25, -29, 21, 21, -7, 29, -15, -8, 24, 14, + 19, -16, -7, 13, -22, 20, 10, 8, 3, 1, -13, 0, 26, 11, -16, 21, -29, -1, -14, 1, + -12, -17, 22, 14, -24, -10, 20, -8, 23, -9, 14, 5, 29, -23, 5, -7, -11, 18, 29, + -10, 8, 16, 25, -3, 18, -11, 4, -20, 17, 19, -12, -29, -8, 28, 29, 2, -21, -28, + 6, -28, -6, -3, -19, -27, -13, -3, 1, -1, 6, -9, -26, 20, 9, 11, 24, -27, -7, + -16, -9, 26, 24, -13, -1, -7, 27, -2, 29, 5, 24, 20, 19, -24, 14, 1, -22, 7, + -15, -9, 25, -22, 10, -29, -3, -17, -5, 13, -25, 7, -29, 14, -26, 16, -27, -20, + 0, 27, -4, 5, 29, -3, 4, -6, -1, 18, -21, -13, -28, 10, 19, -24, 13, -13, 27, + -14, 10, -3, 25, 27, 20, -19, 24, 8, 13, 29, -28, -6, 12, 28, -4, 29, 25, 14, 2, + -27, 14, -12, 5, 15, 11, -22, -28, -13, -28, -2, -13, -12, 26, 29, 17, 1, -10, + 17, -15, 15, -6, 13, 21, 16, -3, -10, 12, 10, 18, -14, -29, -14, 27, 15, 13, + -19, -12, 15, 21, -3, -12, 11, -19, 17, -23, 27, -23, -18, -3, -16, 21, 29, 24, + -23, 27, -10, -4, -17, -19, -8, 11, -13, 27, 8, 8, 27, 6, 21, 19, -30, -27, 17, + 23, -6, 13, 17, -14, -8, -3, 18, 28, -23, 7, 28, 24, 19, 7, -3, -24, 8, 9, 3, + -28, 17, 17, 4, 19, 27, -28, -29, 6, -18, -30, -8, 26, -18, -4, -28, -15, -13, + 22, -18, 9, 22, -3, -30, 0, -23, 28, 17, -25, 25, -6, -24, 10, 6, -30, -23, 6, + 25, -9, 23, 3, -21, -11, -27, -10, -24, -20, -14, -18, -12, -16, 6, -6, -7, -30, + 17, -5, 11, 4, -19, -20, 1, -25, -11, 20, 4, -26, -8, -9, 15, -9, 9, -30, 9, -3, + -3, -27, 20, 11, 19, -17, -17, -25, -7, -20, -1, -25, 12, 18, -13, -20, -11, + -17, -6, -27, 11, -21, -26, 17, -19, -17, 14, -24, -11, -2, -23, -16, -1, -4, + 26, -9, -24, 5, -27, 10, -4, 3, -20, -14, -30, 0, -1, -17, 15, 11, -6, 10, 6, + -14, -24, 22, 11, -6, 21, 11, -1, 27, -30, 23, 8, 27, 21, 14, -5, 2, 21, 26, + -10, 11, -1, -11, 21, 26, -18, 23, 4, -15, -22, -9, -9, 18, 15, 21, 6, -16, 22, + -30, -5, -10, -4, 21, 16, -26, -17, -21, 21, 9, 11, 6, -12, 0, 9, 14, -4, 15, + 25, 17, 3, -10, -27, 25, -28, -2, -6, 12, -13, -23, -5, 7, 2, 26, 28, -24, -30, + 20, 10, -1, 27, -13, 8, 15, -3, 10, -13, -21, 18, 11, -5, -28, 1, -4, 9, -1, + -18, -18, 9, 5, 18, -7, 13, -11, -2, 12, -27, -11, -26, -9, -2, -24, -5, 11, -6, + -27, -10, 17, -22, -21, -3, 19, -24, -27, -11, -4, 16, -11, 10, -1, 8, 12, -26, + -16, 0, 0, -4, 15, 19, -17, -19, -10, -19, -24, -14, 13, 27, 16, 18, -27, 5, -1, + 28, -30, -8, -24, 24, -6, 3, -29, -26, -24, -28, -21, 3, -18, -25, -11, 13, -25, + -14, 12, 23, 28, 25, -7, 5, 6, -5, 15, 2, 1, 27, 5, -9, 21, 3, -23, -11, -22, + -2, -19, 27, -10, 24, 19, -26, -22, 12, -2, 19, -27, -21, 25, 27, -6, -12, -19, + 22, 21, 25, -1, 5, -9, 23, 18, 6, -13, 26, -5, -18, 24, 12, -8, -18, -8, 8, -21, + -17, 22, -15, 13, -29, -4, 29, -11, 10, 25, 12, 23, 11, -1, -16, -29, 8, 21, + -22, 23, 20, 16, 0, -22, 15, -16, 2, -14, 29, 2, -23, 1, -11, 20, 7, 20, -18, + -11, 20, 25, -17, 19, -15, -17, -10, 27, 3, -4, 3, -16, -4, -25, 11, 21, -18, + 24, 5, -11, -19, 5, 2, 21, -22, 10, 25, 25, 25, 17, -26, -29, 5, -11, 2, 5, 13, + -26, 1, 2, -1, -22, 24, 29, -4, 6, -26, -3, -1, 3, 15, -15, -22, -12, -20, 28, + -1, -26, 2, 17, 21, -5, -8, 6, 23, -28, -27, 19, 6, -6, 27, -1, -2, 12, -2, -2, + -9, 24, 5, 21, 3, -25, 27, -2, -16, -17, -10, -16, -4, -12, 9, 24, 21, -17, 21, + -21, 18, 3, -23, -7, 5, -19, -5, -10, 7, 3, -21, 8, 6, 29, -4, 8, -6, 2, 22, + -18, -10, 6, 14, 16, -2, -3, -15, 2, -26, -17, -9, -15, 18, 22, -3, -13, -14, + -2, 15, -24, 6, -1, 20, 15, -5, 14, -21, -10, -24, 2, -6, -9, -29, -2, -1, 4, + 24, 21, -17, 3, 12, 5, 20, 1, -16, -4, 19, -23, -23, 17, -7, -12, -20, -16, 24, + 18, -22, -19, -14, -12, -26, 19, -9, 14, 4, -7, 8, 9, 10, 27, 2, -13, 10, -1, 7, + 26, 27, -2, -9, 6, -7, -26, 27, -6, -12, -23, 19, 15, 5, 12, 9, 18, -13, 15, 12, + -9, -27, -7, -9, 10, 29, -28, 7, -2, -6, 7, -25, 13, 23, 4, 26, 8, -9, -11, 20, + 23, 2, -6, 2, -15, -14, 22, -27, 26, 12, -16, -2, -2, -23, 17, 3, 12, 24, 15, + 22, 15, -18, -4, -26, 1, -11, -3, -9, -7, -17, 10, 12, 15, 3, -19, -3, 3, 2, 15, + 28, -30, -1, 26, -4, -1, -30, 5, 23, -10, -21, -15, 10, -4, -5, -2, 3, 18, 24, + -18, 23, -17, -15, -18, -9, -4, -19, -16, -25, -21, 25, -20, 23, -18, -2, -13, + 14, -6, -2, -19, -23, -28, 18, 14, -21, -21, 25, -10, 5, 20, 0, 11, 26, -12, -4, + -4, 28, 28, -2, -1, 9, 19, -2, -9, 2, -15, 5, -19, 2, 23, -30, -27, -28, -21, + -22, 10, -26, -18, 7, -6, -2, -11, 9, -9, -1, -3, -26, 16, -27, 7, -30, 24, 2, + 4, -29, 21, 1, -17, -22, -16, -2, 13, 5, 22, -28, 10, -18, -16, -25, -25, 6, -8, + 17, 18, 16, 23, -2, -30, 29, 10, -23, 8, 27, -15, 15, 3, -26, -25, 29, 1, 3, + -14, 18, 26, 5, -26, -19, -30, -30, 29, -7, -17, 14, -18, 26, -11, 20, -9, 20, + 23, 6, 14, -16, -21, 27, -6, 24, -26, 20, -24, -4, 6, -9, 4, 3, 28, 0, 7, -29, + -18, -9, -16, 12, 2, -17, -18, -16, -23, 25, 6, 9, -28, -24, 4, -14, 1, -7, 4, + -17, -26, 17, 28, -17, 22, -18, -3, -28, 1, -9, -24, -10, -17, 16, -2, 13, -16, + -3, 24, -27, 11, 19, -11, 20, -27, 21, 21, 3, -23, 18, 3, -17, 3, 24, -1, 27, + 18, -15, 7, -6, -29, -10, -3, 10, -16, -3, -5, 4, -15, -29, 6, 20, 22, -5, -9, + 18, 17, -17, -25, 19, 16, 21, 15, -26, -24, -30, -10, 6, -23, 7, 3, -4, 19, -27, + -10, -9, -15, 10, 14, -24, 12, 6, 9, 5, 15, 20, 13, -26, -22, -17, -4, 22, -15, + 6, -1, 0, 7, 20, -21, -26, 4, 28, 29, 7, 29, 23, 16, -15, 11, -12, 28, -6, -13, + 14, 2, 8, 29, -25, 7, 13, -21, -23, 15, -4, -16, 17, -4, 10, 23, 11, 24, 9, 6, + 13, 20, -21, -23, -11, 21, 4, -7, -2, -27, 25, 13, 3, 27, -19, 12, -22, 25, -18, + 11, -12, -16, -19, 6, -6, -30, -12, 19, -22, 28, 9, 28, -8, 25, 15, -29, -9, + -17, 16, -9, -4, 21, -30, 5, 25, 2, 28, 17, -1, -2, 6, -13, -22, 20, 18, -18, + 10, 20, 9, -11, 15, 10, 4, 17, 27, -13, 28, -13, 5, -3, 29, 14, -18, -9, -4, -3, + 15, 14, 17, 3, -11, 3, -28, -16, 9, -23, -7, 21, 8, -21, 25, -17, -28, -11, -4, + -7, -26, -5, -3, -4, 22, 3, -16, 9, -3, -9, -28, 11, -6, 16, -24, 6, -7, 19, 25, + 28, -14, 9, 27, -14, -15, -18, -26, -14, -25, -10, -9, 13, 23, 5, 2, -8, 16, + -19, -5, -27, 20, -21, -10, 24, 26, 2, -23, 3, 10, 15, 1, 20, 25, -26, -24, 1, + -16, -29, -23, -26, 4, -22, 7, -12, -8, -19, 16, -19, 21, 19, 7, -11, 7, 9, -15, + 28, -5, -19, 12, -6, -20, 11, -6, -20, -11, 26, 28, 19, -3, -21, 0, 11, 13, 14, + -9, -5, 28, -2, -17, -11, -26, -18, -24, -18, -17, -23, -3, -9, -4, 14, -30, 25, + 15, 15, -9, 12, 15, 4, -20, -16, 16, 21, -9, 25, 12, 21, 14, 5, 4, -27, -2, -14, + 2, 25, 7, -9, -21, -15, 15, -15, -2, -16, 5, 11, 3, -2, -30, -5, -17, 21, 26, + 14, -11, -5, -7, -20, 2, -5, 22, -6, 11, -27, -6, 29, 15, -1, -30, -12, -25, -5, + 11, 6, 13, 11, -2, -15, 13, -23, 23, 27, 5, 27, -29, -29, -27, 18, -5, 8, -29, + -20, 26, 15, 13, 19, -30, -5, 19, 6, -5, -14, 20, -5, -16, 18, -15, -5, -19, + -19, 13, -17, -8, 11, -11, -28, -12, -25, -1, -3, 9, 13, 11, -28, 2, -5, 2, -17, + -13, -26, -21, -19, 16, 24, 4, 3, 6, 4, 14, 20, -29, 11, -11, -27, -22, 22, 18, + 10, 7, -7, -20, 22, -23, -26, 13, -29, -27, -5, 14, -8, 13, 26, 7, 9, -10, -13, + -23, 21, 26, -18, -21, -17, 6, -7, -29, -25, 11, 9, 29, -5, 14, -7, 10, 18, -26, + -23, -9, -2, -15, 6, -6, 7, -18, -11, 22, 12, -2, 6, 19, 9, 0, 10, 9, 2, 19, 2, + -30, -24, -13, -23, -22, 14, -21, 24, 23, -8, 6, -24, 19, 19, -7, -16, -23, -8, + 13, -2, -18, 16, 22, 29, 24, -24, -13, -6, -24, 11, 19, -1, -14, 13, 17, -4, + -11, 23, 28, 17, -26, -30, 5, -23, -3, -16, 17, -22, -8, -25, 4, -11, 21, 12, + -24, -15, 18, 6, 16, 8, 8, -27, -20, -22, 8, 10, 22, 3, 29, 11, -1, 8, -28, 5, + -16, 18, -5, -20, -3, -1, 22, 15, 19, 1, -12, 15, 11, 25, 4, 19, 2, -11, 0, -28, + -16, 19, 14, -14, -15, 2, -24, 8, -14, 14, -12, 28, -17, 0, 15, -1, 17, 20, -21, + 24, 19, -12, -18, -29, -14, 14, -25, 26, -26, -19, -11, 12, -27, -3, -6, -21, + -13, 17, 20, -20, -8, -14, -6, 20, -15, -13, -1, 2, -19, 28, 27, -20, -8, 16, + 29, 8, -9, -25, 5, 4, -1, 12, -1, -26, -23, 16, 12, 14, 11, -20, -26, -2, -8, + -15, -26, -27, -10, -17, 0, 19, -15, -1, 10, 25, -7, 18, 27, 24, 24, -12, 28, + -3, 26, 10, 10, 16, -10, -8, 27, -18, -18, 6, -27, -30, -16, -26, 9, -26, -1, + 12, 1, 24, -15, -6, 29, 7, 15, 23, -3, 29, -1, -2, 20, 0, -10, -17, 2, 20, -10, + -2, 11, -7, -13, 9, 23, 20, 23, 14, -26, -20, 12, -23, 13, 3, 5, -12, 23, -20, + -19, 21, 7, -7, 3, -12, 15, 26, 0, -6, -26, -3, -9, 14, 16, 27, -9, -24, -18, + 12, -20, 24, 13, 15, 28, -20, -25, -26, -3, 10, -19, -14, -1, -19, -24, -14, 16, + 7, -29, 22, 24, 13, 7, -13, -1, -1, 6, -11, 22, -18, -1, -10, -7, -4, 22, -6, + -24, -28, 4, 5, -27, -29, -27, 13, -25, -9, -2, -13, 29, -26, -25, 25, -11, 10, + 21, -2, 21, 25, -18, -13, 7, 16, 26, 23, -19, -29, -30, -22, -5, -4, 0, -2, -6, + 0, 13, 23, -30, 10, -5, 12, -28, -3, 4, -29, 27, 23, 28, 2, -16, -11, -17, -15, + 6, -13, -2, 6, 12, 0, -12, -21, -2, -19, -22, 6, 26, -25, 17, -19, 11, -12, -20, + -14, 28, -19, -12, 12, -5, 6, -9, -16, -14, -22, -30, -30, -20, 29, -8, -29, 14, + 20, -23, 8, 8, -8, 16, -18, 10, 7, -5, 2, -21, -12, -24, -25, -7, -18, 21, -1, + 1, 4, -24, 26, 2, 4, -27, -21, -3, -25, -12, 22, -29, 6, -29, -10, -14, -17, 24, + -24, 22, 17, 13, 28, -23, -11, 13, -11, -29, -22, -29, -15, -12, -6, -3, -18, + -28, 28, -18, 16, -24, 17, -26, -29, 15, -18, -4, 13, 19, 3, 11, 6, -29, -21, 6, + 20, -10, -15, -11, 18, -14, -25, 28, 5, 12, 18, 15, -25, -12, -22, 28, -8, 9, + -17, -26, 14, -19, -23, 15, -20, 12, 4, -19, 15, -21, 13, -2, -2, 29, 10, 29, + 16, -18, 5, 14, -24, 11, -12, 1, -27, 21, -20, 16, -8, 22, 13, 7, -24, -29, 18, + 29, 0, 4, 6, 21, 23, -13, 2, 26, 17, -12, -15, -19, 26, -9, -1, -12, 10, 22, 18, + -27, 17, -7, -16, 1, -12, 4, -10, -17, 15, 17, -7, 4, -7, -16, -7, -12, 11, 4, + -30, 29, -26, -13, 22, 21, -15, 5, -27, -18, 14, 19, 27, 5, -11, -1, -10, -9, + -25, 29, 16, 4, 29, -7, -21, -14, -2, -4, 12, 2, -3, -28, -26, -5, 29, 3, 17, + 24, -5, -12, -4, 29, -15, 10, -25, 18, -10, 15, -19, -30, -18, -27, -19, -26, 9, + 4, 0, -1, 4, -21, 13, 19, -17, 9, 29, -27, -19, -12, -30, 19, -2, -16, -1, 24, + -13, -26, -19, -12, -11, 13, -11, 3, 24, -17, 15, -25, -21, 14, -5, 29, -10, + -27, -2, 7, 28, -3, -8, -23, -9, 5, 13, -14, -20, 21, 26, 19, 28, -28, -17, -14, + 5, -23, 11, 25, 14, -20, 0, 17, -8, 11, -16, 22, -14, 11, -19, -23, 28, 6, 18, + -27, 22, -18, 2, 13, -5, -9, -22, 3, 3, 28, 15, 17, -22, -29, -30, 16, 4, 8, 1, + 6, 2, 11, 8, -27, -7, -27, 20, 19, 15, -26, -1, 5, -1, -4, 29, 28, 22, 19, 23, + 26, 24, -12, -6, -15, 0, -5, 23, 12, 2, 9, -29, 3, 27, -26, -10, 27, 10, -30, + -20, 3, 29, -25, 28, -1, 26, -13, -3, -2, 2, -5, 23, 14, 9, -21, 21, -22, 12, + 10, 17, 2, 19, -26, 12, -29, -19, 21, -2, 26, -1, 23, -6, 1, 19, -16, 24, 17, + -9, 22, -28, -8, 1, -20, 8, 19, 16, 19, -6, 28, -12, -6, -20, 13, 24, 13, 9, 29, + 6, -18, -3, 24, -19, -1, -20, -9, -5, 28, -17, 2, -27, -14, 28, 2, -4, -6, -26, + 27, 29, 0, 10, -18, -2, 16, 1, -19, -20, -30, 17, 8, -11, 2, -14, 13, 20, 7, 11, + -17, 11, -27, -10, 7, -8, -26, 7, 23, -16, -10, 0, 0, 22, 11, 9, -22, -3, 0, 15, + -17, 16, -22, -10, -27, -21, 10, 18, -9, 7, -26, -18, -6, -22, 18, 25, 27, -18, + -1, -21, -11, 16, -18, -14, 17, -3, 8, -26, -18, -23, 6, 11, -10, -24, -27, -21, + 28, 22, 20, 4, -28, -9, -7, 3, -24, -24, 10, 19, -30, 17, -4, 29, 26, -20, -13, + -15, -25, 14, -10, -21, 2, 18, -9, 7, 14, -5, 26, -17, 16, 8, -3, 24, -25, 11, + 19, 29, -27, -23, -17, -24, -28, -26, 22, 17, -5, -24, -14, 20, -27, -1, -3, -9, + -20, 12, -15, 2, -1, -17, 9, 16, -13, -17, 14, -29, -8, 4, -11, 24, -28, 9, 16, + -16, 9, -8, 28, 15, -4, -24, 29, 20, 11, 22, -26, 13, -14, 20, -19, -22, -30, + -15, 8, 4, -29, -11, 21, 28, -4, 22, 10, 7, -1, 21, 25, 0, 14, 24, 3, 3, 20, -7, + -22, 24, 17, -25, 13, 7, -11, -24, 16, -25, 26, -28, -20, -7, -3, 1, 4, 24, -2, + 8, -1, -25, 0, 28, 22, 4, 6, -26, -17, 12, -27, -11, -9, -12, 8, -4, 9, 23, 9, + -14, -12, 6, -5, 14, -5, -27, 1, -21, 1, -26, 6, -17, 4, -27, 3, -7, -9, -13, 2, + 25, -21, 8, 9, 2, 14, 5, 14, -26, 15, -26, -26, 13, 10, -14, -22, -25, 9, -15, + -22, 24, 10, -5, 13, -25, 20, 7, -14, 18, 20, 21, 29, 22, -1, -14, 25, -17, 29, + -30, 26, 28, -14, -19, -13, 13, -9, -13, 10, -7, -7, -15, -7, 14, 13, 10, -15, + 28, 19, -26, -13, -21, -3, -6, 15, -11, -8, 25, 8, 8, 10, 24, -3, -20, 23, -2, + -18, -18, -7, -14, 15, 10, -8, -19, 2, -9, 12, 15, 1, 9, -26, -30, -29, 2, 18, + 24, 8, -11, 22, 27, -16, 29, -24, -30, -3, 11, -7, 6, -11, -12, -14, 18, -15, + 15, 21, -15, -3, 6, 10, 7, -18, 26, -3, 19, 2, -28, -1, -4, -28, -28, -4, -6, + 11, -25, 22, -12, 25, -7, 13, 29, -27, -28, -4, 20, 5, 3, -23, 8, -2, -25, -22, + 1, -2, 1, 7, -3, 28, -6, 24, -20, -24, -9, 22, 19, 22, 24, -10, -5, -15, 29, 6, + 10, 1, 21, 13, 19, 14, -9, 28, -4, -4, 2, 14, -27, 27, 28, -8, -12, 24, 15, 9, + -9, -29, -4, -15, 26, -23, -26, -13, -2, -2, -12, -15, -25, 7, -21, -16, -25, + 12, -17, -23, -4, 4, 7, 1, -12, -12, 3, 6, 15, -16, 15, 18, 22, -14, 11, -7, 27, + -1, -4, 25, 26, -6, 29, -14, -13, -19, -22, -8, -7, -24, 14, 20, -5, 6, 10, -5, + -18, 2, 8, -10, -20, -18, -30, -29, 20, -9, 24, 29, 18, 6, -22, 27, 10, -1, -7, + 4, -3, -12, 18, 19, 12, -3, 9, 26, 22, 10, 8, -17, -27, -13, 25, -17, -23, -25, + -20, -24, 17, 4, 26, -6, -5, 28, -24, -5, -18, -27, 24, -29, 23, -5, -5, 0, 1, + -13, -21, -2, -14, 8, 8, 19, -16, -14, -10, 26, 20, 6, 17, -10, -2, 17, -26, -5, + 10, -18, -30, 12, -29, 23, 6, -12, 7, -28, 2, -14, 3, -22, 22, 5, 5, -21, -6, + 22, -24, 23, -23, -6, -17, -7, -14, -25, -10, 12, 8, 21, -14, 12, 9, 14, 25, 1, + 22, 7, 14, 13, -7, 7, 27, 11, -12, -1, -4, -4, -22, 20, -17, 11, 24, -12, -5, + -26, -30, 12, -26, -5, -25, -25, 13, -11, -1, 29, -30, 7, 29, -25, -12, 15, -30, + 6, 20, -11, 1, 7, -5, 11, -16, -3, 4, -19, -1, -21, -16, 6, -23, 29, -11, -27, + 16, -10, 9, -18, 14, 29, 28, 1, 18, -28, -15, 6, -4, 19, 6, 4, 26, -14, 2, -28, + -4, -27, 12, -23, -16, 17, 18, -28, 15, -21, -20, 26, 11, -14, -29, 7, 1, 22, + -13, 12, -10, 20, 5, -18, -1, 26, -14, -20, 27, -29, 13, -14, 3, -4, 22, -1, + -27, 26, -7, -18, -4, 0, 6, -9, 19, 22, 28, -12, 24, -28, 10, -25, 25, 28, 24, + 14, -25, -25, 11, 10, 16, 19, -29, -10, 7, -10, -29, -20, -18, -17, 1, -10, -8, + 6, -29, 27, 29, 2, -22, -7, -21, -17, 29, 23, 3, -14, -22, 11, -23, -6, -15, 9, + 12, -23, 10, 20, -30, -9, 18, -25, 20, 19, -3, -7, 24, 15, 16, 14, 16, 23, -30, + -3, -21, 7, -19, 6, 19, -30, 26, -15, 19, 22, 29, 2, -16, -3, 16, -12, 15, 7, + 11, 8, 15, -9, 11, -21, -18, -24, -16, -23, 26, 5, -28, 9, 10, 16, 21, 6, -7, + 11, 14, 8, -1, -11, -22, -9, -20, 1, 23, 22, 6, 26, -21, 16, -9, -5, -26, -28, + 0, -30, -25, -22, 0, -29, 4, 1, 18, -10, 17, -14, 11, 2, -28, -25, 12, -30, 17, + 14, -5, -13, 29, 29, 20, 16, -3, 18, -21, 6, 13, 19, -23, -4, -14, 11, -3, 25, + 14, -27, 6, 5, -18, 11, 27, 3, -2, -16, -10, -14, 9, 14, 18, -25, 19, -14, -29, + -2, -2, -14, -4, 21, 29, 9, 25, 25, -7, 12, 15, -4, -19, 5, 10, 6, 12, 12, 21, + -20, -22, -15, 17, -17, 3, -20, 4, -2, -6, -11, 5, 18, 29, 12, -26, -21, -17, 6, + 12, -29, -6, -17, 15, 12, -5, -28, 2, -25, -11, -11, -1, 24, 13, 3, 9, 26, -22, + -13, -30, -29, -4, -22, -16, 13, 11, -15, -12, 28, -23, 10, -13, 20, -24, -26, + 8, 0, 2, 3, 2, -27, -1, 26, -17, -27, 23, 5, -9, 11, 26, -1, -4, 19, 9, -16, 18, + -5, -10, -24, -9, 22, 28, 29, 4, -18, 24, 12, 20, -11, -24, 6, -9, 8, 10, 4, 2, + 3, -12, -23, -6, 10, 24, 4, -7, 26, -25, -8, -14, -7, 1, 25, 6, 22, -8, 14, -23, + -20, 24, 26, -8, 18, -9, 25, 7, 29, 17, -18, -21, 3, 24, -11, -11, -29, 11, -14, + -1, 11, 1, 27, 17, 5, 29, 17, 22, -9, -15, -10, 9, 21, -20, -29, -9, 20, -12, + -9, 24, 14, 4, 28, 27, 29, 27, 2, 26, 23, -20, -26, 27, -2, -1, 18, 25, -8, 0, + 27, -17, 2, 22, 17, -16, 19, 22, 27, 19, -14, -9, -3, 25, 4, 16, -18, -22, 28, + 1, 8, 29, -20, -14, -8, 20, -8, 12, -4, -16, -1, -26, 23, 29, 22, -11, 15, 26, + 1, 29, -18, -27, -3, -20, -13, -6, 0, 12, 21, -9, -24, 10, 18, 8, -1, -23, 18, + 8, 29, -30, -1, 24, -12, 26, -23, -13, 28, 5, -29, -28, -13, 6, -4, 16, 16, 11, + -19, 20, -4, 9, 4, -5, 14, 9, -2, -20, -28, -30, -22, 20, 12, 19, 8, -5, 29, + -16, -6, 25, 7, -27, 26, 4, 29, 7, 18, -11, -8, 28, -18, -15, 22, 2, -13, -11, + -14, 11, -14, -22, 28, 28, 11, 19, -26, -23, 11, -20, -12, -23, -15, 5, -3, -13, + -28, 12, -6, -12, 7, 12, -15, -1, -20, -21, 0, -17, -9, -5, -25, -23, 3, -11, + -11, 24, -11, -6, 26, 2, -20, 15, -1, 8, 26, 21, 26, 1, 1, 23, 28, -13, 4, 4, + -27, -8, 29, 24, -24, 13, 23, 3, 18, -15, -8, 17, 9, 25, 29, -7, -8, 7, 7, -15, + 4, -3, 13, -30, -9, 0, 5, 25, 2, 23, -28, -26, -1, -10, 6, -26, 24, 19, 27, 17, + 26, -4, -25, -2, -2, -5, 17, -17, -2, 16, 7, 16, 17, -7, -9, -29, -4, -24, 23, + 14, 28, 13, 23, 22, 17, 15, -9, -12, 6, 10, 3, -18, 28, -2, -18, 20, 22, 3, -16, + -11, -19, -3, -15, -10, 28, -4, 15, -27, -8, 29, 4, 2, -6, 15, 17, 27, -4, -7, + 15, -13, 9, -11, -20, 18, 3, -29, -22, -17, -1, -4, -29, 19, 4, -22, -7, -14, + -25, 24, -2, 28, 19, 7, 8, -6, -12, 29, 6, -26, 7, -19, -25, -19, -20, 28, 25, + -11, -4, -25, -21, 8, -9, 19, 20, 0, -15, -30, 10, 28, 17, -29, 6, 7, 2, -22, 3, + -8, -14, 6, 23, -1, -6, -29, -29, 28, 21, 16, -14, -22, 15, -26, 29, 17, -16, + -29, 18, 13, -12, 15, 18, 8, 22, -19, 17, -5, -27, 26, -12, -6, -15, 22, -25, + -3, -26, -1, -9, 18, -9, -28, 8, -6, -6, -16, 7, -16, 28, -7, 1, -22, -18, 0, + -1, 18, -15, 5, 14, -16, 19, -18, 9, 27, -17, 2, 19, 9, -21, -3, -13, -23, 18, + 9, -2, -4, 16, -16, 18, -24, 1, 11, 29, 2, -18, 16, -30, -10, -16, -13, -14, 1, + 17, 16, -12, -21, -3, -27, -19, 23, 24, 25, 22, 12, -11, -2, 0, 10, -9, -16, 26, + 13, 9, -28, 19, 14, -3, -4, -21, 1, -22, 8, 4, 19, 10, 22, 6, 6, -1, -29, -13, + -14, 18, -17, -19, 3, -26, 7, -22, -27, 3, 10, -1, 16, -25, -3, 6, -26, 11, -7, + -15, -14, -25, 15, 20, -18, -17, 10, -2, -27, -7, -7, 9, 7, -8, 27, -8, -9, -20, + -11, 25, -8, 5, 3, 12, 19, -9, 28, 19, -27, 27, 29, 14, -3, -21, 13, -26, -19, + -29, 18, -7, 2, -29, -2, -7, 22, 7, 25, -25, -26, -13, -16, 20, 9, -7, 12, -30, + -8, 28, 13, -8, 16, -3, -15, -24, -22, -11, -3, -1, 9, 11, 27, 24, -13, -26, -1, + -23, 6, 10, 24, 5, -10, -21, 22, -1, 1, 14, -13, -26, 2, 20, 11 + }; assertEquals(48645, solution1.countRangeSum(nums, 1, 4)); assertEquals(48645, solution2.countRangeSum(nums, 1, 4)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_328Test.java b/src/test/java/com/fishercoder/firstthousand/_328Test.java index 8d0f632252..be2a3cc40a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_328Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_328Test.java @@ -1,35 +1,35 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.solutions.firstthousand._328; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _328Test { - private _328.Solution1 solution1; - private static ListNode expected; - private static ListNode node; + private _328.Solution1 solution1; + private static ListNode expected; + private static ListNode node; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _328.Solution1(); - } + solution1 = new _328.Solution1(); + } - @Test - public void test1() { - node = new ListNode(1); - node.next = new ListNode(2); - node.next.next = new ListNode(3); - node.next.next.next = new ListNode(4); - node.next.next.next.next = new ListNode(5); + @Test + public void test1() { + node = new ListNode(1); + node.next = new ListNode(2); + node.next.next = new ListNode(3); + node.next.next.next = new ListNode(4); + node.next.next.next.next = new ListNode(5); - expected = new ListNode(1); - expected.next = new ListNode(3); - expected.next.next = new ListNode(5); - expected.next.next.next = new ListNode(2); - expected.next.next.next.next = new ListNode(4); - assertEquals(expected, solution1.oddEvenList(node)); - } + expected = new ListNode(1); + expected.next = new ListNode(3); + expected.next.next = new ListNode(5); + expected.next.next.next = new ListNode(2); + expected.next.next.next.next = new ListNode(4); + assertEquals(expected, solution1.oddEvenList(node)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_32Test.java b/src/test/java/com/fishercoder/firstthousand/_32Test.java index dd6191cfa9..3cbee264c9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_32Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_32Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._32; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _32Test { private _32.Solution1 solution1; private _32.Solution2 solution2; @@ -63,5 +63,4 @@ public void test8() { assertEquals(10, solution1.longestValidParentheses(")()(((())))(")); assertEquals(10, solution2.longestValidParentheses(")()(((())))(")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_330Test.java b/src/test/java/com/fishercoder/firstthousand/_330Test.java index e4798a9b0d..69f754c46b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_330Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_330Test.java @@ -1,29 +1,28 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._330; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._330; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _330Test { - private _330.Solution1 solution1; - private static int[] nums; + private _330.Solution1 solution1; + private static int[] nums; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _330.Solution1(); - } + solution1 = new _330.Solution1(); + } - @Test - public void test1() { - nums = new int[] {1, 2, 4, 13, 43}; - List expected = new ArrayList(Arrays.asList(8, 29)); - assertEquals(expected, solution1.findPatches(nums, 100)); - assertEquals(2, solution1.minPatches(nums, 100)); - } + @Test + public void test1() { + nums = new int[] {1, 2, 4, 13, 43}; + List expected = new ArrayList(Arrays.asList(8, 29)); + assertEquals(expected, solution1.findPatches(nums, 100)); + assertEquals(2, solution1.minPatches(nums, 100)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_331Test.java b/src/test/java/com/fishercoder/firstthousand/_331Test.java index 7133346b64..08444a13c9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_331Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_331Test.java @@ -1,41 +1,41 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._331; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _331Test { - private _331.Solution1 solution1; + private _331.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _331.Solution1(); - } - - @Test - public void test1() { - assertEquals(true, solution1.isValidSerialization("9,3,4,#,#,1,#,#,2,#,6,#,#")); - } - - @Test - public void test2() { - assertEquals(false, solution1.isValidSerialization("1,#")); - } - - @Test - public void test3() { - assertEquals(false, solution1.isValidSerialization("9,#,#,1")); - } - - @Test - public void test4() { - assertEquals(false, solution1.isValidSerialization("1")); - } - - @Test - public void test5() { - assertEquals(false, solution1.isValidSerialization("#,7,6,9,#,#,#")); - } + solution1 = new _331.Solution1(); + } + + @Test + public void test1() { + assertEquals(true, solution1.isValidSerialization("9,3,4,#,#,1,#,#,2,#,6,#,#")); + } + + @Test + public void test2() { + assertEquals(false, solution1.isValidSerialization("1,#")); + } + + @Test + public void test3() { + assertEquals(false, solution1.isValidSerialization("9,#,#,1")); + } + + @Test + public void test4() { + assertEquals(false, solution1.isValidSerialization("1")); + } + + @Test + public void test5() { + assertEquals(false, solution1.isValidSerialization("#,7,6,9,#,#,#")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_332Test.java b/src/test/java/com/fishercoder/firstthousand/_332Test.java index 8a24ac51f1..c2a61424ac 100644 --- a/src/test/java/com/fishercoder/firstthousand/_332Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_332Test.java @@ -2,12 +2,11 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._332; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _332Test { private _332.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_334Test.java b/src/test/java/com/fishercoder/firstthousand/_334Test.java index 3b80a5b56a..62059764fc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_334Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_334Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._334; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _334Test { private _334.Solution1 solution1; private _334.Solution2 solution2; @@ -19,26 +19,25 @@ public void setup() { @Test public void test1() { - assertTrue(solution1.increasingTriplet(new int[]{2, 1, 5, 0, 4, 6})); - assertTrue(solution2.increasingTriplet(new int[]{2, 1, 5, 0, 4, 6})); + assertTrue(solution1.increasingTriplet(new int[] {2, 1, 5, 0, 4, 6})); + assertTrue(solution2.increasingTriplet(new int[] {2, 1, 5, 0, 4, 6})); } @Test public void test2() { - assertFalse(solution1.increasingTriplet(new int[]{5, 4, 3, 2, 1})); - assertFalse(solution2.increasingTriplet(new int[]{5, 4, 3, 2, 1})); + assertFalse(solution1.increasingTriplet(new int[] {5, 4, 3, 2, 1})); + assertFalse(solution2.increasingTriplet(new int[] {5, 4, 3, 2, 1})); } @Test public void test3() { - assertFalse(solution1.increasingTriplet(new int[]{1, 1, -2, 6})); - assertFalse(solution2.increasingTriplet(new int[]{1, 1, -2, 6})); + assertFalse(solution1.increasingTriplet(new int[] {1, 1, -2, 6})); + assertFalse(solution2.increasingTriplet(new int[] {1, 1, -2, 6})); } @Test public void test4() { - assertFalse(solution1.increasingTriplet(new int[]{1, 1, 1, 1, 1, 1, 1})); - assertFalse(solution2.increasingTriplet(new int[]{1, 1, 1, 1, 1, 1, 1})); + assertFalse(solution1.increasingTriplet(new int[] {1, 1, 1, 1, 1, 1, 1})); + assertFalse(solution2.increasingTriplet(new int[] {1, 1, 1, 1, 1, 1, 1})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_337Test.java b/src/test/java/com/fishercoder/firstthousand/_337Test.java index b8f0d21a11..cb76b27abe 100644 --- a/src/test/java/com/fishercoder/firstthousand/_337Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_337Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._337; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _337Test { private _337.Solution1 solution1; private _337.Solution2 solution2; @@ -21,8 +20,13 @@ public void setup() { @Test public void test1() { - assertEquals(7, solution1.rob(TreeUtils.constructBinaryTree(Arrays.asList(3, 2, 3, null, 3, null, 1)))); - assertEquals(7, solution2.rob(TreeUtils.constructBinaryTree(Arrays.asList(3, 2, 3, null, 3, null, 1)))); + assertEquals( + 7, + solution1.rob( + TreeUtils.constructBinaryTree(Arrays.asList(3, 2, 3, null, 3, null, 1)))); + assertEquals( + 7, + solution2.rob( + TreeUtils.constructBinaryTree(Arrays.asList(3, 2, 3, null, 3, null, 1)))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_338Test.java b/src/test/java/com/fishercoder/firstthousand/_338Test.java index cced0e775d..1cd3007985 100644 --- a/src/test/java/com/fishercoder/firstthousand/_338Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_338Test.java @@ -1,27 +1,27 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._338; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _338Test { - private _338.Solution1 test; - private static int[] expected; - private static int[] actual; + private _338.Solution1 test; + private static int[] expected; + private static int[] actual; - @BeforeEach + @BeforeEach public void setUp() { - test = new _338.Solution1(); - } + test = new _338.Solution1(); + } - @Test - public void test1() { - expected = new int[] {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; - actual = test.countBits(15); - CommonUtils.printArray(actual); - assertArrayEquals(expected, actual); - } + @Test + public void test1() { + expected = new int[] {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; + actual = test.countBits(15); + CommonUtils.printArray(actual); + assertArrayEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_33Test.java b/src/test/java/com/fishercoder/firstthousand/_33Test.java index e012dfa3ca..17d60a61ac 100644 --- a/src/test/java/com/fishercoder/firstthousand/_33Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_33Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._33; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _33Test { private _33.Solution1 solution1; private static int[] nums; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 5, 6, 7, 0, 1, 2}; + nums = new int[] {4, 5, 6, 7, 0, 1, 2}; expected = 3; target = 7; assertEquals(expected, solution1.search(nums, target)); @@ -27,7 +27,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{4, 5, 6, 7, 0, 1, 2}; + nums = new int[] {4, 5, 6, 7, 0, 1, 2}; expected = 4; target = 0; assertEquals(expected, solution1.search(nums, target)); @@ -35,7 +35,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{4, 5, 6, 7, 0, 1, 2}; + nums = new int[] {4, 5, 6, 7, 0, 1, 2}; expected = 1; target = 5; assertEquals(expected, solution1.search(nums, target)); @@ -43,7 +43,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{4, 5, 6, 7, 0, 1, 2}; + nums = new int[] {4, 5, 6, 7, 0, 1, 2}; expected = -1; target = 3; assertEquals(expected, solution1.search(nums, target)); @@ -51,7 +51,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{1}; + nums = new int[] {1}; expected = -1; target = 0; assertEquals(expected, solution1.search(nums, target)); @@ -59,7 +59,7 @@ public void test5() { @Test public void test6() { - nums = new int[]{1, 3, 5}; + nums = new int[] {1, 3, 5}; expected = -1; target = 4; assertEquals(expected, solution1.search(nums, target)); @@ -67,7 +67,7 @@ public void test6() { @Test public void test7() { - nums = new int[]{1, 3, 5}; + nums = new int[] {1, 3, 5}; expected = -1; target = 6; assertEquals(expected, solution1.search(nums, target)); @@ -75,7 +75,7 @@ public void test7() { @Test public void test8() { - nums = new int[]{1, 3, 5}; + nums = new int[] {1, 3, 5}; expected = -1; target = 2; assertEquals(expected, solution1.search(nums, target)); @@ -83,7 +83,7 @@ public void test8() { @Test public void test9() { - nums = new int[]{5, 1, 3}; + nums = new int[] {5, 1, 3}; expected = -1; target = 4; assertEquals(expected, solution1.search(nums, target)); @@ -91,7 +91,7 @@ public void test9() { @Test public void test10() { - nums = new int[]{1, 2, 3, 4, 5, 6}; + nums = new int[] {1, 2, 3, 4, 5, 6}; expected = 3; target = 4; assertEquals(expected, solution1.search(nums, target)); @@ -99,7 +99,7 @@ public void test10() { @Test public void test11() { - nums = new int[]{5, 1, 2, 3, 4}; + nums = new int[] {5, 1, 2, 3, 4}; expected = 1; target = 1; assertEquals(expected, solution1.search(nums, target)); @@ -107,7 +107,7 @@ public void test11() { @Test public void test12() { - nums = new int[]{8, 9, 2, 3, 4}; + nums = new int[] {8, 9, 2, 3, 4}; expected = 1; target = 9; assertEquals(expected, solution1.search(nums, target)); @@ -115,10 +115,9 @@ public void test12() { @Test public void test13() { - nums = new int[]{4, 5, 6, 7, 8, 1, 2, 3}; + nums = new int[] {4, 5, 6, 7, 8, 1, 2, 3}; expected = 4; target = 8; assertEquals(expected, solution1.search(nums, target)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_340Test.java b/src/test/java/com/fishercoder/firstthousand/_340Test.java index 40b42283b9..241ffee76a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_340Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_340Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._340; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _340Test { private _340.Solution1 solution1; private _340.Solution2 solution2; @@ -61,5 +61,4 @@ public void test6() { public void test7() { assertEquals(3, solution1.lengthOfLongestSubstringKDistinct("bacc", 2)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_341Test.java b/src/test/java/com/fishercoder/firstthousand/_341Test.java index 7a7b356d88..bbc38a078c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_341Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_341Test.java @@ -1,68 +1,67 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.common.classes.NestedInteger; import com.fishercoder.solutions.firstthousand._341; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _341Test { - private _341.Solution1 test; - private static List nestedList; + private _341.Solution1 test; + private static List nestedList; - @BeforeEach + @BeforeEach public void setUp() { - test = new _341.Solution1(); - } + test = new _341.Solution1(); + } - @Test - public void test1() { - NestedInteger six = new NestedInteger(6); - List sixList = new ArrayList<>(); - sixList.add(six); - NestedInteger four = new NestedInteger(4); - List fourList = new ArrayList<>(); - fourList.add(four); - fourList.addAll(sixList); - NestedInteger one = new NestedInteger(1); - List oneList = new ArrayList<>(); - oneList.add(one); - oneList.addAll(fourList); - _341.Solution1.NestedIterator nestedIterator = new _341.Solution1.NestedIterator(oneList); - assertTrue(nestedIterator.hasNext()); - assertEquals(1, (int) nestedIterator.next()); - } + @Test + public void test1() { + NestedInteger six = new NestedInteger(6); + List sixList = new ArrayList<>(); + sixList.add(six); + NestedInteger four = new NestedInteger(4); + List fourList = new ArrayList<>(); + fourList.add(four); + fourList.addAll(sixList); + NestedInteger one = new NestedInteger(1); + List oneList = new ArrayList<>(); + oneList.add(one); + oneList.addAll(fourList); + _341.Solution1.NestedIterator nestedIterator = new _341.Solution1.NestedIterator(oneList); + assertTrue(nestedIterator.hasNext()); + assertEquals(1, (int) nestedIterator.next()); + } - @Test - public void test2() { - List bigList = new ArrayList<>(); + @Test + public void test2() { + List bigList = new ArrayList<>(); - NestedInteger one = new NestedInteger(1); - NestedInteger two = new NestedInteger(2); - List oneList = new ArrayList<>(); - oneList.add(one); - oneList.add(two); - NestedInteger oneNestedInteger = new NestedInteger(oneList); - bigList.add(oneNestedInteger); + NestedInteger one = new NestedInteger(1); + NestedInteger two = new NestedInteger(2); + List oneList = new ArrayList<>(); + oneList.add(one); + oneList.add(two); + NestedInteger oneNestedInteger = new NestedInteger(oneList); + bigList.add(oneNestedInteger); - NestedInteger three = new NestedInteger(3); - bigList.add(three); + NestedInteger three = new NestedInteger(3); + bigList.add(three); - NestedInteger four = new NestedInteger(4); - NestedInteger five = new NestedInteger(5); - List threeList = new ArrayList<>(); - threeList.add(four); - threeList.add(five); - NestedInteger threeNestedInteger = new NestedInteger(threeList); - bigList.add(threeNestedInteger); + NestedInteger four = new NestedInteger(4); + NestedInteger five = new NestedInteger(5); + List threeList = new ArrayList<>(); + threeList.add(four); + threeList.add(five); + NestedInteger threeNestedInteger = new NestedInteger(threeList); + bigList.add(threeNestedInteger); - _341.Solution1.NestedIterator nestedIterator = new _341.Solution1.NestedIterator(bigList); - assertTrue(nestedIterator.hasNext()); - assertEquals(1, (int) nestedIterator.next()); - } + _341.Solution1.NestedIterator nestedIterator = new _341.Solution1.NestedIterator(bigList); + assertTrue(nestedIterator.hasNext()); + assertEquals(1, (int) nestedIterator.next()); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_347Test.java b/src/test/java/com/fishercoder/firstthousand/_347Test.java index 9dc4c2a159..be6dfe9a4b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_347Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_347Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._347; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _347Test { private _347.Solution1 solution1; private _347.Solution2 solution2; @@ -20,33 +20,35 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 0, 1, 0}; - expected = new int[]{0, 3}; - /**Comment out until Leetcode addresses this test case: - * https://discuss.leetcode.com/topic/44237/java-o-n-solution-bucket-sort/75 - * Then I'll update this Solution1 code accordingly. + nums = new int[] {3, 0, 1, 0}; + expected = new int[] {0, 3}; + /** + * Comment out until Leetcode addresses this test case: + * https://discuss.leetcode.com/topic/44237/java-o-n-solution-bucket-sort/75 Then I'll + * update this Solution1 code accordingly. * - * My post is still un-addressed. - 3/12/2018*/ - //assertArrayEquals(expected, solution1.topKFrequent(nums, 2)); + *

My post is still un-addressed. - 3/12/2018 + */ + // assertArrayEquals(expected, solution1.topKFrequent(nums, 2)); } @Test public void test2() { - nums = new int[]{3, 0, 1, 0}; - expected = new int[]{0, 3}; + nums = new int[] {3, 0, 1, 0}; + expected = new int[] {0, 3}; assertArrayEquals(expected, solution2.topKFrequent(nums, 2)); } @Test public void test3() { - nums = new int[]{3, 0, 1, 0}; - expected = new int[]{0, 3}; + nums = new int[] {3, 0, 1, 0}; + expected = new int[] {0, 3}; } @Test public void test4() { - nums = new int[]{1, 1, 1, 2, 2, 3}; - expected = new int[]{1, 2}; + nums = new int[] {1, 1, 1, 2, 2, 3}; + expected = new int[] {1, 2}; assertArrayEquals(expected, solution1.topKFrequent(nums, 2)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_348Test.java b/src/test/java/com/fishercoder/firstthousand/_348Test.java index 44b04d9cce..98ccce9510 100644 --- a/src/test/java/com/fishercoder/firstthousand/_348Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_348Test.java @@ -1,39 +1,39 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._348; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _348Test { - @Test - public void test1() { - int n = 3; - _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); - assertEquals(0, ticTacToe.move(0, 0, 1)); - assertEquals(0, ticTacToe.move(0, 2, 2)); - assertEquals(0, ticTacToe.move(2, 2, 1)); - assertEquals(0, ticTacToe.move(1, 1, 2)); - assertEquals(0, ticTacToe.move(2, 0, 1)); - assertEquals(0, ticTacToe.move(1, 0, 2)); - assertEquals(1, ticTacToe.move(2, 1, 1)); - } + @Test + public void test1() { + int n = 3; + _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); + assertEquals(0, ticTacToe.move(0, 0, 1)); + assertEquals(0, ticTacToe.move(0, 2, 2)); + assertEquals(0, ticTacToe.move(2, 2, 1)); + assertEquals(0, ticTacToe.move(1, 1, 2)); + assertEquals(0, ticTacToe.move(2, 0, 1)); + assertEquals(0, ticTacToe.move(1, 0, 2)); + assertEquals(1, ticTacToe.move(2, 1, 1)); + } - @Test - public void test2() { - int n = 3; - _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); - assertEquals(0, ticTacToe.move(0, 0, 1)); - assertEquals(0, ticTacToe.move(1, 1, 1)); - assertEquals(1, ticTacToe.move(2, 2, 1)); - } + @Test + public void test2() { + int n = 3; + _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); + assertEquals(0, ticTacToe.move(0, 0, 1)); + assertEquals(0, ticTacToe.move(1, 1, 1)); + assertEquals(1, ticTacToe.move(2, 2, 1)); + } - @Test - public void test3() { - int n = 3; - _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); - assertEquals(0, ticTacToe.move(0, 2, 2)); - assertEquals(0, ticTacToe.move(1, 1, 2)); - assertEquals(2, ticTacToe.move(2, 0, 2)); - } + @Test + public void test3() { + int n = 3; + _348.Solution1.TicTacToe ticTacToe = new _348.Solution1.TicTacToe(n); + assertEquals(0, ticTacToe.move(0, 2, 2)); + assertEquals(0, ticTacToe.move(1, 1, 2)); + assertEquals(2, ticTacToe.move(2, 0, 2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_349Test.java b/src/test/java/com/fishercoder/firstthousand/_349Test.java index 4fe5520634..8aaf76ee45 100644 --- a/src/test/java/com/fishercoder/firstthousand/_349Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_349Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._349; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _349Test { private _349.Solution1 solution1; private _349.Solution2 solution2; @@ -20,16 +20,19 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2}, solution1.intersection(new int[]{1, 2, 2, 1}, new int[]{2, 2})); + assertArrayEquals( + new int[] {2}, solution1.intersection(new int[] {1, 2, 2, 1}, new int[] {2, 2})); } @Test public void test2() { - assertArrayEquals(new int[]{2}, solution2.intersection(new int[]{1, 2, 2, 1}, new int[]{2, 2})); + assertArrayEquals( + new int[] {2}, solution2.intersection(new int[] {1, 2, 2, 1}, new int[] {2, 2})); } @Test public void test3() { - assertArrayEquals(new int[]{2}, solution3.intersection(new int[]{1, 2, 2, 1}, new int[]{2, 2})); + assertArrayEquals( + new int[] {2}, solution3.intersection(new int[] {1, 2, 2, 1}, new int[] {2, 2})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_34Test.java b/src/test/java/com/fishercoder/firstthousand/_34Test.java index c333101ae6..6178511220 100644 --- a/src/test/java/com/fishercoder/firstthousand/_34Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_34Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._34; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _34Test { private _34.Solution1 solution1; private _34.Solution2 solution2; @@ -21,17 +21,17 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; - assertArrayEquals(new int[]{1, 1}, solution1.searchRange(nums, 2)); - assertArrayEquals(new int[]{1, 1}, solution2.searchRange(nums, 2)); - assertArrayEquals(new int[]{1, 1}, solution3.searchRange(nums, 2)); + nums = new int[] {1, 2, 3}; + assertArrayEquals(new int[] {1, 1}, solution1.searchRange(nums, 2)); + assertArrayEquals(new int[] {1, 1}, solution2.searchRange(nums, 2)); + assertArrayEquals(new int[] {1, 1}, solution3.searchRange(nums, 2)); } @Test public void test2() { - nums = new int[]{}; - assertArrayEquals(new int[]{-1, -1}, solution1.searchRange(nums, 0)); - assertArrayEquals(new int[]{-1, -1}, solution2.searchRange(nums, 0)); - assertArrayEquals(new int[]{-1, -1}, solution3.searchRange(nums, 0)); + nums = new int[] {}; + assertArrayEquals(new int[] {-1, -1}, solution1.searchRange(nums, 0)); + assertArrayEquals(new int[] {-1, -1}, solution2.searchRange(nums, 0)); + assertArrayEquals(new int[] {-1, -1}, solution3.searchRange(nums, 0)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_350Test.java b/src/test/java/com/fishercoder/firstthousand/_350Test.java index 7b4eab94c3..eb80d41eb7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_350Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_350Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._350; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _350Test { private _350.Solution1 solution1; private _350.Solution2 solution2; @@ -18,12 +18,13 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 2}, solution1.intersect(new int[]{1, 2, 2, 1}, new int[]{2, 2})); + assertArrayEquals( + new int[] {2, 2}, solution1.intersect(new int[] {1, 2, 2, 1}, new int[] {2, 2})); } @Test public void test2() { - assertArrayEquals(new int[]{2, 2}, solution2.intersect(new int[]{1, 2, 2, 1}, new int[]{2, 2})); + assertArrayEquals( + new int[] {2, 2}, solution2.intersect(new int[] {1, 2, 2, 1}, new int[] {2, 2})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_351Test.java b/src/test/java/com/fishercoder/firstthousand/_351Test.java index 609847eb22..60368d0cff 100644 --- a/src/test/java/com/fishercoder/firstthousand/_351Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_351Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._351; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _351Test { private _351.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_352Test.java b/src/test/java/com/fishercoder/firstthousand/_352Test.java index a034a7433a..ee23e2b1c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_352Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_352Test.java @@ -3,40 +3,39 @@ import com.fishercoder.common.classes.Interval; import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._352; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class _352Test { - private _352.Solution1.SummaryRanges test; - private static List actual; + private _352.Solution1.SummaryRanges test; + private static List actual; - @BeforeEach + @BeforeEach public void setUp() { - test = new _352.Solution1.SummaryRanges(); - } - - @Test - public void test1() { - test.addNum(1); - actual = test.getIntervals(); - CommonUtils.printIntervals(actual); - - test.addNum(3); - actual = test.getIntervals(); - CommonUtils.printIntervals(actual); - - test.addNum(7); - actual = test.getIntervals(); - CommonUtils.printIntervals(actual); - - test.addNum(2); - actual = test.getIntervals(); - CommonUtils.printIntervals(actual); - - test.addNum(6); - actual = test.getIntervals(); - CommonUtils.printIntervals(actual); - } + test = new _352.Solution1.SummaryRanges(); + } + + @Test + public void test1() { + test.addNum(1); + actual = test.getIntervals(); + CommonUtils.printIntervals(actual); + + test.addNum(3); + actual = test.getIntervals(); + CommonUtils.printIntervals(actual); + + test.addNum(7); + actual = test.getIntervals(); + CommonUtils.printIntervals(actual); + + test.addNum(2); + actual = test.getIntervals(); + CommonUtils.printIntervals(actual); + + test.addNum(6); + actual = test.getIntervals(); + CommonUtils.printIntervals(actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_355Test.java b/src/test/java/com/fishercoder/firstthousand/_355Test.java index d2373756a7..292e69255b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_355Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_355Test.java @@ -1,17 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._355; -import org.junit.jupiter.api.BeforeEach; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/10/17. - */ +/** Created by fishercoder on 5/10/17. */ public class _355Test { private _355.Solution1.Twitter solution1Twitter; private _355.Solution2.Twitter solution2Twitter; diff --git a/src/test/java/com/fishercoder/firstthousand/_356Test.java b/src/test/java/com/fishercoder/firstthousand/_356Test.java index 505680b750..af1285df33 100644 --- a/src/test/java/com/fishercoder/firstthousand/_356Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_356Test.java @@ -1,35 +1,37 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._356; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _356Test { - private _356.Solution1 solution1; - private static int[][] points; + private _356.Solution1 solution1; + private static int[][] points; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _356.Solution1(); - } + solution1 = new _356.Solution1(); + } - @Test - public void test1() { - points = new int[][] { - {1, 1}, - {-1, 1}, - }; - assertEquals(true, solution1.isReflected(points)); - } + @Test + public void test1() { + points = + new int[][] { + {1, 1}, + {-1, 1}, + }; + assertEquals(true, solution1.isReflected(points)); + } - @Test - public void test2() { - points = new int[][] { - {1, 1}, - {-1, -1}, - }; - assertEquals(false, solution1.isReflected(points)); - } + @Test + public void test2() { + points = + new int[][] { + {1, 1}, + {-1, -1}, + }; + assertEquals(false, solution1.isReflected(points)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_35Test.java b/src/test/java/com/fishercoder/firstthousand/_35Test.java index 2baab3bc07..141636e168 100644 --- a/src/test/java/com/fishercoder/firstthousand/_35Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_35Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._35; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _35Test { private _35.Solution1 solution1; private static int[] nums; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 5, 6}; + nums = new int[] {1, 3, 5, 6}; assertEquals(2, solution1.searchInsert(nums, 5)); } @Test public void test2() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(0, solution1.searchInsert(nums, 1)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_362Test.java b/src/test/java/com/fishercoder/firstthousand/_362Test.java index aae938ab92..ed1a2d849f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_362Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_362Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._362; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _362Test { private _362.Solution1.HitCounter hitCounter; @@ -28,5 +28,4 @@ public void test1() { hitCounter.hit(301); assertEquals(4, hitCounter.getHits(300)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_368Test.java b/src/test/java/com/fishercoder/firstthousand/_368Test.java index 7b3d7d6368..79aba9d320 100644 --- a/src/test/java/com/fishercoder/firstthousand/_368Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_368Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._368; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _368Test { private _368.Solution1 solution1; private _368.Solution2 solution2; @@ -21,39 +20,39 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 4, 8}; + nums = new int[] {1, 2, 4, 8}; assertEquals(Arrays.asList(1, 2, 4, 8), solution1.largestDivisibleSubset(nums)); assertEquals(Arrays.asList(8, 4, 2, 1), solution2.largestDivisibleSubset(nums)); } @Test public void test2() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; assertEquals(solution1.largestDivisibleSubset(nums), Arrays.asList(1, 2)); assertEquals(solution2.largestDivisibleSubset(nums), Arrays.asList(2, 1)); } @Test public void test3() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(solution1.largestDivisibleSubset(nums), Arrays.asList(1)); } @Test public void test4() { - nums = new int[]{546, 669}; + nums = new int[] {546, 669}; assertEquals(solution1.largestDivisibleSubset(nums), Arrays.asList(546)); } @Test public void test5() { - nums = new int[]{}; + nums = new int[] {}; assertEquals(solution1.largestDivisibleSubset(nums), Arrays.asList()); } @Test public void test6() { - nums = new int[]{4, 8, 10, 240}; + nums = new int[] {4, 8, 10, 240}; assertEquals(solution1.largestDivisibleSubset(nums), Arrays.asList(4, 8, 240)); assertEquals(solution2.largestDivisibleSubset(nums), Arrays.asList(240, 8, 4)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_369Test.java b/src/test/java/com/fishercoder/firstthousand/_369Test.java index 137bb84c23..b79ae7faaa 100644 --- a/src/test/java/com/fishercoder/firstthousand/_369Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_369Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._369; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _369Test { private _369.Solution2 solution2; @@ -21,8 +21,8 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 9}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 3, 0}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 9}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 3, 0}); assertEquals(expected, solution2.plusOne(head)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_36Test.java b/src/test/java/com/fishercoder/firstthousand/_36Test.java index d7745be669..22f82442f1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_36Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_36Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._36; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _36Test { private _36.Solution1 solution1; private static char[][] board; @@ -17,66 +17,70 @@ public void setup() { @Test public void test1() { - board = new char[][]{ - {'4', '3', '5', '2', '6', '9', '7', '8', '1'}, - {'6', '8', '2', '5', '7', '1', '4', '9', '3'}, - {'1', '9', '7', '8', '3', '4', '5', '6', '2'}, - {'8', '2', '6', '1', '9', '5', '3', '4', '7'}, - {'3', '7', '4', '6', '8', '2', '9', '1', '5'}, - {'9', '5', '1', '7', '4', '3', '6', '2', '8'}, - {'5', '1', '9', '3', '2', '6', '8', '7', '4'}, - {'2', '4', '8', '9', '5', '7', '1', '3', '6'}, - {'7', '6', '3', '4', '1', '8', '2', '5', '9'}, - }; + board = + new char[][] { + {'4', '3', '5', '2', '6', '9', '7', '8', '1'}, + {'6', '8', '2', '5', '7', '1', '4', '9', '3'}, + {'1', '9', '7', '8', '3', '4', '5', '6', '2'}, + {'8', '2', '6', '1', '9', '5', '3', '4', '7'}, + {'3', '7', '4', '6', '8', '2', '9', '1', '5'}, + {'9', '5', '1', '7', '4', '3', '6', '2', '8'}, + {'5', '1', '9', '3', '2', '6', '8', '7', '4'}, + {'2', '4', '8', '9', '5', '7', '1', '3', '6'}, + {'7', '6', '3', '4', '1', '8', '2', '5', '9'}, + }; assertEquals(true, solution1.isValidSudoku(board)); } @Test public void test2() { - board = new char[][]{ - {'.', '8', '7', '6', '5', '4', '3', '2', '1'}, - {'2', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'3', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'4', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'5', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'6', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'7', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'8', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'9', '.', '.', '.', '.', '.', '.', '.', '.'}, - }; + board = + new char[][] { + {'.', '8', '7', '6', '5', '4', '3', '2', '1'}, + {'2', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'3', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'4', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'5', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'6', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'7', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'8', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'9', '.', '.', '.', '.', '.', '.', '.', '.'}, + }; assertEquals(true, solution1.isValidSudoku(board)); } @Test public void test3() { - board = new char[][]{ - {'.', '.', '.', '.', '5', '.', '.', '1', '.'}, - // this upper right corner 3*3 square is invalid, '1' appears twice - {'.', '4', '.', '3', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '3', '.', '.', '1'}, - {'8', '.', '.', '.', '.', '.', '.', '2', '.'}, - {'.', '.', '2', '.', '7', '.', '.', '.', '.'}, - {'.', '1', '5', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '2', '.', '.', '.'}, - {'.', '2', '.', '9', '.', '.', '.', '.', '.'}, - {'.', '.', '4', '.', '.', '.', '.', '.', '.'}, - }; + board = + new char[][] { + {'.', '.', '.', '.', '5', '.', '.', '1', '.'}, + // this upper right corner 3*3 square is invalid, '1' appears twice + {'.', '4', '.', '3', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '3', '.', '.', '1'}, + {'8', '.', '.', '.', '.', '.', '.', '2', '.'}, + {'.', '.', '2', '.', '7', '.', '.', '.', '.'}, + {'.', '1', '5', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '2', '.', '.', '.'}, + {'.', '2', '.', '9', '.', '.', '.', '.', '.'}, + {'.', '.', '4', '.', '.', '.', '.', '.', '.'}, + }; assertEquals(false, solution1.isValidSudoku(board)); } @Test public void test4() { - board = new char[][]{ - {'.', '.', '4', '.', '.', '.', '6', '3', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'5', '.', '.', '.', '.', '.', '.', '9', '.'}, - {'.', '.', '.', '5', '6', '.', '.', '.', '.'}, - {'4', '.', '3', '.', '.', '.', '.', '.', '1'}, - {'.', '.', '.', '7', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '5', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.', '.'} - }; + board = + new char[][] { + {'.', '.', '4', '.', '.', '.', '6', '3', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'5', '.', '.', '.', '.', '.', '.', '9', '.'}, + {'.', '.', '.', '5', '6', '.', '.', '.', '.'}, + {'4', '.', '3', '.', '.', '.', '.', '.', '1'}, + {'.', '.', '.', '7', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '5', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.', '.'} + }; assertEquals(false, solution1.isValidSudoku(board)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_370Test.java b/src/test/java/com/fishercoder/firstthousand/_370Test.java index 00a33b11be..5b8b999f53 100644 --- a/src/test/java/com/fishercoder/firstthousand/_370Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_370Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._370; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _370Test { private _370.Solution1 solution1; private static int[][] updates; @@ -19,14 +19,14 @@ public void setup() { @Test public void test1() { - updates = new int[][]{ - {1, 3, 2}, - {2, 4, 3}, - {0, 2, -2}, - }; + updates = + new int[][] { + {1, 3, 2}, + {2, 4, 3}, + {0, 2, -2}, + }; length = 5; - expected = new int[]{-2, 0, 3, 5, 3}; + expected = new int[] {-2, 0, 3, 5, 3}; assertArrayEquals(expected, solution1.getModifiedArray(length, updates)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_372Test.java b/src/test/java/com/fishercoder/firstthousand/_372Test.java index af17f734e5..c5d0ec0be9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_372Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_372Test.java @@ -1,71 +1,78 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._372; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _372Test { - private _372.Solution1 solution1; - private static int expected; - private static int actual; - private static int a; - private static int[] b; + private _372.Solution1 solution1; + private static int expected; + private static int actual; + private static int a; + private static int[] b; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _372.Solution1(); - } + solution1 = new _372.Solution1(); + } - @BeforeEach + @BeforeEach public void setupForEachTest() { - expected = 0; - actual = 0; - a = 0; - b = new int[10000]; - } + expected = 0; + actual = 0; + a = 0; + b = new int[10000]; + } - @Test - public void test1() { + @Test + public void test1() { - a = 78267; - b = new int[] {1, 7, 7, 4, 3, 1, 7, 0, 1, 4, 4, 9, 2, 8, 5, 0, 0, 9, 3, 1, 2, 5, 9, 6, 0, 9, 9, - 0, 9, 6, 0, 5, 3, 7, 9, 8, 8, 9, 8, 2, 5, 4, 1, 9, 3, 8, 0, 5, 9, 5, 6, 1, 1, 8, 9, 3, 7, 8, - 5, 8, 5, 5, 3, 0, 4, 3, 1, 5, 4, 1, 7, 9, 6, 8, 8, 9, 8, 0, 6, 7, 8, 3, 1, 1, 1, 0, 6, 8, 1, - 1, 6, 6, 9, 1, 8, 5, 6, 9, 0, 0, 1, 7, 1, 7, 7, 2, 8, 5, 4, 4, 5, 2, 9, 6, 5, 0, 8, 1, 0, 9, - 5, 8, 7, 6, 0, 6, 1, 8, 7, 2, 9, 8, 1, 0, 7, 9, 4, 7, 6, 9, 2, 3, 1, 3, 9, 9, 6, 8, 0, 8, 9, - 7, 7, 7, 3, 9, 5, 5, 7, 4, 9, 8, 3, 0, 1, 2, 1, 5, 0, 8, 4, 4, 3, 8, 9, 3, 7, 5, 3, 9, 4, 4, - 9, 3, 3, 2, 4, 8, 9, 3, 3, 8, 2, 8, 1, 3, 2, 2, 8, 4, 2, 5, 0, 6, 3, 0, 9, 0, 5, 4, 1, 1, 8, - 0, 4, 2, 5, 8, 2, 4, 2, 7, 5, 4, 7, 6, 9, 0, 8, 9, 6, 1, 4, 7, 7, 9, 7, 8, 1, 4, 4, 3, 6, 4, - 5, 2, 6, 0, 1, 1, 5, 3, 8, 0, 9, 8, 8, 0, 0, 6, 1, 6, 9, 6, 5, 8, 7, 4, 8, 9, 9, 2, 4, 7, 7, - 9, 9, 5, 2, 2, 6, 9, 7, 7, 9, 8, 5, 9, 8, 5, 5, 0, 3, 5, 8, 9, 5, 7, 3, 4, 6, 4, 6, 2, 3, 5, - 2, 3, 1, 4, 5, 9, 3, 3, 6, 4, 1, 3, 3, 2, 0, 0, 4, 4, 7, 2, 3, 3, 9, 8, 7, 8, 5, 5, 0, 8, 3, - 4, 1, 4, 0, 9, 5, 5, 4, 4, 9, 7, 7, 4, 1, 8, 7, 5, 2, 4, 9, 7, 9, 1, 7, 8, 9, 2, 4, 1, 1, 7, - 6, 4, 3, 6, 5, 0, 2, 1, 4, 3, 9, 2, 0, 0, 2, 9, 8, 4, 5, 7, 3, 5, 8, 2, 3, 9, 5, 9, 1, 8, 8, - 9, 2, 3, 7, 0, 4, 1, 1, 8, 7, 0, 2, 7, 3, 4, 6, 1, 0, 3, 8, 5, 8, 9, 8, 4, 8, 3, 5, 1, 1, 4, - 2, 5, 9, 0, 5, 3, 1, 7, 4, 8, 9, 6, 7, 2, 3, 5, 5, 3, 9, 6, 9, 9, 5, 7, 3, 5, 2, 9, 9, 5, 5, - 1, 0, 6, 3, 8, 0, 5, 5, 6, 5, 6, 4, 5, 1, 7, 0, 6, 3, 9, 4, 4, 9, 1, 3, 4, 7, 7, 5, 8, 2, 0, - 9, 2, 7, 3, 0, 9, 0, 7, 7, 7, 4, 1, 2, 5, 1, 3, 3, 6, 4, 8, 2, 5, 9, 5, 0, 8, 2, 5, 6, 4, 8, - 8, 8, 7, 3, 1, 8, 5, 0, 5, 2, 4, 8, 5, 1, 1, 0, 7, 9, 6, 5, 1, 2, 6, 6, 4, 7, 0, 9, 5, 6, 9, - 3, 7, 8, 8, 8, 6, 5, 8, 3, 8, 5, 4, 5, 8, 5, 7, 5, 7, 3, 2, 8, 7, 1, 7, 1, 8, 7, 3, 3, 6, 2, - 9, 3, 3, 9, 3, 1, 5, 1, 5, 5, 8, 1, 2, 7, 8, 9, 2, 5, 4, 5, 4, 2, 6, 1, 3, 6, 0, 6, 9, 6, 1, - 0, 1, 4, 0, 4, 5, 5, 8, 2, 2, 6, 3, 4, 3, 4, 3, 8, 9, 7, 5, 5, 9, 1, 8, 5, 9, 9, 1, 8, 7, 2, - 1, 1, 8, 1, 5, 6, 8, 5, 8, 0, 2, 4, 4, 7, 8, 9, 5, 9, 8, 0, 5, 0, 3, 5, 5, 2, 6, 8, 3, 4, 1, - 4, 7, 1, 7, 2, 7, 5, 8, 8, 7, 2, 2, 3, 9, 2, 2, 7, 3, 2, 9, 0, 2, 3, 6, 9, 7, 2, 8, 0, 8, 1, - 6, 5, 2, 3, 0, 2, 0, 0, 0, 9, 2, 2, 2, 3, 6, 6, 0, 9, 1, 0, 0, 3, 5, 8, 3, 2, 0, 3, 5, 1, 4, - 1, 6, 8, 7, 6, 0, 9, 8, 0, 1, 0, 4, 5, 6, 0, 2, 8, 2, 5, 0, 2, 8, 5, 2, 3, 0, 2, 6, 7, 3, 0, - 0, 2, 1, 9, 0, 1, 9, 9, 2, 0, 1, 6, 7, 7, 9, 9, 6, 1, 4, 8, 5, 5, 6, 7, 0, 6, 1, 7, 3, 5, 9, - 3, 9, 0, 5, 9, 2, 4, 8, 6, 6, 2, 2, 3, 9, 3, 5, 7, 4, 1, 6, 9, 8, 2, 6, 9, 0, 0, 8, 5, 7, 7, - 0, 6, 0, 5, 7, 4, 9, 6, 0, 7, 8, 4, 3, 9, 8, 8, 7, 4, 1, 5, 6, 0, 9, 4, 1, 9, 4, 9, 4, 1, 8, - 6, 7, 8, 2, 5, 2, 3, 3, 4, 3, 3, 1, 6, 4, 1, 6, 1, 5, 7, 8, 1, 9, 7, 6, 0, 8, 0, 1, 4, 4, 0, - 1, 1, 8, 3, 8, 3, 8, 3, 9, 1, 6, 0, 7, 1, 3, 3, 4, 9, 3, 5, 2, 4, 2, 0, 7, 3, 3, 8, 7, 7, 8, - 8, 0, 9, 3, 1, 2, 2, 4, 3, 3, 3, 6, 1, 6, 9, 6, 2, 0, 1, 7, 5, 6, 2, 5, 3, 5, 0, 3, 2, 7, 2, - 3, 0, 3, 6, 1, 7, 8, 7, 0, 4, 0, 6, 7, 6, 6, 3, 9, 8, 5, 8, 3, 3, 0, 9, 6, 7, 1, 9, 2, 1, 3, - 5, 1, 6, 3, 4, 3, 4, 1, 6, 8, 4, 2, 5}; - expected = 70; - actual = solution1.superPow(a, b); - assertEquals(expected, actual); - } + a = 78267; + b = + new int[] { + 1, 7, 7, 4, 3, 1, 7, 0, 1, 4, 4, 9, 2, 8, 5, 0, 0, 9, 3, 1, 2, 5, 9, 6, 0, 9, 9, + 0, 9, 6, 0, 5, 3, 7, 9, 8, 8, 9, 8, 2, 5, 4, 1, 9, 3, 8, 0, 5, 9, 5, 6, 1, 1, 8, + 9, 3, 7, 8, 5, 8, 5, 5, 3, 0, 4, 3, 1, 5, 4, 1, 7, 9, 6, 8, 8, 9, 8, 0, 6, 7, 8, + 3, 1, 1, 1, 0, 6, 8, 1, 1, 6, 6, 9, 1, 8, 5, 6, 9, 0, 0, 1, 7, 1, 7, 7, 2, 8, 5, + 4, 4, 5, 2, 9, 6, 5, 0, 8, 1, 0, 9, 5, 8, 7, 6, 0, 6, 1, 8, 7, 2, 9, 8, 1, 0, 7, + 9, 4, 7, 6, 9, 2, 3, 1, 3, 9, 9, 6, 8, 0, 8, 9, 7, 7, 7, 3, 9, 5, 5, 7, 4, 9, 8, + 3, 0, 1, 2, 1, 5, 0, 8, 4, 4, 3, 8, 9, 3, 7, 5, 3, 9, 4, 4, 9, 3, 3, 2, 4, 8, 9, + 3, 3, 8, 2, 8, 1, 3, 2, 2, 8, 4, 2, 5, 0, 6, 3, 0, 9, 0, 5, 4, 1, 1, 8, 0, 4, 2, + 5, 8, 2, 4, 2, 7, 5, 4, 7, 6, 9, 0, 8, 9, 6, 1, 4, 7, 7, 9, 7, 8, 1, 4, 4, 3, 6, + 4, 5, 2, 6, 0, 1, 1, 5, 3, 8, 0, 9, 8, 8, 0, 0, 6, 1, 6, 9, 6, 5, 8, 7, 4, 8, 9, + 9, 2, 4, 7, 7, 9, 9, 5, 2, 2, 6, 9, 7, 7, 9, 8, 5, 9, 8, 5, 5, 0, 3, 5, 8, 9, 5, + 7, 3, 4, 6, 4, 6, 2, 3, 5, 2, 3, 1, 4, 5, 9, 3, 3, 6, 4, 1, 3, 3, 2, 0, 0, 4, 4, + 7, 2, 3, 3, 9, 8, 7, 8, 5, 5, 0, 8, 3, 4, 1, 4, 0, 9, 5, 5, 4, 4, 9, 7, 7, 4, 1, + 8, 7, 5, 2, 4, 9, 7, 9, 1, 7, 8, 9, 2, 4, 1, 1, 7, 6, 4, 3, 6, 5, 0, 2, 1, 4, 3, + 9, 2, 0, 0, 2, 9, 8, 4, 5, 7, 3, 5, 8, 2, 3, 9, 5, 9, 1, 8, 8, 9, 2, 3, 7, 0, 4, + 1, 1, 8, 7, 0, 2, 7, 3, 4, 6, 1, 0, 3, 8, 5, 8, 9, 8, 4, 8, 3, 5, 1, 1, 4, 2, 5, + 9, 0, 5, 3, 1, 7, 4, 8, 9, 6, 7, 2, 3, 5, 5, 3, 9, 6, 9, 9, 5, 7, 3, 5, 2, 9, 9, + 5, 5, 1, 0, 6, 3, 8, 0, 5, 5, 6, 5, 6, 4, 5, 1, 7, 0, 6, 3, 9, 4, 4, 9, 1, 3, 4, + 7, 7, 5, 8, 2, 0, 9, 2, 7, 3, 0, 9, 0, 7, 7, 7, 4, 1, 2, 5, 1, 3, 3, 6, 4, 8, 2, + 5, 9, 5, 0, 8, 2, 5, 6, 4, 8, 8, 8, 7, 3, 1, 8, 5, 0, 5, 2, 4, 8, 5, 1, 1, 0, 7, + 9, 6, 5, 1, 2, 6, 6, 4, 7, 0, 9, 5, 6, 9, 3, 7, 8, 8, 8, 6, 5, 8, 3, 8, 5, 4, 5, + 8, 5, 7, 5, 7, 3, 2, 8, 7, 1, 7, 1, 8, 7, 3, 3, 6, 2, 9, 3, 3, 9, 3, 1, 5, 1, 5, + 5, 8, 1, 2, 7, 8, 9, 2, 5, 4, 5, 4, 2, 6, 1, 3, 6, 0, 6, 9, 6, 1, 0, 1, 4, 0, 4, + 5, 5, 8, 2, 2, 6, 3, 4, 3, 4, 3, 8, 9, 7, 5, 5, 9, 1, 8, 5, 9, 9, 1, 8, 7, 2, 1, + 1, 8, 1, 5, 6, 8, 5, 8, 0, 2, 4, 4, 7, 8, 9, 5, 9, 8, 0, 5, 0, 3, 5, 5, 2, 6, 8, + 3, 4, 1, 4, 7, 1, 7, 2, 7, 5, 8, 8, 7, 2, 2, 3, 9, 2, 2, 7, 3, 2, 9, 0, 2, 3, 6, + 9, 7, 2, 8, 0, 8, 1, 6, 5, 2, 3, 0, 2, 0, 0, 0, 9, 2, 2, 2, 3, 6, 6, 0, 9, 1, 0, + 0, 3, 5, 8, 3, 2, 0, 3, 5, 1, 4, 1, 6, 8, 7, 6, 0, 9, 8, 0, 1, 0, 4, 5, 6, 0, 2, + 8, 2, 5, 0, 2, 8, 5, 2, 3, 0, 2, 6, 7, 3, 0, 0, 2, 1, 9, 0, 1, 9, 9, 2, 0, 1, 6, + 7, 7, 9, 9, 6, 1, 4, 8, 5, 5, 6, 7, 0, 6, 1, 7, 3, 5, 9, 3, 9, 0, 5, 9, 2, 4, 8, + 6, 6, 2, 2, 3, 9, 3, 5, 7, 4, 1, 6, 9, 8, 2, 6, 9, 0, 0, 8, 5, 7, 7, 0, 6, 0, 5, + 7, 4, 9, 6, 0, 7, 8, 4, 3, 9, 8, 8, 7, 4, 1, 5, 6, 0, 9, 4, 1, 9, 4, 9, 4, 1, 8, + 6, 7, 8, 2, 5, 2, 3, 3, 4, 3, 3, 1, 6, 4, 1, 6, 1, 5, 7, 8, 1, 9, 7, 6, 0, 8, 0, + 1, 4, 4, 0, 1, 1, 8, 3, 8, 3, 8, 3, 9, 1, 6, 0, 7, 1, 3, 3, 4, 9, 3, 5, 2, 4, 2, + 0, 7, 3, 3, 8, 7, 7, 8, 8, 0, 9, 3, 1, 2, 2, 4, 3, 3, 3, 6, 1, 6, 9, 6, 2, 0, 1, + 7, 5, 6, 2, 5, 3, 5, 0, 3, 2, 7, 2, 3, 0, 3, 6, 1, 7, 8, 7, 0, 4, 0, 6, 7, 6, 6, + 3, 9, 8, 5, 8, 3, 3, 0, 9, 6, 7, 1, 9, 2, 1, 3, 5, 1, 6, 3, 4, 3, 4, 1, 6, 8, 4, + 2, 5 + }; + expected = 70; + actual = solution1.superPow(a, b); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_376Test.java b/src/test/java/com/fishercoder/firstthousand/_376Test.java index 2453178d8b..b7479c82b9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_376Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_376Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._376; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _376Test { private _376.Solution1 solution1; private static int[] nums; @@ -17,70 +17,77 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 7, 4, 9, 2, 5}; + nums = new int[] {1, 7, 4, 9, 2, 5}; assertEquals(6, solution1.wiggleMaxLength(nums)); } @Test public void test2() { - nums = new int[]{1, 17, 5, 10, 13, 15, 10, 5, 16, 8}; + nums = new int[] {1, 17, 5, 10, 13, 15, 10, 5, 16, 8}; assertEquals(7, solution1.wiggleMaxLength(nums)); } @Test public void test3() { - nums = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9}; + nums = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9}; assertEquals(2, solution1.wiggleMaxLength(nums)); } @Test public void test4() { nums = - new int[]{33, 53, 12, 64, 50, 41, 45, 21, 97, 35, 47, 92, 39, 0, 93, 55, 40, 46, 69, 42, 6, - 95, 51, 68, 72, 9, 32, 84, 34, 64, 6, 2, 26, 98, 3, 43, 30, 60, 3, 68, 82, 9, 97, 19, - 27, 98, 99, 4, 30, 96, 37, 9, 78, 43, 64, 4, 65, 30, 84, 90, 87, 64, 18, 50, 60, 1, 40, - 32, 48, 50, 76, 100, 57, 29, 63, 53, 46, 57, 93, 98, 42, 80, 82, 9, 41, 55, 69, 84, 82, - 79, 30, 79, 18, 97, 67, 23, 52, 38, 74, 15}; + new int[] { + 33, 53, 12, 64, 50, 41, 45, 21, 97, 35, 47, 92, 39, 0, 93, 55, 40, 46, 69, 42, + 6, 95, 51, 68, 72, 9, 32, 84, 34, 64, 6, 2, 26, 98, 3, 43, 30, 60, 3, 68, 82, 9, + 97, 19, 27, 98, 99, 4, 30, 96, 37, 9, 78, 43, 64, 4, 65, 30, 84, 90, 87, 64, 18, + 50, 60, 1, 40, 32, 48, 50, 76, 100, 57, 29, 63, 53, 46, 57, 93, 98, 42, 80, 82, + 9, 41, 55, 69, 84, 82, 79, 30, 79, 18, 97, 67, 23, 52, 38, 74, 15 + }; assertEquals(67, solution1.wiggleMaxLength(nums)); } @Test public void test5() { - nums = new int[]{3, 3, 3, 2, 5}; + nums = new int[] {3, 3, 3, 2, 5}; assertEquals(3, solution1.wiggleMaxLength(nums)); } @Test public void test6() { nums = - new int[]{372, 492, 288, 399, 81, 2, 320, 94, 416, 469, 427, 117, 265, 357, 399, 456, 496, - 337, 355, 219, 475, 295, 457, 350, 490, 470, 281, 127, 131, 36, 430, 412, 442, 174, 128, - 253, 1, 56, 306, 295, 340, 73, 253, 130, 259, 223, 14, 79, 409, 384, 209, 151, 317, 441, - 156, 275, 140, 224, 128, 250, 290, 191, 161, 472, 477, 125, 470, 230, 321, 5, 311, 23, - 27, 248, 138, 284, 215, 356, 320, 194, 434, 136, 221, 273, 450, 440, 28, 179, 36, 386, - 482, 203, 24, 8, 391, 21, 500, 484, 135, 348, 292, 396, 145, 443, 406, 61, 212, 480, - 455, 78, 309, 318, 84, 474, 209, 225, 177, 356, 227, 263, 181, 476, 478, 151, 494, 395, - 23, 114, 395, 429, 450, 247, 245, 150, 354, 230, 100, 172, 454, 155, 189, 33, 290, 187, - 443, 123, 59, 358, 241, 141, 39, 196, 491, 381, 157, 157, 134, 431, 295, 20, 123, 118, - 207, 199, 317, 188, 267, 335, 315, 308, 115, 321, 56, 52, 253, 492, 97, 374, 398, 272, - 74, 206, 109, 172, 471, 55, 452, 452, 329, 367, 372, 252, 99, 62, 122, 287, 320, 325, - 307, 481, 316, 378, 87, 97, 457, 21, 312, 249, 354, 286, 196, 43, 170, 500, 265, 253, - 19, 480, 438, 113, 473, 247, 257, 33, 395, 456, 246, 310, 469, 408, 112, 385, 53, 449, - 117, 122, 210, 286, 149, 20, 364, 372, 71, 26, 155, 292, 16, 72, 384, 160, 79, 241, 346, - 230, 15, 427, 96, 95, 59, 151, 325, 490, 223, 131, 81, 294, 18, 70, 171, 339, 14, 40, - 463, 421, 355, 123, 408, 357, 202, 235, 390, 344, 198, 98, 361, 434, 174, 216, 197, 274, - 231, 85, 494, 57, 136, 258, 134, 441, 477, 456, 318, 155, 138, 461, 65, 426, 162, 90, - 342, 284, 374, 204, 464, 9, 280, 391, 491, 231, 298, 284, 82, 417, 355, 356, 207, 367, - 262, 244, 283, 489, 477, 143, 495, 472, 372, 447, 322, 399, 239, 450, 168, 202, 89, 333, - 276, 199, 416, 490, 494, 488, 137, 327, 113, 189, 430, 320, 197, 120, 71, 262, 31, 295, - 218, 74, 238, 169, 489, 308, 300, 260, 397, 308, 328, 267, 419, 84, 357, 486, 289, 312, - 230, 64, 468, 227, 268, 28, 243, 267, 254, 153, 407, 399, 346, 385, 77, 297, 273, 484, - 366, 482, 491, 368, 221, 423, 107, 272, 98, 309, 426, 181, 320, 77, 185, 382, 478, 398, - 476, 22, 328, 450, 299, 211, 285, 62, 344, 484, 395, 466, 291, 487, 301, 407, 28, 295, - 36, 429, 99, 462, 240, 124, 261, 387, 30, 362, 161, 156, 184, 188, 99, 377, 392, 442, - 300, 98, 285, 312, 312, 365, 415, 367, 105, 81, 378, 413, 43, 326, 490, 320, 266, 390, - 53, 327, 75, 332, 454, 29, 370, 392, 360, 1, 335, 355, 344, 120, 417, 455, 93, 60, 256, - 451, 188, 161, 388, 338, 238, 26, 275, 340, 109, 185}; + new int[] { + 372, 492, 288, 399, 81, 2, 320, 94, 416, 469, 427, 117, 265, 357, 399, 456, 496, + 337, 355, 219, 475, 295, 457, 350, 490, 470, 281, 127, 131, 36, 430, 412, 442, + 174, 128, 253, 1, 56, 306, 295, 340, 73, 253, 130, 259, 223, 14, 79, 409, 384, + 209, 151, 317, 441, 156, 275, 140, 224, 128, 250, 290, 191, 161, 472, 477, 125, + 470, 230, 321, 5, 311, 23, 27, 248, 138, 284, 215, 356, 320, 194, 434, 136, 221, + 273, 450, 440, 28, 179, 36, 386, 482, 203, 24, 8, 391, 21, 500, 484, 135, 348, + 292, 396, 145, 443, 406, 61, 212, 480, 455, 78, 309, 318, 84, 474, 209, 225, + 177, 356, 227, 263, 181, 476, 478, 151, 494, 395, 23, 114, 395, 429, 450, 247, + 245, 150, 354, 230, 100, 172, 454, 155, 189, 33, 290, 187, 443, 123, 59, 358, + 241, 141, 39, 196, 491, 381, 157, 157, 134, 431, 295, 20, 123, 118, 207, 199, + 317, 188, 267, 335, 315, 308, 115, 321, 56, 52, 253, 492, 97, 374, 398, 272, 74, + 206, 109, 172, 471, 55, 452, 452, 329, 367, 372, 252, 99, 62, 122, 287, 320, + 325, 307, 481, 316, 378, 87, 97, 457, 21, 312, 249, 354, 286, 196, 43, 170, 500, + 265, 253, 19, 480, 438, 113, 473, 247, 257, 33, 395, 456, 246, 310, 469, 408, + 112, 385, 53, 449, 117, 122, 210, 286, 149, 20, 364, 372, 71, 26, 155, 292, 16, + 72, 384, 160, 79, 241, 346, 230, 15, 427, 96, 95, 59, 151, 325, 490, 223, 131, + 81, 294, 18, 70, 171, 339, 14, 40, 463, 421, 355, 123, 408, 357, 202, 235, 390, + 344, 198, 98, 361, 434, 174, 216, 197, 274, 231, 85, 494, 57, 136, 258, 134, + 441, 477, 456, 318, 155, 138, 461, 65, 426, 162, 90, 342, 284, 374, 204, 464, 9, + 280, 391, 491, 231, 298, 284, 82, 417, 355, 356, 207, 367, 262, 244, 283, 489, + 477, 143, 495, 472, 372, 447, 322, 399, 239, 450, 168, 202, 89, 333, 276, 199, + 416, 490, 494, 488, 137, 327, 113, 189, 430, 320, 197, 120, 71, 262, 31, 295, + 218, 74, 238, 169, 489, 308, 300, 260, 397, 308, 328, 267, 419, 84, 357, 486, + 289, 312, 230, 64, 468, 227, 268, 28, 243, 267, 254, 153, 407, 399, 346, 385, + 77, 297, 273, 484, 366, 482, 491, 368, 221, 423, 107, 272, 98, 309, 426, 181, + 320, 77, 185, 382, 478, 398, 476, 22, 328, 450, 299, 211, 285, 62, 344, 484, + 395, 466, 291, 487, 301, 407, 28, 295, 36, 429, 99, 462, 240, 124, 261, 387, 30, + 362, 161, 156, 184, 188, 99, 377, 392, 442, 300, 98, 285, 312, 312, 365, 415, + 367, 105, 81, 378, 413, 43, 326, 490, 320, 266, 390, 53, 327, 75, 332, 454, 29, + 370, 392, 360, 1, 335, 355, 344, 120, 417, 455, 93, 60, 256, 451, 188, 161, 388, + 338, 238, 26, 275, 340, 109, 185 + }; assertEquals(334, solution1.wiggleMaxLength(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_377Test.java b/src/test/java/com/fishercoder/firstthousand/_377Test.java index d47bbe5a20..edbe1c9d56 100644 --- a/src/test/java/com/fishercoder/firstthousand/_377Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_377Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._377; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _377Test { private _377.Solution1 solution1; private _377.Solution2 solution2; @@ -25,14 +24,14 @@ public void setup() { @BeforeEach public void setUp() throws Exception { - //always have to reset these global variables before using it again + // always have to reset these global variables before using it again solution2.count = 0; solution4 = new _377.Solution4(); } @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; target = 4; expected = 7; assertEquals(expected, solution1.combinationSum4(nums, target)); @@ -43,10 +42,11 @@ public void test1() { @Test public void test2() { - nums = new int[]{4, 2, 1}; + nums = new int[] {4, 2, 1}; target = 32; expected = 39882198; -// assertEquals(39882198, solution1.combinationSum4(nums, target));//this results in MLE, so comment out + // assertEquals(39882198, solution1.combinationSum4(nums, target));//this results in + // MLE, so comment out assertEquals(expected, solution2.combinationSum4(nums, target)); @@ -57,7 +57,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{9}; + nums = new int[] {9}; target = 3; expected = 0; assertEquals(expected, solution1.combinationSum4(nums, target)); @@ -65,5 +65,4 @@ public void test3() { assertEquals(expected, solution3.combinationSum4(nums, target)); assertEquals(expected, solution4.combinationSum4(nums, target)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_378Test.java b/src/test/java/com/fishercoder/firstthousand/_378Test.java index e5c109268c..92a89fcd26 100644 --- a/src/test/java/com/fishercoder/firstthousand/_378Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_378Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._378; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _378Test { private _378.Solution1 solution1; private _378.Solution2 solution2; @@ -22,9 +22,7 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - new int[]{-5} - }; + matrix = new int[][] {new int[] {-5}}; assertEquals(-5, solution1.kthSmallest(matrix, 1)); assertEquals(-5, solution2.kthSmallest(matrix, 1)); assertEquals(-5, solution3.kthSmallest(matrix, 1)); @@ -32,7 +30,8 @@ public void test1() { @Test public void test2() { - matrix = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[1,3]"); + matrix = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[1,3]"); assertEquals(1, solution1.kthSmallest(matrix, 2)); assertEquals(1, solution2.kthSmallest(matrix, 2)); assertEquals(1, solution3.kthSmallest(matrix, 2)); @@ -40,10 +39,11 @@ public void test2() { @Test public void test3() { - matrix = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,5,9],[10,11,13],[12,13,15]"); + matrix = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,5,9],[10,11,13],[12,13,15]"); assertEquals(13, solution1.kthSmallest(matrix, 8)); assertEquals(13, solution2.kthSmallest(matrix, 8)); assertEquals(13, solution3.kthSmallest(matrix, 8)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_37Test.java b/src/test/java/com/fishercoder/firstthousand/_37Test.java index 570cb2a1d0..16132d627e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_37Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_37Test.java @@ -16,17 +16,18 @@ public void setup() { @Test public void test1() { - board = new char[][]{ - {'5', '3', '.', '.', '7', '.', '.', '.', '.'}, - {'6', '.', '.', '1', '9', '5', '.', '.', '.'}, - {'.', '9', '8', '.', '.', '.', '.', '6', '.'}, - {'8', '3', '.', '.', '6', '.', '.', '.', '3'}, - {'4', '.', '.', '8', '.', '3', '.', '.', '1'}, - {'7', '.', '.', '.', '2', '.', '.', '.', '6'}, - {'.', '6', '.', '.', '7', '.', '2', '8', '.'}, - {'.', '.', '.', '4', '1', '9', '.', '.', '5'}, - {'.', '.', '.', '.', '8', '.', '.', '7', '9'} - }; + board = + new char[][] { + {'5', '3', '.', '.', '7', '.', '.', '.', '.'}, + {'6', '.', '.', '1', '9', '5', '.', '.', '.'}, + {'.', '9', '8', '.', '.', '.', '.', '6', '.'}, + {'8', '3', '.', '.', '6', '.', '.', '.', '3'}, + {'4', '.', '.', '8', '.', '3', '.', '.', '1'}, + {'7', '.', '.', '.', '2', '.', '.', '.', '6'}, + {'.', '6', '.', '.', '7', '.', '2', '8', '.'}, + {'.', '.', '.', '4', '1', '9', '.', '.', '5'}, + {'.', '.', '.', '.', '8', '.', '.', '7', '9'} + }; CommonUtils.print2DCharArray(board); solution1.solveSudoku(board); CommonUtils.print2DCharArray(board); diff --git a/src/test/java/com/fishercoder/firstthousand/_381Test.java b/src/test/java/com/fishercoder/firstthousand/_381Test.java index 01e9f3cb32..dbb8bbb8e8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_381Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_381Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._381; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _381Test { private _381.Solution1.RandomizedCollection randomizedCollection; @@ -24,5 +24,4 @@ public void test1() { assertTrue(randomizedCollection.remove(2)); randomizedCollection.getRandom(); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_384Test.java b/src/test/java/com/fishercoder/firstthousand/_384Test.java index 36b8c833e5..1ea924c463 100644 --- a/src/test/java/com/fishercoder/firstthousand/_384Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_384Test.java @@ -9,7 +9,7 @@ public class _384Test { @Test public void test1() { - solution2 = new _384.Solution2(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); + solution2 = new _384.Solution2(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); CommonUtils.printArray(solution2.shuffle()); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_385Test.java b/src/test/java/com/fishercoder/firstthousand/_385Test.java index 9bb3df5be8..981039e06e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_385Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_385Test.java @@ -5,36 +5,35 @@ import org.junit.jupiter.api.Test; public class _385Test { - private _385.Solution1 solution1; + private _385.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _385.Solution1(); - } - - @Test - public void test1() { - solution1.deserialize("324"); - } - - @Test - public void test2() { - solution1.deserialize("[-1]"); - } - - @Test - public void test3() { - solution1.deserialize("[]"); - } - - @Test - public void test4() { - solution1.deserialize("[-1,-2]"); - } - - @Test - public void test5() { - solution1.deserialize("[-1,-2,[-3,-4,[5,[6,[7,8]]]]]"); - } - + solution1 = new _385.Solution1(); + } + + @Test + public void test1() { + solution1.deserialize("324"); + } + + @Test + public void test2() { + solution1.deserialize("[-1]"); + } + + @Test + public void test3() { + solution1.deserialize("[]"); + } + + @Test + public void test4() { + solution1.deserialize("[-1,-2]"); + } + + @Test + public void test5() { + solution1.deserialize("[-1,-2,[-3,-4,[5,[6,[7,8]]]]]"); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_388Test.java b/src/test/java/com/fishercoder/firstthousand/_388Test.java index c5f59c7d95..4c269f0917 100644 --- a/src/test/java/com/fishercoder/firstthousand/_388Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_388Test.java @@ -1,64 +1,62 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._388; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _388Test { - private _388.Solution1 solution1; + private _388.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _388.Solution1(); - } - - @Test - public void test1() { - assertEquals(10, solution1.lengthLongestPath( - "dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext")); - } - - @Test - public void test2() { - assertEquals(9, solution1.lengthLongestPath( - "dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext")); - } - - @Test - public void test3() { - assertEquals(7, solution1.lengthLongestPath( - "aaaaaaaaaaaaaaaaaaaaa/sth.png")); - } - - @Test - public void test4() { - assertEquals(9, solution1.lengthLongestPath( - "a/aa/aaa/file1.txt")); - } - - @Test - public void test5() { - assertEquals(25, solution1.lengthLongestPath( - "file name with space.txt")); - } - - @Test - public void test6() { - assertEquals(13, solution1.lengthLongestPath( - "dir\\n file.txt")); - } - - @Test - public void test7() { - assertEquals(12, solution1.lengthLongestPath( - "dir\n file.txt")); - } - - @Test - public void test8() { - assertEquals(7, solution1.lengthLongestPath( - "a\\n\\tb1\\n\\t\\tf1.txt\\n\\taaaaa\\n\\t\\tf2.txt")); - } + solution1 = new _388.Solution1(); + } + + @Test + public void test1() { + assertEquals( + 10, + solution1.lengthLongestPath( + "dir\\n\\tsubdir1\\n\\t\\tfile1.ext\\n\\t\\tsubsubdir1\\n\\tsubdir2\\n\\t\\tsubsubdir2\\n\\t\\t\\tfile2.ext")); + } + + @Test + public void test2() { + assertEquals( + 9, solution1.lengthLongestPath("dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext")); + } + + @Test + public void test3() { + assertEquals(7, solution1.lengthLongestPath("aaaaaaaaaaaaaaaaaaaaa/sth.png")); + } + + @Test + public void test4() { + assertEquals(9, solution1.lengthLongestPath("a/aa/aaa/file1.txt")); + } + + @Test + public void test5() { + assertEquals(25, solution1.lengthLongestPath("file name with space.txt")); + } + + @Test + public void test6() { + assertEquals(13, solution1.lengthLongestPath("dir\\n file.txt")); + } + + @Test + public void test7() { + assertEquals(12, solution1.lengthLongestPath("dir\n file.txt")); + } + + @Test + public void test8() { + assertEquals( + 7, + solution1.lengthLongestPath("a\\n\\tb1\\n\\t\\tf1.txt\\n\\taaaaa\\n\\t\\tf2.txt")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_38Test.java b/src/test/java/com/fishercoder/firstthousand/_38Test.java index 7594d20ace..fa65f70732 100644 --- a/src/test/java/com/fishercoder/firstthousand/_38Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_38Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._38; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _38Test { private _38.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_392Test.java b/src/test/java/com/fishercoder/firstthousand/_392Test.java index 825bcf3ca6..434a2e279f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_392Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_392Test.java @@ -1,38 +1,38 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._392; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _392Test { - private _392.Solution1 solution1; - private static String s; - private static String t; - private static boolean expected; - private static boolean actual; + private _392.Solution1 solution1; + private static String s; + private static String t; + private static boolean expected; + private static boolean actual; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _392.Solution1(); - } + solution1 = new _392.Solution1(); + } - @Test - public void test1() { - s = "abc"; - t = "ahbgdc"; - expected = true; - actual = solution1.isSubsequence(s, t); - assertEquals(expected, actual); - } + @Test + public void test1() { + s = "abc"; + t = "ahbgdc"; + expected = true; + actual = solution1.isSubsequence(s, t); + assertEquals(expected, actual); + } - @Test - public void test2() { - s = "axc"; - t = "ahbgdc"; - expected = false; - actual = solution1.isSubsequence(s, t); - assertEquals(expected, actual); - } + @Test + public void test2() { + s = "axc"; + t = "ahbgdc"; + expected = false; + actual = solution1.isSubsequence(s, t); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_393Test.java b/src/test/java/com/fishercoder/firstthousand/_393Test.java index cad8a9b622..59843a778d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_393Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_393Test.java @@ -1,37 +1,37 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._393; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _393Test { - private _393.Solution1 solution1; - private static boolean expected; - private static boolean actual; - private static int[] data; + private _393.Solution1 solution1; + private static boolean expected; + private static boolean actual; + private static int[] data; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _393.Solution1(); - } + solution1 = new _393.Solution1(); + } - @Test - @Disabled - public void test1() { - data = new int[] {197, 130, 1}; - expected = true; - actual = solution1.validUtf8(data); - assertEquals(expected, actual); - } + @Test + @Disabled + public void test1() { + data = new int[] {197, 130, 1}; + expected = true; + actual = solution1.validUtf8(data); + assertEquals(expected, actual); + } - @Test - public void test2() { - data = new int[] {5}; - expected = true; - actual = solution1.validUtf8(data); - assertEquals(expected, actual); - } + @Test + public void test2() { + data = new int[] {5}; + expected = true; + actual = solution1.validUtf8(data); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_394Test.java b/src/test/java/com/fishercoder/firstthousand/_394Test.java index 9e10269f1e..b119b04f3b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_394Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_394Test.java @@ -1,35 +1,32 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._394; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by varunu28 on 1/08/19. - */ - +/** Created by varunu28 on 1/08/19. */ public class _394Test { - private _394.Solution1 test; + private _394.Solution1 test; - @BeforeEach + @BeforeEach public void setUp() { - test = new _394.Solution1(); - } - - @Test - public void test1() { - assertEquals("aaabcbc", test.decodeString("3[a]2[bc]")); - } - - @Test - public void test2() { - assertEquals("accaccacc", test.decodeString("3[a2[c]]")); - } - - @Test - public void test3() { - assertEquals("abcabccdcdcdef", test.decodeString("2[abc]3[cd]ef")); - } + test = new _394.Solution1(); + } + + @Test + public void test1() { + assertEquals("aaabcbc", test.decodeString("3[a]2[bc]")); + } + + @Test + public void test2() { + assertEquals("accaccacc", test.decodeString("3[a2[c]]")); + } + + @Test + public void test3() { + assertEquals("abcabccdcdcdef", test.decodeString("2[abc]3[cd]ef")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_395Test.java b/src/test/java/com/fishercoder/firstthousand/_395Test.java index c407d918ed..6ac366c8bb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_395Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_395Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._395; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _395Test { private _395.Solution1 solution1; @@ -64,5 +64,4 @@ public void test5() { assertEquals(expected, solution1.longestSubstring(s, k)); assertEquals(expected, solution2.longestSubstring(s, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_396Test.java b/src/test/java/com/fishercoder/firstthousand/_396Test.java index a8278b1425..55c69fc2fd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_396Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_396Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._396; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _396Test { private _396.Solution1 solution1; private _396.Solution2 solution2; @@ -19,16 +19,15 @@ public void setup() { @Test public void test1() { - A = new int[]{4, 3, 2, 6}; + A = new int[] {4, 3, 2, 6}; assertEquals(26, solution1.maxRotateFunction(A)); assertEquals(26, solution2.maxRotateFunction(A)); } @Test public void test2() { - A = new int[]{1,2,3,4,5,6,7,8,9,10}; + A = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; assertEquals(330, solution1.maxRotateFunction(A)); assertEquals(330, solution2.maxRotateFunction(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_397Test.java b/src/test/java/com/fishercoder/firstthousand/_397Test.java index 2d1a7dfe8b..f90f3a007c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_397Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_397Test.java @@ -1,31 +1,31 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._397; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _397Test { - private _397.Solution1 solution1; + private _397.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _397.Solution1(); - } + solution1 = new _397.Solution1(); + } - @Test - public void test1() { - assertEquals(17, solution1.integerReplacement(65535)); - } + @Test + public void test1() { + assertEquals(17, solution1.integerReplacement(65535)); + } - @Test - public void test2() { - assertEquals(14, solution1.integerReplacement(1234)); - } + @Test + public void test2() { + assertEquals(14, solution1.integerReplacement(1234)); + } - @Test - public void test3() { - assertEquals(3, solution1.integerReplacement(5)); - } + @Test + public void test3() { + assertEquals(3, solution1.integerReplacement(5)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_39Test.java b/src/test/java/com/fishercoder/firstthousand/_39Test.java index 74a5d45fa3..75620c59bb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_39Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_39Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._39; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._39; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _39Test { private _39.Solution1 solution1; @@ -22,7 +21,7 @@ public void setup() { @Test public void test1() { - candidates = new int[]{2, 3, 6, 7}; + candidates = new int[] {2, 3, 6, 7}; expected = new ArrayList<>(); expected.add(Arrays.asList(2, 2, 3)); expected.add(Arrays.asList(7)); diff --git a/src/test/java/com/fishercoder/firstthousand/_3Test.java b/src/test/java/com/fishercoder/firstthousand/_3Test.java index f319112547..adfaed89fb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_3Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_3Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._3; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3Test { private _3.Solution1 solution1; private _3.Solution2 solution2; @@ -37,5 +37,4 @@ public void test1() { assertEquals(expected, solution5.lengthOfLongestSubstring(s)); assertEquals(expected, solution6.lengthOfLongestSubstring(s)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_400Test.java b/src/test/java/com/fishercoder/firstthousand/_400Test.java index ec075c944c..5dc6e10a2a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_400Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_400Test.java @@ -1,27 +1,27 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._400; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _400Test { - private _400.Solution1 solution1; - private static int expected; - private static int actual; - private static int n; + private _400.Solution1 solution1; + private static int expected; + private static int actual; + private static int n; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _400.Solution1(); - } + solution1 = new _400.Solution1(); + } - @Test - public void test1() { - n = 11; - expected = 0; - actual = solution1.findNthDigit(n); - assertEquals(expected, actual); - } + @Test + public void test1() { + n = 11; + expected = 0; + actual = solution1.findNthDigit(n); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_401Test.java b/src/test/java/com/fishercoder/firstthousand/_401Test.java index 83d651586a..cc22597b4e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_401Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_401Test.java @@ -1,24 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._401; import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _401Test { - private _401.Solution1 solution1; + private _401.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _401.Solution1(); - } + solution1 = new _401.Solution1(); + } - @Test - public void test1() { - assertEquals( - Arrays.asList("0:01", "0:02", "0:04", "0:08", "0:16", "0:32", "1:00", "2:00", "4:00", - "8:00"), solution1.readBinaryWatch(1)); - } + @Test + public void test1() { + assertEquals( + Arrays.asList( + "0:01", "0:02", "0:04", "0:08", "0:16", "0:32", "1:00", "2:00", "4:00", + "8:00"), + solution1.readBinaryWatch(1)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_402Test.java b/src/test/java/com/fishercoder/firstthousand/_402Test.java index 6a455d3106..192c8d7083 100644 --- a/src/test/java/com/fishercoder/firstthousand/_402Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_402Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._402; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _402Test { - private _402.Solution1 solution1; + private _402.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _402.Solution1(); - } + solution1 = new _402.Solution1(); + } - @Test - public void test1() { - assertEquals("1219", solution1.removeKdigits("1432219", 3)); - } + @Test + public void test1() { + assertEquals("1219", solution1.removeKdigits("1432219", 3)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_404Test.java b/src/test/java/com/fishercoder/firstthousand/_404Test.java index 29acaf14e9..2f12c7c4af 100644 --- a/src/test/java/com/fishercoder/firstthousand/_404Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_404Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._404; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _404Test { private _404.Solution1 solution1; private _404.Solution2 solution2; @@ -41,5 +40,4 @@ public void test2() { assertEquals(expected, solution2.sumOfLeftLeaves(root)); assertEquals(expected, solution3.sumOfLeftLeaves(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_406Test.java b/src/test/java/com/fishercoder/firstthousand/_406Test.java index e6cc90fd84..e56f5d5cfe 100644 --- a/src/test/java/com/fishercoder/firstthousand/_406Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_406Test.java @@ -6,26 +6,27 @@ import org.junit.jupiter.api.Test; public class _406Test { - private _406.Solution1 solution1; - private static int[][] people; - private static int[][] actual; + private _406.Solution1 solution1; + private static int[][] people; + private static int[][] actual; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _406.Solution1(); - } + solution1 = new _406.Solution1(); + } - @Test - public void test1() { - people = new int[][] { - {7, 0}, - {4, 4}, - {7, 1}, - {5, 0}, - {6, 1}, - {5, 2} - }; - actual = solution1.reconstructQueue(people); - CommonUtils.printArrayArray(actual); - } + @Test + public void test1() { + people = + new int[][] { + {7, 0}, + {4, 4}, + {7, 1}, + {5, 0}, + {6, 1}, + {5, 2} + }; + actual = solution1.reconstructQueue(people); + CommonUtils.printArrayArray(actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_408Test.java b/src/test/java/com/fishercoder/firstthousand/_408Test.java index 774012cc1a..6462eb480e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_408Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_408Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._408; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _408Test { private _408.Solution1 solution1; private _408.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_409Test.java b/src/test/java/com/fishercoder/firstthousand/_409Test.java index 4e355197f5..79fb529d0d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_409Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_409Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._409; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _409Test { private _409.Solution1 solution1; private _409.Solution2 solution2; @@ -30,10 +30,14 @@ public void test2() { @Test public void test3() { - assertEquals(983, solution1.longestPalindrome( - "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); - assertEquals(983, solution2.longestPalindrome( - "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); + assertEquals( + 983, + solution1.longestPalindrome( + "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); + assertEquals( + 983, + solution2.longestPalindrome( + "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); } @Test diff --git a/src/test/java/com/fishercoder/firstthousand/_40Test.java b/src/test/java/com/fishercoder/firstthousand/_40Test.java index 02671b102c..b3d2f399c5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_40Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_40Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._40; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._40; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _40Test { private _40.Solution1 solution1; @@ -22,16 +21,31 @@ public void setup() { @Test public void test1() { - candidates = new int[]{10, 1, 2, 7, 6, 1, 5}; - expected = Arrays.asList((Arrays.asList(1, 1, 6)), Arrays.asList(1, 2, 5), Arrays.asList(1, 7), Arrays.asList(2, 6)); + candidates = new int[] {10, 1, 2, 7, 6, 1, 5}; + expected = + Arrays.asList( + (Arrays.asList(1, 1, 6)), + Arrays.asList(1, 2, 5), + Arrays.asList(1, 7), + Arrays.asList(2, 6)); target = 8; assertEquals(expected, solution1.combinationSum2(candidates, target)); } @Test public void test2() { - candidates = new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - expected = Arrays.asList(Arrays.asList(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)); + candidates = + new int[] { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + expected = + Arrays.asList( + Arrays.asList( + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1)); target = 30; assertEquals(expected, solution1.combinationSum2(candidates, target)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_410Test.java b/src/test/java/com/fishercoder/firstthousand/_410Test.java index 03d41d0523..5acdae8d2e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_410Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_410Test.java @@ -1,23 +1,23 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._410; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _410Test { - private _410.Solution1 test; - private static int[] nums; + private _410.Solution1 test; + private static int[] nums; - @BeforeEach + @BeforeEach public void setUp() { - test = new _410.Solution1(); - } + test = new _410.Solution1(); + } - @Test - public void test1() { - nums = new int[] {7, 2, 5, 10, 8}; - assertEquals(18, test.splitArray(nums, 2)); - } + @Test + public void test1() { + nums = new int[] {7, 2, 5, 10, 8}; + assertEquals(18, test.splitArray(nums, 2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_415Test.java b/src/test/java/com/fishercoder/firstthousand/_415Test.java index 01de36da58..5b30300506 100644 --- a/src/test/java/com/fishercoder/firstthousand/_415Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_415Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._415; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _415Test { private _415.Solution1 solution1; private _415.Solution2 solution2; @@ -48,5 +48,4 @@ public void test3() { actual = solution1.addStrings(num1, num2); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_416Test.java b/src/test/java/com/fishercoder/firstthousand/_416Test.java index 50afa2794c..5f2b480484 100644 --- a/src/test/java/com/fishercoder/firstthousand/_416Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_416Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._416; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _416Test { private _416.Solution1 solution1; private static int[] nums; @@ -17,21 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 5, 11, 5}; + nums = new int[] {1, 5, 11, 5}; assertEquals(true, solution1.canPartition(nums)); } @Test public void test2() { - nums = new int[]{1, 2, 3, 5}; + nums = new int[] {1, 2, 3, 5}; assertEquals(false, solution1.canPartition(nums)); } @Test public void test3() { - nums = new int[]{1, 2, 3, 4, 5, 6, 7}; + nums = new int[] {1, 2, 3, 4, 5, 6, 7}; assertEquals(true, solution1.canPartition(nums)); } - } - diff --git a/src/test/java/com/fishercoder/firstthousand/_417Test.java b/src/test/java/com/fishercoder/firstthousand/_417Test.java index 529dcded0b..5a0922198c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_417Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_417Test.java @@ -16,11 +16,12 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {2, 3, 5}, - {3, 4, 4}, - {5, 3, 1}, - }; + matrix = + new int[][] { + {2, 3, 5}, + {3, 4, 4}, + {5, 3, 1}, + }; for (int[] arr : solution1.pacificAtlantic(matrix)) { CommonUtils.printArray(arr); } @@ -28,10 +29,11 @@ public void test1() { @Test public void test2() { - matrix = new int[][]{ - {3, 5}, - {4, 4}, - }; + matrix = + new int[][] { + {3, 5}, + {4, 4}, + }; for (int[] arr : solution1.pacificAtlantic(matrix)) { CommonUtils.printArray(arr); } @@ -39,13 +41,14 @@ public void test2() { @Test public void test3() { - matrix = new int[][]{ - {1, 2, 2, 3, 5}, - {3, 2, 3, 4, 4}, - {2, 4, 5, 3, 1}, - {6, 7, 1, 4, 5}, - {5, 1, 1, 2, 4}, - }; + matrix = + new int[][] { + {1, 2, 2, 3, 5}, + {3, 2, 3, 4, 4}, + {2, 4, 5, 3, 1}, + {6, 7, 1, 4, 5}, + {5, 1, 1, 2, 4}, + }; for (int[] arr : solution1.pacificAtlantic(matrix)) { CommonUtils.printArray(arr); } @@ -53,13 +56,13 @@ public void test3() { @Test public void test4() { - matrix = new int[][]{ - {2, 3, 5}, - {3, 4, 4}, - }; + matrix = + new int[][] { + {2, 3, 5}, + {3, 4, 4}, + }; for (int[] arr : solution1.pacificAtlantic(matrix)) { CommonUtils.printArray(arr); } } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_418Test.java b/src/test/java/com/fishercoder/firstthousand/_418Test.java index ee93019772..e0184d1fca 100644 --- a/src/test/java/com/fishercoder/firstthousand/_418Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_418Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._418; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _418Test { private _418.Solution1 test; private static String[] sentence; @@ -17,37 +17,37 @@ public void setup() { @Test public void test1() { - sentence = new String[]{"hello", "world"}; + sentence = new String[] {"hello", "world"}; assertEquals(1, test.wordsTyping(sentence, 2, 8)); } @Test public void test2() { - sentence = new String[]{"a", "bcd", "e"}; + sentence = new String[] {"a", "bcd", "e"}; assertEquals(2, test.wordsTyping(sentence, 3, 6)); } @Test public void test3() { - sentence = new String[]{"I", "had", "apple", "pie"}; + sentence = new String[] {"I", "had", "apple", "pie"}; assertEquals(1, test.wordsTyping(sentence, 4, 5)); } @Test public void test4() { - sentence = new String[]{"f", "p", "a"}; + sentence = new String[] {"f", "p", "a"}; assertEquals(10, test.wordsTyping(sentence, 8, 7)); } @Test public void test5() { - sentence = new String[]{"hello", "leetcode"}; + sentence = new String[] {"hello", "leetcode"}; assertEquals(1, test.wordsTyping(sentence, 1, 20)); } @Test public void test6() { - sentence = new String[]{"h"}; + sentence = new String[] {"h"}; assertEquals(4, test.wordsTyping(sentence, 2, 3)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_41Test.java b/src/test/java/com/fishercoder/firstthousand/_41Test.java index 32bfa89133..6e87dd0f61 100644 --- a/src/test/java/com/fishercoder/firstthousand/_41Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_41Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._41; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _41Test { private _41.Solution1 solution1; private static int[] nums; @@ -17,25 +17,25 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 0}; + nums = new int[] {1, 2, 0}; assertEquals(3, solution1.firstMissingPositive(nums)); } @Test public void test2() { - nums = new int[]{}; + nums = new int[] {}; assertEquals(1, solution1.firstMissingPositive(nums)); } @Test public void test3() { - nums = new int[]{3, 4, -1, 1}; + nums = new int[] {3, 4, -1, 1}; assertEquals(2, solution1.firstMissingPositive(nums)); } @Test public void test4() { - nums = new int[]{2}; + nums = new int[] {2}; assertEquals(1, solution1.firstMissingPositive(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_421Test.java b/src/test/java/com/fishercoder/firstthousand/_421Test.java index d6f6e80dcd..83fc3c43c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_421Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_421Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._421; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _421Test { private _421.Solution1 solution1; private static int expected; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 10, 5, 25, 2, 8}; + nums = new int[] {3, 10, 5, 25, 2, 8}; expected = 28; actual = solution1.findMaximumXOR(nums); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_422Test.java b/src/test/java/com/fishercoder/firstthousand/_422Test.java index a906a8d570..a775b17c11 100644 --- a/src/test/java/com/fishercoder/firstthousand/_422Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_422Test.java @@ -1,52 +1,49 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._422; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._422; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _422Test { - private _422.Solution1 test; - private static boolean expected; - private static boolean actual; - private static List words; + private _422.Solution1 test; + private static boolean expected; + private static boolean actual; + private static List words; - @BeforeEach + @BeforeEach public void setUp() { - test = new _422.Solution1(); - } - - @BeforeEach - public void setupForEachTest() { - } - - @Test - public void test1() { - words = new ArrayList<>(Arrays.asList("abcd", "bnrt", "crmy", "dtye")); - expected = true; - actual = test.validWordSquare(words); - assertEquals(expected, actual); - } - - @Test - public void test2() { - words = new ArrayList<>(Arrays.asList("abcd", "bnrt", "crm", "dt")); - expected = true; - actual = test.validWordSquare(words); - assertEquals(expected, actual); - } - - @Test - public void test3() { - words = new ArrayList<>(Arrays.asList("ball", "asee", "let", "lep")); - expected = false; - actual = test.validWordSquare(words); - assertEquals(expected, actual); - } + test = new _422.Solution1(); + } + + @BeforeEach + public void setupForEachTest() {} + + @Test + public void test1() { + words = new ArrayList<>(Arrays.asList("abcd", "bnrt", "crmy", "dtye")); + expected = true; + actual = test.validWordSquare(words); + assertEquals(expected, actual); + } + + @Test + public void test2() { + words = new ArrayList<>(Arrays.asList("abcd", "bnrt", "crm", "dt")); + expected = true; + actual = test.validWordSquare(words); + assertEquals(expected, actual); + } + + @Test + public void test3() { + words = new ArrayList<>(Arrays.asList("ball", "asee", "let", "lep")); + expected = false; + actual = test.validWordSquare(words); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_423Test.java b/src/test/java/com/fishercoder/firstthousand/_423Test.java index d4b2ef20ac..d6a69f52a0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_423Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_423Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._423; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _423Test { private _423.Solution1 solution1; private static String expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_424Test.java b/src/test/java/com/fishercoder/firstthousand/_424Test.java index 5e97637a53..7f13ab1f86 100644 --- a/src/test/java/com/fishercoder/firstthousand/_424Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_424Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._424; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _424Test { private _424.Solution1 solution1; private _424.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_425Test.java b/src/test/java/com/fishercoder/firstthousand/_425Test.java index 571753284a..04ba5f9fd1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_425Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_425Test.java @@ -2,11 +2,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._425; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class _425Test { private _425.Solution1 solution1; private static String[] words; @@ -18,7 +17,7 @@ public void setup() { @Test public void test1() { - words = new String[]{"area", "lead", "wall", "lady", "ball"}; + words = new String[] {"area", "lead", "wall", "lady", "ball"}; List> result = solution1.wordSquares(words); CommonUtils.printListList(result); } diff --git a/src/test/java/com/fishercoder/firstthousand/_426Test.java b/src/test/java/com/fishercoder/firstthousand/_426Test.java index 5b7955d753..9f6c6ae4ec 100644 --- a/src/test/java/com/fishercoder/firstthousand/_426Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_426Test.java @@ -26,5 +26,4 @@ public void test1() { _426.Node actual = solution1.treeToDoublyList(node4); System.out.println("Finished."); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_429Test.java b/src/test/java/com/fishercoder/firstthousand/_429Test.java index d145c3d843..9f3a1f315c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_429Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_429Test.java @@ -1,47 +1,46 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.Node; import com.fishercoder.solutions.firstthousand._429; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _429Test { - private _429.Solution1 solution1; - private static Node root; - private static List> expected; + private _429.Solution1 solution1; + private static Node root; + private static List> expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _429.Solution1(); - } + solution1 = new _429.Solution1(); + } - @Test - public void test1() { - root = new Node(1); - Node node3 = new Node(3); - Node node2 = new Node(2); - Node node4 = new Node(4); - root.children = Arrays.asList(node3, node2, node4); - Node node5 = new Node(5); - Node node6 = new Node(6); - node3.children = Arrays.asList(node5, node6); - expected = new ArrayList<>(); - expected.add(Arrays.asList(1)); - expected.add(Arrays.asList(3, 2, 4)); - expected.add(Arrays.asList(5, 6)); - assertEquals(expected, solution1.levelOrder(root)); - } + @Test + public void test1() { + root = new Node(1); + Node node3 = new Node(3); + Node node2 = new Node(2); + Node node4 = new Node(4); + root.children = Arrays.asList(node3, node2, node4); + Node node5 = new Node(5); + Node node6 = new Node(6); + node3.children = Arrays.asList(node5, node6); + expected = new ArrayList<>(); + expected.add(Arrays.asList(1)); + expected.add(Arrays.asList(3, 2, 4)); + expected.add(Arrays.asList(5, 6)); + assertEquals(expected, solution1.levelOrder(root)); + } - @Test - public void test2() { - root = null; - expected = new ArrayList<>(); - assertEquals(expected, solution1.levelOrder(root)); - } + @Test + public void test2() { + root = null; + expected = new ArrayList<>(); + assertEquals(expected, solution1.levelOrder(root)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_42Test.java b/src/test/java/com/fishercoder/firstthousand/_42Test.java index 4095214344..899cf42f30 100644 --- a/src/test/java/com/fishercoder/firstthousand/_42Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_42Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._42; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/13/17. - */ +/** Created by fishercoder on 5/13/17. */ public class _42Test { private _42.Solution1 solution1; private static int[] height; @@ -20,9 +18,7 @@ public void setup() { @Test public void test1() { - height = new int[]{0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}; + height = new int[] {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}; assertEquals(6, solution1.trap(height)); } - - } diff --git a/src/test/java/com/fishercoder/firstthousand/_433Test.java b/src/test/java/com/fishercoder/firstthousand/_433Test.java index 06486c06e8..cdbf47e1aa 100644 --- a/src/test/java/com/fishercoder/firstthousand/_433Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_433Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._433; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _433Test { private _433.Solution1 solution1; @@ -16,19 +16,34 @@ public void setup() { @Test public void test1() { - assertEquals(-1, solution1.minMutation("AACCGGTT", "AACCGGTA", new String[]{})); + assertEquals(-1, solution1.minMutation("AACCGGTT", "AACCGGTA", new String[] {})); } @Test public void test2() { - assertEquals(-1, solution1.minMutation("AAAAAAAA", "CCCCCCCC", - new String[]{"AAAAAAAA", "AAAAAAAC", "AAAAAACC", "AAAAACCC", "AAAACCCC", "AACACCCC", "ACCACCCC", "ACCCCCCC", "CCCCCCCA"})); + assertEquals( + -1, + solution1.minMutation( + "AAAAAAAA", + "CCCCCCCC", + new String[] { + "AAAAAAAA", + "AAAAAAAC", + "AAAAAACC", + "AAAAACCC", + "AAAACCCC", + "AACACCCC", + "ACCACCCC", + "ACCCCCCC", + "CCCCCCCA" + })); } @Test public void test3() { - assertEquals(-1, solution1.minMutation("AAAAAAAT", "CCCCCCCC", - new String[]{"AAAAAAAC", "AAAAAAAA", "CCCCCCCC"})); + assertEquals( + -1, + solution1.minMutation( + "AAAAAAAT", "CCCCCCCC", new String[] {"AAAAAAAC", "AAAAAAAA", "CCCCCCCC"})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_434Test.java b/src/test/java/com/fishercoder/firstthousand/_434Test.java index 353ea57dc2..9e4fdeea01 100644 --- a/src/test/java/com/fishercoder/firstthousand/_434Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_434Test.java @@ -1,42 +1,41 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._434; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _434Test { - private _434.Solution1 solution1; - private static int expected; - private static int actual; - private static String s; + private _434.Solution1 solution1; + private static int expected; + private static int actual; + private static String s; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _434.Solution1(); - } + solution1 = new _434.Solution1(); + } - @BeforeEach + @BeforeEach public void setupForEachTest() { - expected = 0; - actual = 0; - } + expected = 0; + actual = 0; + } - @Test - public void test1() { - s = "Hello, my name is John"; - expected = 5; - actual = solution1.countSegments(s); - assertEquals(expected, actual); - } + @Test + public void test1() { + s = "Hello, my name is John"; + expected = 5; + actual = solution1.countSegments(s); + assertEquals(expected, actual); + } - @Test - public void test2() { - s = ", , , , a, eaefa"; - expected = 6; - actual = solution1.countSegments(s); - assertEquals(expected, actual); - } + @Test + public void test2() { + s = ", , , , a, eaefa"; + expected = 6; + actual = solution1.countSegments(s); + assertEquals(expected, actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_435Test.java b/src/test/java/com/fishercoder/firstthousand/_435Test.java index 0503662e6e..f582707184 100644 --- a/src/test/java/com/fishercoder/firstthousand/_435Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_435Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._435; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _435Test { private _435.Solution1 solution1; private _435.Solution2 solution2; @@ -19,16 +19,19 @@ public void setup() { @Test public void test1() { - int[][] intervals = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[2,3],[3,4],[1,3]"); + int[][] intervals = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[2,3],[3,4],[1,3]"); assertEquals(1, solution1.eraseOverlapIntervals(intervals)); assertEquals(1, solution2.eraseOverlapIntervals(intervals)); } @Test public void test2() { - int[][] intervals = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[-52,31],[-73,-26],[82,97],[-65,-11],[-62,-49],[95,99],[58,95],[-31,49],[66,98],[-63,2],[30,47],[-40,-26]"); + int[][] intervals = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[-52,31],[-73,-26],[82,97],[-65,-11],[-62,-49],[95,99],[58,95],[-31,49],[66,98],[-63,2],[30,47],[-40,-26]"); assertEquals(7, solution1.eraseOverlapIntervals(intervals)); assertEquals(7, solution2.eraseOverlapIntervals(intervals)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_436Test.java b/src/test/java/com/fishercoder/firstthousand/_436Test.java index c32b0c2a63..261b183472 100644 --- a/src/test/java/com/fishercoder/firstthousand/_436Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_436Test.java @@ -14,21 +14,23 @@ public void setup() { @Test public void test1() { - int[][] intervals = new int[][]{ - {3, 4}, - {2, 3}, - {1, 2} - }; + int[][] intervals = + new int[][] { + {3, 4}, + {2, 3}, + {1, 2} + }; solution1.findRightInterval(intervals); } @Test public void test2() { - int[][] intervals = new int[][]{ - {1, 4}, - {2, 3}, - {3, 4} - }; + int[][] intervals = + new int[][] { + {1, 4}, + {2, 3}, + {3, 4} + }; solution1.findRightInterval(intervals); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_439Test.java b/src/test/java/com/fishercoder/firstthousand/_439Test.java index 962df67f43..6739456566 100644 --- a/src/test/java/com/fishercoder/firstthousand/_439Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_439Test.java @@ -1,49 +1,47 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._439; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/18/17. - */ +/** Created by fishercoder on 5/18/17. */ public class _439Test { - private _439.Solution1 solution1; - private static String expression; - private static String expected; + private _439.Solution1 solution1; + private static String expression; + private static String expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _439.Solution1(); - } - - @Test - public void test1() { - expression = "T?2:3"; - expected = "2"; - assertEquals(expected, solution1.parseTernary(expression)); - } - - @Test - public void test2() { - expression = "F?1:T?4:5"; - expected = "4"; - assertEquals(expected, solution1.parseTernary(expression)); - } - - @Test - public void test3() { - expression = "T?T?F:5:3"; - expected = "F"; - assertEquals(expected, solution1.parseTernary(expression)); - } - - @Test - public void test4() { - expression = "T?T:F?T?1:2:F?3:4"; - expected = "T"; - assertEquals(expected, solution1.parseTernary(expression)); - } + solution1 = new _439.Solution1(); + } + + @Test + public void test1() { + expression = "T?2:3"; + expected = "2"; + assertEquals(expected, solution1.parseTernary(expression)); + } + + @Test + public void test2() { + expression = "F?1:T?4:5"; + expected = "4"; + assertEquals(expected, solution1.parseTernary(expression)); + } + + @Test + public void test3() { + expression = "T?T?F:5:3"; + expected = "F"; + assertEquals(expected, solution1.parseTernary(expression)); + } + + @Test + public void test4() { + expression = "T?T:F?T?1:2:F?3:4"; + expected = "T"; + assertEquals(expected, solution1.parseTernary(expression)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_43Test.java b/src/test/java/com/fishercoder/firstthousand/_43Test.java index 11c23c760d..088fa7da81 100644 --- a/src/test/java/com/fishercoder/firstthousand/_43Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_43Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._43; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _43Test { private _43.Solution1 solution1; private _43.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_441Test.java b/src/test/java/com/fishercoder/firstthousand/_441Test.java index f2b78eb0f0..7e52e61d5d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_441Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_441Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._441; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _441Test { private _441.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.arrangeCoins(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_442Test.java b/src/test/java/com/fishercoder/firstthousand/_442Test.java index 33e3695044..58c790eb7b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_442Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_442Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._442; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _442Test { private _442.Solution1 solution1; private _442.Solution2 solution2; @@ -20,8 +19,9 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(2, 3), solution1.findDuplicates(new int[]{4, 3, 2, 7, 8, 2, 3, 1})); - assertEquals(Arrays.asList(2, 3), solution2.findDuplicates(new int[]{4, 3, 2, 7, 8, 2, 3, 1})); + assertEquals( + Arrays.asList(2, 3), solution1.findDuplicates(new int[] {4, 3, 2, 7, 8, 2, 3, 1})); + assertEquals( + Arrays.asList(2, 3), solution2.findDuplicates(new int[] {4, 3, 2, 7, 8, 2, 3, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_443Test.java b/src/test/java/com/fishercoder/firstthousand/_443Test.java index c0bec55a47..d56753855d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_443Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_443Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._443; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _443Test { private _443.Solution1 solution1; private static char[] chars; @@ -17,25 +17,25 @@ public void setup() { @Test public void test1() { - chars = new char[]{'a', 'a', 'b', 'b', 'c', 'c', 'c'}; + chars = new char[] {'a', 'a', 'b', 'b', 'c', 'c', 'c'}; assertEquals(6, solution1.compress(chars)); } @Test public void test2() { - chars = new char[]{'a'}; + chars = new char[] {'a'}; assertEquals(1, solution1.compress(chars)); } @Test public void test3() { - chars = new char[]{'a', 'b'}; + chars = new char[] {'a', 'b'}; assertEquals(2, solution1.compress(chars)); } @Test public void test4() { - chars = new char[]{'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'}; + chars = new char[] {'a', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'}; assertEquals(4, solution1.compress(chars)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_444Test.java b/src/test/java/com/fishercoder/firstthousand/_444Test.java index c1909dc6c6..a7f1a27c57 100644 --- a/src/test/java/com/fishercoder/firstthousand/_444Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_444Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._444; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._444; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _444Test { private _444.Solution1 solution1; @@ -22,7 +21,7 @@ public void setup() { @Test public void test1() { - org = new int[]{1, 2, 3}; + org = new int[] {1, 2, 3}; seqs = new ArrayList<>(); seqs.add(Arrays.asList(1, 2)); seqs.add(Arrays.asList(1, 3)); diff --git a/src/test/java/com/fishercoder/firstthousand/_445Test.java b/src/test/java/com/fishercoder/firstthousand/_445Test.java index f002919173..c926890eb9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_445Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_445Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._445; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/13/17. - */ +/** Created by fishercoder on 5/13/17. */ public class _445Test { private _445.Solution1 solution1; private _445.Solution2 solution2; @@ -23,33 +21,33 @@ public void setup() { @Test public void test1() { - ListNode l1 = LinkedListUtils.contructLinkedList(new int[]{7, 2, 4, 3}); + ListNode l1 = LinkedListUtils.contructLinkedList(new int[] {7, 2, 4, 3}); - ListNode l2 = LinkedListUtils.contructLinkedList(new int[]{5, 6, 4}); + ListNode l2 = LinkedListUtils.contructLinkedList(new int[] {5, 6, 4}); - ListNode expected = LinkedListUtils.contructLinkedList(new int[]{7, 8, 0, 7}); + ListNode expected = LinkedListUtils.contructLinkedList(new int[] {7, 8, 0, 7}); assertEquals(expected, solution1.addTwoNumbers(l1, l2)); } @Test public void test2() { - ListNode l1 = LinkedListUtils.contructLinkedList(new int[]{7, 2, 4, 3}); + ListNode l1 = LinkedListUtils.contructLinkedList(new int[] {7, 2, 4, 3}); - ListNode l2 = LinkedListUtils.contructLinkedList(new int[]{5, 6, 4}); + ListNode l2 = LinkedListUtils.contructLinkedList(new int[] {5, 6, 4}); - ListNode expected = LinkedListUtils.contructLinkedList(new int[]{7, 8, 0, 7}); + ListNode expected = LinkedListUtils.contructLinkedList(new int[] {7, 8, 0, 7}); assertEquals(expected, solution2.addTwoNumbers(l1, l2)); } @Test public void test3() { - ListNode l1 = LinkedListUtils.contructLinkedList(new int[]{5}); + ListNode l1 = LinkedListUtils.contructLinkedList(new int[] {5}); - ListNode l2 = LinkedListUtils.contructLinkedList(new int[]{5}); + ListNode l2 = LinkedListUtils.contructLinkedList(new int[] {5}); - ListNode expected = LinkedListUtils.contructLinkedList(new int[]{1, 0}); + ListNode expected = LinkedListUtils.contructLinkedList(new int[] {1, 0}); assertEquals(expected, solution2.addTwoNumbers(l1, l2)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_447Test.java b/src/test/java/com/fishercoder/firstthousand/_447Test.java index 62cab29f17..8d29aa59ac 100644 --- a/src/test/java/com/fishercoder/firstthousand/_447Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_447Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._447; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _447Test { private _447.Solution1 solution1; private static int[][] points; @@ -17,28 +17,29 @@ public void setup() { @Test public void test1() { - points = new int[][]{ - {0, 0}, - {1, 0}, - {2, 0}, - }; + points = + new int[][] { + {0, 0}, + {1, 0}, + {2, 0}, + }; assertEquals(2, solution1.numberOfBoomerangs(points)); } @Test public void test2() { - points = new int[][]{ - {3, 6}, - {7, 5}, - {3, 5}, - {6, 2}, - {9, 1}, - {2, 7}, - {0, 9}, - {0, 6}, - {2, 6} - }; + points = + new int[][] { + {3, 6}, + {7, 5}, + {3, 5}, + {6, 2}, + {9, 1}, + {2, 7}, + {0, 9}, + {0, 6}, + {2, 6} + }; assertEquals(10, solution1.numberOfBoomerangs(points)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_449Test.java b/src/test/java/com/fishercoder/firstthousand/_449Test.java index a28e6b9b27..e3ea11dbff 100644 --- a/src/test/java/com/fishercoder/firstthousand/_449Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_449Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._449; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _449Test { private _449.Solution1 solution1; private _449.Solution2 solution2; @@ -24,8 +23,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { @@ -33,10 +31,18 @@ public void test1() { expectedRoot.left = new TreeNode(1); expectedRoot.right = new TreeNode(4); expectedRoot.left.right = new TreeNode(2); - assertEquals(expectedRoot.toString(), solution1.deserialize(solution1.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution2.deserialize(solution2.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution3.deserialize(solution3.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution4.deserialize(solution4.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution1.deserialize(solution1.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution2.deserialize(solution2.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution3.deserialize(solution3.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution4.deserialize(solution4.serialize(expectedRoot)).toString()); } @Test @@ -44,9 +50,17 @@ public void test2() { expectedRoot = new TreeNode(2); expectedRoot.left = new TreeNode(1); expectedRoot.right = new TreeNode(3); - assertEquals(expectedRoot.toString(), solution1.deserialize(solution1.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution2.deserialize(solution2.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution3.deserialize(solution3.serialize(expectedRoot)).toString()); - assertEquals(expectedRoot.toString(), solution4.deserialize(solution4.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution1.deserialize(solution1.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution2.deserialize(solution2.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution3.deserialize(solution3.serialize(expectedRoot)).toString()); + assertEquals( + expectedRoot.toString(), + solution4.deserialize(solution4.serialize(expectedRoot)).toString()); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_44Test.java b/src/test/java/com/fishercoder/firstthousand/_44Test.java index 8193e68463..152448d90d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_44Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_44Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._44; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _44Test { private _44.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_450Test.java b/src/test/java/com/fishercoder/firstthousand/_450Test.java index acc9cf0aef..db09c365b5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_450Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_450Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._450; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _450Test { private _450.Solution1 solution1; private _450.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_451Test.java b/src/test/java/com/fishercoder/firstthousand/_451Test.java index 8e8225d0cb..5c49ba669d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_451Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_451Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._451; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _451Test { private _451.Solution1 solution1; private _451.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_452Test.java b/src/test/java/com/fishercoder/firstthousand/_452Test.java index cdc40d0a9c..a7b30ea48f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_452Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_452Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._452; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _452Test { private _452.Solution1 solution1; private _452.Solution2 solution2; @@ -21,8 +21,9 @@ public void setup() { @Test public void test1() { - int[][] points = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[3,9],[7,12],[3,8],[6,8],[9,10],[2,9],[0,9],[3,9],[0,6],[2,8]"); + int[][] points = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[3,9],[7,12],[3,8],[6,8],[9,10],[2,9],[0,9],[3,9],[0,6],[2,8]"); assertEquals(2, solution1.findMinArrowShots(points)); assertEquals(2, solution2.findMinArrowShots(points)); assertEquals(2, solution3.findMinArrowShots(points)); @@ -30,8 +31,9 @@ public void test1() { @Test public void test2() { - int[][] points = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[-2147483646,-2147483645],[2147483646,2147483647]"); + int[][] points = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[-2147483646,-2147483645],[2147483646,2147483647]"); assertEquals(2, solution1.findMinArrowShots(points)); assertEquals(2, solution2.findMinArrowShots(points)); assertEquals(2, solution3.findMinArrowShots(points)); @@ -39,8 +41,9 @@ public void test2() { @Test public void test3() { - int[][] points = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[0,6],[0,9],[7,8]"); + int[][] points = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,6],[0,9],[7,8]"); assertEquals(2, solution1.findMinArrowShots(points)); assertEquals(2, solution2.findMinArrowShots(points)); assertEquals(2, solution3.findMinArrowShots(points)); @@ -48,11 +51,11 @@ public void test3() { @Test public void test4() { - int[][] points = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[9,12],[1,10],[4,11],[8,12],[3,9],[6,9],[6,7]"); + int[][] points = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[9,12],[1,10],[4,11],[8,12],[3,9],[6,9],[6,7]"); assertEquals(2, solution1.findMinArrowShots(points)); assertEquals(2, solution2.findMinArrowShots(points)); assertEquals(2, solution3.findMinArrowShots(points)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_453Test.java b/src/test/java/com/fishercoder/firstthousand/_453Test.java index 4a4023af2a..b725346569 100644 --- a/src/test/java/com/fishercoder/firstthousand/_453Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_453Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._453; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - - public class _453Test { private _453.Solution1 solution1; @@ -17,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minMoves(new int[]{1, 2, 3})); + assertEquals(3, solution1.minMoves(new int[] {1, 2, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_454Test.java b/src/test/java/com/fishercoder/firstthousand/_454Test.java index efd86f6dc9..c1a12e375d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_454Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_454Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._454; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _454Test { private _454.Solution1 solution1; private static int expected; @@ -22,13 +22,12 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 2}; - B = new int[]{-2, -1}; - C = new int[]{-1, 2}; - D = new int[]{0, 2}; + A = new int[] {1, 2}; + B = new int[] {-2, -1}; + C = new int[] {-1, 2}; + D = new int[] {0, 2}; expected = 2; actual = solution1.fourSumCount(A, B, C, D); assertEquals(expected, actual); - } } diff --git a/src/test/java/com/fishercoder/firstthousand/_455Test.java b/src/test/java/com/fishercoder/firstthousand/_455Test.java index f72ee57cdf..4b6a58ced0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_455Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_455Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._455; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _455Test { private _455.Solution1 solution1; @@ -16,13 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.findContentChildren(new int[]{1, 2, 3}, new int[]{1, 1})); - + assertEquals(1, solution1.findContentChildren(new int[] {1, 2, 3}, new int[] {1, 1})); } @Test public void test2() { - assertEquals(2, solution1.findContentChildren(new int[]{1, 2}, new int[]{1, 2, 3})); - + assertEquals(2, solution1.findContentChildren(new int[] {1, 2}, new int[] {1, 2, 3})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_456Test.java b/src/test/java/com/fishercoder/firstthousand/_456Test.java index f0cead488e..8d1a8a3a85 100644 --- a/src/test/java/com/fishercoder/firstthousand/_456Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_456Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._456; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _456Test { private _456.Solution1 solution1; @@ -16,8 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.find132pattern(new int[]{-1, 3, 2, 0})); - + assertEquals(true, solution1.find132pattern(new int[] {-1, 3, 2, 0})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_457Test.java b/src/test/java/com/fishercoder/firstthousand/_457Test.java index 6837f1266f..01e549836e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_457Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_457Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._457; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _457Test { private _457.Solution1 solution1; private static int[] nums; @@ -17,26 +17,25 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, -1, 1, 2, 2}; + nums = new int[] {2, -1, 1, 2, 2}; assertEquals(true, solution1.circularArrayLoop(nums)); } @Test public void test2() { - nums = new int[]{-1, 2}; + nums = new int[] {-1, 2}; assertEquals(false, solution1.circularArrayLoop(nums)); } @Test public void test3() { - nums = new int[]{-1, 2, 3}; + nums = new int[] {-1, 2, 3}; assertEquals(false, solution1.circularArrayLoop(nums)); } @Test public void test4() { - nums = new int[]{2, 1, 9}; + nums = new int[] {2, 1, 9}; assertEquals(false, solution1.circularArrayLoop(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_458Test.java b/src/test/java/com/fishercoder/firstthousand/_458Test.java index 3d09e4bf88..48ca6d8fe8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_458Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_458Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._458; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _458Test { private _458.Solution1 solution1; private static int expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_459Test.java b/src/test/java/com/fishercoder/firstthousand/_459Test.java index ea42d66d1c..c6a6dfb8dd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_459Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_459Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._459; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _459Test { private _459.Solution1 solution1; private _459.Solution2 solution2; @@ -41,9 +41,18 @@ public void test3() { @Test public void test4() { - assertEquals(false, solution1.repeatedSubstringPattern("qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); - assertEquals(false, solution2.repeatedSubstringPattern("qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); - assertEquals(false, solution3.repeatedSubstringPattern("qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); + assertEquals( + false, + solution1.repeatedSubstringPattern( + "qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); + assertEquals( + false, + solution2.repeatedSubstringPattern( + "qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); + assertEquals( + false, + solution3.repeatedSubstringPattern( + "qtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvburqtpddbuotbbqcwivrfxjujjddntgeiqvdgaijvwcyaubwewpjvygehljxepbpiwuqzdzubdubzvafspqpqwuzifwovyddwyvvbus")); } @Test diff --git a/src/test/java/com/fishercoder/firstthousand/_45Test.java b/src/test/java/com/fishercoder/firstthousand/_45Test.java index 0640016e68..da234fcdfb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_45Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_45Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._45; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _45Test { private _45.Solution1 solution1; private static int[] nums; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 3, 1, 1, 4}; + nums = new int[] {2, 3, 1, 1, 4}; assertEquals(2, solution1.jump(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_460Test.java b/src/test/java/com/fishercoder/firstthousand/_460Test.java index 6c241f0e04..2fcc36309e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_460Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_460Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._460; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _460Test { private _460.Solution1.LFUCache lfuCache; diff --git a/src/test/java/com/fishercoder/firstthousand/_461Test.java b/src/test/java/com/fishercoder/firstthousand/_461Test.java index 33c201fd60..65a77696c0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_461Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_461Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._461; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _461Test { private _461.Solution1 solution1; private _461.Solution2 solution2; @@ -40,5 +40,4 @@ public void test2() { assertEquals(expected, solution2.hammingDistance(x, y)); assertEquals(expected, solution3.hammingDistance(x, y)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_462Test.java b/src/test/java/com/fishercoder/firstthousand/_462Test.java index 0c229142db..d4725baaf5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_462Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_462Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._462; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _462Test { private _462.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.minMoves2(new int[]{1, 2, 3})); + assertEquals(2, solution1.minMoves2(new int[] {1, 2, 3})); } @Test public void test2() { - assertEquals(0, solution1.minMoves2(new int[]{1})); + assertEquals(0, solution1.minMoves2(new int[] {1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_467Test.java b/src/test/java/com/fishercoder/firstthousand/_467Test.java index 87c27a321b..80679c1c90 100644 --- a/src/test/java/com/fishercoder/firstthousand/_467Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_467Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._467; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _467Test { private _467.Solution1 solution1; @@ -17,7 +17,5 @@ public void setup() { @Test public void test1() { assertEquals(1, solution1.findSubstringInWraproundString("a")); - } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_468Test.java b/src/test/java/com/fishercoder/firstthousand/_468Test.java index e81438864c..49f609d838 100644 --- a/src/test/java/com/fishercoder/firstthousand/_468Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_468Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._468; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _468Test { private _468.Solution1 solution1; @@ -31,7 +31,8 @@ public void test3() { @Test public void test4() { - assertEquals("Neither", solution1.validIPAddress("02001:0db8:85a3:0000:0000:8a2e:0370:7334")); + assertEquals( + "Neither", solution1.validIPAddress("02001:0db8:85a3:0000:0000:8a2e:0370:7334")); } @Test @@ -78,5 +79,4 @@ public void test12() { public void test13() { assertEquals("Neither", solution1.validIPAddress("1081:db8:85a3:01:z:8A2E:0370:7334")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_46Test.java b/src/test/java/com/fishercoder/firstthousand/_46Test.java index 150f02d4e6..7148c2aa71 100644 --- a/src/test/java/com/fishercoder/firstthousand/_46Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_46Test.java @@ -19,15 +19,15 @@ public void setup() { @Test public void test1() { - CommonUtils.printListList(solution1.permute(new int[]{1, 2, 3})); - CommonUtils.printListList(solution2.permute(new int[]{1, 2, 3})); - CommonUtils.printListList(solution3.permute(new int[]{1, 2, 3})); + CommonUtils.printListList(solution1.permute(new int[] {1, 2, 3})); + CommonUtils.printListList(solution2.permute(new int[] {1, 2, 3})); + CommonUtils.printListList(solution3.permute(new int[] {1, 2, 3})); } @Test public void test2() { - CommonUtils.printListList(solution1.permute(new int[]{1, 2, 3, 4, 5, 6})); - CommonUtils.printListList(solution2.permute(new int[]{1, 2, 3, 4, 5, 6})); - CommonUtils.printListList(solution3.permute(new int[]{1, 2, 3, 4, 5, 6})); + CommonUtils.printListList(solution1.permute(new int[] {1, 2, 3, 4, 5, 6})); + CommonUtils.printListList(solution2.permute(new int[] {1, 2, 3, 4, 5, 6})); + CommonUtils.printListList(solution3.permute(new int[] {1, 2, 3, 4, 5, 6})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_473Test.java b/src/test/java/com/fishercoder/firstthousand/_473Test.java index e042eef07f..b7df76bc45 100644 --- a/src/test/java/com/fishercoder/firstthousand/_473Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_473Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._473; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _473Test { private _473.Solution1 solution1; private static int[] nums; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 2, 2, 2}; + nums = new int[] {1, 1, 2, 2, 2}; assertEquals(true, solution1.makesquare(nums)); } @Test public void test2() { - nums = new int[]{3, 3, 3, 3, 4}; + nums = new int[] {3, 3, 3, 3, 4}; assertEquals(false, solution1.makesquare(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_474Test.java b/src/test/java/com/fishercoder/firstthousand/_474Test.java index a291e8237f..fdcad6f4d3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_474Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_474Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._474; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _474Test { private _474.Solution1 solution1; @@ -16,7 +16,7 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.findMaxForm(new String[]{"10", "0001", "111001", "1", "0"}, 5, 3)); + assertEquals( + 4, solution1.findMaxForm(new String[] {"10", "0001", "111001", "1", "0"}, 5, 3)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_475Test.java b/src/test/java/com/fishercoder/firstthousand/_475Test.java index d208935dd2..42d0ea415a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_475Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_475Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._475; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/23/17. - */ +/** Created by fishercoder on 4/23/17. */ public class _475Test { private _475.Solution1 test; private static int expected; @@ -23,8 +21,8 @@ public void setup() { @Test public void test1() { - houses = new int[]{1, 2, 3}; - heaters = new int[]{2}; + houses = new int[] {1, 2, 3}; + heaters = new int[] {2}; expected = 1; actual = test.findRadius(houses, heaters); assertEquals(expected, actual); @@ -32,8 +30,8 @@ public void test1() { @Test public void test2() { - houses = new int[]{1, 2, 3, 4}; - heaters = new int[]{1, 4}; + houses = new int[] {1, 2, 3, 4}; + heaters = new int[] {1, 4}; expected = 1; actual = test.findRadius(houses, heaters); assertEquals(expected, actual); @@ -41,8 +39,8 @@ public void test2() { @Test public void test3() { - houses = new int[]{1}; - heaters = new int[]{1, 2, 3, 4}; + houses = new int[] {1}; + heaters = new int[] {1, 2, 3, 4}; expected = 0; actual = test.findRadius(houses, heaters); assertEquals(expected, actual); @@ -50,8 +48,8 @@ public void test3() { @Test public void test4() { - houses = new int[]{1, 2, 3, 5, 15}; - heaters = new int[]{2, 30}; + houses = new int[] {1, 2, 3, 5, 15}; + heaters = new int[] {2, 30}; expected = 13; actual = test.findRadius(houses, heaters); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_476Test.java b/src/test/java/com/fishercoder/firstthousand/_476Test.java index 7d65681d87..78c31ad38a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_476Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_476Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._476; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/14/17. - */ +/** Created by fishercoder on 1/14/17. */ public class _476Test { private _476.Solution1 solution1; private _476.Solution2 solution2; @@ -38,7 +35,6 @@ public void test1() { actual = solution1.findComplement(input); actual = solution2.findComplement(input); assertEquals(expected, actual); - } @Test @@ -49,6 +45,5 @@ public void test2() { actual = solution1.findComplement(input); actual = solution2.findComplement(input); assertEquals(expected, actual); - } } diff --git a/src/test/java/com/fishercoder/firstthousand/_478Test.java b/src/test/java/com/fishercoder/firstthousand/_478Test.java index 5d3c84ee65..b925782524 100644 --- a/src/test/java/com/fishercoder/firstthousand/_478Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_478Test.java @@ -12,5 +12,4 @@ public void test1() { solution1 = new _478.Solution1(10.0, 5.0, -7.5); CommonUtils.printArray(solution1.randPoint()); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_479Test.java b/src/test/java/com/fishercoder/firstthousand/_479Test.java index c67028a493..cbed893142 100644 --- a/src/test/java/com/fishercoder/firstthousand/_479Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_479Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._479; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _479Test { private _479.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_47Test.java b/src/test/java/com/fishercoder/firstthousand/_47Test.java index 4fc97fe00b..02da863165 100644 --- a/src/test/java/com/fishercoder/firstthousand/_47Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_47Test.java @@ -2,11 +2,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._47; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class _47Test { private _47.Solution1 solution1; private _47.Solution2 solution2; @@ -20,10 +19,9 @@ public void setup() { @Test public void test1() { - actual = solution1.permuteUnique(new int[]{1, 1, 2}); + actual = solution1.permuteUnique(new int[] {1, 1, 2}); CommonUtils.printListList(actual); - actual = solution2.permuteUnique(new int[]{1, 1, 2}); + actual = solution2.permuteUnique(new int[] {1, 1, 2}); CommonUtils.printListList(actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_480Test.java b/src/test/java/com/fishercoder/firstthousand/_480Test.java index 005bb52bc0..4cc3d1235c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_480Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_480Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._480; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 5/27/17. - */ +/** Created by fishercoder on 5/27/17. */ public class _480Test { private _480.Solution1 solution1; private static int[] nums; @@ -22,8 +20,8 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, -1, -3, 5, 3, 6, 7}; - expected = new double[]{1, -1, -1, 3, 5, 6}; + nums = new int[] {1, 3, -1, -3, 5, 3, 6, 7}; + expected = new double[] {1, -1, -1, 3, 5, 6}; k = 3; assertArrayEquals(expected, solution1.medianSlidingWindow(nums, k), 0); } diff --git a/src/test/java/com/fishercoder/firstthousand/_482Test.java b/src/test/java/com/fishercoder/firstthousand/_482Test.java index 2a58e16eaa..c25838e0bf 100644 --- a/src/test/java/com/fishercoder/firstthousand/_482Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_482Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._482; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _482Test { private _482.Solution1 solution1; private static String expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_485Test.java b/src/test/java/com/fishercoder/firstthousand/_485Test.java index 47d1becf42..0efab86396 100644 --- a/src/test/java/com/fishercoder/firstthousand/_485Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_485Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._485; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _485Test { private _485.Solution1 solution1; private _485.Solution2 solution2; @@ -18,8 +18,7 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.findMaxConsecutiveOnes(new int[]{1, 1, 0, 1, 1, 1})); - assertEquals(3, solution2.findMaxConsecutiveOnes(new int[]{1, 1, 0, 1, 1, 1})); + assertEquals(3, solution1.findMaxConsecutiveOnes(new int[] {1, 1, 0, 1, 1, 1})); + assertEquals(3, solution2.findMaxConsecutiveOnes(new int[] {1, 1, 0, 1, 1, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_487Test.java b/src/test/java/com/fishercoder/firstthousand/_487Test.java index 8876f4009a..80711ab672 100644 --- a/src/test/java/com/fishercoder/firstthousand/_487Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_487Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._487; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _487Test { private _487.Solution1 soution1; private _487.Solution2 soution2; @@ -21,136 +21,412 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 0, 1, 1, 1}; + nums = new int[] {1, 1, 0, 1, 1, 1}; expected = 6; actual = soution1.findMaxConsecutiveOnes(nums); assertEquals(expected, actual); actual = soution2.findMaxConsecutiveOnes(nums); assertEquals(expected, actual); - } @Test public void test2() { - nums = new int[]{1, 1, 1, 1, 1, 1}; + nums = new int[] {1, 1, 1, 1, 1, 1}; expected = 6; assertEquals(expected, soution1.findMaxConsecutiveOnes(nums)); - } @Test public void test3() { - nums = new int[]{}; + nums = new int[] {}; expected = 0; assertEquals(expected, soution1.findMaxConsecutiveOnes(nums)); } @Test public void test4() { - nums = new int[]{1, 0, 0, 0, 1, 1, 0}; + nums = new int[] {1, 0, 0, 0, 1, 1, 0}; expected = 3; assertEquals(expected, soution1.findMaxConsecutiveOnes(nums)); } @Test public void test5() { - nums = new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + nums = + new int[] { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; expected = 9621; assertEquals(expected, soution1.findMaxConsecutiveOnes(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_48Test.java b/src/test/java/com/fishercoder/firstthousand/_48Test.java index 09a4c797c6..dce9612f49 100644 --- a/src/test/java/com/fishercoder/firstthousand/_48Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_48Test.java @@ -20,56 +20,61 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - }; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + }; solution1.rotate(matrix); CommonUtils.print2DIntArray(matrix); } @Test public void test2() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - }; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + }; solution2.rotate(matrix); CommonUtils.print2DIntArray(matrix); } @Test public void test3() { - matrix = new int[][]{ - {1, 2, 3, 4}, - {5, 6, 7, 8}, - {9, 10, 11, 12}, - {13, 14, 15, 16} - }; + matrix = + new int[][] { + {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10, 11, 12}, + {13, 14, 15, 16} + }; solution2.rotate(matrix); CommonUtils.print2DIntArray(matrix); } @Test public void test4() { - matrix = new int[][]{ - {1, 2}, - {3, 4} - }; + matrix = + new int[][] { + {1, 2}, + {3, 4} + }; solution1.rotate(matrix); CommonUtils.print2DIntArray(matrix); } @Test public void test5() { - matrix = new int[][]{ - {1, 2, 3, 4}, - {5, 6, 7, 8}, - {9, 10, 11, 12}, - {13, 14, 15, 16} - }; + matrix = + new int[][] { + {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10, 11, 12}, + {13, 14, 15, 16} + }; CommonUtils.print2DIntArray(matrix); solution3.rotate(matrix); CommonUtils.print2DIntArray(matrix); @@ -77,14 +82,14 @@ public void test5() { @Test public void test6() { - matrix = new int[][]{ - {1, 2, 3, 4}, - {5, 6, 7, 8}, - {9, 10, 11, 12}, - {13, 14, 15, 16} - }; + matrix = + new int[][] { + {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10, 11, 12}, + {13, 14, 15, 16} + }; solution1.rotate(matrix); CommonUtils.print2DIntArray(matrix); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_490Test.java b/src/test/java/com/fishercoder/firstthousand/_490Test.java index 9f8cfcf65e..edac25fedf 100644 --- a/src/test/java/com/fishercoder/firstthousand/_490Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_490Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._490; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _490Test { private _490 test; private static boolean expected; @@ -21,37 +20,37 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { - maze = new int[][]{ - {0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1}, - {0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1}, - {0, 1, 0, 0, 0} - }; - start = new int[]{4, 3}; - destination = new int[]{0, 1}; + maze = + new int[][] { + {0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1}, + {0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1}, + {0, 1, 0, 0, 0} + }; + start = new int[] {4, 3}; + destination = new int[] {0, 1}; actual = test.hasPath(maze, start, destination); expected = false; assertEquals(expected, actual); - } @Test public void test2() { - maze = new int[][]{ - {0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0}, - {1, 1, 0, 1, 1}, - {0, 0, 0, 0, 0} - }; - start = new int[]{0, 4}; - destination = new int[]{4, 4}; + maze = + new int[][] { + {0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0}, + {1, 1, 0, 1, 1}, + {0, 0, 0, 0, 0} + }; + start = new int[] {0, 4}; + destination = new int[] {4, 4}; actual = test.hasPath(maze, start, destination); expected = true; assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_491Test.java b/src/test/java/com/fishercoder/firstthousand/_491Test.java index f1dd57b92d..3fdd5d782a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_491Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_491Test.java @@ -2,24 +2,23 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._491; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class _491Test { - private _491.Solution1 solution1; - private static int[] nums; + private _491.Solution1 solution1; + private static int[] nums; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _491.Solution1(); - } + solution1 = new _491.Solution1(); + } - @Test - public void test1() { - nums = new int[] {4, 6, 7, 7}; - List> actual = solution1.findSubsequences(nums); - CommonUtils.printListList(actual); - } + @Test + public void test1() { + nums = new int[] {4, 6, 7, 7}; + List> actual = solution1.findSubsequences(nums); + CommonUtils.printListList(actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_492Test.java b/src/test/java/com/fishercoder/firstthousand/_492Test.java index 67bd489839..4b5a1f9d24 100644 --- a/src/test/java/com/fishercoder/firstthousand/_492Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_492Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._492; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 1/25/17. - */ +/** Created by fishercoder on 1/25/17. */ public class _492Test { private _492.Solution1 solution1; private static int[] expected; @@ -23,15 +20,15 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new int[]{0, 0}; - actual = new int[]{0, 0}; + expected = new int[] {0, 0}; + actual = new int[] {0, 0}; area = 0; } @Test public void test1() { area = 4; - expected = new int[]{2, 2}; + expected = new int[] {2, 2}; actual = solution1.constructRectangle(area); assertArrayEquals(expected, actual); } @@ -39,7 +36,7 @@ public void test1() { @Test public void test2() { area = 3; - expected = new int[]{3, 1}; + expected = new int[] {3, 1}; actual = solution1.constructRectangle(area); assertArrayEquals(expected, actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_493Test.java b/src/test/java/com/fishercoder/firstthousand/_493Test.java index 0d962e0f30..cefd291db9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_493Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_493Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._493; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _493Test { private _493.Solution1 solution1; private static int[] nums; @@ -17,31 +17,31 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 2, 3, 1}; + nums = new int[] {1, 3, 2, 3, 1}; assertEquals(2, solution1.reversePairs(nums)); } @Test public void test2() { - nums = new int[]{2, 4, 3, 5, 1}; + nums = new int[] {2, 4, 3, 5, 1}; assertEquals(3, solution1.reversePairs(nums)); } @Test public void test3() { - nums = new int[]{2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647}; + nums = new int[] {2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647}; assertEquals(0, solution1.reversePairs(nums)); } @Test public void test4() { - nums = new int[]{1, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647}; + nums = new int[] {1, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647}; assertEquals(0, solution1.reversePairs(nums)); } @Test public void test5() { - nums = new int[]{2147483647, 2147483646, 2147483647, 2147483647, 2147483647}; + nums = new int[] {2147483647, 2147483646, 2147483647, 2147483647, 2147483647}; assertEquals(0, solution1.reversePairs(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_494Test.java b/src/test/java/com/fishercoder/firstthousand/_494Test.java index 396aa2dc4e..e0895d8257 100644 --- a/src/test/java/com/fishercoder/firstthousand/_494Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_494Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._494; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _494Test { private _494.Solution1 solution1; private static int expected; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { S = 3; - nums = new int[]{1, 1, 1, 1, 1}; + nums = new int[] {1, 1, 1, 1, 1}; expected = 5; actual = solution1.findTargetSumWays(nums, S); assertEquals(expected, actual); @@ -30,7 +30,7 @@ public void test1() { @Test public void test2() { S = 3; - nums = new int[]{1, 1, 1, 1, 5}; + nums = new int[] {1, 1, 1, 1, 5}; expected = 4; actual = solution1.findTargetSumWays(nums, S); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_495Test.java b/src/test/java/com/fishercoder/firstthousand/_495Test.java index 23249fc8fd..dc281c8163 100644 --- a/src/test/java/com/fishercoder/firstthousand/_495Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_495Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._495; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/8/17. - */ +/** Created by fishercoder on 5/8/17. */ public class _495Test { _495.Solution1 solution1 = new _495.Solution1(); private static int actual = 0; @@ -18,7 +16,7 @@ public class _495Test { @BeforeEach public void setup() { - timeSeries = new int[]{}; + timeSeries = new int[] {}; duration = 0; expected = 0; actual = 0; @@ -26,7 +24,7 @@ public void setup() { @Test public void test1() { - timeSeries = new int[]{1, 4}; + timeSeries = new int[] {1, 4}; duration = 2; actual = solution1.findPoisonedDuration(timeSeries, duration); expected = 4; @@ -35,7 +33,7 @@ public void test1() { @Test public void test2() { - timeSeries = new int[]{1, 2}; + timeSeries = new int[] {1, 2}; duration = 2; actual = solution1.findPoisonedDuration(timeSeries, duration); expected = 3; @@ -44,7 +42,7 @@ public void test2() { @Test public void test3() { - timeSeries = new int[]{}; + timeSeries = new int[] {}; duration = 100000; actual = solution1.findPoisonedDuration(timeSeries, duration); expected = 0; diff --git a/src/test/java/com/fishercoder/firstthousand/_496Test.java b/src/test/java/com/fishercoder/firstthousand/_496Test.java index 1a3c22d704..ef46577443 100644 --- a/src/test/java/com/fishercoder/firstthousand/_496Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_496Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._496; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _496Test { private _496.Solution1 solution1; private _496.Solution2 solution2; @@ -23,17 +22,17 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new int[]{}; - actual = new int[]{}; - findNums = new int[]{}; - nums = new int[]{}; + expected = new int[] {}; + actual = new int[] {}; + findNums = new int[] {}; + nums = new int[] {}; } @Test public void test1() { - findNums = new int[]{4, 1, 2}; - nums = new int[]{1, 3, 4, 2}; - expected = new int[]{-1, 3, -1}; + findNums = new int[] {4, 1, 2}; + nums = new int[] {1, 3, 4, 2}; + expected = new int[] {-1, 3, -1}; actual = solution1.nextGreaterElement(findNums, nums); assertArrayEquals(expected, actual); actual = solution2.nextGreaterElement(findNums, nums); diff --git a/src/test/java/com/fishercoder/firstthousand/_498Test.java b/src/test/java/com/fishercoder/firstthousand/_498Test.java index 99cfb2e287..764224c17d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_498Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_498Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._498; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 5/26/17. - */ +/** Created by fishercoder on 5/26/17. */ public class _498Test { private _498.Solutoin1 solutoin1; private _498.Solutoin2 solutoin2; @@ -23,58 +21,60 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - }; - expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 9}; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + }; + expected = new int[] {1, 2, 4, 7, 5, 3, 6, 8, 9}; assertArrayEquals(expected, solutoin1.findDiagonalOrder(matrix)); } @Test public void test2() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - {10, 11, 12}, - {13, 14, 15}, - }; - expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 10, 13, 11, 9, 12, 14, 15}; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + {10, 11, 12}, + {13, 14, 15}, + }; + expected = new int[] {1, 2, 4, 7, 5, 3, 6, 8, 10, 13, 11, 9, 12, 14, 15}; assertArrayEquals(expected, solutoin1.findDiagonalOrder(matrix)); } @Test public void test3() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - }; - expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 9}; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + }; + expected = new int[] {1, 2, 4, 7, 5, 3, 6, 8, 9}; assertArrayEquals(expected, solutoin2.findDiagonalOrder(matrix)); } @Test public void test4() { - matrix = new int[][]{ - {2, 5}, {8, 4}, {0, -1} - }; - expected = new int[]{2, 5, 8, 0, 4, -1}; + matrix = new int[][] {{2, 5}, {8, 4}, {0, -1}}; + expected = new int[] {2, 5, 8, 0, 4, -1}; assertArrayEquals(expected, solutoin2.findDiagonalOrder(matrix)); } @Test public void test5() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - {10, 11, 12}, - {13, 14, 15}, - }; - expected = new int[]{1, 2, 4, 7, 5, 3, 6, 8, 10, 13, 11, 9, 12, 14, 15}; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + {10, 11, 12}, + {13, 14, 15}, + }; + expected = new int[] {1, 2, 4, 7, 5, 3, 6, 8, 10, 13, 11, 9, 12, 14, 15}; assertArrayEquals(expected, solutoin2.findDiagonalOrder(matrix)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_49Test.java b/src/test/java/com/fishercoder/firstthousand/_49Test.java index 7aa932bf08..e983d6566d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_49Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_49Test.java @@ -1,16 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._49; +import java.util.Arrays; +import java.util.List; import org.apache.commons.collections4.CollectionUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _49Test { private _49.Solution1 solution1; private static String[] words; @@ -24,7 +23,7 @@ public void setup() { @Test public void test1() { - words = new String[]{"eat", "tea", "tan", "ate", "nat", "bat"}; + words = new String[] {"eat", "tea", "tan", "ate", "nat", "bat"}; List e1 = Arrays.asList("bat"); List e2 = Arrays.asList("tan", "nat"); List e3 = Arrays.asList("ate", "eat", "tea"); @@ -44,7 +43,7 @@ public void test1() { assertTrue(CollectionUtils.isEqualCollection(e3, a)); break; default: - //Should not have come into this branch ever. + // Should not have come into this branch ever. assertTrue(false); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_4Test.java b/src/test/java/com/fishercoder/firstthousand/_4Test.java index 2ec238a697..5e7b3321cf 100644 --- a/src/test/java/com/fishercoder/firstthousand/_4Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_4Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._4; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _4Test { private _4.Solution1 solution1; private _4.Solution2 solution2; @@ -20,18 +20,17 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 3}; - B = new int[]{2}; + A = new int[] {1, 3}; + B = new int[] {2}; assertEquals(2.0, solution1.findMedianSortedArrays(A, B), 0.0); assertEquals(2.0, solution2.findMedianSortedArrays(A, B), 0.0); } @Test public void test2() { - A = new int[]{1, 2}; - B = new int[]{3, 4}; + A = new int[] {1, 2}; + B = new int[] {3, 4}; assertEquals(2.5, solution1.findMedianSortedArrays(A, B), 0.0); assertEquals(2.5, solution2.findMedianSortedArrays(A, B), 0.0); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_500Test.java b/src/test/java/com/fishercoder/firstthousand/_500Test.java index f50700df20..08ee029a0a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_500Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_500Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._500; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 1/15/17. - */ +/** Created by fishercoder on 1/15/17. */ public class _500Test { private _500 test; private static String[] expected; @@ -22,8 +20,8 @@ public void setup() { @Test public void test1() { - words = new String[]{"Alaska", "Hello", "Dad", "Peace"}; - expected = new String[]{"Alaska", "Dad"}; + words = new String[] {"Alaska", "Hello", "Dad", "Peace"}; + expected = new String[] {"Alaska", "Dad"}; actual = test.findWords(words); assertArrayEquals(expected, actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_501Test.java b/src/test/java/com/fishercoder/firstthousand/_501Test.java index 0b3ec35562..6c70f2320e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_501Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_501Test.java @@ -1,17 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._501; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 1/28/17. - */ +/** Created by fishercoder on 1/28/17. */ public class _501Test { private _501.Solution1 solution1; private _501.Solution2 solution2; @@ -27,8 +24,8 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new int[]{}; - actual = new int[]{}; + expected = new int[] {}; + actual = new int[] {}; treeNode = new TreeNode(0); } @@ -37,7 +34,7 @@ public void test1() { treeNode = new TreeNode(1); treeNode.right = new TreeNode(2); treeNode.right.left = new TreeNode(2); - expected = new int[]{2}; + expected = new int[] {2}; CommonUtils.printArray(expected); CommonUtils.printArray(actual); actual = solution1.findMode(treeNode); diff --git a/src/test/java/com/fishercoder/firstthousand/_502Test.java b/src/test/java/com/fishercoder/firstthousand/_502Test.java index 49cbbf7300..61431cb639 100644 --- a/src/test/java/com/fishercoder/firstthousand/_502Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_502Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._502; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _502Test { private _502.Solution1 solution1; private static int[] Profits; @@ -18,8 +18,8 @@ public void setup() { @Test public void test1() { - Profits = new int[]{1, 2, 3}; - Capital = new int[]{0, 1, 1}; + Profits = new int[] {1, 2, 3}; + Capital = new int[] {0, 1, 1}; assertEquals(4, solution1.findMaximizedCapital(2, 0, Profits, Capital)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_503Test.java b/src/test/java/com/fishercoder/firstthousand/_503Test.java index 7e9ae45827..099e5f2cca 100644 --- a/src/test/java/com/fishercoder/firstthousand/_503Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_503Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._503; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _503Test { private _503.Solution1 solution1; private _503.Solution2 solution2; @@ -22,14 +21,14 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new int[]{}; - nums = new int[]{}; + expected = new int[] {}; + nums = new int[] {}; } @Test public void test1() { - nums = new int[]{1, 2, 1}; - expected = new int[]{2, -1, 2}; + nums = new int[] {1, 2, 1}; + expected = new int[] {2, -1, 2}; actual = solution1.nextGreaterElements(nums); assertArrayEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_504Test.java b/src/test/java/com/fishercoder/firstthousand/_504Test.java index 822fc23fc3..8920f94133 100644 --- a/src/test/java/com/fishercoder/firstthousand/_504Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_504Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._504; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/15/17. - */ +/** Created by fishercoder on 1/15/17. */ public class _504Test { private _504.Solution1 solution1; private static String expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_505Test.java b/src/test/java/com/fishercoder/firstthousand/_505Test.java index 198609a158..49f1edc9f3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_505Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_505Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._505; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _505Test { private _505.Solution1 solution1; private static int expected; @@ -21,37 +20,37 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { - maze = new int[][]{ - {0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1}, - {0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1}, - {0, 1, 0, 0, 0} - }; - start = new int[]{4, 3}; - destination = new int[]{0, 1}; + maze = + new int[][] { + {0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1}, + {0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1}, + {0, 1, 0, 0, 0} + }; + start = new int[] {4, 3}; + destination = new int[] {0, 1}; actual = solution1.shortestDistance(maze, start, destination); expected = -1; assertEquals(expected, actual); - } @Test public void test2() { - maze = new int[][]{ - {0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0}, - {1, 1, 0, 1, 1}, - {0, 0, 0, 0, 0} - }; - start = new int[]{0, 4}; - destination = new int[]{4, 4}; + maze = + new int[][] { + {0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0}, + {1, 1, 0, 1, 1}, + {0, 0, 0, 0, 0} + }; + start = new int[] {0, 4}; + destination = new int[] {4, 4}; actual = solution1.shortestDistance(maze, start, destination); expected = 12; assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_506Test.java b/src/test/java/com/fishercoder/firstthousand/_506Test.java index 5014656876..63be585537 100644 --- a/src/test/java/com/fishercoder/firstthousand/_506Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_506Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._506; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 1/15/17. - */ +/** Created by fishercoder on 1/15/17. */ public class _506Test { private _506.Solution1 solution1; private static String[] expected; @@ -23,25 +20,23 @@ public void setup() { @BeforeEach public void setupForEachTest() { - expected = new String[]{}; - actual = new String[]{}; + expected = new String[] {}; + actual = new String[] {}; } @Test public void test1() { - nums = new int[]{2, 4, 1}; - expected = new String[]{"Silver Medal", "Gold Medal", "Bronze Medal"}; + nums = new int[] {2, 4, 1}; + expected = new String[] {"Silver Medal", "Gold Medal", "Bronze Medal"}; actual = solution1.findRelativeRanks(nums); assertArrayEquals(expected, actual); - } @Test public void test2() { - nums = new int[]{5, 4, 3, 2, 1}; - expected = new String[]{"Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"}; + nums = new int[] {5, 4, 3, 2, 1}; + expected = new String[] {"Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"}; actual = solution1.findRelativeRanks(nums); assertArrayEquals(expected, actual); - } } diff --git a/src/test/java/com/fishercoder/firstthousand/_507Test.java b/src/test/java/com/fishercoder/firstthousand/_507Test.java index 1e3b578624..1636c9b59f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_507Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_507Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._507; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/25/17. - */ +/** Created by fishercoder on 1/25/17. */ public class _507Test { private _507.Solution1 solution1; private static boolean expected; @@ -22,8 +19,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { diff --git a/src/test/java/com/fishercoder/firstthousand/_508Test.java b/src/test/java/com/fishercoder/firstthousand/_508Test.java index 7653dd9f76..b841774220 100644 --- a/src/test/java/com/fishercoder/firstthousand/_508Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_508Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._508; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _508Test { private _508.Solution1 solution1; private _508.Solution2 solution2; @@ -28,8 +27,8 @@ public void setup() { @Test public void test1() { root = TreeUtils.constructBinaryTree(Arrays.asList(5, 2, -3)); - expected = new int[]{2, -3, 4}; - /**Since order does NOT matter, so I'll sort them and then compare*/ + expected = new int[] {2, -3, 4}; + /** Since order does NOT matter, so I'll sort them and then compare */ Arrays.sort(expected); actual = solution1.findFrequentTreeSum(root); Arrays.sort(actual); @@ -47,7 +46,7 @@ public void test1() { @Test public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(5, 2, -5)); - expected = new int[]{2}; + expected = new int[] {2}; actual = solution1.findFrequentTreeSum(root); assertArrayEquals(expected, actual); @@ -60,9 +59,11 @@ public void test2() { @Test public void test3() { - root = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, 5, 0, 2, 4, 6, null, null, null, 3)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(3, 1, 5, 0, 2, 4, 6, null, null, null, 3)); TreeUtils.printBinaryTree(root); - expected = new int[]{6}; + expected = new int[] {6}; actual = solution1.findFrequentTreeSum(root); assertArrayEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_509Test.java b/src/test/java/com/fishercoder/firstthousand/_509Test.java index f58603f55b..3d54cc06cd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_509Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_509Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._509; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _509Test { private _509.Solution1 solution1; private _509.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_50Test.java b/src/test/java/com/fishercoder/firstthousand/_50Test.java index 9cc9332ab8..e644c5f4c0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_50Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_50Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._50; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _50Test { private _50.Solution1 solution1; private _50.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_513Test.java b/src/test/java/com/fishercoder/firstthousand/_513Test.java index d86a035820..0080b85ed3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_513Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_513Test.java @@ -1,16 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._513; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/15/17. - */ +/** Created by fishercoder on 1/15/17. */ public class _513Test { private _513.Solution1 solution1; private static int expected; @@ -37,7 +34,6 @@ public void test1() { expected = 1; actual = solution1.findBottomLeftValue(root); assertEquals(expected, actual); - } @Test diff --git a/src/test/java/com/fishercoder/firstthousand/_515Test.java b/src/test/java/com/fishercoder/firstthousand/_515Test.java index baa5420fb1..a770ecbfa6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_515Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_515Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._515; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _515Test { private _515.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_516Test.java b/src/test/java/com/fishercoder/firstthousand/_516Test.java index 153009d430..3e8077a123 100644 --- a/src/test/java/com/fishercoder/firstthousand/_516Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_516Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._516; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _516Test { private _516.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(4, solution1.longestPalindromeSubseq("bbbab")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_518Test.java b/src/test/java/com/fishercoder/firstthousand/_518Test.java index dd6a2e225f..a135a9b146 100644 --- a/src/test/java/com/fishercoder/firstthousand/_518Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_518Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._518; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _518Test { private _518.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_519Test.java b/src/test/java/com/fishercoder/firstthousand/_519Test.java index 5692a4bd7d..66397207fa 100644 --- a/src/test/java/com/fishercoder/firstthousand/_519Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_519Test.java @@ -17,5 +17,4 @@ public void test1() { solution1.reset(); CommonUtils.printArray(solution1.flip()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_51Test.java b/src/test/java/com/fishercoder/firstthousand/_51Test.java index 1c08794d17..0db8087fff 100644 --- a/src/test/java/com/fishercoder/firstthousand/_51Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_51Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._51; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._51; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _51Test { private _51.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_522Test.java b/src/test/java/com/fishercoder/firstthousand/_522Test.java index 8550921c5d..fa8bb6f6a2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_522Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_522Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._522; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 12/31/16. - */ +/** Created by fishercoder on 12/31/16. */ public class _522Test { private _522.Solution1 solution1; @@ -23,10 +21,9 @@ public void setup() { @Test public void test1() { - strs = new String[]{"aaa", "aaa", "aa"}; + strs = new String[] {"aaa", "aaa", "aa"}; expected = -1; actual = solution1.findLUSlength(strs); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_523Test.java b/src/test/java/com/fishercoder/firstthousand/_523Test.java index d225587255..115baf9bb9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_523Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_523Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._523; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _523Test { private _523.Solution1 solution1; private _523.Solution2 solution2; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{23, 2, 4, 6, 7}; + nums = new int[] {23, 2, 4, 6, 7}; expected = true; k = 6; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -30,7 +30,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{23, 2, 6, 4, 7}; + nums = new int[] {23, 2, 6, 4, 7}; expected = true; k = 6; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -39,7 +39,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{23, 2, 6, 4, 7}; + nums = new int[] {23, 2, 6, 4, 7}; expected = false; k = 0; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -48,7 +48,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{0, 1, 0}; + nums = new int[] {0, 1, 0}; expected = false; k = 0; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -57,7 +57,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{0, 0}; + nums = new int[] {0, 0}; expected = true; k = 0; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -66,7 +66,7 @@ public void test5() { @Test public void test6() { - nums = new int[]{1, 1}; + nums = new int[] {1, 1}; expected = true; k = 2; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -75,7 +75,7 @@ public void test6() { @Test public void test7() { - nums = new int[]{0}; + nums = new int[] {0}; expected = false; k = -1; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -84,7 +84,7 @@ public void test7() { @Test public void test8() { - nums = new int[]{23, 2, 4, 6, 7}; + nums = new int[] {23, 2, 4, 6, 7}; expected = true; k = -6; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -93,7 +93,7 @@ public void test8() { @Test public void test9() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; expected = false; k = 4; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -102,7 +102,7 @@ public void test9() { @Test public void test10() { - nums = new int[]{5, 2, 4}; + nums = new int[] {5, 2, 4}; expected = false; k = 5; assertEquals(expected, solution1.checkSubarraySum(nums, k)); @@ -111,11 +111,10 @@ public void test10() { @Test public void test11() { - nums = new int[]{23, 2, 4, 6, 6}; + nums = new int[] {23, 2, 4, 6, 6}; expected = true; k = 7; assertEquals(expected, solution1.checkSubarraySum(nums, k)); assertEquals(expected, solution2.checkSubarraySum(nums, k)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_524Test.java b/src/test/java/com/fishercoder/firstthousand/_524Test.java index cfcb0cd5e0..79e4370024 100644 --- a/src/test/java/com/fishercoder/firstthousand/_524Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_524Test.java @@ -1,17 +1,14 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._524; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._524; import java.util.ArrayList; import java.util.Arrays; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/30/17. - */ +/** Created by fishercoder on 4/30/17. */ public class _524Test { private _524.Solution1 solution1; private static String expected; @@ -44,7 +41,10 @@ public void test2() { @Test public void test3() { - d = new ArrayList(Arrays.asList("apple", "ewaf", "awefawfwaf", "awef", "awefe", "ewafeffewafewf")); + d = + new ArrayList( + Arrays.asList( + "apple", "ewaf", "awefawfwaf", "awef", "awefe", "ewafeffewafewf")); s = "aewfafwafjlwajflwajflwafj"; expected = "ewaf"; actual = solution1.findLongestWord(expected, d); diff --git a/src/test/java/com/fishercoder/firstthousand/_525Test.java b/src/test/java/com/fishercoder/firstthousand/_525Test.java index a878562925..271950d072 100644 --- a/src/test/java/com/fishercoder/firstthousand/_525Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_525Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._525; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _525Test { private _525.Solution1 solution1; private static int expected; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{0, 1}; + nums = new int[] {0, 1}; expected = 2; actual = solution1.findMaxLength(nums); assertEquals(expected, actual); @@ -27,7 +27,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{0, 1, 0}; + nums = new int[] {0, 1, 0}; expected = 2; actual = solution1.findMaxLength(nums); assertEquals(expected, actual); @@ -35,10 +35,9 @@ public void test2() { @Test public void test3() { - nums = new int[]{0, 0, 1, 0, 0, 0, 1, 1}; + nums = new int[] {0, 0, 1, 0, 0, 0, 1, 1}; expected = 6; actual = solution1.findMaxLength(nums); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_526Test.java b/src/test/java/com/fishercoder/firstthousand/_526Test.java index 8a070ff41d..c2acb0a663 100644 --- a/src/test/java/com/fishercoder/firstthousand/_526Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_526Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._526; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _526Test { private _526.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(3, solution1.countArrangement(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_527Test.java b/src/test/java/com/fishercoder/firstthousand/_527Test.java index ba61f7b3fb..4bd68b9764 100644 --- a/src/test/java/com/fishercoder/firstthousand/_527Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_527Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._527; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _527Test { - + private _527.Solution1 solution1; @BeforeEach @@ -19,7 +18,27 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("l2e", "god", "internal", "me", "i6t", "interval", "inte4n", "f2e", "intr4n"), solution1.wordsAbbreviation(Arrays.asList("like", "god", "internal", "me", "internet", "interval", "intension", "face", "intrusion"))); + assertEquals( + Arrays.asList( + "l2e", + "god", + "internal", + "me", + "i6t", + "interval", + "inte4n", + "f2e", + "intr4n"), + solution1.wordsAbbreviation( + Arrays.asList( + "like", + "god", + "internal", + "me", + "internet", + "interval", + "intension", + "face", + "intrusion"))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_528Test.java b/src/test/java/com/fishercoder/firstthousand/_528Test.java index b36bd61172..c5e5b1a035 100644 --- a/src/test/java/com/fishercoder/firstthousand/_528Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_528Test.java @@ -1,29 +1,28 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._528; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _528Test { private _528.Solution1 solution1; private static int expected; @Test public void test1() { - solution1 = new _528.Solution1(new int[]{1}); + solution1 = new _528.Solution1(new int[] {1}); expected = 0; assertEquals(expected, solution1.pickIndex()); } @Test public void test2() { - solution1 = new _528.Solution1(new int[]{1, 3}); + solution1 = new _528.Solution1(new int[] {1, 3}); System.out.println(solution1.pickIndex()); System.out.println(solution1.pickIndex()); System.out.println(solution1.pickIndex()); System.out.println(solution1.pickIndex()); System.out.println(solution1.pickIndex()); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_529Test.java b/src/test/java/com/fishercoder/firstthousand/_529Test.java index 87e8602ee4..0914ba6db3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_529Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_529Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._529; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _529Test { private _529.Solution1 solution1; @@ -16,18 +16,22 @@ public void setup() { @Test public void test1() { - char[][] actual = solution1.updateBoard(new char[][]{ - {'E', 'E', 'E', 'E', 'E'}, - {'E', 'E', 'M', 'E', 'E'}, - {'E', 'E', 'E', 'E', 'E'}, - {'E', 'E', 'E', 'E', 'E'}, - }, new int[]{3, 0}); - char[][] expected = new char[][]{ - {'B', '1', 'E', '1', 'B'}, - {'B', '1', 'M', '1', 'B'}, - {'B', '1', '1', '1', 'B'}, - {'B', 'B', 'B', 'B', 'B'}, - }; + char[][] actual = + solution1.updateBoard( + new char[][] { + {'E', 'E', 'E', 'E', 'E'}, + {'E', 'E', 'M', 'E', 'E'}, + {'E', 'E', 'E', 'E', 'E'}, + {'E', 'E', 'E', 'E', 'E'}, + }, + new int[] {3, 0}); + char[][] expected = + new char[][] { + {'B', '1', 'E', '1', 'B'}, + {'B', '1', 'M', '1', 'B'}, + {'B', '1', '1', '1', 'B'}, + {'B', 'B', 'B', 'B', 'B'}, + }; assertArrayEquals(expected, actual); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_52Test.java b/src/test/java/com/fishercoder/firstthousand/_52Test.java index c40dd82c79..40f8dfd2c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_52Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_52Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._52; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _52Test { private _52.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_530Test.java b/src/test/java/com/fishercoder/firstthousand/_530Test.java index 1dc2a71ca6..d96f6bf327 100644 --- a/src/test/java/com/fishercoder/firstthousand/_530Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_530Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._530; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _530Test { private _530.Solution1 solution1; private static int expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_532Test.java b/src/test/java/com/fishercoder/firstthousand/_532Test.java index 11279d32a6..0446d5d7c2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_532Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_532Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._532; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._532; import java.io.IOException; import java.io.InputStream; import java.util.Properties; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _532Test { private _532.Solution1 test; @@ -22,7 +20,8 @@ public class _532Test { public void setup() throws IOException { test = new _532.Solution1(); Properties properties = new Properties(); - InputStream inputStream = _532.class.getClassLoader().getResourceAsStream("fishercoder.properties"); + InputStream inputStream = + _532.class.getClassLoader().getResourceAsStream("fishercoder.properties"); properties.load(inputStream); } @@ -37,7 +36,7 @@ public void setupForEachTest() { @Test public void test1() { k = 2; - nums = new int[]{3, 1, 4, 1, 5}; + nums = new int[] {3, 1, 4, 1, 5}; expected = 2; actual = test.findPairs(nums, k); assertEquals(expected, actual); @@ -46,7 +45,7 @@ public void test1() { @Test public void test2() { k = 1; - nums = new int[]{1, 2, 3, 4, 5}; + nums = new int[] {1, 2, 3, 4, 5}; expected = 4; actual = test.findPairs(nums, k); assertEquals(expected, actual); @@ -55,31 +54,31 @@ public void test2() { @Test public void test3() { k = 0; - nums = new int[]{1, 3, 1, 5, 4}; + nums = new int[] {1, 3, 1, 5, 4}; expected = 1; actual = test.findPairs(nums, k); assertEquals(expected, actual); } -// This test case will throw TLE error if your algorithm is O(n^2) -// And it doesn't compile in IntelliJ, it throws "java: code too large" error -// so I'll comment it out for build -// @Test -// public void test4() { -// k = -139; -// nums = new int[]{32196,25662,20113,8991,14524,22650,29922,23567,24083,35838,49415,21584,31906,7236,672,28196,40565,17915,31989,43287,2911,44179,35938,7755,31891,34685,54614,46501,32365,1269,49348,23164,22259,34750,29889,24471,52189,54257,20514,27263,46438,54041,42826,211,15954,29874,31160,3511,1091,39059,51850,18957,23086,112,38817,32389,17860,8,29479,774,33497,55493,25741,15363,25706,7951,31961,23162,32613,34616,14693,48726,17341,53668,458,36597,28752,32215,14322,39975,31848,24846,42980,30957,35787,16670,3952,2886,38448,47644,55049,26426,33899,38998,36414,2388,5121,47599,8774,9148,15117,21696,17737,51500,11336,20896,4766,53999,27252,22109,24015,54663,28571,43978,1740,14785,10141,20019,13503,6515,27590,947,50841,5779,24068,11730,40286,3234,18279,2765,6052,24902,27020,20278,36152,36247,19831,20235,8798,13809,13906,37247,37702,35412,36194,32718,35458,47620,14501,25623,41152,42175,48674,15585,42236,21872,39004,28638,54912,36515,24355,53765,32928,36332,43966,33281,53220,17,38581,25567,38285,31125,55445,16154,33575,475,48688,17202,41092,38465,54816,2020,9194,862,31441,39638,13576,16073,9480,21395,19668,31980,50527,50619,17278,16688,26088,4953,51389,55146,19908,55071,30693,34312,6419,39717,30346,43734,43827,13584,41010,935,38147,26518,46409,52594,23276,13459,29334,12386,151,55154,53765,30122,53357,7159,25227,50383,37460,1116,2529,37133,51391,12681,22955,41006,50924,23239,32863,11161,31422,7450,52849,49240,38933,10038,6355,21937,18966,54561,51486,53702,51151,36965,10531,14662,13755,19194,14584,8562,32798,28241,23009,12170,41928,25733,42394,35933,38724,32579,13536,31032,21204,27260,38737,9947,31527,38198,48146,32034,26733,9844,19620,7068,32453,50978,5571,9372,46512,45623,24719,32443,25175,31428,14185,46196,50140,2890,15140,1558,32166,26632,48420,25872,399,25075,53136,5001,12307,6619,45377,48536,39123,2576,6394,45275,15308,44765,21206,49367,31185,19190,45590,9909,13168,39395,19533,36877,41393,6962,34706,10107,7467,38734,31008,14216,49241,3671,26884,30386,43388,21102,14572,21356,22450,43365,26645,50549,15276,6863,53622,4344,49819,46650,47388,45294,35030,1447,36017,46167,17212,2623,32634,49557,53708,14446,38588,5649,44805,42448,31599,55183,997,8311,34660,52148,14272,26911,26754,26723,44568,14490,22241,39669,12113,14450,16460,12823,49804,33914,24661,32178,50501,12689,12085,22257,54841,42364,6447,5470,36103,46496,6750,26462,3802,25507,31784,33498,3357,42658,44574,22348,38148,1624,46864,38928,18494,15408,24885,23971,40930,22850,35088,37741,45600,41620,52377,49812,9234,20215,4519,30221,55387,26976,40308,10630,44462,52025,50184,16952,13074,19695,8052,8040,19847,52618,43223,6115,23590,24160,51992,35131,2218,2149,19684,32472,52398,49558,27301,25550,48465,38878,46962,30043,18604,54909,9522,13893,44743,40643,3835,50385,43864,19480,19828,38178,44482,24616,25354,1837,16217,7419,28653,45204,55042,41556,38993,13251,30387,14423,17588,45230,41108,28967,43136,45918,7516,16669,23874,19471,29914,51379,35706,50297,40996,38997,21957,258,12159,42203,10545,40130,53143,54369,49918,12139,23336,24607,12538,51171,12021,18593,44836,26918,43108,4818,449,18814,52186,17390,11595,19300,49077,52096,52304,29333,18904,14791,10793,24509,55123,28770,20881,22917,25437,20336,7607,17515,43755,4211,25601,55344,42014,36246,4235,31909,46790,6194,47102,22036,13535,14177,43361,42787,49938,40304,39519,23669,29420,2927,48980,22450,19423,11234,22472,9042,12787,28890,43057,51659,20169,33790,41879,6491,54775,36100,44315,13387,8536,51296,49923,23414,18541,45084,23044,54602,17406,16380,10982,52754,44488,19769,39854,42002,35875,23765,7081,27460,8,54137,23841,41029,28713,53870,38165,11791,51826,36146,38678,29076,54120,7665,46165,34117,34153,32284,249,5470,51121,21421,27289,40198,34143,20440,12113,39959,27250,11346,10878,18450,20606,22592,53135,38699,353,29930,39360,15987,47312,28183,13731,53310,26046,45571,55214,20880,29609,5971,49014,2836,35381,17807,31381,20893,1013,31606,13487,40770,52515,51951,36231,16391,20292,1178,2167,48222,47029,40381,37849,51485,8234,22503,28250,41234,10234,46254,6813,38584,24494,20030,30884,35316,23630,17172,4926,39660,46702,47665,9422,7233,29190,55191,47319,30645,25270,36605,47729,13814,43758,20184,2984,5842,45826,44739,49595,22164,12326,36743,38698,51726,13294,38747,16481,54631,9316,10524,28614,45760,13099,9964,47536,27808,30583,6952,49509,20065,53331,48832,8978,52086,29308,51588,2658,30219,18044,14131,20391,42231,29272,2818,28854,31337,52687,46583,40418,7051,6891,37865,4319,45281,26248,2191,19302,17819,50807,21547,17922,15313,45828,53680,55231,38811,11457,20106,11146,6884,27947,55151,20694,3460,25503,20389,1384,28539,48509,19480,40175,50893,33217,18760,24051,29980,674,9345,43571,30850,38533,44570,37513,30613,45909,31018,52880,27871,31604,6064,52668,8299,41884,17599,12466,14761,32862,28615,18111,1875,5040,48669,11338,54528,55347,54142,32462,2716,28033,2200,2027,32579,49920,5073,31526,45654,42888,43834,49605,10786,55065,24606,1285,30528,31279,13858,1049,9981,30474,4928,19415,22397,30149,22395,2289,26727,25314,36378,18493,10727,22257,39483,16460,45801,8379,8406,19114,54240,5783,9941,2968,10543,18267,33981,52572,33026,3178,45500,11869,28000,13452,3017,33341,53949,51582,55454,32612,12395,32410,37072,45792,50050,4022,4253,25851,27246,31334,23721,19262,37319,5102,18615,29534,14606,5302,44639,12031,6394,2738,51552,41989,1450,13680,21446,48938,45576,10216,48924,34699,33377,44846,55430,54623,12811,7956,13237,15237,39565,34224,27286,8081,1277,42916,33101,11791,42238,41645,51653,28609,46333,5569,37704,13907,40143,50603,19628,39940,1944,44681,49874,27177,3063,1005,14636,28522,34561,51396,5606,32192,36364,52769,18829,18198,19570,26751,40292,48546,35981,7579,26662,47893,14688,22893,18127,16212,22399,17975,40739,35181,50185,17120,27963,46959,31658,44160,30914,43402,25734,12087,6490,9480,17650,43168,12475,22584,32015,16918,14704,49062,8401,25506,16029,45088,34167,14151,18610,14563,38544,30908,34608,18774,17411,24695,50245,26753,11702,32096,16257,52755,6947,41806,44487,17147,50839,51290,44840,32043,15995,34959,1761,39296,37647,24503,21421,17005,48697,8170,5289,16261,25246,31541,50997,18289,41941,10305,46091,12892,37212,18033,14443,45177,39876,24746,22870,15886,10187,17429,14175,10991,27391,48344,42205,6789,22755,40200,27148,46178,18978,26480,14615,53478,8087,41812,33170,40743,7223,31647,33231,28002,45961,12174,30725,4089,53330,19748,11002,22466,14489,14115,13617,22197,9467,12319,40261,27741,11613,15980,52958,22676,42599,4652,49637,13732,168,47785,38306,45279,10463,14826,51934,35341,17595,851,4718,34197,45800,30513,20348,28176,13657,45396,49324,6568,3487,1267,8702,20856,26089,48082,52056,3327,20711,32152,33478,45852,55288,8567,4606,40072,12947,52918,35383,23123,39247,27737,43637,4836,38253,19565,49170,12384,51602,4003,49764,9047,26861,41856,33948,29924,16845,24757,22712,39592,6378,15899,17809,47405,42282,7497,15628,38824,46631,6400,19773,32296,50984,24527,24457,49616,32627,1274,9661,51794,47284,28768,44799,29413,52873,31643,52741,29458,37651,40158,2604,18822,39274,47672,53732,25201,12811,8332,31974,42538,483,5484,18764,38612,49046,15774,55273,2333,35698,3858,4676,709,21693,49251,19993,28425,46000,44089,18206,28488,4097,21872,20737,34751,51871,27190,50596,7173,11312,4116,48012,2468,20786,50589,16340,40740,39301,29346,41769,10207,39331,26160,1144,29630,15747,29755,12341,9737,19677,44914,7537,15208,13877,44013,35969,31013,53624,21491,19378,28011,38070,19472,54758,2091,46407,43703,8908,16819,43598,23455,39358,44744,51218,48019,21835,6290,50576,46260,36090,49548,29386,1814,43402,39919,37559,13956,26318,6031,13660,45724,40085,428,43462,986,2524,1369,40818,32556,31015,8227,41226,44790,3745,15149,18170,1751,24759,23632,12711,34328,2216,53792,30424,35949,53880,27005,23411,31599,19064,5698,33822,39662,30083,16755,11654,48410,8768,19635,27877,52417,40712,25938,5458,451,30565,4433,44588,28065,45890,19354,53235,33098,27247,7528,15810,54205,22279,11903,8371,48003,39188,23060,5446,49340,4562,10447,50314,32737,44520,26324,45624,23514,25236,13906,28444,43760,21652,46075,17012,47719,9937,24384,46069,47486,13691,41515,53304,32847,49562,37098,45053,44787,15028,27016,1087,899,54161,42714,25632,18225,16279,34559,25857,55106,18522,10686,39346,48359,12594,6485,18908,2177,29110,54631,9432,10021,24643,52385,36706,3038,49044,43733,46332,30581,6931,29670,36974,27313,8636,3675,18087,55039,47312,32714,4213,28143,32098,31821,47702,49800,50768,54674,50632,8045,10642,14031,44927,1265,49650,45958,8320,47969,47867,51743,39380,50950,33189,27158,49779,5418,55012,20261,22716,21597,4387,6734,17096,30370,42587,19945,29825,44219,5963,45751,13092,41338,20592,43232,3706,48221,28162,16656,20353,9603,52818,30409,42646,38058,42889,37940,40923,15162,8495,8668,24976,38335,17678,409,20833,10979,22271,47517,12480,25210,48375,5424,6322,10633,35421,52720,43277,37436,47471,17407,24607,15195,52700,52503,2760,39354,27562,17245,25880,17840,1994,21409,30887,13320,42246,52701,23200,13907,40518,18189,36984,40213,38744,41266,46333,4705,19895,32475,49844,13814,54538,10218,40091,39242,42104,42571,40564,17149,29184,24843,12976,38797,19921,39739,1031,39387,37882,44180,52184,35437,28526,47250,50628,22837,24570,48803,22840,19601,6962,25033,33341,32463,39275,54194,43365,55034,27672,28105,13615,5067,49227,50669,45712,7757,19104,9316,28694,4709,50669,4472,30254,38375,22197,26531,10700,8609,41273,42354,30257,44728,14353,55417,38651,34696,11324,7754,52388,23857,8080,24231,11953,52748,54000,33518,28327,50309,54885,50724,41379,33851,42556,38424,29811,5470,31417,47493,12301,195,23702,27227,34820,9991,7582,26169,30408,43544,35028,5070,12316,29310,24586,7867,2278,765,49407,18339,10444,29027,37,14833,22857,23175,25356,47901,42145,28963,43935,810,2371,15898,26578,7633,12997,10028,23625,33906,6672,43014,3,33869,36242,48861,39365,31457,21112,1842,50722,41871,14195,48844,3948,20456,44923,5624,50702,42835,18318,46537,28553,27307,30953,3568,11605,1293,2106,33941,25948,1466,28953,29858,50965,22021,52275,32625,26558,34176,9904,22046,4830,14412,53828,17913,33081,21661,22044,1385,30755,19311,28265,16188,52376,29256,1286,16503,37657,40964,16723,28409,32633,14221,53708,43698,19031,43716,17077,10090,29383,34963,6753,7769,51810,37289,28398,25914,24636,7733,53100,42048,16072,26812,19240,38252,53960,30907,43122,6809,10129,13161,50608,16891,19871,22523,6734,27874,10290,2503,27992,15525,19372,23120,15336,52048,3183,50188,46515,12235,47343,25239,8015,20195,55084,49946,4317,19145,9067,21108,19261,10111,21790,537,46356,34969,30784,9686,13354,53725,51704,17730,25408,7209,14657,48129,23060,29592,46784,34435,32501,52597,22972,2068,47880,36875,15393,33329,17803,47232,8142,42245,46810,21230,3194,16364,17827,43204,3438,48057,19491,23160,29529,52762,21240,54967,42228,26817,4433,3602,50396,3556,13040,48025,14722,19405,47962,6333,34006,24875,26189,6011,33765,24655,1914,6065,40579,13762,19441,30495,51928,33070,33007,32296,45893,41799,28369,31741,31579,8351,2231,24965,593,9244,1426,16053,2838,53091,37610,8306,40717,15473,13989,39331,21117,2837,33659,10119,43167,1358,45489,15453,49349,34826,9127,1385,4196,9221,36479,7138,18325,9966,8698,22076,2732,23148,38452,46713,51439,41135,46718,12775,35399,46535,10995,10286,42034,33558,45957,22727,47474,15827,8912,33269,13025,14669,41006,35770,41428,46369,7177,2021,42551,34585,12703,30490,39885,42223,3688,48869,24682,21132,49541,14243,52081,40283,42969,46421,36603,50505,19351,37536,26276,26774,7946,50258,41054,48266,44524,46422,11487,8457,29759,4630,20312,50307,35147,11274,37262,20911,38186,23629,33055,29333,8262,41757,16832,22307,52886,23583,41659,27882,26557,44359,46962,20782,47197,14000,52607,12849,1766,16653,34003,22081,46840,52372,38722,54286,3637,21160,4788,38255,11240,6849,52670,29518,8836,8060,27598,35569,53523,33557,47845,37843,25855,16945,3170,1849,13508,20957,7573,3840,9764,53827,5567,43745,52100,10592,7914,46499,30574,7571,22565,4220,9674,50919,23540,9360,55015,18916,42948,7813,3889,16678,52200,53283,48560,14495,4214,9838,42089,46405,12202,38438,49694,5855,27284,25138,39991,14737,7910,32187,15419,44407,27314,27044,14381,54015,34096,27404,5871,9367,36889,50193,46075,24179,51178,47394,24782,32253,33653,14252,43455,1628,44396,16149,31443,9196,7947,49801,54360,50044,32330,27967,28557,54692,13466,37445,25447,32875,1451,12267,51907,48069,31592,26025,29116,15626,28829,5870,8686,1818,49385,1098,8519,7140,44161,1882,41502,28721,29427,3169,15643,24826,41157,10544,8630,38983,43273,13695,23368,48531,51273,54561,26777,41541,25952,27063,3670,2434,26764,20296,25123,48232,18894,20586,9222,44872,3182,8438,55090,30423,45126,40234,44791,19272,30502,17800,7298,22448,49938,6797,8274,8328,23661,26333,8055,24767,3823,9797,32661,42466,8973,30323,15172,45046,983,53335,25407,9900,50873,29431,6901,46831,36236,33748,29794,409,9454,2943,53387,7412,41945,50168,13785,6931,33788,8674,14865,4383,14258,49404,17655,48264,33318,53890,19307,30046,32961,16938,19441,50044,18401,42502,54287,14056,27803,30085,12705,48589,49718,10783,33793,44436,37455,46251,13658,21765,6199,30815,37711,37122,9286,48039,43361,2805,39535,40663,47242,54181,5530,32452,4819,9241,26793,55301,22882,24751,40839,54612,984,9661,48455,33471,46716,47475,1048,47560,39634,25984,24473,13198,50118,10309,48597,52109,42050,46702,55495,28998,41876,12905,49826,40559,46723,9137,15274,2365,11601,12527,33313,5186,26926,9008,42277,39301,29208,24769,38184,8133,32119,8499,17883,15797,11777,40147,11701,13742,50442,52282,19249,16090,169,21906,33201,2652,6014,46966,33299,50720,35383,5924,27404,51403,17718,10636,34831,1846,34072,31619,25419,28881,4291,25467,27622,43342,13237,184,17051,31653,42058,37976,14826,26955,15189,41984,18844,45734,46140,923,35442,29587,54013,34827,5110,21856,16237,34668,12249,33209,49993,32547,10742,35386,13675,47169,27183,48652,28402,28729,46476,39845,31794,14504,36167,13806,8795,29691,11332,6744,23048,40389,30754,28642,42046,13988,50789,26925,32029,28564,1674,2579,40896,42632,20009,13343,26538,2860,44768,22690,12377,27862,19080,28702,509,28891,50874,39562,38337,48819,19161,53831,20721,17076,32987,4382,1605,48765,24875,6712,52711,20096,31243,44771,47928,51452,17345,29021,7506,28663,11723,9203,38844,16037,55043,18455,42032,44813,43678,4707,26060,2353,26014,3342,44720,16642,33806,40379,30863,4439,23581,12251,50800,51164,9477,5130,51183,46275,45778,15076,44246,22068,21625,10138,3193,41550,45136,50373,549,2623,54103,54746,47304,54605,51666,52766,2020,1104,36436,22827,54712,46368,1796,21028,1654,38688,52529,53634,25518,36888,22218,49350,34848,47243,34277,28350,16891,37593,3370,42330,21853,4097,40653,47094,50938,44704,31099,17224,14418,55348,51705,28340,5063,42086,2609,38223,6592,12976,51059,25270,15834,52921,51412,52244,5161,8459,26407,48679,11110,21236,32351,31935,38886,7586,42316,29825,28762,48674,39439,29714,30360,20319,28791,29056,44101,11014,14900,10076,26505,49872,29438,33830,55100,29530,6668,12209,14041,47184,28253,26034,47223,46209,27508,2017,36128,4295,21931,21664,47194,17995,14471,20057,38066,40719,24858,51237,11618,23954,12222,18979,43100,35323,223,51672,54034,33831,49738,6003,40024,25585,3039,45916,50864,5467,46925,35230,41960,32887,47302,18570,50514,21897,19145,18707,50386,20076,16513,28901,35442,50989,20887,16349,27260,40693,54149,35312,11927,19125,42198,31926,9655,15550,38928,16246,53428,13537,895,37215,3631,23284,38257,24827,5704,32247,50725,22854,7120,31518,45579,40936,52007,31795,17096,25706,9963,1252,42363,54375,35398,47672,20924,37690,42159,4747,33510,19429,8163,53503,5138,37296,3156,43892,22033,37543,18177,54915,23562,11036,25466,19107,8396,45508,16241,16794,35737,4000,35935,49673,46071,47758,9827,30396,11487,35189,30048,35416,39041,27486,30039,50118,47120,9404,38051,11126,31451,7724,39707,53155,28211,38638,41511,16470,46327,38272,6151,55148,13762,40620,34766,16147,825,33838,35986,32324,34242,36740,42934,52260,11935,46291,18330,46294,9614,23307,39985,30669,21295,28908,9703,41414,25087,44552,47540,5950,10221,2054,27312,40598,18702,49413,16914,51903,31618,47676,23091,42618,19605,50762,12254,12659,39737,21857,23425,40689,17127,41590,22667,603,28989,46616,17860,23486,17084,23665,22573,43869,16968,9138,495,22149,16191,1281,12511,24343,24554,37445,34181,54979,35223,45871,47785,26557,26717,35794,17120,9538,24281,7048,30114,43507,54655,7227,45105,2665,10269,51636,47388,43864,36694,48605,16346,19833,3822,6697,53324,928,5004,52890,40446,30934,20437,73,31747,48358,40141,9462,17679,28759,6209,15891,2274,11302,12533,35908,25993,22814,9663,47128,38034,21287,4174,28988,16513,33483,48344,31680,26676,7124,38081,28593,54815,53250,54025,32490,39288,28226,28950,16303,43288,45007,38202,20839,50678,43937,6926,47729,37532,43214,48895,2659,37541,42968,31110,2148,49002,1666,47505,45435,47221,22793,31009,19888,28978,40411,7420,18301,1513,6885,24492,5793,45998,9065,21551,3962,46266,30019,42262,29118,42974,36602,33068,9559,28408,4065,2237,44839,20651,17188,2901,29388,26491,41733,38296,42765,41097,38780,51180,50363,26030,25562,4272,30504,37707,19986,8413,46056,50465,32997,49313,328,2050,3778,23131,13884,15382,8937,41948,1592,34894,15277,43218,38957,2009,22872,18527,11580,25258,4802,45523,5069,24950,16957,38568,40146,18116,3445,16090,34443,29902,5973,37776,31097,47243,52443,4147,49831,3957,38208,46387,24446,37315,3244,30771,25611,53873,44094,40718,37697,35406,39116,25709,1333,30545,16907,14385,30659,42452,30273,32267,44259,47334,31888,33915,21290,24986,53839,16712,42700,35218,51397,24847,48943,3970,30216,45979,34617,6367,52296,2593,52777,7802,40673,37970,26005,5223,1837,39037,11492,50094,21147,19728,54350,10802,3185,16696,32366,27817,151,47784,39566,16411,13381,18351,37256,16510,42436,4119,3401,36799,18733,45307,18408,36159,10577,17690,4185,23345,18213,16558,40120,47703,32245,51457,32847,46872,14757,18335,4921,967,36425,15290,6028,13010,7793,26735,23707,16948,25908,19236,17374,42397,41029,8281,18961,5925,34252,28576,54845,12949,31432,18836,42455,44903,24758,9855,31615,2975,33161,13983,51957,39300,47221,23676,43919,27099,834,41972,6811,218,30418,25321,42686,4623,23795,29489,40884,19755,6343,5919,8365,39383,35850,33850,41020,33130,38161,25869,28283,42005,35029,23937,36041,46806,10942,18809,34301,41895,52583,1281,18758,50443,23459,15235,18622,29083,22337,13924,3382,13056,17090,25241,2519,12840,8601,43974,7238,35428,3708,39352,46083,47466,31907,30156,39019,27238,30012,24583,13348,48677,33532,11038,33693,21733,53431,31756,6735,46744,36487,49834,31667,36354,4880,55414,22728,14120,39129,8729,23318,37117,1379,50499,5381,44518,33711,52317,38119,50718,17535,25713,36990,1873,29912,14500,31803,49388,10024,14498,28888,40772,53945,43846,21950,23849,46623,26978,27350,40703,32639,11675,44993,23491,28345,53087,26829,49991,25379,15898,38515,33397,21162,50835,33799,14848,50203,13565,13715,21515,45418,37138,7738,53529,6730,9360,33528,47646,45565,49313,25936,39680,47967,26018,52824,39744,5756,54079,53458,2174,3465,22783,26302,15805,19411,1398,8704,12632,20722,44647,41612,2019,54435,15323,5960,45680,20235,47140,20035,6199,6313,33321,29494,55363,38577,26755,24202,31675,10921,5063,31019,32993,18946,37767,44944,51704,31472,14893,29051,28363,474,15502,3493,6042,31939,32180,55442,31904,3348,17690,6280,23580,45432,20567,29957,35319,33097,53691,18600,33724,47650,30215,51052,35053,52584,15500,21352,15771,26393,46156,18476,49885,21028,21812,29712,11645,19827,11513,27434,49548,40777,6583,20426,33485,52875,124,34386,40892,24328,33491,41869,32054,39709,12224,50156,32877,30641,36065,50987,47023,5348,40057,19607,17121,35523,18094,48389,51092,30501,30226,9347,36558,17183,29564,50108,50092,17740,13943,17640,8473,26300,53451,31811,6811,22217,45109,28007,30591,2736,31835,44416,3073,38971,41678,11439,29230,35106,21941,20791,2729,27469,5654,33333,42378,51940,31468,54345,19568,22746,30994,20656,51726,21503,2941,54509,40788,107,37146,43178,22056,49535,43658,31336,21922,41714,38106,7710,31366,50165,1489,49765,53132,47035,46435,12336,53187,8018,29359,23937,29980,3263,53525,44662,27755,33815,48152,4287,26486,38100,34400,49542,11007,6092,37785,28058,39907,47270,49801,5628,2777,46214,44964,38359,9902,53395,15459,40842,20630,31588,39010,35814,3009,1374,45949,28799,14696,21045,28949,20147,28216,25398,44370,10996,20861,32893,17055,15499,48137,32452,20228,37635,32988,26432,3803,43084,27695,6657,25101,51119,28516,2951,19596,43091,52545,26184,28824,8473,30917,7292,34225,13921,12507,20066,256,34496,27609,51552,38052,53046,28401,50677,41400,21241,43221,5687,45439,33600,34710,54639,38169,35155,9308,9480,34796,3544,6778,10673,51914,16796,18899,8584,36312,54348,23113,6216,1408,55129,40066,21915,52519,28202,934,43371,34111,55090,9512,5406,16571,29539,5316,37775,30720,1073,53516,1780,15645,4258,31784,31166,51470,11572,54401,24583,52103,21426,54810,14614,19988,25476,44572,53792,40858,4521,46194,51020,17568,27450,16718,53861,6127,43356,53662,21055,40503,26229,21651,1070,17278,32470,33019,20661,28761,7351,50377,7925,34351,31509,23838,20764,18281,27184,14121,55376,32036,29898,34659,27308,46060,31658,51241,18755,39456,33682,49169,18749,27906,17217,10049,50776,34758,5820,14761,20211,35437,22499,17943,21819,2392,17642,11491,42055,43000,39456,2589,26195,46389,9717,46780,17404,26750,6744,4083,1660,10341,1993,39626,32892,34673,37230,54543,44809,53499,52365,6873,11114,41862,21934,19900,5731,43890,43551,24817,4793,50350,21267,49958,26435,10124,46715,22989,10804,6622,1958,39537,45686,47316,2051,55251,3655,35723,21845,45634,34643,35802,51611,14653,445,27850,7097,51045,34213,42479,6347,17692,47199,19688,23386,35096,35825,46814,7939,39611,17482,24364,20984,1502,31118,38409,41372,9475,54117,493,34812,48070,43517,34605,32526,1474,26645,53101,21683,35689,23853,45059,42254,15334,54551,52648,50135,33227,13676,5095,48624,16858,27668,46865,3308,19346,29747,19483,4713,1906,48013,44303,53269,6558,41754,9781,19770,32735,2513,1920,5239,27851,45122,41099,7912,14481,22961,49679,48002,37959,12406,47287,42821,38992,51273,22209,48747,32894,10855,13270,42789,4766,52755,32538,53454,54905,31144,43767,14015,53045,45806,17391,41360,540,38204,1259,12675,45272,4237,46217,49224,2666,5352,54280,32269,44431,21005,20684,20834,34768,53285,51609,42014,43517,9392,27598,12140,6035,20728,16064,53913,51390,44898,10175,10400,51196,35464,21114,6496,17031,23320,11561,18618,9498,3332,14810,53043,47487,28524,9057,45685,21874,28962,11666,19715,28014,46109,30041,38250,24550,25913,18420,50510,3334,6811,38191,39541,9489,6315,39330,30753,2210,33013,13279,32991,19031,27539,14106,24472,5600,45585,35700,38749,12514,49186,30927,27599,21916,27216,44634,13660,21972,45257,13690,18835,40204,43175,48001,8316,15608,9907,49566,22322,42618,32066,25558,34100,22100,39504,16823,31288,30673,238,41663,13943,9400,48112,49570,19859,51289,2835,15100,12707,41390,34630,14077,51412,48514,10068,30479,33251,19306,16815,1737,16726,42101,45022,34708,25790,38844,13771,32593,32977,6652,41392,17944,20377,25735,30388,15227,13862,5955,33959,3234,9667,21764,1872,8356,35182,13131,23740,46130,11109,36033,17511,1475,6910,12497,14077,4723,1166,7962,14229,48575,33339,22618,12247,36643,41263,39822,21486,37251,48213,40127,32010,14635,14067,2616,24573,9966,28944,18902,9081,21376,28281,46393,38959,12194,23222,3829,35347,32140,1983,30644,23943,10333,13920,21582,13770,51818,2546,42667,19896,25363,47586,38964,31422,41336,46510,24487,54250,8296,39208,24595,50652,13259,6321,9386,3160,35248,7365,11536,47364,53336,27534,52599,30124,19880,48807,52915,46586,39913,16099,53476,8327,36838,35770,9521,121,19641,46730,4837,10346,31475,48699,46140,7700,15518,21985,35075,4303,51189,51085,27752,20241,42107,15316,6651,46533,46852,34862,16130,8454,30809,24219,36627,39665,22509,13630,977,19784,39663,17552,54045,43189,20311,7278,18082,37309,40409,53389,22006,47200,36237,26546,51549,12187,40002,19649,27993,3129,33462,48819,8232,13429,54862,6834,38301,3183,9323,19935,19205,3479,23584,31699,51083,1645,7977,35362,45965,48631,20681,45706,18849,2792,29799,9883,23438,25191,53361,28616,8540,31769,41349,39657,25872,17870,35093,1309,42610,28959,21096,27914,52663,4585,31689,8366,23990,54024,53091,12360,38929,20042,15234,52557,21040,7811,9795,3681,26710,5323,26428,14459,5978,43484,23437,2542,17564,31397,30209,2041,36223,20539,25091,8559,49566,3321,17267,33736,12738,42767,49082,43773,13204,659,49343,42515,38614,33245,27300,30828,45423,43085,35168,6478,46010,9501,33489,20974,26931,34877,30314,11195,40483,2286,16594,46797,49434,39517,764,6327,14381,6527,2608,48097,7702,12082,39465,47839,32340,13826,2429,22176,25913,53020,48247,50973,12171,50013,33713,1118,3465,42810,19759,34359,53752,49315,36816,45738,6984,34066,22366,42102,10933,30921,4776,9227,14706,42458,34283,30074,38184,8541,2719,44,11213,6703,55360,41777,34836,43788,25583,3017,47115,16362,35893,21841,45120,8452,619,31252,50231,44567,28501,9016,53881,41957,27383,51619,714,49198,27771,23716,29421,53039,24071,54063,33980,10819,2467,17638,50169,31986,48729,22488,10118,16792,3026,793,14941,20727,1079,28063,15477,6057,37489,32015,5322,50075,16818,5557,21908,28011,28773,40378,37707,43281,336,17365,22023,29033,12404,2584,25593,33781,20908,23269,51556,45360,14172,9895,40988,5713,44906,4887,13651,23120,16593,36919,17805,21743,39364,44512,7244,41289,31731,8034,38333,4867,46956,3099,10678,35522,18485,29055,5481,1055,13820,9333,11175,13385,10250,6650,5631,21814,36763,15769,50415,54350,4144,41741,24293,21214,17075,14907,45790,20505,41092,11494,1639,32660,20242,40881,2894,43393,36639,5622,8864,30532,41176,16963,11516,30010,4490,18103,21224,18174,45001,11752,53591,34582,37188,52453,47066,2672,10939,19554,37104,1130,37194,52014,34184,4240,43222,3204,10418,27838,4851,46068,9563,16287,34040,37990,15675,32370,50584,36465,55480,54332,11603,51437,7076,9371,37012,23981,14207,33109,54521,14290,52167,1537,6039,21500,35784,3248,689,1921,12901,9434,195,27432,41184,14575,27352,51964,29025,51030,39542,35186,43785,19208,28885,42473,5132,19550,39672,25309,10508,13766,54995,34613,31463,51718,45311,52177,31686,3662,31338,49183,17179,134,55361,38422,44605,43070,49370,52778,29840,45072,10089,42678,10815,39735,6493,15681,25888,14700,54746,30465,31142,23281,30643,49703,17871,14848,16319,7887,1057,54264,52052,25439,978,30971,20883,22272,25621,2275,15900,3081,54082,36895,25817,34770,48932,23079,21729,41933,11367,222,39807,37562,33641,11648,43549,21037,38269,31771,4216,31842,9600,10131,37682,11398,13589,37101,15988,20036,48821,46202,13639,26475,51983,47521,53469,20137,5422,41703,51734,49704,31427,22390,53809,27631,48447,38484,25020,6304,39320,29434,9784,12010,47053,21471,49509,42642,44147,48678,45215,39783,21665,18674,22854,8939,35481,45582,15362,3922,35646,27894,4383,4740,22366,20563,4886,19748,40341,31950,20496,42053,41310,27186,27540,18891,27663,21456,5051,37190,33334,47793,31572,973,3944,34886,25896,13481,30787,33630,10921,54546,8017,49706,1577,15330,43379,19799,50916,13742,47105,8654,3336,4190,37908,23675,15004,1295,34457,33171,27870,42213,32062,44961,49184,22173,36807,54927,39291,54072,24762,11323,51602,32962,5752,29606,4738,42302,27784,8950,32545,43346,5175,33062,102,23129,24250,28644,15941,36753,32220,24323,43191,45636,43586,13824,6515,6324,4297,5855,13679,19300,7871,54368,53934,11640,1350,54112,31185,45804,1807,36823,31240,22906,36902,12558,13956,7077,26556,5960,29421,55269,19970,21695,43260,49659,36279,22353,36570,46263,6415,2420,35977,37203,51822,7965,51231,53158,37241,25250,7669,17835,16004,21039,9567,12855,29780,15671,982,4788,41049,51942,21456,19051,38002,21304,37484,41955,54335,55142,8648,53082,53589,14113,5408,41178,8148,55464,54571,38724,17952,38755,8196,3173,28533,25750,2705,49833,49407,22597,42653,37911,19522,8752,12447,48962,35386,39334,16166,5869,9982,36163,28445,6518,38868,42793,16300,23104,3146,55170,33420,47820,4595,16714,4900,49851,51910,31622,12602,41312,54774,41696,53684,7814,50852,29733,47645,27791,13145,54560,13123,41647,49733,4517,53342,45727,31303,8075,28225,53555,45016,39297,17761,29001,9647,8049,47630,9114,34456,26156,47644,44903,31995,19640,29348,54425,48393,25402,23462,39658,38798,48971,23479,46517,5049,4614,6927,36560,39218,45501,21884,43276,5351,17754,9122,17384,16581,35223,18524,15800,14299,21321,49027,52621,38288,39504,23739,22923,6576,27177,29997,53071,9956,22121,9369,20306,26970,24449,27322,20257,10796,8164,47647,12056,27432,47841,18122,53289,55426,39870,42906,40904,278,52532,17778,47239,20596,1924,46978,50138,50703,29387,25195,29426,10762,49558,10751,6314,9855,15970,756,20997,50146,27586,43288,37479,32940,53370,54391,31570,7202,50405,12962,43397,28825,10124,35681,861,5645,30854,43558,31654,25865,20859,6992,31399,18393,33112,52700,31048,38879,46144,6019,3412,45461,24635,45550,27335,9105,14984,9841,31006,6144,17408,5896,43635,43653,17705,26079,50269,23171,47658,25485,16505,30661,34415,55347,38561,45021,14495,33565,32718,14770,44893,49845,49042,20282,21108,37001,52494,5647,23909,5038,3000,41378,2656,45182,28882,53861,48783,27945,28551,33434,44835,15420,16892,32792,22174,37300,6205,48307,24627,47724,38514,54168,36421,9852,15759,37377,7242,34459,22226,40657,16057,21164,40449,26544,25871,49062,28767,2128,30543,20789,53162,21069,26385,28015,26530,26978,32323,37086,36902,36009,6758,37366,25892,10752,24565,42921,24677,31192,17356,44847,14395,20931,3729,53901,36004,17585,24062,25974,25144,8087,32631,51372,47603,47922,14869,25824,20539,50443,41709,36465,15774,18070,11296,40333,29895,23247,23151,27034,2520,3235,5395,54445,35916,35335,3318,34258,48010,6927,38997,22889,46539,17385,4167,46570,42211,19105,41411,25031,15304,11697,17467,23631,12251,28337,50797,13652,7183,1755,3205,45496,53173,47625,49838,49430,45657,12310,45329,11486,12457,52228,42226,30053,34211,44419,40029,48182,13377,51382,35779,50001,55084,773,38962,11769,39677,14775,10539,3310,42114,28198,4247,47863,42613,52955,37843,2596,30508,51482,40667,12659,2823,1652,45717,43228,42950,39744,19123,20452,42347,10,30062,3043,43673,53061,83,40730,16270,20675,17622,109,32058,43085,20869,28285,22476,2783,1473,16000,44721,46478,13730,13549,7447,39958,35507,1477,43863,38621,18354,704,40165,13065,23175,7866,20651,40311,16913,16896,21630,18602,23902,27471,20640,15493,49917,21178,27151,1022,41335,31113,11076,40763,45079,29540,36953,16718,29763,10902,41244,11042,43143,46280,7300,46357,368,38036,9238,48295,29402,51635,29305,46138,51866,47818,8087,14310,49256,22929,38630,16199,1903,12219,31149,10448,40899,29049,26982,5288,53905,25945,44781,1793,23359,17068,37627,6350,18494,32386,5447,49921,54896,54649,45788,49622,11247,22520,5058,21837,47839,4261,31614,950,54235,956,2599,21168,40335,12018,47437,40507,54788,34682,55373,51749,37240,21585,24566,28654,14558,29038,28399,49891,10593,47096,38888,3213,19793,27567,5245,25356,21099,54394,39676,53885,49521,30717,7233,54201,26140,28640,27975,54328,42349,13545,11938,52000,10535,6543,35932,30635,44300,11482,52723,11559,25916,30361,16285,7683,7326,40729,27492,34860,13201,50718,1446,10746,55364,3009,10125,54106,887,5996,31741,13548,43815,20756,8346,14758,51383,2696,38125,28842,9054,9976,28713,2002,22286,21652,39827,50813,38869,15976,49957,37143,26300,30923,18840,4980,31614,12018,53937,47550,11800,9792,11950,16679,3537,30727,2338,20274,20652,25857,49677,32657,28583,25159,10693,35758,18529,50727,23997,569,48889,53478,9381,27794,21832,23248,25174,12509,7942,28732,33644,33141,12870,18659,27383,1882,46082,34776,30157,7810,42043,21529,32036,21709,3464,28554,34918,25643,24144,23898,25815,26846,19583,41341,7759,23105,2719,29089,19481,11364,41411,31842,49545,3826,47686,48251,29098,1354,27179,39588,26940,5704,10605,37539,33737,5692,9875,8788,30976,38666,7318,30456,15196,16759,4011,35198,9441,21335,5930,48900,706,41270,13045,27142,28446,4614,49987,30314,4026,9112,42169,39253,15792,42113,43058,45222,29626,50682,52234,46099,44213,38414,7815,52420,42416,3539,39804,35925,1101,17020,33200,54653,9030,21816,31386,27046,3927,33885,21325,23404,6240,31912,54151,40304,36899,42115,20279,53915,54644,34478,21290,50680,34898,17121,5351,42494,15249,24764,11276,21904,49560,13187,30049,5943,45729,52692,38279,36348,4156,3290,14764,50844,6212,9951,17246,54268,36614,20310,44257,34680,19413,29580,49341,36979,51753,52755,34447,34470,26814,40118,15192,52903,32408,1828,34546,43381,10607,9379,40986,48724,47257,10164,40661,13454,40449,45412,7945,5545,54553,651,5901,4312,18831,6127,26189,51409,21012,14183,6060,28880,32062,41132,8387,12349,33159,11667,8018,27045,19267,906,18278,45555,11131,37926,18945,35607,54757,2809,32369,3284,31495,12842,4228,40315,46684,51713,50925,53905,31957,37155,4674,24614,19168,28945,44579,18097,33103,51398,46354,27150,54284,11722,36033,54137,9811,18610,42638,41523,3117,24458,3341,16963,27661,6728,15354,25198,15876,39613,1870,55380,14111,49830,1367,37718,18144,41618,50230,15773,48175,6760,45967,21544,5897,41833,9694,39023,48732,30033,35535,12590,41197,21057,6585,2075,29854,35091,18605,20959,53956,14538,21201,45427,53714,46227,33810,51297,47215,35606,45172,32297,5996,12074,6270,16689,23024,7998,32692,32251,16964,27626,31942,9063,40547,3169,15983,53674,8908,16612,300,29978,53137,51570,43811,28277,53779,52066,55338,30514,13250,12766,13324,2459,4927,18648,42831,43464,40494,37527,24378,24349,26702,6370,16950,27493,34183,8649,13052,586,45384,17554,44038,38279,22434,98,39351,33247,14483,44846,35220,9958,53727,11623,12909,54444,14940,41190,13743,25277,47986,31642,48602,15267,42749,20831,45460,5616,19043,37430,12864,10756,13930,29716,806,21322,39597,48662,48573,46196,12183,26325,11319,2167,47799,5035,36730,41053,25145,21148,21668,47744,49672,13749,50792,37604,37009,4945,19283,32320,43039,30951,25188,9327,37303,32468,25402,38211,38810,53310,38507,21433,51191,7481,50071,35355,51511,20659,33867,10187,53576,34363,45328,52505,50253,23662,7838,37392,53538,42242,5070,21730,1325,19967,37883,52031,40927,9857,44302,34061,11685,34515,49596,32858,752,22010,17952,10950,12142,7245,33628,3805,40019,54593,21329,51115,35086,3735,24124,8197,9031,27489,22345,33802,40563,11786,14272,43259,30875,43498,12875,32461,24376,8887,5541,54615,51523,41668,6932,33415,11887,20784,14812,45379,33300,16687,8944,54077,21615,11606,33102,33350,2963,36401,7773,48593,36100,6308,5625,40234,38510,15598,5759,6577,48159,29086,22458,37978,1990,42605,48555,3095,17693,23614,44124,53967,49098,10125,8184,26880,14834,50480,50980,52380,11211,23624,27260,23549,29497,20970,40583,19127,912,40349,24037,10743,47016,30882,53110,1891,3845,2041,28354,29667,10340,28470,50445,38817,52496,39789,36674,44345,12262,47164,30634,14004,7317,32514,35837,25087,4605,28134,29807,43470,47090,451,15666,29276,37866,31157,54729,36766,43492,38718,3284,37557,52010,27116,15036,43216,39089,33902,10088,51378,271,4593,38404,24545,46137,22272,12202,34520,9671,6426,38072,37898,49957,15534,16128,398,10469,48495,41821,47158,30677,51884,24357,10264,5794,55259,33345,6769,33073,34118,53431,46879,51172,25188,32838,9058,27773,38856,21210,28545,19939,23004,54118,5364,18094,33968,49594,44948,13566,38728,18789,50014,5241,9262,55351,39160,1218,23835,21595,21105,27822,46708,55211,5773,21356,16866,52246,11104,24755,54295,17199,3290,54117,8242,32492,11177,53249,14471,19461,39199,17453,12632,12107,6714,21657,40769,2282,49180,36947,47992,32161,12016,27087,45157,15626,28316,5687,3710,10276,18544,11868,40242,45259,9351,13815,48187,37494,54907,49163,25128,19989,7170,22276,44609,28989,18182,43191,446,55333,27718,29093,6598,15114,47896,7504,3222,52509,31254,38808,11506,22642,781,8132,35677,9470,10452,47185,20166,43629,16303,32630,22752,18640,37310,48529,18971,16513,33142,5007,12280,35758,10459,3703,39060,46184,26528,38726,40636,10637,14926,47905,34673,16901,44571,2560,9017,43463,26699,17026,17120,18785,12107,44021,31055,39620,29409,9435,20785,15155,2923,6389,1218,12906,50115,43199,26061,42111,39940,7002,24395,16247,12066,50005,2456,16895,9744,52441,16197,37997,42907,50578,9945,12984,50078,847,46633,10830,10056,29976,41791,31924,42346,17647,12433,9121,13382,4901,624,21213,32105,5881,17571,28050,23452,16010,9382,19912,17085,4069,12392,5946,40487,35915,4937,6503,32228,20145,37850,53972,20449,19051,53816,14559,43543,36015,1266,19628,44776,12479,47175,13755,20591,46568,1037,35207,29934,12034,17399,50784,35227,47050,8019,11243,93,34254,35643,14936,25659,7186,5369,12973,6170,27072,35098,25083,51477,42982,4157,585,10564,41274,26468,3378,30694,17576,20837,16755,13476,37047,42156,4264,35294,35610,4991,40700,39942,12250,53847,41001,36107,39008,54318,5047,17109,37927,25498,342,25067,18187,1356,50698,43226,42539,49847,18855,39105,46655,618,2645,30289,10574,48882,2099,34766,26840,14077,5775,45041,9068,16308,12625,1204,30921,9813,18187,30865,29045,25429,38632,20104,28665,24427,12946,23257,16978,37482,16599,46192,49575,7604,1981,14275,37711,38349,52408,9030,7857,10918,26789,18874,33468,22943,51058,190,35771,36251,25371,16550,49660,19458,35642,55048,6196,15692,54627,24191,39799,15878,5920,44822,17368,15336,19117,52268,52046,32414,45253,32143,38220,5395,10684,10445,47652,5064,30951,52992,10822,37346,28291,38127,493,50138,7792,53741,30605,49900,39313,6933,6989,43487,4882,10958,27238,42120,35900,37073,34008,16773,23062,6299,41871,48082,1468,6512,5026,8247,10737,33029,29680,54418,21328,29111,10462,13975,48000,42740,4463,27030,42579,48118,23252,20122,50324,45193,44082,26880,47324,47711,3768,50265,13359,46748,18832,21165,45779,1780,35041,6785,45040,10666,49370,43262,9649,27941,23385,9080,11384,9470,41970,47877,31664,44165,32981,26479,4705,16661,13784,39519,6094,35502,13114,53535,26384,31559,41719,3564,45095,46230,29212,36672,23434,14510,6459,13363,35755,45159,27531,24653,2627,55418,40730,39649,2505,48598,49816,6547,12931,47045,28801,16091,18676,20589,33400,9417,45608,11835,23895,25679,23586,7094,55244,36903,53258,27146,25045,12118,21896,47459,21701,32457,34602,21406,26147,30779,17784,6413,31384,45453,7037,53263,3959,41714,40149,25427,43020,39631,16922,11608,41092,47662,30309,5164,20945,17552,3101,2766,28646,20183,18768,22273,10466,22186,34893,15193,52697,17609,9634,11408,22776,45839,93,52624,14538,7968,23567,35222,53088,10704,26885,55161,38925,25946,13026,30064,25439,41414,26210,30450,50299,5494,4677,41778,51985,3983,25224,9498,23780,5686,11879,29066,6071,24209,49165,22798,37314,44448,21038,26813,13946,24333,13880,22937,16347,9639,23383,37410,9660,11982,4064,45179,18239,19906,50319,52033,18917,47545,20534,24165,34122,19602,2114,53975,24079,43579,38316,1106,15919,38075,53310,40535,4418,9035,24802,15061,20802,39143,12419,5972,7943,53645,8453,22055,49638,31319,21492,49361,53657,43201,18795,7572,17338,30817,9312,12548,917,19870,46926,41397,273,15290,45513,16925,12462,8797,33389,31458,39297,49945,29418,6462,16210,27708,10486,21967,29947,38866,32884,33287,23314,40283,15675,27040,36033,28905,27580,15544,47587,14360,32795,1521,43009,54280,53299,46191,30603,44283,28355,53912,33037,38046,21422,47481,46072,34529,36736,15140,30198,20047,15832,11542,9998,13429,31296,12361,9643,20509,51944,40682,30677,36816,20436,37291,41305,40397,40829,8323,38163,41996,53544,40255,47436,38702,35993,49052,3162,41736,15636,32976,55435,40477,6295,23392,7857,28643,51103,18507,6329,7403,21585,45019,32116,40491,37692,26411,10013,34575,37707,19869,34356,38307,3464,4395,44050,3554,30966,21679,35072,11588,30157,626,31466,7602,42621,35716,44079,16170,30580,21576,9847,46390,33862,10350,13073,35071,1624,38436,12572,22090,41159,6050,32817,55232,50190,16840,20019,52324,19753,54547,54771,31480,40956,26674,9898,15706,44185,12841,16622,34975,41024,26475,54046,3705,7167,342,46148,10107,42681,17016,50174,45598,9542,43680,27899,27669,14535,42329,29769,23080,43966,37910,1593,22856,7633,10798,10296,10292,16535,53018,42082,27770,48048,27672,53442,48695,47433,25401,25949,53912,18304,16992,16914,54869,48030,34037,45495,29164,35415,20124,46954,34240,3449,16826,14216,28964,31743,200,16044,48819,11175,33376,53747,5583,45193,19018,40060,12611,26783,20231,13595,38262,40362,7705,11912,9249,50604,37321,17550,54540,10408,16505,30050,18614,30247,5780,5288,31670,37429,20529,36779,52919,31349,55340,45399,32846,50204,10724,19292,20121,21392,12271,30112,29062,28645,21033,49115,11981,35237,6024,20923,48995,31762,8344,10840,33398,10319,5600,41605,6610,37042,23760,17635,39220,20081,24944,9934,33352,17712,46910,11683,17435,43962,21867,3874,11467,30062,5683,35883,18306,43643,25528,45221,832,52558,22334,31069,29486,2856,31469,37743,37292,27482,43026,48066,14464,54220,18173,5428,1421,40008,35136,46187,55410,20614,39594,45489,9152,33884,466,39978,22639,30130,12194,21792,26558,25204,43790,16166,8693,51226,35053,26090,54676,33797,15101,925,36025,31856,8663,16798,19381,31626,6801,47392,53436,50085,49438,1087,16918,30542,18810,51810,43795,43652,44371,42992,45884,13419,7393,45213,28694,39852,32468,51642,41331,4562,24765,45739,54406,25679,13201,55230,31288,1504,32941,55093,32399,20902,46419,36429,12260,38547,42353,22915,25811,15401,51727,46516,215,3579,8891,1631,23371,20082,53843,39842,33204,22473,431,6960,38040,36639,26704,29804,53920,55113,23808,7943,5934,12161,28995,45484,46046,15703,26305,24627,4828,7613,561,44764,2714,12092,32820,17383,46528,22961,814,49646,8221,33761,33673,7407,10064,50893,52832,25722,23565,45982,16707,7092,27725,31247,52204,34831,40397,19320,37279,52977,37575,35495,21470,6635,51896,21987,39227,25928,27870,35366,47861,33211,8589,17963,50671,5717,53015,35792,18105,19338,48247,51741,5612,46808,55044,8987,4675,1765,47454,48598,39019,46057,53105,40352,2108,12148,54690,27236,6001,44841,41992,44107,24729,14660,50751,26699,27074,16998,11145,27436,2109,54017,30286,38462,25046,13500,33158,31213,5866,31139,6558,10303,10742,22121,18887,10682,10240,36506,375,26770,54802,13684,33282,16938,38104,53394,44538,50402,49519,50126,26288,40856,6066,31577,26655,17066,52577,25965,53723,41244,16733,22835,9959,15365,46479,26431,33070,42048,6910,5654,25772,36303,26874,49240,42257,42444,2408,71,42503,13880,5484,47935,49418,29399,45384,8734,40777,4808,20585,45795,24393,1584,53837,30197,1859,38581,15058,35204,11438,17564,12413,11976,51304,12420,13418,9694,24651,8416,12838,23088,15811,47226,43299,39209,13583,27777,15123,16270,8228,46406,6293,32752,12545,11218,6518,2835,9787,24138,27672,19952,45633,37981,51,18558,17573,31321,39014,20967,38552,18432,44782,1252,46758,39037,18407,9442,28809,54701,12181,8072,26318,11889,30866,11290,54512,44279,49738,12034,46363,494,10056,27797,13921,12611,38427,43671,16537,6435,17903,26153,32603,21613,32972,33191,31960,4110,40820,42878,18279,24955,31483,25121,21311,16751,10712,38762,13889,15334,16650,53431,20026,2138,44103,44543,2816,32275,50248,26042,46401,27338,8188,52068,23326,21566,17278,54166,16706,3529,37272,8290,7446,26675,2901,15119,27775,44186,31521,25503,27145,16174,29019,22661,29203,44871,3134,7806,53363,32827,13252,13772,19859,43930,46336,13644,53759,17020,1855,25296,34757,6754,53879,15835,51510,30993,3692,40735,9926,22242,20138,12335,10415,9922,13352,42297,50064,6145,25989,28006,53422,45031,22217,51904,10826,40598,44512,46632,27412,38268,27670,23423,19150,33118,37469,30516,23329,22369,32551,51645,12494,28324,43953,2530,4288,4590,27895,25090,4248,19736,36665,13040,27407,36119,27072,34094,90,36666,21829,14050,23221,46566,46686,19654,34317,41654,53076,40983,50065,46726,36144,30382,53477,31110,19349,31030,15262,43251,34616,17796,54253,31578,34081,25890,15741,36681,24311,2622,48398,54197,24328,18370,44208,33571,4577,32972,28239,42993,19409,46109,50777,4333,46624,38946,28830,46481,19383,44003,25178,42448,43638,273,18865,54216,3171,33813,50006,39014,45230,28917,26635,11393,22814,50817,25676,7017,17448,38001,27981,55475,46480,54579,3331,25125,43364,52256,3317,47761,26123,29509,33124,40455,30402,18695,27337,28499,25288,34309,28466,24657,54426,992,19167,45137,12746,28033,35201,12593,34476,52431,22386,2380,37057,20269,6194,15517,22958,45489,51158,48039,39733,362,27779,4195,1714,3558,320,26510,30295,26943,29901,25777,50218,18691,34724,39432,50495,9362,22187,50970,51839,39840,55477,27562,3673,44121,13660,10477,22127,48777,27631,46062,35130,11903,33827,27325,39845,16062,35503,14359,25624,20416,2316,42032,19222,34231,6336,19179,19336,21835,1626,39017,25792,24423,29098,10331,42541,15335,41544,29872,52509,33144,21456,11387,25854,47951,35352,46125,13522,19883,25125,53118,16457,8153,52524,27029,13701,4561,29140,53592,25950,42809,43816,35230,38659,13609,37188,25654,27326,1516,53932,7617,25971,22435,33134,39327,32608,36350,44257,33553,17620,54852,24788,32739,9650,36286,52806,26720,51377,26646,26029,8757,54359,24334,38098,14169,19499,55010,7946,27867,14997,22335,20411,26709,42205,1968,12491,49812,51136,17075,30028,25653,46870,13582,36361,25081,40387,7817,35888,21683,27462,16987,44948,50909,19151,35486,47715,41129,40548,42058,39443,48734,11138,14489,52903,4977,17664,46029,8246,35476,8456,23730,23388,25529,27768,30833,26374,6583,46546,43413,46841,16819,22363,40770,16244,36072,30495,19989,34959,41298,44593,44059,5384,20516,34655,36172,20859,13939,19201,44050,20766,15168,31933,16391,20733,11454,21652,10404,32558,26946,12333,13205,1241,23113,11479,17573,35018,49957,26533,7330,53182,16237,32300,52675,10384,42328,45281,41336,36767,43596,19965,20427,12063,18232,52061,6973,54693,15816,10487,32273,5104,16336,33752,41907,33630,11261,27868,31294,248,48773,21922,37646,2148,236,49014,49611,6159,31897,48689,25206,9378,24658,1320,12620,15926,45578,37445,53662,6376,8814,1650,4801,12930,1151,11213,53748,35264,19863,14276,5037,29360,41478,2607,280,17848,8096,12739,51523,51575,42864,8320,34225,30470,51715,48731,22590,19593,1833,41464,35063,47657,14113,51620,36102,12852,12309,49208,46204,2524,52601,37584,5826,25359,49727,4188,54985,35317,10502,6645,55226,45806,10410,20458,20168,17117,8567,48058,27394,28882,45621,11831,52990,34761,12395,33823,25023,20389,973,55467,27129,8831,23785,13896,40423,46935,54804,11610,17359,28098,34416,12523,19246,47863,13342,18618,27748,24562,11962,26433,36446,15004,35570,350,27935,30755,51596,25707,24808,1054,43122,38157,39757,20819,20347,9971,10424,15141,5782,29688,39170,28302,12667,1181,25686,31409,10487,38552,38593,19414,19622,6065,19910,9403,11216,44079,10839,39268,5846,5578,32625,27988,27044,4450,10396,6244,36363,26545,48719,5314,44093,2017,38102,32376,41550,31902,32888,12041,48839,1082,51038,36775,12015,20888,42793,15228,21898,18292,22550,13471,24904,32111,967,49282,615,40698,38115,34131,5668,3073,13326,37398,34914,55195,1670,41958,25882,1888,21960,34500,9140,1810,49035,17363,41125,40052,17544,32141,16474,31413,1039,9360,11767,16894,14987,39538,10728,31998,29738,16868,33468,1843,5244,42363,8165,49522,50573,16817,32936,7343,54879,48419,23691,23861,10369,15802,48648,6261,26285,48104,37248,34960,12303,24940,34908,9469,42885,51965,1509,23155,36774,49050,15900,12669,29719,37742,17676,27548,2538,14820,45969,25619,3723,2355,37885,4307,28107,27801,24125,43751,54503,43898,53625,48802,6562,22258,34036,28466,7770,45476,53885,23234,17736,53084,39752,9443,25916,21168,36688,47869,6352,29598,14470,19356,9002,2412,29071,10284,32142,17734,38234,8952,7788,6997,24545,20048,8511,12464,49663,51354,39428,23112,51494,51441,45392,25737,13159,803,14761,6317,4307,42308,11441,41357,40551,22689,6787,31185,22117,54044,42269,7877,20867,1517,18740,46386,25875,39412,39986,8993,44545,3516,24198,12647,55014,9416,2442,11123,35876,31015,42098,19019,23528,31193,49096,12065,5204,43548,5217,1728,811,12882,26440,27836,32011,14124,19144,38287,12412,37723,28756,22907,5710,34481,53066,19144,34726,29420,51863,41618,12137,26854,24648,25729,37620,22945,28518,22908,44617,7359,37853,33678,16712,48609,39317,6986,13314,37283,1197,20084,5587,8472,10121,6357,50800,5139,10533,23977,10216,29430,53216,13819,15499,18032,20777,12984,45040,32924,34351,39393,53844,33561,9079,1115,54288,24718,26638,23226,6592,38007,34865,30268,3776,26826,1155,37767,5869,6372,36463,18701,30764,38661,40139,1459,49872,24794,10796,18380,48404,42117,48205,34546,21701,19549,6858,52239,27002,4426,7971,8298,8185,19304,43563,1096,34911,52878,17018,2551,12005,27244,28027,37134,51985,37575,2072,54522,52736,21842,54452,13618,13359,25142,47794,49894,14925,40173,30101,16369,45623,54929,20376,2371,13754,48498,53522,3283,25656,48916,49009,46301,5129,12583,11445,24896,51990,23603,54704,4301,9199,49396,34960,29192,6276,15727,37871,19652,32781,41214,2515,51828,30105,19349,4876,9962,51329,48495,45210,36642,32736,47006,47154,27232,53603,54193,1508,3913,26599,28020,44995,5444,48076,38959,1073,48644,4623,35234,54206,33860,11336,16297,17006,55372,49535,36623,34465,18380,37749,41198,4727,21418,4519,36487,24329,53435,39457,30378,5902,47983,10136,51396,39251,42709,35775,1387,54901,50243,51086,10432,54656,31901,43617,51230,37012,10959,14878,6170,41291,40345,30505,37741,15972,7979,831,36891,55323,53586,33014,51849,32818,13926,46208,35592,814,7794,40357,16212,44520,445,5444,17431,26830,53552,43446,5143,50804,36661,37504,43541,49772,50788,48581,51448,30279,12164,46570,11444,2535,6997,34096,52301,47365,489,27250,14921,38445,6471,10636,23284,51724,13665,10275,1347,50589,10827,9442,53057,8133,10053,11019,43052,9883,19423,22902,274,21452,12305,41508,54848,11607,17474,36662,27955,55411,46240,25055,53371,42505,24507,46196,8916,4620,26805,1390,19131,16459,5074,38114,41315,21099,29212,48713,15300,12339,53512,32969,31538,22388,13538,10707,26154,3679,38372,51343,2055,48443,18932,43490,38680,50717,32980,45583,2120,5147,54043,42795,39733,26721,32868,51337,52639,4355,19781,9267,16227,42578,21569,21298,25486,32443,18020,41365,14525,31945,18380,6741,22620,48228,50631,48724,38454,19489,13079,47540,55349,35040,42508,51327,29797,36239,11431,35728,12333,34538,15141,10825,30196,47188,41046,9166,26236,12020,3764,1001,48210,47769,10282,21224,52668,51991,37790,13247,7160,43855,4557,15602,160,25571,16680,29434,36536,24090,16333,53652,6366,2641,12609,48878,23601,11520,40161,1961,24266,46263,19749,42370,24570,17777,38181,3789,6782,8908,49901,20534,41362,15852,45632,43974,33372,47801,27717,36226,14071,37408,22396,47191,38186,48797,508,8456,33944,14031,33925,23188,6960,22871,54557,43701,37951,20279,51256,46268,14035,20378,36261,20136,30366,34717,1999,35068,18224,36969,9058,38212,38878,11273,8385,49570,27912,33468,39184,13281,25348,28923,9395,45108,7626,24091,26482,50103,38010,37799,16801,46320,52723,35894,8389,36102,19372,13345,28122,43247,39920,24092,6868,37179,38004,604,53783,2793,6779,19221,15484,12465,27220,3464,15139,9734,34862,45382,7761,55054,5099,34875,14816,3412,55285,10759,10662,43221,54656,8831,23345,18109,32658,38409,34341,12902,38141,21537,47688,31869,25365,47144,13226,46916,17957,25377,29582,25914,13163,22105,8417,49720,52115,46482,37553,55173,17875,43375,40825,28598,27321,38800,21406,35036,21475,31243,20303,21112,29733,25732,49783,10158,34900,4629,14551,15818,8802,5245,9912,17305,40298,27422,27246,18562,2863,453,44019,33335,49891,13828,5886,19229,27104,28815,3967,25873,52929,43196,30351,16413,18510,30237,20549,16607,37874,53896,38810,8426,9340,3347,46277,55333,41186,48017,22889,24590,12826,23263,810,13610,15684,43478,55321,9519,33833,33850,42948,33579,51446,803,20006,19739,22113,47011,26264,3725,19636,45211,55070,773,11156,41155,32029,10688,23528,12838,11679,44961,26486,20340,19089,42008,12620,7108,14703,53283,44353,1439,15010,37008,37686,11061,15395,27542,32769,43060,24520,2416,33334,12138,5286,29895,1899,43441,13394,4542,39915,48828,41628,19286,8330,20717,23184,18280,53033,37548,4443,13829,28619,8271,30239,53974,2825,46315,41564,16920,37930,49310,4717,19855,42074,49742,29611,38648,35784,12052,8054,53270,26307,9440,52425,25818,29744,630,8738,38877,7131,28384,7461,22587,35831,24003,40692,14920,54127,49116,50756,52651,12660,40389,53077,39623,16539,43723,45758,670,24666,36915,7466,10536,11752,39014,32205,8252,23612,12165,48305,42777,14067,16764,14473,1688,10627,7101,22427,23095,9606,586,3121,21092,5109,38477,54608,14007,28692,35420,17540,6428,26663,7282,18615,43004,5916,55305,46655,37379,43307,51750,21781,54796,13796,5272,26013,50608,37493,42507,32734,32159,39891,29305,12201,52448,25247,10122,1028,48085,40328,24082,32518,14492,23772,46387,37281,40664,6632,17071,21764,45020,8978,5757,41463,13028,45730,31900,52266,16065,39491,36017,9306,9611,36603,50163,54779,49895,3463,55132,42762,27776,53607,20316,27848,6599,13243,39898,36787,46647,2534,4698,50148,7616,40695,35459,50717,10230,7907,52007,9133,22950,55253,54465,19608,34286,47140,39786,3384,53177,38079,23892,44184,41700,29389,38242,31094,36240,11244,433,45918,32886,54763,24832,44228,14826,19857,20230,53863,37476,8843,20734,41797,33477,6963,28561,11732,33697,27186,22906,5673,19360,33937,29961,2121,50385,6266,32403,23359,17804,41477,50948,14529,30520,8553,4337,35427,6649,19578,49337,27032,20718,8459,9631,25505,50474,39158,3279,14074,4159,36580,8133,37074,36600,6312,3622,54282,14614,20002,30122,46733,41087,15183,24254,11327,49202,23058,42495,50585,42562,49597,32980,5807,54987,28967,47413,20969,43954,41916,53100,36326,9019,53308,34863,8470,10614,3391,9732,2558,16084,49762,1775,11455,29452,48916,15180,44477,55243,5944,32976,9751,50409,2838,4664,28194,21969,38256,42350,34288,32529,53394,37013,49813,28477,22748,49316,33021,37589,50477,16514,6049,40191,11388,22213,33834,46812,39606,25989,35907,13955,36073,41834,40653,41507,38483,37482,34904,15750,38376,52658,5837,52835,29474,50333,49802,37401,28535,51141,5112,49479,4727,7776,16434,16505,21689,49437,47692,18219,11300,42685,25022,18414,16582,24293,30968,140,5921,19232,36420,18248,55177,26223,50577,1225,34841,1260,24715,23263,47482,53840,10126,55114,40188,37865,610,36539,38411,47266,45725,16417,11718,22546,24260,13277,37771,53191,25219,6174,18104,39737,42866,38834,28950,2495,8912,8989,15542,54328,29852,14399,39819,7978,16169,49324,30611,50384,42924,50781,39397,23758,46235,25557,28293,28901,34707,23900,56,52209,4103,8322,45962,49194,21226,6783,19329,25663,22242,24076,27487,5639,36791,50805,45928,35534,24168,42398,18485,18892,38393,36433,23761,42544,52594,22966,19614,47641,6261,23235,23987,19102,14011,21796,28232,19540,14068,7217,17593,33643,1639,47389,27602,29941,33139,41562,48824,27153,241,34633,7168,53453,42866,29914,24289,22690,11594,35216,55433,36591,49024,23141,16225,51141,46763,34515,8611,29749,10067,40475,17737,20360,55092,18435,46027,3562,31963,44499,3708,13352,14885,7676,15525,50650,11961,5417,2056,32064,38122,35872,32492,51106,51048,2424,52274,29288,3381,30475,43976,11765,40236,53271,23906,47466,17092,10445,50260,28748,17892,31454,10805,35300,2786,29929,5681,48347,3081,52175,26064,20047,26817,16962,46799,581,15856,12043,8859,29948,50175,16344,1801,13440,8507,17023,190,8472,23148,54934,32009,52433,45460,53171,33320,28811,29042,17879,20559,28570,29045,34999,48188,32761,46657,12401,52268,7909,28135,14672,1848,8127,18899,23977,32148,24670,14409,7920,34380,9831,40327,52094,15730,26619,3952,44092,33975,18370,50029,49666,51629,52046,46988,45158,15647,49742,14812,11566,42969,33326,30677,29905,40321,43302,20,11904,38902,49232,1670,55048,3625,10917,13844,48198,19303,51704,28392,45760,42219,16079,10222,20736,45241,40373,17713,41840,13719,16650,42551,28592,18697,55163,44392,4307,39635,35081,32575,43736,43268,50451,22648,32999,13332,17789,4579,34881,44944,19897,7689,27442,5095,35039,39474,19225,45914,49705,53850,35385,31772,53781,24774,41831,1078,27503,25884,24896,48925,14812,24452,35412,54381,53659,20387,36491,24689,15537,25278,16864,2164,35941,15744,30127,55471,16760,6655,3988,3791,19727,17926,53629,9935,31602,40661,14445,33155,42138,3940,16411,1566,12625,44861,16966,51311,3079,14829,10747,10224,41099,47411,44107,43613,50357,17000,8115,45331,40279,50031,44374,10710,7359,1310,760,13030,715,40855,3158,3079,8192,35654,23561,12652,21342,11827,6432,47920,22256,13653,48966,51720,30329,25173,47810,17918,406,8567,35491,24123,53008,13189,22660,29065,9459,1857,24072,31997,52711,37598,37428,42698,21920,2309,9176,4111,27810,55358,18700,437,3868,39524,40817,4374,44317,13372,4025,44185,41360,53414,30397,41696,46975,40613,26722,20336,37476,3106,31208,12708,12821,7184,258,22694,11067,842,4535,642,23157,44509,35643,9723,38490,50854,1757,48402,48942,35806,8244,4383,24183,32553,50098,20264,17202,27710,52957,52046,47636,43206,28609,53671,49041,5538,37195,34225,49031,25753,23699,42481,6060,31669,42380,16524,51629,30386,31059,54029,24628,38304,41104,11237,52444,12677,10658,53140,1412,11543,26427,2332,37809,18239,38514,32017,18948,3563,17969,45978,50911,3846,42278,48226,22737,2158,7997,19785,37246,44085,52187,39373,31004,1545,33888,2274,55418,48259,1673,9576,22619,17338,35582,38961,43046,39948,19170,52990,4096,27338,47028,44810,20536,17018,18215,12592,11436,53152,41286,19736,16232,40233,52795,9596,23747,32043,17901,32367,25468,39559,14194,23012,26340,44639,41520,11813,16790,17104,27470,11735,50418,40679,26380,275,50946,25456,14990,17100,10047,50144,36846,25511,4372,1494,8905,10207,23425,44603,43456,41168,49512,27899,46313,36180,15043,48996,43629,47260,6588,32707,8271,54302,1610,22905,46320,39783,19625,21227,13153,3979,55443,35699,25055,46765,25851,44119,16774,38015,3695,4263,7593,25043,21211,1066,14240,8098,54727,43098,38299,48489,33573,26732,25438,37599,13777,5580,48597,30197,4141,53660,52006,50419,49602,13062,13300,19611,1610,5999,40068,54850,35019,19143,20715,25820,34431,25479,19902,29300,2134,25406,51034,38081,1009,35582,52960,32636,33570,8287,17861,22636,4535,6075,4918,14416,45010,52948,45087,26363,51932,22315,3344,26367,2897,49883,33507,22455,50350,50,14490,20930,6640,15787,42928,14297,18814,7744,30786,52358,8463,1909,16108,1276,52299,48264,11334,55067,28727,30010,14756,7927,19316,45226,16227,12914,37968,45586,17786,27819,10979,17999,10662,1435,18430,9008,51627,30999,2421,38498,8128,32504,27162,24174,1709,10719,24499,29076,28016,30295,32546,37186,25393,33364,24890,10199,40836,16278,13683,17515,11865,5010,14535,49141,4109,25154,34830,52516,53262,29945,14327,48286,20755,40698,16506,2894,32444,18907,16324,24972,31248,12308,16328,28243,44771,34307,31920,46582,1970,49393,15719,37746,47497,19172,41330,54910,33447,53994,26837,43209,15516,50966,15007,7908,10326,21968,24346,35775,13064,43627,55018,19432,7516,7525,24323,14193,41761,29097,39446,995,34188,53369,31571,47948,37902,49311,256,48643,42949,31554,34885,36250,13961,17201,27637,9084,42953,25237,51706,43580,21970,2245,24194,49149,22814,27442,23079,29643,32552,48376,37881,53412,4664,1393,32044,15435,4464,11773,14314,45361,7553,19295,16243,54650,50966,40940,2992,50089,43054,19522,12174,4945,25210,39162,16237,9009,3323,54523,33137,24786,11026,19818,14652,36170,40984,6189,54659,22283,27150,3357,18346,20838,16130,10306,1124,24518,28315,16221,50725,30722,5634,38099,33702,25151,30179,34740,32227,542,46937,5700,13853,50492,10126,2293,23937,50820,45434,20009,6923,26902,50138,18862,44693,41563,4723,7909,48192,24268}; -// expected = 0; -// actual = test.findPairs(nums, k); -// assertEquals(expected, actual); -// } + // This test case will throw TLE error if your algorithm is O(n^2) + // And it doesn't compile in IntelliJ, it throws "java: code too large" error + // so I'll comment it out for build + // @Test + // public void test4() { + // k = -139; + // nums = new + // int[]{32196,25662,20113,8991,14524,22650,29922,23567,24083,35838,49415,21584,31906,7236,672,28196,40565,17915,31989,43287,2911,44179,35938,7755,31891,34685,54614,46501,32365,1269,49348,23164,22259,34750,29889,24471,52189,54257,20514,27263,46438,54041,42826,211,15954,29874,31160,3511,1091,39059,51850,18957,23086,112,38817,32389,17860,8,29479,774,33497,55493,25741,15363,25706,7951,31961,23162,32613,34616,14693,48726,17341,53668,458,36597,28752,32215,14322,39975,31848,24846,42980,30957,35787,16670,3952,2886,38448,47644,55049,26426,33899,38998,36414,2388,5121,47599,8774,9148,15117,21696,17737,51500,11336,20896,4766,53999,27252,22109,24015,54663,28571,43978,1740,14785,10141,20019,13503,6515,27590,947,50841,5779,24068,11730,40286,3234,18279,2765,6052,24902,27020,20278,36152,36247,19831,20235,8798,13809,13906,37247,37702,35412,36194,32718,35458,47620,14501,25623,41152,42175,48674,15585,42236,21872,39004,28638,54912,36515,24355,53765,32928,36332,43966,33281,53220,17,38581,25567,38285,31125,55445,16154,33575,475,48688,17202,41092,38465,54816,2020,9194,862,31441,39638,13576,16073,9480,21395,19668,31980,50527,50619,17278,16688,26088,4953,51389,55146,19908,55071,30693,34312,6419,39717,30346,43734,43827,13584,41010,935,38147,26518,46409,52594,23276,13459,29334,12386,151,55154,53765,30122,53357,7159,25227,50383,37460,1116,2529,37133,51391,12681,22955,41006,50924,23239,32863,11161,31422,7450,52849,49240,38933,10038,6355,21937,18966,54561,51486,53702,51151,36965,10531,14662,13755,19194,14584,8562,32798,28241,23009,12170,41928,25733,42394,35933,38724,32579,13536,31032,21204,27260,38737,9947,31527,38198,48146,32034,26733,9844,19620,7068,32453,50978,5571,9372,46512,45623,24719,32443,25175,31428,14185,46196,50140,2890,15140,1558,32166,26632,48420,25872,399,25075,53136,5001,12307,6619,45377,48536,39123,2576,6394,45275,15308,44765,21206,49367,31185,19190,45590,9909,13168,39395,19533,36877,41393,6962,34706,10107,7467,38734,31008,14216,49241,3671,26884,30386,43388,21102,14572,21356,22450,43365,26645,50549,15276,6863,53622,4344,49819,46650,47388,45294,35030,1447,36017,46167,17212,2623,32634,49557,53708,14446,38588,5649,44805,42448,31599,55183,997,8311,34660,52148,14272,26911,26754,26723,44568,14490,22241,39669,12113,14450,16460,12823,49804,33914,24661,32178,50501,12689,12085,22257,54841,42364,6447,5470,36103,46496,6750,26462,3802,25507,31784,33498,3357,42658,44574,22348,38148,1624,46864,38928,18494,15408,24885,23971,40930,22850,35088,37741,45600,41620,52377,49812,9234,20215,4519,30221,55387,26976,40308,10630,44462,52025,50184,16952,13074,19695,8052,8040,19847,52618,43223,6115,23590,24160,51992,35131,2218,2149,19684,32472,52398,49558,27301,25550,48465,38878,46962,30043,18604,54909,9522,13893,44743,40643,3835,50385,43864,19480,19828,38178,44482,24616,25354,1837,16217,7419,28653,45204,55042,41556,38993,13251,30387,14423,17588,45230,41108,28967,43136,45918,7516,16669,23874,19471,29914,51379,35706,50297,40996,38997,21957,258,12159,42203,10545,40130,53143,54369,49918,12139,23336,24607,12538,51171,12021,18593,44836,26918,43108,4818,449,18814,52186,17390,11595,19300,49077,52096,52304,29333,18904,14791,10793,24509,55123,28770,20881,22917,25437,20336,7607,17515,43755,4211,25601,55344,42014,36246,4235,31909,46790,6194,47102,22036,13535,14177,43361,42787,49938,40304,39519,23669,29420,2927,48980,22450,19423,11234,22472,9042,12787,28890,43057,51659,20169,33790,41879,6491,54775,36100,44315,13387,8536,51296,49923,23414,18541,45084,23044,54602,17406,16380,10982,52754,44488,19769,39854,42002,35875,23765,7081,27460,8,54137,23841,41029,28713,53870,38165,11791,51826,36146,38678,29076,54120,7665,46165,34117,34153,32284,249,5470,51121,21421,27289,40198,34143,20440,12113,39959,27250,11346,10878,18450,20606,22592,53135,38699,353,29930,39360,15987,47312,28183,13731,53310,26046,45571,55214,20880,29609,5971,49014,2836,35381,17807,31381,20893,1013,31606,13487,40770,52515,51951,36231,16391,20292,1178,2167,48222,47029,40381,37849,51485,8234,22503,28250,41234,10234,46254,6813,38584,24494,20030,30884,35316,23630,17172,4926,39660,46702,47665,9422,7233,29190,55191,47319,30645,25270,36605,47729,13814,43758,20184,2984,5842,45826,44739,49595,22164,12326,36743,38698,51726,13294,38747,16481,54631,9316,10524,28614,45760,13099,9964,47536,27808,30583,6952,49509,20065,53331,48832,8978,52086,29308,51588,2658,30219,18044,14131,20391,42231,29272,2818,28854,31337,52687,46583,40418,7051,6891,37865,4319,45281,26248,2191,19302,17819,50807,21547,17922,15313,45828,53680,55231,38811,11457,20106,11146,6884,27947,55151,20694,3460,25503,20389,1384,28539,48509,19480,40175,50893,33217,18760,24051,29980,674,9345,43571,30850,38533,44570,37513,30613,45909,31018,52880,27871,31604,6064,52668,8299,41884,17599,12466,14761,32862,28615,18111,1875,5040,48669,11338,54528,55347,54142,32462,2716,28033,2200,2027,32579,49920,5073,31526,45654,42888,43834,49605,10786,55065,24606,1285,30528,31279,13858,1049,9981,30474,4928,19415,22397,30149,22395,2289,26727,25314,36378,18493,10727,22257,39483,16460,45801,8379,8406,19114,54240,5783,9941,2968,10543,18267,33981,52572,33026,3178,45500,11869,28000,13452,3017,33341,53949,51582,55454,32612,12395,32410,37072,45792,50050,4022,4253,25851,27246,31334,23721,19262,37319,5102,18615,29534,14606,5302,44639,12031,6394,2738,51552,41989,1450,13680,21446,48938,45576,10216,48924,34699,33377,44846,55430,54623,12811,7956,13237,15237,39565,34224,27286,8081,1277,42916,33101,11791,42238,41645,51653,28609,46333,5569,37704,13907,40143,50603,19628,39940,1944,44681,49874,27177,3063,1005,14636,28522,34561,51396,5606,32192,36364,52769,18829,18198,19570,26751,40292,48546,35981,7579,26662,47893,14688,22893,18127,16212,22399,17975,40739,35181,50185,17120,27963,46959,31658,44160,30914,43402,25734,12087,6490,9480,17650,43168,12475,22584,32015,16918,14704,49062,8401,25506,16029,45088,34167,14151,18610,14563,38544,30908,34608,18774,17411,24695,50245,26753,11702,32096,16257,52755,6947,41806,44487,17147,50839,51290,44840,32043,15995,34959,1761,39296,37647,24503,21421,17005,48697,8170,5289,16261,25246,31541,50997,18289,41941,10305,46091,12892,37212,18033,14443,45177,39876,24746,22870,15886,10187,17429,14175,10991,27391,48344,42205,6789,22755,40200,27148,46178,18978,26480,14615,53478,8087,41812,33170,40743,7223,31647,33231,28002,45961,12174,30725,4089,53330,19748,11002,22466,14489,14115,13617,22197,9467,12319,40261,27741,11613,15980,52958,22676,42599,4652,49637,13732,168,47785,38306,45279,10463,14826,51934,35341,17595,851,4718,34197,45800,30513,20348,28176,13657,45396,49324,6568,3487,1267,8702,20856,26089,48082,52056,3327,20711,32152,33478,45852,55288,8567,4606,40072,12947,52918,35383,23123,39247,27737,43637,4836,38253,19565,49170,12384,51602,4003,49764,9047,26861,41856,33948,29924,16845,24757,22712,39592,6378,15899,17809,47405,42282,7497,15628,38824,46631,6400,19773,32296,50984,24527,24457,49616,32627,1274,9661,51794,47284,28768,44799,29413,52873,31643,52741,29458,37651,40158,2604,18822,39274,47672,53732,25201,12811,8332,31974,42538,483,5484,18764,38612,49046,15774,55273,2333,35698,3858,4676,709,21693,49251,19993,28425,46000,44089,18206,28488,4097,21872,20737,34751,51871,27190,50596,7173,11312,4116,48012,2468,20786,50589,16340,40740,39301,29346,41769,10207,39331,26160,1144,29630,15747,29755,12341,9737,19677,44914,7537,15208,13877,44013,35969,31013,53624,21491,19378,28011,38070,19472,54758,2091,46407,43703,8908,16819,43598,23455,39358,44744,51218,48019,21835,6290,50576,46260,36090,49548,29386,1814,43402,39919,37559,13956,26318,6031,13660,45724,40085,428,43462,986,2524,1369,40818,32556,31015,8227,41226,44790,3745,15149,18170,1751,24759,23632,12711,34328,2216,53792,30424,35949,53880,27005,23411,31599,19064,5698,33822,39662,30083,16755,11654,48410,8768,19635,27877,52417,40712,25938,5458,451,30565,4433,44588,28065,45890,19354,53235,33098,27247,7528,15810,54205,22279,11903,8371,48003,39188,23060,5446,49340,4562,10447,50314,32737,44520,26324,45624,23514,25236,13906,28444,43760,21652,46075,17012,47719,9937,24384,46069,47486,13691,41515,53304,32847,49562,37098,45053,44787,15028,27016,1087,899,54161,42714,25632,18225,16279,34559,25857,55106,18522,10686,39346,48359,12594,6485,18908,2177,29110,54631,9432,10021,24643,52385,36706,3038,49044,43733,46332,30581,6931,29670,36974,27313,8636,3675,18087,55039,47312,32714,4213,28143,32098,31821,47702,49800,50768,54674,50632,8045,10642,14031,44927,1265,49650,45958,8320,47969,47867,51743,39380,50950,33189,27158,49779,5418,55012,20261,22716,21597,4387,6734,17096,30370,42587,19945,29825,44219,5963,45751,13092,41338,20592,43232,3706,48221,28162,16656,20353,9603,52818,30409,42646,38058,42889,37940,40923,15162,8495,8668,24976,38335,17678,409,20833,10979,22271,47517,12480,25210,48375,5424,6322,10633,35421,52720,43277,37436,47471,17407,24607,15195,52700,52503,2760,39354,27562,17245,25880,17840,1994,21409,30887,13320,42246,52701,23200,13907,40518,18189,36984,40213,38744,41266,46333,4705,19895,32475,49844,13814,54538,10218,40091,39242,42104,42571,40564,17149,29184,24843,12976,38797,19921,39739,1031,39387,37882,44180,52184,35437,28526,47250,50628,22837,24570,48803,22840,19601,6962,25033,33341,32463,39275,54194,43365,55034,27672,28105,13615,5067,49227,50669,45712,7757,19104,9316,28694,4709,50669,4472,30254,38375,22197,26531,10700,8609,41273,42354,30257,44728,14353,55417,38651,34696,11324,7754,52388,23857,8080,24231,11953,52748,54000,33518,28327,50309,54885,50724,41379,33851,42556,38424,29811,5470,31417,47493,12301,195,23702,27227,34820,9991,7582,26169,30408,43544,35028,5070,12316,29310,24586,7867,2278,765,49407,18339,10444,29027,37,14833,22857,23175,25356,47901,42145,28963,43935,810,2371,15898,26578,7633,12997,10028,23625,33906,6672,43014,3,33869,36242,48861,39365,31457,21112,1842,50722,41871,14195,48844,3948,20456,44923,5624,50702,42835,18318,46537,28553,27307,30953,3568,11605,1293,2106,33941,25948,1466,28953,29858,50965,22021,52275,32625,26558,34176,9904,22046,4830,14412,53828,17913,33081,21661,22044,1385,30755,19311,28265,16188,52376,29256,1286,16503,37657,40964,16723,28409,32633,14221,53708,43698,19031,43716,17077,10090,29383,34963,6753,7769,51810,37289,28398,25914,24636,7733,53100,42048,16072,26812,19240,38252,53960,30907,43122,6809,10129,13161,50608,16891,19871,22523,6734,27874,10290,2503,27992,15525,19372,23120,15336,52048,3183,50188,46515,12235,47343,25239,8015,20195,55084,49946,4317,19145,9067,21108,19261,10111,21790,537,46356,34969,30784,9686,13354,53725,51704,17730,25408,7209,14657,48129,23060,29592,46784,34435,32501,52597,22972,2068,47880,36875,15393,33329,17803,47232,8142,42245,46810,21230,3194,16364,17827,43204,3438,48057,19491,23160,29529,52762,21240,54967,42228,26817,4433,3602,50396,3556,13040,48025,14722,19405,47962,6333,34006,24875,26189,6011,33765,24655,1914,6065,40579,13762,19441,30495,51928,33070,33007,32296,45893,41799,28369,31741,31579,8351,2231,24965,593,9244,1426,16053,2838,53091,37610,8306,40717,15473,13989,39331,21117,2837,33659,10119,43167,1358,45489,15453,49349,34826,9127,1385,4196,9221,36479,7138,18325,9966,8698,22076,2732,23148,38452,46713,51439,41135,46718,12775,35399,46535,10995,10286,42034,33558,45957,22727,47474,15827,8912,33269,13025,14669,41006,35770,41428,46369,7177,2021,42551,34585,12703,30490,39885,42223,3688,48869,24682,21132,49541,14243,52081,40283,42969,46421,36603,50505,19351,37536,26276,26774,7946,50258,41054,48266,44524,46422,11487,8457,29759,4630,20312,50307,35147,11274,37262,20911,38186,23629,33055,29333,8262,41757,16832,22307,52886,23583,41659,27882,26557,44359,46962,20782,47197,14000,52607,12849,1766,16653,34003,22081,46840,52372,38722,54286,3637,21160,4788,38255,11240,6849,52670,29518,8836,8060,27598,35569,53523,33557,47845,37843,25855,16945,3170,1849,13508,20957,7573,3840,9764,53827,5567,43745,52100,10592,7914,46499,30574,7571,22565,4220,9674,50919,23540,9360,55015,18916,42948,7813,3889,16678,52200,53283,48560,14495,4214,9838,42089,46405,12202,38438,49694,5855,27284,25138,39991,14737,7910,32187,15419,44407,27314,27044,14381,54015,34096,27404,5871,9367,36889,50193,46075,24179,51178,47394,24782,32253,33653,14252,43455,1628,44396,16149,31443,9196,7947,49801,54360,50044,32330,27967,28557,54692,13466,37445,25447,32875,1451,12267,51907,48069,31592,26025,29116,15626,28829,5870,8686,1818,49385,1098,8519,7140,44161,1882,41502,28721,29427,3169,15643,24826,41157,10544,8630,38983,43273,13695,23368,48531,51273,54561,26777,41541,25952,27063,3670,2434,26764,20296,25123,48232,18894,20586,9222,44872,3182,8438,55090,30423,45126,40234,44791,19272,30502,17800,7298,22448,49938,6797,8274,8328,23661,26333,8055,24767,3823,9797,32661,42466,8973,30323,15172,45046,983,53335,25407,9900,50873,29431,6901,46831,36236,33748,29794,409,9454,2943,53387,7412,41945,50168,13785,6931,33788,8674,14865,4383,14258,49404,17655,48264,33318,53890,19307,30046,32961,16938,19441,50044,18401,42502,54287,14056,27803,30085,12705,48589,49718,10783,33793,44436,37455,46251,13658,21765,6199,30815,37711,37122,9286,48039,43361,2805,39535,40663,47242,54181,5530,32452,4819,9241,26793,55301,22882,24751,40839,54612,984,9661,48455,33471,46716,47475,1048,47560,39634,25984,24473,13198,50118,10309,48597,52109,42050,46702,55495,28998,41876,12905,49826,40559,46723,9137,15274,2365,11601,12527,33313,5186,26926,9008,42277,39301,29208,24769,38184,8133,32119,8499,17883,15797,11777,40147,11701,13742,50442,52282,19249,16090,169,21906,33201,2652,6014,46966,33299,50720,35383,5924,27404,51403,17718,10636,34831,1846,34072,31619,25419,28881,4291,25467,27622,43342,13237,184,17051,31653,42058,37976,14826,26955,15189,41984,18844,45734,46140,923,35442,29587,54013,34827,5110,21856,16237,34668,12249,33209,49993,32547,10742,35386,13675,47169,27183,48652,28402,28729,46476,39845,31794,14504,36167,13806,8795,29691,11332,6744,23048,40389,30754,28642,42046,13988,50789,26925,32029,28564,1674,2579,40896,42632,20009,13343,26538,2860,44768,22690,12377,27862,19080,28702,509,28891,50874,39562,38337,48819,19161,53831,20721,17076,32987,4382,1605,48765,24875,6712,52711,20096,31243,44771,47928,51452,17345,29021,7506,28663,11723,9203,38844,16037,55043,18455,42032,44813,43678,4707,26060,2353,26014,3342,44720,16642,33806,40379,30863,4439,23581,12251,50800,51164,9477,5130,51183,46275,45778,15076,44246,22068,21625,10138,3193,41550,45136,50373,549,2623,54103,54746,47304,54605,51666,52766,2020,1104,36436,22827,54712,46368,1796,21028,1654,38688,52529,53634,25518,36888,22218,49350,34848,47243,34277,28350,16891,37593,3370,42330,21853,4097,40653,47094,50938,44704,31099,17224,14418,55348,51705,28340,5063,42086,2609,38223,6592,12976,51059,25270,15834,52921,51412,52244,5161,8459,26407,48679,11110,21236,32351,31935,38886,7586,42316,29825,28762,48674,39439,29714,30360,20319,28791,29056,44101,11014,14900,10076,26505,49872,29438,33830,55100,29530,6668,12209,14041,47184,28253,26034,47223,46209,27508,2017,36128,4295,21931,21664,47194,17995,14471,20057,38066,40719,24858,51237,11618,23954,12222,18979,43100,35323,223,51672,54034,33831,49738,6003,40024,25585,3039,45916,50864,5467,46925,35230,41960,32887,47302,18570,50514,21897,19145,18707,50386,20076,16513,28901,35442,50989,20887,16349,27260,40693,54149,35312,11927,19125,42198,31926,9655,15550,38928,16246,53428,13537,895,37215,3631,23284,38257,24827,5704,32247,50725,22854,7120,31518,45579,40936,52007,31795,17096,25706,9963,1252,42363,54375,35398,47672,20924,37690,42159,4747,33510,19429,8163,53503,5138,37296,3156,43892,22033,37543,18177,54915,23562,11036,25466,19107,8396,45508,16241,16794,35737,4000,35935,49673,46071,47758,9827,30396,11487,35189,30048,35416,39041,27486,30039,50118,47120,9404,38051,11126,31451,7724,39707,53155,28211,38638,41511,16470,46327,38272,6151,55148,13762,40620,34766,16147,825,33838,35986,32324,34242,36740,42934,52260,11935,46291,18330,46294,9614,23307,39985,30669,21295,28908,9703,41414,25087,44552,47540,5950,10221,2054,27312,40598,18702,49413,16914,51903,31618,47676,23091,42618,19605,50762,12254,12659,39737,21857,23425,40689,17127,41590,22667,603,28989,46616,17860,23486,17084,23665,22573,43869,16968,9138,495,22149,16191,1281,12511,24343,24554,37445,34181,54979,35223,45871,47785,26557,26717,35794,17120,9538,24281,7048,30114,43507,54655,7227,45105,2665,10269,51636,47388,43864,36694,48605,16346,19833,3822,6697,53324,928,5004,52890,40446,30934,20437,73,31747,48358,40141,9462,17679,28759,6209,15891,2274,11302,12533,35908,25993,22814,9663,47128,38034,21287,4174,28988,16513,33483,48344,31680,26676,7124,38081,28593,54815,53250,54025,32490,39288,28226,28950,16303,43288,45007,38202,20839,50678,43937,6926,47729,37532,43214,48895,2659,37541,42968,31110,2148,49002,1666,47505,45435,47221,22793,31009,19888,28978,40411,7420,18301,1513,6885,24492,5793,45998,9065,21551,3962,46266,30019,42262,29118,42974,36602,33068,9559,28408,4065,2237,44839,20651,17188,2901,29388,26491,41733,38296,42765,41097,38780,51180,50363,26030,25562,4272,30504,37707,19986,8413,46056,50465,32997,49313,328,2050,3778,23131,13884,15382,8937,41948,1592,34894,15277,43218,38957,2009,22872,18527,11580,25258,4802,45523,5069,24950,16957,38568,40146,18116,3445,16090,34443,29902,5973,37776,31097,47243,52443,4147,49831,3957,38208,46387,24446,37315,3244,30771,25611,53873,44094,40718,37697,35406,39116,25709,1333,30545,16907,14385,30659,42452,30273,32267,44259,47334,31888,33915,21290,24986,53839,16712,42700,35218,51397,24847,48943,3970,30216,45979,34617,6367,52296,2593,52777,7802,40673,37970,26005,5223,1837,39037,11492,50094,21147,19728,54350,10802,3185,16696,32366,27817,151,47784,39566,16411,13381,18351,37256,16510,42436,4119,3401,36799,18733,45307,18408,36159,10577,17690,4185,23345,18213,16558,40120,47703,32245,51457,32847,46872,14757,18335,4921,967,36425,15290,6028,13010,7793,26735,23707,16948,25908,19236,17374,42397,41029,8281,18961,5925,34252,28576,54845,12949,31432,18836,42455,44903,24758,9855,31615,2975,33161,13983,51957,39300,47221,23676,43919,27099,834,41972,6811,218,30418,25321,42686,4623,23795,29489,40884,19755,6343,5919,8365,39383,35850,33850,41020,33130,38161,25869,28283,42005,35029,23937,36041,46806,10942,18809,34301,41895,52583,1281,18758,50443,23459,15235,18622,29083,22337,13924,3382,13056,17090,25241,2519,12840,8601,43974,7238,35428,3708,39352,46083,47466,31907,30156,39019,27238,30012,24583,13348,48677,33532,11038,33693,21733,53431,31756,6735,46744,36487,49834,31667,36354,4880,55414,22728,14120,39129,8729,23318,37117,1379,50499,5381,44518,33711,52317,38119,50718,17535,25713,36990,1873,29912,14500,31803,49388,10024,14498,28888,40772,53945,43846,21950,23849,46623,26978,27350,40703,32639,11675,44993,23491,28345,53087,26829,49991,25379,15898,38515,33397,21162,50835,33799,14848,50203,13565,13715,21515,45418,37138,7738,53529,6730,9360,33528,47646,45565,49313,25936,39680,47967,26018,52824,39744,5756,54079,53458,2174,3465,22783,26302,15805,19411,1398,8704,12632,20722,44647,41612,2019,54435,15323,5960,45680,20235,47140,20035,6199,6313,33321,29494,55363,38577,26755,24202,31675,10921,5063,31019,32993,18946,37767,44944,51704,31472,14893,29051,28363,474,15502,3493,6042,31939,32180,55442,31904,3348,17690,6280,23580,45432,20567,29957,35319,33097,53691,18600,33724,47650,30215,51052,35053,52584,15500,21352,15771,26393,46156,18476,49885,21028,21812,29712,11645,19827,11513,27434,49548,40777,6583,20426,33485,52875,124,34386,40892,24328,33491,41869,32054,39709,12224,50156,32877,30641,36065,50987,47023,5348,40057,19607,17121,35523,18094,48389,51092,30501,30226,9347,36558,17183,29564,50108,50092,17740,13943,17640,8473,26300,53451,31811,6811,22217,45109,28007,30591,2736,31835,44416,3073,38971,41678,11439,29230,35106,21941,20791,2729,27469,5654,33333,42378,51940,31468,54345,19568,22746,30994,20656,51726,21503,2941,54509,40788,107,37146,43178,22056,49535,43658,31336,21922,41714,38106,7710,31366,50165,1489,49765,53132,47035,46435,12336,53187,8018,29359,23937,29980,3263,53525,44662,27755,33815,48152,4287,26486,38100,34400,49542,11007,6092,37785,28058,39907,47270,49801,5628,2777,46214,44964,38359,9902,53395,15459,40842,20630,31588,39010,35814,3009,1374,45949,28799,14696,21045,28949,20147,28216,25398,44370,10996,20861,32893,17055,15499,48137,32452,20228,37635,32988,26432,3803,43084,27695,6657,25101,51119,28516,2951,19596,43091,52545,26184,28824,8473,30917,7292,34225,13921,12507,20066,256,34496,27609,51552,38052,53046,28401,50677,41400,21241,43221,5687,45439,33600,34710,54639,38169,35155,9308,9480,34796,3544,6778,10673,51914,16796,18899,8584,36312,54348,23113,6216,1408,55129,40066,21915,52519,28202,934,43371,34111,55090,9512,5406,16571,29539,5316,37775,30720,1073,53516,1780,15645,4258,31784,31166,51470,11572,54401,24583,52103,21426,54810,14614,19988,25476,44572,53792,40858,4521,46194,51020,17568,27450,16718,53861,6127,43356,53662,21055,40503,26229,21651,1070,17278,32470,33019,20661,28761,7351,50377,7925,34351,31509,23838,20764,18281,27184,14121,55376,32036,29898,34659,27308,46060,31658,51241,18755,39456,33682,49169,18749,27906,17217,10049,50776,34758,5820,14761,20211,35437,22499,17943,21819,2392,17642,11491,42055,43000,39456,2589,26195,46389,9717,46780,17404,26750,6744,4083,1660,10341,1993,39626,32892,34673,37230,54543,44809,53499,52365,6873,11114,41862,21934,19900,5731,43890,43551,24817,4793,50350,21267,49958,26435,10124,46715,22989,10804,6622,1958,39537,45686,47316,2051,55251,3655,35723,21845,45634,34643,35802,51611,14653,445,27850,7097,51045,34213,42479,6347,17692,47199,19688,23386,35096,35825,46814,7939,39611,17482,24364,20984,1502,31118,38409,41372,9475,54117,493,34812,48070,43517,34605,32526,1474,26645,53101,21683,35689,23853,45059,42254,15334,54551,52648,50135,33227,13676,5095,48624,16858,27668,46865,3308,19346,29747,19483,4713,1906,48013,44303,53269,6558,41754,9781,19770,32735,2513,1920,5239,27851,45122,41099,7912,14481,22961,49679,48002,37959,12406,47287,42821,38992,51273,22209,48747,32894,10855,13270,42789,4766,52755,32538,53454,54905,31144,43767,14015,53045,45806,17391,41360,540,38204,1259,12675,45272,4237,46217,49224,2666,5352,54280,32269,44431,21005,20684,20834,34768,53285,51609,42014,43517,9392,27598,12140,6035,20728,16064,53913,51390,44898,10175,10400,51196,35464,21114,6496,17031,23320,11561,18618,9498,3332,14810,53043,47487,28524,9057,45685,21874,28962,11666,19715,28014,46109,30041,38250,24550,25913,18420,50510,3334,6811,38191,39541,9489,6315,39330,30753,2210,33013,13279,32991,19031,27539,14106,24472,5600,45585,35700,38749,12514,49186,30927,27599,21916,27216,44634,13660,21972,45257,13690,18835,40204,43175,48001,8316,15608,9907,49566,22322,42618,32066,25558,34100,22100,39504,16823,31288,30673,238,41663,13943,9400,48112,49570,19859,51289,2835,15100,12707,41390,34630,14077,51412,48514,10068,30479,33251,19306,16815,1737,16726,42101,45022,34708,25790,38844,13771,32593,32977,6652,41392,17944,20377,25735,30388,15227,13862,5955,33959,3234,9667,21764,1872,8356,35182,13131,23740,46130,11109,36033,17511,1475,6910,12497,14077,4723,1166,7962,14229,48575,33339,22618,12247,36643,41263,39822,21486,37251,48213,40127,32010,14635,14067,2616,24573,9966,28944,18902,9081,21376,28281,46393,38959,12194,23222,3829,35347,32140,1983,30644,23943,10333,13920,21582,13770,51818,2546,42667,19896,25363,47586,38964,31422,41336,46510,24487,54250,8296,39208,24595,50652,13259,6321,9386,3160,35248,7365,11536,47364,53336,27534,52599,30124,19880,48807,52915,46586,39913,16099,53476,8327,36838,35770,9521,121,19641,46730,4837,10346,31475,48699,46140,7700,15518,21985,35075,4303,51189,51085,27752,20241,42107,15316,6651,46533,46852,34862,16130,8454,30809,24219,36627,39665,22509,13630,977,19784,39663,17552,54045,43189,20311,7278,18082,37309,40409,53389,22006,47200,36237,26546,51549,12187,40002,19649,27993,3129,33462,48819,8232,13429,54862,6834,38301,3183,9323,19935,19205,3479,23584,31699,51083,1645,7977,35362,45965,48631,20681,45706,18849,2792,29799,9883,23438,25191,53361,28616,8540,31769,41349,39657,25872,17870,35093,1309,42610,28959,21096,27914,52663,4585,31689,8366,23990,54024,53091,12360,38929,20042,15234,52557,21040,7811,9795,3681,26710,5323,26428,14459,5978,43484,23437,2542,17564,31397,30209,2041,36223,20539,25091,8559,49566,3321,17267,33736,12738,42767,49082,43773,13204,659,49343,42515,38614,33245,27300,30828,45423,43085,35168,6478,46010,9501,33489,20974,26931,34877,30314,11195,40483,2286,16594,46797,49434,39517,764,6327,14381,6527,2608,48097,7702,12082,39465,47839,32340,13826,2429,22176,25913,53020,48247,50973,12171,50013,33713,1118,3465,42810,19759,34359,53752,49315,36816,45738,6984,34066,22366,42102,10933,30921,4776,9227,14706,42458,34283,30074,38184,8541,2719,44,11213,6703,55360,41777,34836,43788,25583,3017,47115,16362,35893,21841,45120,8452,619,31252,50231,44567,28501,9016,53881,41957,27383,51619,714,49198,27771,23716,29421,53039,24071,54063,33980,10819,2467,17638,50169,31986,48729,22488,10118,16792,3026,793,14941,20727,1079,28063,15477,6057,37489,32015,5322,50075,16818,5557,21908,28011,28773,40378,37707,43281,336,17365,22023,29033,12404,2584,25593,33781,20908,23269,51556,45360,14172,9895,40988,5713,44906,4887,13651,23120,16593,36919,17805,21743,39364,44512,7244,41289,31731,8034,38333,4867,46956,3099,10678,35522,18485,29055,5481,1055,13820,9333,11175,13385,10250,6650,5631,21814,36763,15769,50415,54350,4144,41741,24293,21214,17075,14907,45790,20505,41092,11494,1639,32660,20242,40881,2894,43393,36639,5622,8864,30532,41176,16963,11516,30010,4490,18103,21224,18174,45001,11752,53591,34582,37188,52453,47066,2672,10939,19554,37104,1130,37194,52014,34184,4240,43222,3204,10418,27838,4851,46068,9563,16287,34040,37990,15675,32370,50584,36465,55480,54332,11603,51437,7076,9371,37012,23981,14207,33109,54521,14290,52167,1537,6039,21500,35784,3248,689,1921,12901,9434,195,27432,41184,14575,27352,51964,29025,51030,39542,35186,43785,19208,28885,42473,5132,19550,39672,25309,10508,13766,54995,34613,31463,51718,45311,52177,31686,3662,31338,49183,17179,134,55361,38422,44605,43070,49370,52778,29840,45072,10089,42678,10815,39735,6493,15681,25888,14700,54746,30465,31142,23281,30643,49703,17871,14848,16319,7887,1057,54264,52052,25439,978,30971,20883,22272,25621,2275,15900,3081,54082,36895,25817,34770,48932,23079,21729,41933,11367,222,39807,37562,33641,11648,43549,21037,38269,31771,4216,31842,9600,10131,37682,11398,13589,37101,15988,20036,48821,46202,13639,26475,51983,47521,53469,20137,5422,41703,51734,49704,31427,22390,53809,27631,48447,38484,25020,6304,39320,29434,9784,12010,47053,21471,49509,42642,44147,48678,45215,39783,21665,18674,22854,8939,35481,45582,15362,3922,35646,27894,4383,4740,22366,20563,4886,19748,40341,31950,20496,42053,41310,27186,27540,18891,27663,21456,5051,37190,33334,47793,31572,973,3944,34886,25896,13481,30787,33630,10921,54546,8017,49706,1577,15330,43379,19799,50916,13742,47105,8654,3336,4190,37908,23675,15004,1295,34457,33171,27870,42213,32062,44961,49184,22173,36807,54927,39291,54072,24762,11323,51602,32962,5752,29606,4738,42302,27784,8950,32545,43346,5175,33062,102,23129,24250,28644,15941,36753,32220,24323,43191,45636,43586,13824,6515,6324,4297,5855,13679,19300,7871,54368,53934,11640,1350,54112,31185,45804,1807,36823,31240,22906,36902,12558,13956,7077,26556,5960,29421,55269,19970,21695,43260,49659,36279,22353,36570,46263,6415,2420,35977,37203,51822,7965,51231,53158,37241,25250,7669,17835,16004,21039,9567,12855,29780,15671,982,4788,41049,51942,21456,19051,38002,21304,37484,41955,54335,55142,8648,53082,53589,14113,5408,41178,8148,55464,54571,38724,17952,38755,8196,3173,28533,25750,2705,49833,49407,22597,42653,37911,19522,8752,12447,48962,35386,39334,16166,5869,9982,36163,28445,6518,38868,42793,16300,23104,3146,55170,33420,47820,4595,16714,4900,49851,51910,31622,12602,41312,54774,41696,53684,7814,50852,29733,47645,27791,13145,54560,13123,41647,49733,4517,53342,45727,31303,8075,28225,53555,45016,39297,17761,29001,9647,8049,47630,9114,34456,26156,47644,44903,31995,19640,29348,54425,48393,25402,23462,39658,38798,48971,23479,46517,5049,4614,6927,36560,39218,45501,21884,43276,5351,17754,9122,17384,16581,35223,18524,15800,14299,21321,49027,52621,38288,39504,23739,22923,6576,27177,29997,53071,9956,22121,9369,20306,26970,24449,27322,20257,10796,8164,47647,12056,27432,47841,18122,53289,55426,39870,42906,40904,278,52532,17778,47239,20596,1924,46978,50138,50703,29387,25195,29426,10762,49558,10751,6314,9855,15970,756,20997,50146,27586,43288,37479,32940,53370,54391,31570,7202,50405,12962,43397,28825,10124,35681,861,5645,30854,43558,31654,25865,20859,6992,31399,18393,33112,52700,31048,38879,46144,6019,3412,45461,24635,45550,27335,9105,14984,9841,31006,6144,17408,5896,43635,43653,17705,26079,50269,23171,47658,25485,16505,30661,34415,55347,38561,45021,14495,33565,32718,14770,44893,49845,49042,20282,21108,37001,52494,5647,23909,5038,3000,41378,2656,45182,28882,53861,48783,27945,28551,33434,44835,15420,16892,32792,22174,37300,6205,48307,24627,47724,38514,54168,36421,9852,15759,37377,7242,34459,22226,40657,16057,21164,40449,26544,25871,49062,28767,2128,30543,20789,53162,21069,26385,28015,26530,26978,32323,37086,36902,36009,6758,37366,25892,10752,24565,42921,24677,31192,17356,44847,14395,20931,3729,53901,36004,17585,24062,25974,25144,8087,32631,51372,47603,47922,14869,25824,20539,50443,41709,36465,15774,18070,11296,40333,29895,23247,23151,27034,2520,3235,5395,54445,35916,35335,3318,34258,48010,6927,38997,22889,46539,17385,4167,46570,42211,19105,41411,25031,15304,11697,17467,23631,12251,28337,50797,13652,7183,1755,3205,45496,53173,47625,49838,49430,45657,12310,45329,11486,12457,52228,42226,30053,34211,44419,40029,48182,13377,51382,35779,50001,55084,773,38962,11769,39677,14775,10539,3310,42114,28198,4247,47863,42613,52955,37843,2596,30508,51482,40667,12659,2823,1652,45717,43228,42950,39744,19123,20452,42347,10,30062,3043,43673,53061,83,40730,16270,20675,17622,109,32058,43085,20869,28285,22476,2783,1473,16000,44721,46478,13730,13549,7447,39958,35507,1477,43863,38621,18354,704,40165,13065,23175,7866,20651,40311,16913,16896,21630,18602,23902,27471,20640,15493,49917,21178,27151,1022,41335,31113,11076,40763,45079,29540,36953,16718,29763,10902,41244,11042,43143,46280,7300,46357,368,38036,9238,48295,29402,51635,29305,46138,51866,47818,8087,14310,49256,22929,38630,16199,1903,12219,31149,10448,40899,29049,26982,5288,53905,25945,44781,1793,23359,17068,37627,6350,18494,32386,5447,49921,54896,54649,45788,49622,11247,22520,5058,21837,47839,4261,31614,950,54235,956,2599,21168,40335,12018,47437,40507,54788,34682,55373,51749,37240,21585,24566,28654,14558,29038,28399,49891,10593,47096,38888,3213,19793,27567,5245,25356,21099,54394,39676,53885,49521,30717,7233,54201,26140,28640,27975,54328,42349,13545,11938,52000,10535,6543,35932,30635,44300,11482,52723,11559,25916,30361,16285,7683,7326,40729,27492,34860,13201,50718,1446,10746,55364,3009,10125,54106,887,5996,31741,13548,43815,20756,8346,14758,51383,2696,38125,28842,9054,9976,28713,2002,22286,21652,39827,50813,38869,15976,49957,37143,26300,30923,18840,4980,31614,12018,53937,47550,11800,9792,11950,16679,3537,30727,2338,20274,20652,25857,49677,32657,28583,25159,10693,35758,18529,50727,23997,569,48889,53478,9381,27794,21832,23248,25174,12509,7942,28732,33644,33141,12870,18659,27383,1882,46082,34776,30157,7810,42043,21529,32036,21709,3464,28554,34918,25643,24144,23898,25815,26846,19583,41341,7759,23105,2719,29089,19481,11364,41411,31842,49545,3826,47686,48251,29098,1354,27179,39588,26940,5704,10605,37539,33737,5692,9875,8788,30976,38666,7318,30456,15196,16759,4011,35198,9441,21335,5930,48900,706,41270,13045,27142,28446,4614,49987,30314,4026,9112,42169,39253,15792,42113,43058,45222,29626,50682,52234,46099,44213,38414,7815,52420,42416,3539,39804,35925,1101,17020,33200,54653,9030,21816,31386,27046,3927,33885,21325,23404,6240,31912,54151,40304,36899,42115,20279,53915,54644,34478,21290,50680,34898,17121,5351,42494,15249,24764,11276,21904,49560,13187,30049,5943,45729,52692,38279,36348,4156,3290,14764,50844,6212,9951,17246,54268,36614,20310,44257,34680,19413,29580,49341,36979,51753,52755,34447,34470,26814,40118,15192,52903,32408,1828,34546,43381,10607,9379,40986,48724,47257,10164,40661,13454,40449,45412,7945,5545,54553,651,5901,4312,18831,6127,26189,51409,21012,14183,6060,28880,32062,41132,8387,12349,33159,11667,8018,27045,19267,906,18278,45555,11131,37926,18945,35607,54757,2809,32369,3284,31495,12842,4228,40315,46684,51713,50925,53905,31957,37155,4674,24614,19168,28945,44579,18097,33103,51398,46354,27150,54284,11722,36033,54137,9811,18610,42638,41523,3117,24458,3341,16963,27661,6728,15354,25198,15876,39613,1870,55380,14111,49830,1367,37718,18144,41618,50230,15773,48175,6760,45967,21544,5897,41833,9694,39023,48732,30033,35535,12590,41197,21057,6585,2075,29854,35091,18605,20959,53956,14538,21201,45427,53714,46227,33810,51297,47215,35606,45172,32297,5996,12074,6270,16689,23024,7998,32692,32251,16964,27626,31942,9063,40547,3169,15983,53674,8908,16612,300,29978,53137,51570,43811,28277,53779,52066,55338,30514,13250,12766,13324,2459,4927,18648,42831,43464,40494,37527,24378,24349,26702,6370,16950,27493,34183,8649,13052,586,45384,17554,44038,38279,22434,98,39351,33247,14483,44846,35220,9958,53727,11623,12909,54444,14940,41190,13743,25277,47986,31642,48602,15267,42749,20831,45460,5616,19043,37430,12864,10756,13930,29716,806,21322,39597,48662,48573,46196,12183,26325,11319,2167,47799,5035,36730,41053,25145,21148,21668,47744,49672,13749,50792,37604,37009,4945,19283,32320,43039,30951,25188,9327,37303,32468,25402,38211,38810,53310,38507,21433,51191,7481,50071,35355,51511,20659,33867,10187,53576,34363,45328,52505,50253,23662,7838,37392,53538,42242,5070,21730,1325,19967,37883,52031,40927,9857,44302,34061,11685,34515,49596,32858,752,22010,17952,10950,12142,7245,33628,3805,40019,54593,21329,51115,35086,3735,24124,8197,9031,27489,22345,33802,40563,11786,14272,43259,30875,43498,12875,32461,24376,8887,5541,54615,51523,41668,6932,33415,11887,20784,14812,45379,33300,16687,8944,54077,21615,11606,33102,33350,2963,36401,7773,48593,36100,6308,5625,40234,38510,15598,5759,6577,48159,29086,22458,37978,1990,42605,48555,3095,17693,23614,44124,53967,49098,10125,8184,26880,14834,50480,50980,52380,11211,23624,27260,23549,29497,20970,40583,19127,912,40349,24037,10743,47016,30882,53110,1891,3845,2041,28354,29667,10340,28470,50445,38817,52496,39789,36674,44345,12262,47164,30634,14004,7317,32514,35837,25087,4605,28134,29807,43470,47090,451,15666,29276,37866,31157,54729,36766,43492,38718,3284,37557,52010,27116,15036,43216,39089,33902,10088,51378,271,4593,38404,24545,46137,22272,12202,34520,9671,6426,38072,37898,49957,15534,16128,398,10469,48495,41821,47158,30677,51884,24357,10264,5794,55259,33345,6769,33073,34118,53431,46879,51172,25188,32838,9058,27773,38856,21210,28545,19939,23004,54118,5364,18094,33968,49594,44948,13566,38728,18789,50014,5241,9262,55351,39160,1218,23835,21595,21105,27822,46708,55211,5773,21356,16866,52246,11104,24755,54295,17199,3290,54117,8242,32492,11177,53249,14471,19461,39199,17453,12632,12107,6714,21657,40769,2282,49180,36947,47992,32161,12016,27087,45157,15626,28316,5687,3710,10276,18544,11868,40242,45259,9351,13815,48187,37494,54907,49163,25128,19989,7170,22276,44609,28989,18182,43191,446,55333,27718,29093,6598,15114,47896,7504,3222,52509,31254,38808,11506,22642,781,8132,35677,9470,10452,47185,20166,43629,16303,32630,22752,18640,37310,48529,18971,16513,33142,5007,12280,35758,10459,3703,39060,46184,26528,38726,40636,10637,14926,47905,34673,16901,44571,2560,9017,43463,26699,17026,17120,18785,12107,44021,31055,39620,29409,9435,20785,15155,2923,6389,1218,12906,50115,43199,26061,42111,39940,7002,24395,16247,12066,50005,2456,16895,9744,52441,16197,37997,42907,50578,9945,12984,50078,847,46633,10830,10056,29976,41791,31924,42346,17647,12433,9121,13382,4901,624,21213,32105,5881,17571,28050,23452,16010,9382,19912,17085,4069,12392,5946,40487,35915,4937,6503,32228,20145,37850,53972,20449,19051,53816,14559,43543,36015,1266,19628,44776,12479,47175,13755,20591,46568,1037,35207,29934,12034,17399,50784,35227,47050,8019,11243,93,34254,35643,14936,25659,7186,5369,12973,6170,27072,35098,25083,51477,42982,4157,585,10564,41274,26468,3378,30694,17576,20837,16755,13476,37047,42156,4264,35294,35610,4991,40700,39942,12250,53847,41001,36107,39008,54318,5047,17109,37927,25498,342,25067,18187,1356,50698,43226,42539,49847,18855,39105,46655,618,2645,30289,10574,48882,2099,34766,26840,14077,5775,45041,9068,16308,12625,1204,30921,9813,18187,30865,29045,25429,38632,20104,28665,24427,12946,23257,16978,37482,16599,46192,49575,7604,1981,14275,37711,38349,52408,9030,7857,10918,26789,18874,33468,22943,51058,190,35771,36251,25371,16550,49660,19458,35642,55048,6196,15692,54627,24191,39799,15878,5920,44822,17368,15336,19117,52268,52046,32414,45253,32143,38220,5395,10684,10445,47652,5064,30951,52992,10822,37346,28291,38127,493,50138,7792,53741,30605,49900,39313,6933,6989,43487,4882,10958,27238,42120,35900,37073,34008,16773,23062,6299,41871,48082,1468,6512,5026,8247,10737,33029,29680,54418,21328,29111,10462,13975,48000,42740,4463,27030,42579,48118,23252,20122,50324,45193,44082,26880,47324,47711,3768,50265,13359,46748,18832,21165,45779,1780,35041,6785,45040,10666,49370,43262,9649,27941,23385,9080,11384,9470,41970,47877,31664,44165,32981,26479,4705,16661,13784,39519,6094,35502,13114,53535,26384,31559,41719,3564,45095,46230,29212,36672,23434,14510,6459,13363,35755,45159,27531,24653,2627,55418,40730,39649,2505,48598,49816,6547,12931,47045,28801,16091,18676,20589,33400,9417,45608,11835,23895,25679,23586,7094,55244,36903,53258,27146,25045,12118,21896,47459,21701,32457,34602,21406,26147,30779,17784,6413,31384,45453,7037,53263,3959,41714,40149,25427,43020,39631,16922,11608,41092,47662,30309,5164,20945,17552,3101,2766,28646,20183,18768,22273,10466,22186,34893,15193,52697,17609,9634,11408,22776,45839,93,52624,14538,7968,23567,35222,53088,10704,26885,55161,38925,25946,13026,30064,25439,41414,26210,30450,50299,5494,4677,41778,51985,3983,25224,9498,23780,5686,11879,29066,6071,24209,49165,22798,37314,44448,21038,26813,13946,24333,13880,22937,16347,9639,23383,37410,9660,11982,4064,45179,18239,19906,50319,52033,18917,47545,20534,24165,34122,19602,2114,53975,24079,43579,38316,1106,15919,38075,53310,40535,4418,9035,24802,15061,20802,39143,12419,5972,7943,53645,8453,22055,49638,31319,21492,49361,53657,43201,18795,7572,17338,30817,9312,12548,917,19870,46926,41397,273,15290,45513,16925,12462,8797,33389,31458,39297,49945,29418,6462,16210,27708,10486,21967,29947,38866,32884,33287,23314,40283,15675,27040,36033,28905,27580,15544,47587,14360,32795,1521,43009,54280,53299,46191,30603,44283,28355,53912,33037,38046,21422,47481,46072,34529,36736,15140,30198,20047,15832,11542,9998,13429,31296,12361,9643,20509,51944,40682,30677,36816,20436,37291,41305,40397,40829,8323,38163,41996,53544,40255,47436,38702,35993,49052,3162,41736,15636,32976,55435,40477,6295,23392,7857,28643,51103,18507,6329,7403,21585,45019,32116,40491,37692,26411,10013,34575,37707,19869,34356,38307,3464,4395,44050,3554,30966,21679,35072,11588,30157,626,31466,7602,42621,35716,44079,16170,30580,21576,9847,46390,33862,10350,13073,35071,1624,38436,12572,22090,41159,6050,32817,55232,50190,16840,20019,52324,19753,54547,54771,31480,40956,26674,9898,15706,44185,12841,16622,34975,41024,26475,54046,3705,7167,342,46148,10107,42681,17016,50174,45598,9542,43680,27899,27669,14535,42329,29769,23080,43966,37910,1593,22856,7633,10798,10296,10292,16535,53018,42082,27770,48048,27672,53442,48695,47433,25401,25949,53912,18304,16992,16914,54869,48030,34037,45495,29164,35415,20124,46954,34240,3449,16826,14216,28964,31743,200,16044,48819,11175,33376,53747,5583,45193,19018,40060,12611,26783,20231,13595,38262,40362,7705,11912,9249,50604,37321,17550,54540,10408,16505,30050,18614,30247,5780,5288,31670,37429,20529,36779,52919,31349,55340,45399,32846,50204,10724,19292,20121,21392,12271,30112,29062,28645,21033,49115,11981,35237,6024,20923,48995,31762,8344,10840,33398,10319,5600,41605,6610,37042,23760,17635,39220,20081,24944,9934,33352,17712,46910,11683,17435,43962,21867,3874,11467,30062,5683,35883,18306,43643,25528,45221,832,52558,22334,31069,29486,2856,31469,37743,37292,27482,43026,48066,14464,54220,18173,5428,1421,40008,35136,46187,55410,20614,39594,45489,9152,33884,466,39978,22639,30130,12194,21792,26558,25204,43790,16166,8693,51226,35053,26090,54676,33797,15101,925,36025,31856,8663,16798,19381,31626,6801,47392,53436,50085,49438,1087,16918,30542,18810,51810,43795,43652,44371,42992,45884,13419,7393,45213,28694,39852,32468,51642,41331,4562,24765,45739,54406,25679,13201,55230,31288,1504,32941,55093,32399,20902,46419,36429,12260,38547,42353,22915,25811,15401,51727,46516,215,3579,8891,1631,23371,20082,53843,39842,33204,22473,431,6960,38040,36639,26704,29804,53920,55113,23808,7943,5934,12161,28995,45484,46046,15703,26305,24627,4828,7613,561,44764,2714,12092,32820,17383,46528,22961,814,49646,8221,33761,33673,7407,10064,50893,52832,25722,23565,45982,16707,7092,27725,31247,52204,34831,40397,19320,37279,52977,37575,35495,21470,6635,51896,21987,39227,25928,27870,35366,47861,33211,8589,17963,50671,5717,53015,35792,18105,19338,48247,51741,5612,46808,55044,8987,4675,1765,47454,48598,39019,46057,53105,40352,2108,12148,54690,27236,6001,44841,41992,44107,24729,14660,50751,26699,27074,16998,11145,27436,2109,54017,30286,38462,25046,13500,33158,31213,5866,31139,6558,10303,10742,22121,18887,10682,10240,36506,375,26770,54802,13684,33282,16938,38104,53394,44538,50402,49519,50126,26288,40856,6066,31577,26655,17066,52577,25965,53723,41244,16733,22835,9959,15365,46479,26431,33070,42048,6910,5654,25772,36303,26874,49240,42257,42444,2408,71,42503,13880,5484,47935,49418,29399,45384,8734,40777,4808,20585,45795,24393,1584,53837,30197,1859,38581,15058,35204,11438,17564,12413,11976,51304,12420,13418,9694,24651,8416,12838,23088,15811,47226,43299,39209,13583,27777,15123,16270,8228,46406,6293,32752,12545,11218,6518,2835,9787,24138,27672,19952,45633,37981,51,18558,17573,31321,39014,20967,38552,18432,44782,1252,46758,39037,18407,9442,28809,54701,12181,8072,26318,11889,30866,11290,54512,44279,49738,12034,46363,494,10056,27797,13921,12611,38427,43671,16537,6435,17903,26153,32603,21613,32972,33191,31960,4110,40820,42878,18279,24955,31483,25121,21311,16751,10712,38762,13889,15334,16650,53431,20026,2138,44103,44543,2816,32275,50248,26042,46401,27338,8188,52068,23326,21566,17278,54166,16706,3529,37272,8290,7446,26675,2901,15119,27775,44186,31521,25503,27145,16174,29019,22661,29203,44871,3134,7806,53363,32827,13252,13772,19859,43930,46336,13644,53759,17020,1855,25296,34757,6754,53879,15835,51510,30993,3692,40735,9926,22242,20138,12335,10415,9922,13352,42297,50064,6145,25989,28006,53422,45031,22217,51904,10826,40598,44512,46632,27412,38268,27670,23423,19150,33118,37469,30516,23329,22369,32551,51645,12494,28324,43953,2530,4288,4590,27895,25090,4248,19736,36665,13040,27407,36119,27072,34094,90,36666,21829,14050,23221,46566,46686,19654,34317,41654,53076,40983,50065,46726,36144,30382,53477,31110,19349,31030,15262,43251,34616,17796,54253,31578,34081,25890,15741,36681,24311,2622,48398,54197,24328,18370,44208,33571,4577,32972,28239,42993,19409,46109,50777,4333,46624,38946,28830,46481,19383,44003,25178,42448,43638,273,18865,54216,3171,33813,50006,39014,45230,28917,26635,11393,22814,50817,25676,7017,17448,38001,27981,55475,46480,54579,3331,25125,43364,52256,3317,47761,26123,29509,33124,40455,30402,18695,27337,28499,25288,34309,28466,24657,54426,992,19167,45137,12746,28033,35201,12593,34476,52431,22386,2380,37057,20269,6194,15517,22958,45489,51158,48039,39733,362,27779,4195,1714,3558,320,26510,30295,26943,29901,25777,50218,18691,34724,39432,50495,9362,22187,50970,51839,39840,55477,27562,3673,44121,13660,10477,22127,48777,27631,46062,35130,11903,33827,27325,39845,16062,35503,14359,25624,20416,2316,42032,19222,34231,6336,19179,19336,21835,1626,39017,25792,24423,29098,10331,42541,15335,41544,29872,52509,33144,21456,11387,25854,47951,35352,46125,13522,19883,25125,53118,16457,8153,52524,27029,13701,4561,29140,53592,25950,42809,43816,35230,38659,13609,37188,25654,27326,1516,53932,7617,25971,22435,33134,39327,32608,36350,44257,33553,17620,54852,24788,32739,9650,36286,52806,26720,51377,26646,26029,8757,54359,24334,38098,14169,19499,55010,7946,27867,14997,22335,20411,26709,42205,1968,12491,49812,51136,17075,30028,25653,46870,13582,36361,25081,40387,7817,35888,21683,27462,16987,44948,50909,19151,35486,47715,41129,40548,42058,39443,48734,11138,14489,52903,4977,17664,46029,8246,35476,8456,23730,23388,25529,27768,30833,26374,6583,46546,43413,46841,16819,22363,40770,16244,36072,30495,19989,34959,41298,44593,44059,5384,20516,34655,36172,20859,13939,19201,44050,20766,15168,31933,16391,20733,11454,21652,10404,32558,26946,12333,13205,1241,23113,11479,17573,35018,49957,26533,7330,53182,16237,32300,52675,10384,42328,45281,41336,36767,43596,19965,20427,12063,18232,52061,6973,54693,15816,10487,32273,5104,16336,33752,41907,33630,11261,27868,31294,248,48773,21922,37646,2148,236,49014,49611,6159,31897,48689,25206,9378,24658,1320,12620,15926,45578,37445,53662,6376,8814,1650,4801,12930,1151,11213,53748,35264,19863,14276,5037,29360,41478,2607,280,17848,8096,12739,51523,51575,42864,8320,34225,30470,51715,48731,22590,19593,1833,41464,35063,47657,14113,51620,36102,12852,12309,49208,46204,2524,52601,37584,5826,25359,49727,4188,54985,35317,10502,6645,55226,45806,10410,20458,20168,17117,8567,48058,27394,28882,45621,11831,52990,34761,12395,33823,25023,20389,973,55467,27129,8831,23785,13896,40423,46935,54804,11610,17359,28098,34416,12523,19246,47863,13342,18618,27748,24562,11962,26433,36446,15004,35570,350,27935,30755,51596,25707,24808,1054,43122,38157,39757,20819,20347,9971,10424,15141,5782,29688,39170,28302,12667,1181,25686,31409,10487,38552,38593,19414,19622,6065,19910,9403,11216,44079,10839,39268,5846,5578,32625,27988,27044,4450,10396,6244,36363,26545,48719,5314,44093,2017,38102,32376,41550,31902,32888,12041,48839,1082,51038,36775,12015,20888,42793,15228,21898,18292,22550,13471,24904,32111,967,49282,615,40698,38115,34131,5668,3073,13326,37398,34914,55195,1670,41958,25882,1888,21960,34500,9140,1810,49035,17363,41125,40052,17544,32141,16474,31413,1039,9360,11767,16894,14987,39538,10728,31998,29738,16868,33468,1843,5244,42363,8165,49522,50573,16817,32936,7343,54879,48419,23691,23861,10369,15802,48648,6261,26285,48104,37248,34960,12303,24940,34908,9469,42885,51965,1509,23155,36774,49050,15900,12669,29719,37742,17676,27548,2538,14820,45969,25619,3723,2355,37885,4307,28107,27801,24125,43751,54503,43898,53625,48802,6562,22258,34036,28466,7770,45476,53885,23234,17736,53084,39752,9443,25916,21168,36688,47869,6352,29598,14470,19356,9002,2412,29071,10284,32142,17734,38234,8952,7788,6997,24545,20048,8511,12464,49663,51354,39428,23112,51494,51441,45392,25737,13159,803,14761,6317,4307,42308,11441,41357,40551,22689,6787,31185,22117,54044,42269,7877,20867,1517,18740,46386,25875,39412,39986,8993,44545,3516,24198,12647,55014,9416,2442,11123,35876,31015,42098,19019,23528,31193,49096,12065,5204,43548,5217,1728,811,12882,26440,27836,32011,14124,19144,38287,12412,37723,28756,22907,5710,34481,53066,19144,34726,29420,51863,41618,12137,26854,24648,25729,37620,22945,28518,22908,44617,7359,37853,33678,16712,48609,39317,6986,13314,37283,1197,20084,5587,8472,10121,6357,50800,5139,10533,23977,10216,29430,53216,13819,15499,18032,20777,12984,45040,32924,34351,39393,53844,33561,9079,1115,54288,24718,26638,23226,6592,38007,34865,30268,3776,26826,1155,37767,5869,6372,36463,18701,30764,38661,40139,1459,49872,24794,10796,18380,48404,42117,48205,34546,21701,19549,6858,52239,27002,4426,7971,8298,8185,19304,43563,1096,34911,52878,17018,2551,12005,27244,28027,37134,51985,37575,2072,54522,52736,21842,54452,13618,13359,25142,47794,49894,14925,40173,30101,16369,45623,54929,20376,2371,13754,48498,53522,3283,25656,48916,49009,46301,5129,12583,11445,24896,51990,23603,54704,4301,9199,49396,34960,29192,6276,15727,37871,19652,32781,41214,2515,51828,30105,19349,4876,9962,51329,48495,45210,36642,32736,47006,47154,27232,53603,54193,1508,3913,26599,28020,44995,5444,48076,38959,1073,48644,4623,35234,54206,33860,11336,16297,17006,55372,49535,36623,34465,18380,37749,41198,4727,21418,4519,36487,24329,53435,39457,30378,5902,47983,10136,51396,39251,42709,35775,1387,54901,50243,51086,10432,54656,31901,43617,51230,37012,10959,14878,6170,41291,40345,30505,37741,15972,7979,831,36891,55323,53586,33014,51849,32818,13926,46208,35592,814,7794,40357,16212,44520,445,5444,17431,26830,53552,43446,5143,50804,36661,37504,43541,49772,50788,48581,51448,30279,12164,46570,11444,2535,6997,34096,52301,47365,489,27250,14921,38445,6471,10636,23284,51724,13665,10275,1347,50589,10827,9442,53057,8133,10053,11019,43052,9883,19423,22902,274,21452,12305,41508,54848,11607,17474,36662,27955,55411,46240,25055,53371,42505,24507,46196,8916,4620,26805,1390,19131,16459,5074,38114,41315,21099,29212,48713,15300,12339,53512,32969,31538,22388,13538,10707,26154,3679,38372,51343,2055,48443,18932,43490,38680,50717,32980,45583,2120,5147,54043,42795,39733,26721,32868,51337,52639,4355,19781,9267,16227,42578,21569,21298,25486,32443,18020,41365,14525,31945,18380,6741,22620,48228,50631,48724,38454,19489,13079,47540,55349,35040,42508,51327,29797,36239,11431,35728,12333,34538,15141,10825,30196,47188,41046,9166,26236,12020,3764,1001,48210,47769,10282,21224,52668,51991,37790,13247,7160,43855,4557,15602,160,25571,16680,29434,36536,24090,16333,53652,6366,2641,12609,48878,23601,11520,40161,1961,24266,46263,19749,42370,24570,17777,38181,3789,6782,8908,49901,20534,41362,15852,45632,43974,33372,47801,27717,36226,14071,37408,22396,47191,38186,48797,508,8456,33944,14031,33925,23188,6960,22871,54557,43701,37951,20279,51256,46268,14035,20378,36261,20136,30366,34717,1999,35068,18224,36969,9058,38212,38878,11273,8385,49570,27912,33468,39184,13281,25348,28923,9395,45108,7626,24091,26482,50103,38010,37799,16801,46320,52723,35894,8389,36102,19372,13345,28122,43247,39920,24092,6868,37179,38004,604,53783,2793,6779,19221,15484,12465,27220,3464,15139,9734,34862,45382,7761,55054,5099,34875,14816,3412,55285,10759,10662,43221,54656,8831,23345,18109,32658,38409,34341,12902,38141,21537,47688,31869,25365,47144,13226,46916,17957,25377,29582,25914,13163,22105,8417,49720,52115,46482,37553,55173,17875,43375,40825,28598,27321,38800,21406,35036,21475,31243,20303,21112,29733,25732,49783,10158,34900,4629,14551,15818,8802,5245,9912,17305,40298,27422,27246,18562,2863,453,44019,33335,49891,13828,5886,19229,27104,28815,3967,25873,52929,43196,30351,16413,18510,30237,20549,16607,37874,53896,38810,8426,9340,3347,46277,55333,41186,48017,22889,24590,12826,23263,810,13610,15684,43478,55321,9519,33833,33850,42948,33579,51446,803,20006,19739,22113,47011,26264,3725,19636,45211,55070,773,11156,41155,32029,10688,23528,12838,11679,44961,26486,20340,19089,42008,12620,7108,14703,53283,44353,1439,15010,37008,37686,11061,15395,27542,32769,43060,24520,2416,33334,12138,5286,29895,1899,43441,13394,4542,39915,48828,41628,19286,8330,20717,23184,18280,53033,37548,4443,13829,28619,8271,30239,53974,2825,46315,41564,16920,37930,49310,4717,19855,42074,49742,29611,38648,35784,12052,8054,53270,26307,9440,52425,25818,29744,630,8738,38877,7131,28384,7461,22587,35831,24003,40692,14920,54127,49116,50756,52651,12660,40389,53077,39623,16539,43723,45758,670,24666,36915,7466,10536,11752,39014,32205,8252,23612,12165,48305,42777,14067,16764,14473,1688,10627,7101,22427,23095,9606,586,3121,21092,5109,38477,54608,14007,28692,35420,17540,6428,26663,7282,18615,43004,5916,55305,46655,37379,43307,51750,21781,54796,13796,5272,26013,50608,37493,42507,32734,32159,39891,29305,12201,52448,25247,10122,1028,48085,40328,24082,32518,14492,23772,46387,37281,40664,6632,17071,21764,45020,8978,5757,41463,13028,45730,31900,52266,16065,39491,36017,9306,9611,36603,50163,54779,49895,3463,55132,42762,27776,53607,20316,27848,6599,13243,39898,36787,46647,2534,4698,50148,7616,40695,35459,50717,10230,7907,52007,9133,22950,55253,54465,19608,34286,47140,39786,3384,53177,38079,23892,44184,41700,29389,38242,31094,36240,11244,433,45918,32886,54763,24832,44228,14826,19857,20230,53863,37476,8843,20734,41797,33477,6963,28561,11732,33697,27186,22906,5673,19360,33937,29961,2121,50385,6266,32403,23359,17804,41477,50948,14529,30520,8553,4337,35427,6649,19578,49337,27032,20718,8459,9631,25505,50474,39158,3279,14074,4159,36580,8133,37074,36600,6312,3622,54282,14614,20002,30122,46733,41087,15183,24254,11327,49202,23058,42495,50585,42562,49597,32980,5807,54987,28967,47413,20969,43954,41916,53100,36326,9019,53308,34863,8470,10614,3391,9732,2558,16084,49762,1775,11455,29452,48916,15180,44477,55243,5944,32976,9751,50409,2838,4664,28194,21969,38256,42350,34288,32529,53394,37013,49813,28477,22748,49316,33021,37589,50477,16514,6049,40191,11388,22213,33834,46812,39606,25989,35907,13955,36073,41834,40653,41507,38483,37482,34904,15750,38376,52658,5837,52835,29474,50333,49802,37401,28535,51141,5112,49479,4727,7776,16434,16505,21689,49437,47692,18219,11300,42685,25022,18414,16582,24293,30968,140,5921,19232,36420,18248,55177,26223,50577,1225,34841,1260,24715,23263,47482,53840,10126,55114,40188,37865,610,36539,38411,47266,45725,16417,11718,22546,24260,13277,37771,53191,25219,6174,18104,39737,42866,38834,28950,2495,8912,8989,15542,54328,29852,14399,39819,7978,16169,49324,30611,50384,42924,50781,39397,23758,46235,25557,28293,28901,34707,23900,56,52209,4103,8322,45962,49194,21226,6783,19329,25663,22242,24076,27487,5639,36791,50805,45928,35534,24168,42398,18485,18892,38393,36433,23761,42544,52594,22966,19614,47641,6261,23235,23987,19102,14011,21796,28232,19540,14068,7217,17593,33643,1639,47389,27602,29941,33139,41562,48824,27153,241,34633,7168,53453,42866,29914,24289,22690,11594,35216,55433,36591,49024,23141,16225,51141,46763,34515,8611,29749,10067,40475,17737,20360,55092,18435,46027,3562,31963,44499,3708,13352,14885,7676,15525,50650,11961,5417,2056,32064,38122,35872,32492,51106,51048,2424,52274,29288,3381,30475,43976,11765,40236,53271,23906,47466,17092,10445,50260,28748,17892,31454,10805,35300,2786,29929,5681,48347,3081,52175,26064,20047,26817,16962,46799,581,15856,12043,8859,29948,50175,16344,1801,13440,8507,17023,190,8472,23148,54934,32009,52433,45460,53171,33320,28811,29042,17879,20559,28570,29045,34999,48188,32761,46657,12401,52268,7909,28135,14672,1848,8127,18899,23977,32148,24670,14409,7920,34380,9831,40327,52094,15730,26619,3952,44092,33975,18370,50029,49666,51629,52046,46988,45158,15647,49742,14812,11566,42969,33326,30677,29905,40321,43302,20,11904,38902,49232,1670,55048,3625,10917,13844,48198,19303,51704,28392,45760,42219,16079,10222,20736,45241,40373,17713,41840,13719,16650,42551,28592,18697,55163,44392,4307,39635,35081,32575,43736,43268,50451,22648,32999,13332,17789,4579,34881,44944,19897,7689,27442,5095,35039,39474,19225,45914,49705,53850,35385,31772,53781,24774,41831,1078,27503,25884,24896,48925,14812,24452,35412,54381,53659,20387,36491,24689,15537,25278,16864,2164,35941,15744,30127,55471,16760,6655,3988,3791,19727,17926,53629,9935,31602,40661,14445,33155,42138,3940,16411,1566,12625,44861,16966,51311,3079,14829,10747,10224,41099,47411,44107,43613,50357,17000,8115,45331,40279,50031,44374,10710,7359,1310,760,13030,715,40855,3158,3079,8192,35654,23561,12652,21342,11827,6432,47920,22256,13653,48966,51720,30329,25173,47810,17918,406,8567,35491,24123,53008,13189,22660,29065,9459,1857,24072,31997,52711,37598,37428,42698,21920,2309,9176,4111,27810,55358,18700,437,3868,39524,40817,4374,44317,13372,4025,44185,41360,53414,30397,41696,46975,40613,26722,20336,37476,3106,31208,12708,12821,7184,258,22694,11067,842,4535,642,23157,44509,35643,9723,38490,50854,1757,48402,48942,35806,8244,4383,24183,32553,50098,20264,17202,27710,52957,52046,47636,43206,28609,53671,49041,5538,37195,34225,49031,25753,23699,42481,6060,31669,42380,16524,51629,30386,31059,54029,24628,38304,41104,11237,52444,12677,10658,53140,1412,11543,26427,2332,37809,18239,38514,32017,18948,3563,17969,45978,50911,3846,42278,48226,22737,2158,7997,19785,37246,44085,52187,39373,31004,1545,33888,2274,55418,48259,1673,9576,22619,17338,35582,38961,43046,39948,19170,52990,4096,27338,47028,44810,20536,17018,18215,12592,11436,53152,41286,19736,16232,40233,52795,9596,23747,32043,17901,32367,25468,39559,14194,23012,26340,44639,41520,11813,16790,17104,27470,11735,50418,40679,26380,275,50946,25456,14990,17100,10047,50144,36846,25511,4372,1494,8905,10207,23425,44603,43456,41168,49512,27899,46313,36180,15043,48996,43629,47260,6588,32707,8271,54302,1610,22905,46320,39783,19625,21227,13153,3979,55443,35699,25055,46765,25851,44119,16774,38015,3695,4263,7593,25043,21211,1066,14240,8098,54727,43098,38299,48489,33573,26732,25438,37599,13777,5580,48597,30197,4141,53660,52006,50419,49602,13062,13300,19611,1610,5999,40068,54850,35019,19143,20715,25820,34431,25479,19902,29300,2134,25406,51034,38081,1009,35582,52960,32636,33570,8287,17861,22636,4535,6075,4918,14416,45010,52948,45087,26363,51932,22315,3344,26367,2897,49883,33507,22455,50350,50,14490,20930,6640,15787,42928,14297,18814,7744,30786,52358,8463,1909,16108,1276,52299,48264,11334,55067,28727,30010,14756,7927,19316,45226,16227,12914,37968,45586,17786,27819,10979,17999,10662,1435,18430,9008,51627,30999,2421,38498,8128,32504,27162,24174,1709,10719,24499,29076,28016,30295,32546,37186,25393,33364,24890,10199,40836,16278,13683,17515,11865,5010,14535,49141,4109,25154,34830,52516,53262,29945,14327,48286,20755,40698,16506,2894,32444,18907,16324,24972,31248,12308,16328,28243,44771,34307,31920,46582,1970,49393,15719,37746,47497,19172,41330,54910,33447,53994,26837,43209,15516,50966,15007,7908,10326,21968,24346,35775,13064,43627,55018,19432,7516,7525,24323,14193,41761,29097,39446,995,34188,53369,31571,47948,37902,49311,256,48643,42949,31554,34885,36250,13961,17201,27637,9084,42953,25237,51706,43580,21970,2245,24194,49149,22814,27442,23079,29643,32552,48376,37881,53412,4664,1393,32044,15435,4464,11773,14314,45361,7553,19295,16243,54650,50966,40940,2992,50089,43054,19522,12174,4945,25210,39162,16237,9009,3323,54523,33137,24786,11026,19818,14652,36170,40984,6189,54659,22283,27150,3357,18346,20838,16130,10306,1124,24518,28315,16221,50725,30722,5634,38099,33702,25151,30179,34740,32227,542,46937,5700,13853,50492,10126,2293,23937,50820,45434,20009,6923,26902,50138,18862,44693,41563,4723,7909,48192,24268}; + // expected = 0; + // actual = test.findPairs(nums, k); + // assertEquals(expected, actual); + // } @Test public void test5() { k = -1; - nums = new int[]{1, 2, 3, 4, 5}; + nums = new int[] {1, 2, 3, 4, 5}; expected = 0; actual = test.findPairs(nums, k); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_533Test.java b/src/test/java/com/fishercoder/firstthousand/_533Test.java index d7dd6b1223..86fbc6db6c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_533Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_533Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._533; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _533Test { private _533.Solution1 solution1; private static char[][] picture; @@ -17,17 +17,19 @@ public void setup() { @Test public void test1() { - picture = new char[][]{ - {'W', 'B', 'W', 'B', 'B', 'W'}, - {'W', 'B', 'W', 'B', 'B', 'W'}, - {'W', 'B', 'W', 'B', 'B', 'W'}, - {'W', 'W', 'B', 'W', 'B', 'W'}}; + picture = + new char[][] { + {'W', 'B', 'W', 'B', 'B', 'W'}, + {'W', 'B', 'W', 'B', 'B', 'W'}, + {'W', 'B', 'W', 'B', 'B', 'W'}, + {'W', 'W', 'B', 'W', 'B', 'W'} + }; assertEquals(6, solution1.findBlackPixel(picture, 3)); } @Test public void test2() { - picture = new char[][]{{'B'}}; + picture = new char[][] {{'B'}}; assertEquals(1, solution1.findBlackPixel(picture, 1)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_536Test.java b/src/test/java/com/fishercoder/firstthousand/_536Test.java index fe58bbb2d4..257548b147 100644 --- a/src/test/java/com/fishercoder/firstthousand/_536Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_536Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._536; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _536Test { private _536.Solution1 solution1; private _536.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_537Test.java b/src/test/java/com/fishercoder/firstthousand/_537Test.java index 5f140e989f..a9e6067e07 100644 --- a/src/test/java/com/fishercoder/firstthousand/_537Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_537Test.java @@ -1,18 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._537; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/25/17. - */ +/** Created by fishercoder on 1/25/17. */ public class _537Test { - private _537 .Solution1 solution1; - private _537 .Solution2 solution2; + private _537.Solution1 solution1; + private _537.Solution2 solution2; private static String expected; private static String a; private static String b; @@ -24,8 +21,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { diff --git a/src/test/java/com/fishercoder/firstthousand/_538Test.java b/src/test/java/com/fishercoder/firstthousand/_538Test.java index 494590dc16..b7a4c95822 100644 --- a/src/test/java/com/fishercoder/firstthousand/_538Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_538Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._538; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _538Test { private _538.Solution1 solution1; private _538.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_539Test.java b/src/test/java/com/fishercoder/firstthousand/_539Test.java index 1f7f68c3d3..79bd4efce0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_539Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_539Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._539; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._539; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _539Test { private _539.Soluiton1 soluiton1; @@ -43,5 +41,4 @@ public void test2() { actual = soluiton1.findMinDifference(timePoints); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_53Test.java b/src/test/java/com/fishercoder/firstthousand/_53Test.java index c47b292b6a..719477196f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_53Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_53Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._53; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _53Test { private _53.Solution1 solution1; private static int[] nums; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{-2, 1, -3, 4, -1, 2, 1, -5, 4}; + nums = new int[] {-2, 1, -3, 4, -1, 2, 1, -5, 4}; assertEquals(6, solution1.maxSubArray(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_540Test.java b/src/test/java/com/fishercoder/firstthousand/_540Test.java index 775cbc27bf..a75a374bf2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_540Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_540Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._540; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _540Test { private _540.Solution1 solution1; private _540.Solution2 solution2; @@ -22,7 +22,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 2, 3, 3, 4, 4, 8, 8}; + nums = new int[] {1, 1, 2, 3, 3, 4, 4, 8, 8}; expected = 2; assertEquals(expected, solution1.singleNonDuplicate(nums)); assertEquals(expected, solution2.singleNonDuplicate(nums)); @@ -31,7 +31,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{3, 3, 7, 7, 10, 11, 11}; + nums = new int[] {3, 3, 7, 7, 10, 11, 11}; expected = 10; assertEquals(expected, solution1.singleNonDuplicate(nums)); assertEquals(expected, solution2.singleNonDuplicate(nums)); @@ -40,7 +40,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{1, 1, 2}; + nums = new int[] {1, 1, 2}; expected = 2; assertEquals(expected, solution1.singleNonDuplicate(nums)); assertEquals(expected, solution2.singleNonDuplicate(nums)); @@ -49,7 +49,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{1, 1, 2, 2, 3}; + nums = new int[] {1, 1, 2, 2, 3}; expected = 3; assertEquals(expected, solution1.singleNonDuplicate(nums)); assertEquals(expected, solution2.singleNonDuplicate(nums)); @@ -58,7 +58,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{1, 2, 2, 3, 3}; + nums = new int[] {1, 2, 2, 3, 3}; expected = 1; assertEquals(expected, solution1.singleNonDuplicate(nums)); assertEquals(expected, solution2.singleNonDuplicate(nums)); diff --git a/src/test/java/com/fishercoder/firstthousand/_541Test.java b/src/test/java/com/fishercoder/firstthousand/_541Test.java index 93339b8fab..252c6de4b7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_541Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_541Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._541; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _541Test { private _541.Solution1 solution1; private static String expected; @@ -20,8 +19,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { @@ -70,12 +68,13 @@ public void test5() { @Test public void test6() { - s = "hyzqyljrnigxvdtneasepfahmtyhlohwxmkqcdfehybknvdmfrfvtbsovjbdhevlfxpdaovjgunjqlimjkfnqcqnajmebeddqsgl"; + s = + "hyzqyljrnigxvdtneasepfahmtyhlohwxmkqcdfehybknvdmfrfvtbsovjbdhevlfxpdaovjgunjqlimjkfnqcqnajmebeddqsgl"; System.out.println("s.length() = " + s.length()); k = 39; - expected = "fdcqkmxwholhytmhafpesaentdvxginrjlyqzyhehybknvdmfrfvtbsovjbdhevlfxpdaovjgunjqllgsqddebemjanqcqnfkjmi"; + expected = + "fdcqkmxwholhytmhafpesaentdvxginrjlyqzyhehybknvdmfrfvtbsovjbdhevlfxpdaovjgunjqllgsqddebemjanqcqnfkjmi"; actual = solution1.reverseStr(s, k); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_542Test.java b/src/test/java/com/fishercoder/firstthousand/_542Test.java index 4e370b0554..897be93688 100644 --- a/src/test/java/com/fishercoder/firstthousand/_542Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_542Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._542; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _542Test { private _542.Solution1 solution1; private _542.Solution2 solution2; @@ -19,18 +19,25 @@ public void setup() { @Test public void test1() { - int[][] matrix = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,1,0,1,1,1,1,1,1,1],[1,1,0,1,1,1,1,1,1,1],[1,1,1,1,0,0,0,1,1,0],[1,1,1,1,1,1,0,0,1,0],[1,0,0,1,1,1,0,1,0,1],[0,0,1,0,0,1,1,0,0,1],[0,1,0,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0,0,0],[0,0,1,1,1,1,0,1,1,1],[1,1,0,0,1,0,1,0,1,1]"); - int[][] expected = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,1,0,1,2,2,2,3,3,2],[2,1,0,1,1,1,1,2,2,1],[3,2,1,1,0,0,0,1,1,0],[2,1,1,2,1,1,0,0,1,0],[1,0,0,1,1,1,0,1,0,1],[0,0,1,0,0,1,1,0,0,1],[0,1,0,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0,0,0],[0,0,1,1,2,1,0,1,1,1],[1,1,0,0,1,0,1,0,1,2]"); + int[][] matrix = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1,0,1,1,1,1,1,1,1],[1,1,0,1,1,1,1,1,1,1],[1,1,1,1,0,0,0,1,1,0],[1,1,1,1,1,1,0,0,1,0],[1,0,0,1,1,1,0,1,0,1],[0,0,1,0,0,1,1,0,0,1],[0,1,0,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0,0,0],[0,0,1,1,1,1,0,1,1,1],[1,1,0,0,1,0,1,0,1,1]"); + int[][] expected = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,1,0,1,2,2,2,3,3,2],[2,1,0,1,1,1,1,2,2,1],[3,2,1,1,0,0,0,1,1,0],[2,1,1,2,1,1,0,0,1,0],[1,0,0,1,1,1,0,1,0,1],[0,0,1,0,0,1,1,0,0,1],[0,1,0,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0,0,0],[0,0,1,1,2,1,0,1,1,1],[1,1,0,0,1,0,1,0,1,2]"); assertArrayEquals(expected, solution1.updateMatrix(matrix)); assertArrayEquals(expected, solution2.updateMatrix(matrix)); } @Test public void test2() { - int[][] matrix = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0,0],[0,1,0],[0,0,0]"); - int[][] expected = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0,0],[0,1,0],[0,0,0]"); + int[][] matrix = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0,0],[0,1,0],[0,0,0]"); + int[][] expected = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0,0],[0,1,0],[0,0,0]"); assertArrayEquals(expected, solution1.updateMatrix(matrix)); assertArrayEquals(expected, solution2.updateMatrix(matrix)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_543Test.java b/src/test/java/com/fishercoder/firstthousand/_543Test.java index 6158d92842..96b3ee4068 100644 --- a/src/test/java/com/fishercoder/firstthousand/_543Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_543Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._543; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _543Test { private _543.Solution1 solution1; private static TreeNode root; @@ -25,5 +24,4 @@ public void test1() { TreeUtils.printBinaryTree(root); assertEquals(3, solution1.diameterOfBinaryTree(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_544Test.java b/src/test/java/com/fishercoder/firstthousand/_544Test.java index 3b249e8eb9..5f847ed228 100644 --- a/src/test/java/com/fishercoder/firstthousand/_544Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_544Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._544; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _544Test { private _544 test; private static int n; @@ -19,8 +18,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { @@ -45,5 +43,4 @@ public void test3() { actual = test.findContestMatch(n); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_545Test.java b/src/test/java/com/fishercoder/firstthousand/_545Test.java index d6c254fb17..2af7bc81ba 100644 --- a/src/test/java/com/fishercoder/firstthousand/_545Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_545Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._545; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _545Test { private _545.Solution1 test; @@ -28,5 +27,4 @@ public void test1() { expected = Arrays.asList(1, 2, 4, 6, 7, 5, 3); assertEquals(expected, test.boundaryOfBinaryTree(root)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_547Test.java b/src/test/java/com/fishercoder/firstthousand/_547Test.java index fadbc24577..83f44f2ed5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_547Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_547Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._547; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 1/9/17. - */ +/** Created by fishercoder on 1/9/17. */ public class _547Test { private _547.Solution1 test; private static int expected; @@ -22,11 +20,12 @@ public void setup() { @Test public void test1() { - isConnected = new int[][]{ - {1, 1, 0}, - {1, 1, 0}, - {0, 0, 1}, - }; + isConnected = + new int[][] { + {1, 1, 0}, + {1, 1, 0}, + {0, 0, 1}, + }; expected = 2; actual = test.findCircleNum(isConnected); assertEquals(expected, actual); @@ -34,11 +33,12 @@ public void test1() { @Test public void test2() { - isConnected = new int[][]{ - {1, 1, 0}, - {1, 1, 1}, - {0, 1, 1}, - }; + isConnected = + new int[][] { + {1, 1, 0}, + {1, 1, 1}, + {0, 1, 1}, + }; expected = 1; actual = test.findCircleNum(isConnected); assertEquals(expected, actual); @@ -46,12 +46,13 @@ public void test2() { @Test public void test3() { - isConnected = new int[][]{ - {1, 0, 0, 1}, - {0, 1, 1, 0}, - {0, 1, 1, 1}, - {1, 0, 1, 1}, - }; + isConnected = + new int[][] { + {1, 0, 0, 1}, + {0, 1, 1, 0}, + {0, 1, 1, 1}, + {1, 0, 1, 1}, + }; expected = 1; actual = test.findCircleNum(isConnected); assertEquals(expected, actual); @@ -59,11 +60,12 @@ public void test3() { @Test public void test4() { - isConnected = new int[][]{ - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1}, - }; + isConnected = + new int[][] { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }; expected = 3; actual = test.findCircleNum(isConnected); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_548Test.java b/src/test/java/com/fishercoder/firstthousand/_548Test.java index 2a9a372c22..5454af53bb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_548Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_548Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._548; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _548Test { private _548.Solution1 test; private static boolean expected; @@ -25,7 +24,7 @@ public void setupForEachTest() { @Test public void test1() { - nums = new int[]{1, 2, 1, 2, 1, 2, 1}; + nums = new int[] {1, 2, 1, 2, 1, 2, 1}; expected = true; actual = test.splitArray(nums); assertEquals(expected, actual); @@ -33,7 +32,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{1, 2, 1, 2, 1, 2, 1, 2}; + nums = new int[] {1, 2, 1, 2, 1, 2, 1, 2}; expected = false; actual = test.splitArray(nums); assertEquals(expected, actual); @@ -41,2019 +40,96 @@ public void test2() { @Test public void test3() { - nums = new int[]{ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - }; + nums = + new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, + }; expected = false; long start = System.currentTimeMillis(); actual = test.splitArray(nums); - System.out.println("It took " + (System.currentTimeMillis() - start) + " ms to solve this test case."); + System.out.println( + "It took " + (System.currentTimeMillis() - start) + " ms to solve this test case."); assertEquals(expected, actual); } @Test public void test4() { - //equalSum is 3, j = 6, k = 9 - nums = new int[]{1, 2, 1, 3, 0, 0, 2, 2, 1, 3, 3}; + // equalSum is 3, j = 6, k = 9 + nums = new int[] {1, 2, 1, 3, 0, 0, 2, 2, 1, 3, 3}; expected = true; actual = test.splitArray(nums); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_549Test.java b/src/test/java/com/fishercoder/firstthousand/_549Test.java index 015ab2eb7c..cdc0555835 100644 --- a/src/test/java/com/fishercoder/firstthousand/_549Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_549Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._549; -import org.junit.jupiter.api.BeforeEach; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _549Test { private _549.Solution1 solution1; private static int expected; @@ -18,8 +16,7 @@ public class _549Test { private static TreeNode root; @BeforeEach - public void setup() { - } + public void setup() {} @BeforeEach public void setupForEachTest() { diff --git a/src/test/java/com/fishercoder/firstthousand/_54Test.java b/src/test/java/com/fishercoder/firstthousand/_54Test.java index 2eff4459d9..e353f45695 100644 --- a/src/test/java/com/fishercoder/firstthousand/_54Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_54Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._54; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _54Test { private _54.Solution1 solution1; private static int[][] matrix; @@ -19,17 +18,18 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9}, - }; + matrix = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9}, + }; assertEquals(Arrays.asList(1, 2, 3, 6, 9, 8, 7, 4, 5), solution1.spiralOrder(matrix)); } @Test public void test2() { - matrix = new int[][]{}; + matrix = new int[][] {}; assertEquals(Arrays.asList(), solution1.spiralOrder(matrix)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_551Test.java b/src/test/java/com/fishercoder/firstthousand/_551Test.java index e47bcf7872..10fb164575 100644 --- a/src/test/java/com/fishercoder/firstthousand/_551Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_551Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._551; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _551Test { private _551.Solution1 test; private static boolean expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_553Test.java b/src/test/java/com/fishercoder/firstthousand/_553Test.java index 3d54331f62..df45413c09 100644 --- a/src/test/java/com/fishercoder/firstthousand/_553Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_553Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._553; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/25/17. - */ +/** Created by fishercoder on 5/25/17. */ public class _553Test { private _553.Solution1 solution1; private static int[] nums; @@ -20,13 +18,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{1000, 100, 10, 2}; + nums = new int[] {1000, 100, 10, 2}; assertEquals("1000/(100/10/2)", solution1.optimalDivision(nums)); } @Test public void test2() { - nums = new int[]{1000, 100, 40, 10, 2}; + nums = new int[] {1000, 100, 40, 10, 2}; assertEquals("1000/(100/40/10/2)", solution1.optimalDivision(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_554Test.java b/src/test/java/com/fishercoder/firstthousand/_554Test.java index 87a689b07f..177e2e2a8c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_554Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_554Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._554; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._554; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _554Test { private _554.Solution1 test; @@ -23,8 +21,7 @@ public void setup() { } @BeforeEach - public void setupForEachTest() { - } + public void setupForEachTest() {} @Test public void test1() { diff --git a/src/test/java/com/fishercoder/firstthousand/_555Test.java b/src/test/java/com/fishercoder/firstthousand/_555Test.java index 6a02dba53c..5a57cd49b0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_555Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_555Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._555; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/29/17. - */ +/** Created by fishercoder on 4/29/17. */ public class _555Test { private _555.Solution1 solution1; private static String expected; @@ -22,7 +20,7 @@ public void setup() { @Test public void test1() { - strs = new String[]{"abc", "xyz"}; + strs = new String[] {"abc", "xyz"}; expected = "zyxcba"; actual = solution1.splitLoopedString(strs); assertEquals(expected, actual); @@ -30,7 +28,7 @@ public void test1() { @Test public void test2() { - strs = new String[]{"lc", "evol", "cdy"}; + strs = new String[] {"lc", "evol", "cdy"}; expected = "ylclovecd"; actual = solution1.splitLoopedString(strs); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_556Test.java b/src/test/java/com/fishercoder/firstthousand/_556Test.java index b67b642750..5951007176 100644 --- a/src/test/java/com/fishercoder/firstthousand/_556Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_556Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._556; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _556Test { private _556.Solution1 solution1; private static int n; @@ -58,5 +58,4 @@ public void test5() { actual = solution1.nextGreaterElement(n); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_559Test.java b/src/test/java/com/fishercoder/firstthousand/_559Test.java index 11a7dfea84..4f170c1f87 100644 --- a/src/test/java/com/fishercoder/firstthousand/_559Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_559Test.java @@ -1,33 +1,33 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.Node; import com.fishercoder.solutions.firstthousand._559; import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _559Test { - private _559.Solution1 solution1; - private static Node root; + private _559.Solution1 solution1; + private static Node root; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _559.Solution1(); - } + solution1 = new _559.Solution1(); + } - @Test - public void test1() { - root = new Node(1); - Node node3 = new Node(3); - Node node2 = new Node(2); - Node node4 = new Node(4); - root.children = Arrays.asList(node3, node2, node4); - Node node5 = new Node(5); - Node node6 = new Node(6); - node3.children = Arrays.asList(node5, node6); + @Test + public void test1() { + root = new Node(1); + Node node3 = new Node(3); + Node node2 = new Node(2); + Node node4 = new Node(4); + root.children = Arrays.asList(node3, node2, node4); + Node node5 = new Node(5); + Node node6 = new Node(6); + node3.children = Arrays.asList(node5, node6); - assertEquals(3, solution1.maxDepth(root)); - } + assertEquals(3, solution1.maxDepth(root)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_55Test.java b/src/test/java/com/fishercoder/firstthousand/_55Test.java index 0d8d7aa10c..409487add8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_55Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_55Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._55; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _55Test { private _55.Solution1 solution1; private _55.Solution2 solution2; @@ -23,7 +23,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{0, 2, 3}; + nums = new int[] {0, 2, 3}; assertEquals(false, solution1.canJump(nums)); assertEquals(false, solution2.canJump(nums)); assertEquals(false, solution3.canJump(nums)); @@ -32,7 +32,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{1, 2}; + nums = new int[] {1, 2}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -41,7 +41,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{2, 3, 1, 1, 4}; + nums = new int[] {2, 3, 1, 1, 4}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -50,7 +50,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{5, 9, 3, 2, 1, 0, 2, 3, 3, 1, 0, 0}; + nums = new int[] {5, 9, 3, 2, 1, 0, 2, 3, 3, 1, 0, 0}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -59,7 +59,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{2, 0, 0}; + nums = new int[] {2, 0, 0}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -68,7 +68,7 @@ public void test5() { @Test public void test6() { - nums = new int[]{2, 0}; + nums = new int[] {2, 0}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -77,7 +77,7 @@ public void test6() { @Test public void test7() { - nums = new int[]{1, 1, 0, 1}; + nums = new int[] {1, 1, 0, 1}; assertEquals(false, solution1.canJump(nums)); assertEquals(false, solution2.canJump(nums)); assertEquals(false, solution3.canJump(nums)); @@ -86,7 +86,7 @@ public void test7() { @Test public void test8() { - nums = new int[]{0}; + nums = new int[] {0}; assertEquals(true, solution1.canJump(nums)); assertEquals(true, solution2.canJump(nums)); assertEquals(true, solution3.canJump(nums)); @@ -95,12 +95,10 @@ public void test8() { @Test public void test9() { - nums = new int[]{3, 2, 1, 0, 4}; + nums = new int[] {3, 2, 1, 0, 4}; assertEquals(false, solution1.canJump(nums)); assertEquals(false, solution2.canJump(nums)); assertEquals(false, solution3.canJump(nums)); assertEquals(false, solution4.canJump(nums)); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_560Test.java b/src/test/java/com/fishercoder/firstthousand/_560Test.java index 03c2c3be2a..0f7c8954cc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_560Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_560Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._560; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _560Test { private _560.Solution1 solution1; private _560.Solution2 solution2; @@ -22,7 +22,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 1}; + nums = new int[] {1, 1, 1}; k = 2; expected = 2; actual = solution1.subarraySum(nums, k); @@ -33,7 +33,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; k = 3; expected = 2; actual = solution1.subarraySum(nums, k); @@ -44,7 +44,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{1, 1}; + nums = new int[] {1, 1}; k = 1; expected = 2; actual = solution1.subarraySum(nums, k); @@ -55,7 +55,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{0, 0}; + nums = new int[] {0, 0}; k = 0; expected = 3; actual = solution1.subarraySum(nums, k); @@ -66,7 +66,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{100, 1, 2, 3, 4}; + nums = new int[] {100, 1, 2, 3, 4}; k = 3; expected = 2; actual = solution1.subarraySum(nums, k); @@ -74,5 +74,4 @@ public void test5() { actual = solution2.subarraySum(nums, k); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_561Test.java b/src/test/java/com/fishercoder/firstthousand/_561Test.java index 2433008785..64191faa9b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_561Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_561Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._561; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/23/17. - */ +/** Created by fishercoder on 4/23/17. */ public class _561Test { private _561.Solution1 solution1; private static int expected; @@ -22,10 +20,9 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 4, 3, 2}; + nums = new int[] {1, 4, 3, 2}; expected = 4; actual = solution1.arrayPairSum(nums); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_562Test.java b/src/test/java/com/fishercoder/firstthousand/_562Test.java index b26f27130b..1443891832 100644 --- a/src/test/java/com/fishercoder/firstthousand/_562Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_562Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._562; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/23/17. - */ +/** Created by fishercoder on 4/23/17. */ public class _562Test { private _562.Solution1 solution1; private static int expected; @@ -22,14 +20,14 @@ public void setup() { @Test public void test1() { - M = new int[][]{ - {0, 1, 1, 0}, - {0, 1, 1, 0}, - {0, 0, 0, 1} - }; + M = + new int[][] { + {0, 1, 1, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 1} + }; expected = 3; actual = solution1.longestLine(M); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_563Test.java b/src/test/java/com/fishercoder/firstthousand/_563Test.java index d6f8027400..f3ea932725 100644 --- a/src/test/java/com/fishercoder/firstthousand/_563Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_563Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._563; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/23/17. - */ +/** Created by fishercoder on 4/23/17. */ public class _563Test { private _563.Solution1 solution1; private static int expected; @@ -45,5 +43,4 @@ public void test2() { actual = solution1.findTilt(root); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_566Test.java b/src/test/java/com/fishercoder/firstthousand/_566Test.java index 8dd3ce1440..2ed54921b4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_566Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_566Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._566; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -/** - * Created by fishercoder on 4/29/17. - */ +/** Created by fishercoder on 4/29/17. */ public class _566Test { private _566.Solution1 solution1; private _566.Solution2 solution2; @@ -26,13 +24,14 @@ public void setup() { @Test public void test1() { - nums = new int[][]{ - {1, 2}, - {3, 4}, - }; + nums = + new int[][] { + {1, 2}, + {3, 4}, + }; r = 1; c = 4; - expected = new int[][]{{1, 2, 3, 4}}; + expected = new int[][] {{1, 2, 3, 4}}; actual = solution1.matrixReshape(nums, r, c); assertArrayEquals(expected, actual); actual = solution2.matrixReshape(nums, r, c); diff --git a/src/test/java/com/fishercoder/firstthousand/_567Test.java b/src/test/java/com/fishercoder/firstthousand/_567Test.java index 335bf1da8d..e1097f856c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_567Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_567Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._567; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _567Test { private _567.Solution1 solution1; private _567.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_56Test.java b/src/test/java/com/fishercoder/firstthousand/_56Test.java index 5b0720771d..5e3f64fc9f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_56Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_56Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._56; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _56Test { private _56.Solution1 solution1; private static int[][] intervals; @@ -18,18 +18,19 @@ public void setup() { @Test public void test1() { - intervals = new int[][]{ - {2, 3}, - {5, 5}, - {2, 2}, - {3, 4}, - {3, 4} - }; - expected = new int[][]{ - {2, 4}, - {5, 5} - }; + intervals = + new int[][] { + {2, 3}, + {5, 5}, + {2, 2}, + {3, 4}, + {3, 4} + }; + expected = + new int[][] { + {2, 4}, + {5, 5} + }; assertArrayEquals(expected, solution1.merge(intervals)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_572Test.java b/src/test/java/com/fishercoder/firstthousand/_572Test.java index 6aea4bb0ae..6b65129c14 100644 --- a/src/test/java/com/fishercoder/firstthousand/_572Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_572Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._572; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _572Test { private _572.Solution1 solution1; private static boolean expected; @@ -32,11 +31,12 @@ public void test1() { @Test public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(3, 4, 5, 1, 2, null, null, null, null, 0)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(3, 4, 5, 1, 2, null, null, null, null, 0)); TreeUtils.printBinaryTree(root); subRoot = TreeUtils.constructBinaryTree(Arrays.asList(4, 1, 2)); expected = false; assertEquals(expected, solution1.isSubtree(root, subRoot)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_575Test.java b/src/test/java/com/fishercoder/firstthousand/_575Test.java index b56a8fbc17..f94ff73108 100644 --- a/src/test/java/com/fishercoder/firstthousand/_575Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_575Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._575; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _575Test { private _575.Solution1 solution1; private static int expected; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - candyType = new int[]{1, 1, 2, 3}; + candyType = new int[] {1, 1, 2, 3}; expected = 2; actual = solution1.distributeCandies(candyType); assertEquals(expected, actual); @@ -27,7 +27,7 @@ public void test1() { @Test public void test2() { - candyType = new int[]{1, 1, 2, 2, 3, 3}; + candyType = new int[] {1, 1, 2, 2, 3, 3}; expected = 3; actual = solution1.distributeCandies(candyType); assertEquals(expected, actual); @@ -35,7 +35,7 @@ public void test2() { @Test public void test3() { - candyType = new int[]{1000, 1, 1, 1}; + candyType = new int[] {1000, 1, 1, 1}; expected = 2; actual = solution1.distributeCandies(candyType); assertEquals(expected, actual); diff --git a/src/test/java/com/fishercoder/firstthousand/_57Test.java b/src/test/java/com/fishercoder/firstthousand/_57Test.java index 054404f198..c0dea9517f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_57Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_57Test.java @@ -15,28 +15,35 @@ public void setup() { @Test public void test1() { - Assertions.assertArrayEquals(new int[][]{ - {1, 5}, - {6, 9} - }, solution1.insert(new int[][]{ - {1, 3}, - {6, 9} - }, new int[]{2, 5})); + Assertions.assertArrayEquals( + new int[][] { + {1, 5}, + {6, 9} + }, + solution1.insert( + new int[][] { + {1, 3}, + {6, 9} + }, + new int[] {2, 5})); } - @Test public void test2() { - Assertions.assertArrayEquals(new int[][]{ - {1, 2}, - {3, 10}, - {12, 16} - }, solution1.insert(new int[][]{ - {1, 2}, - {3, 5}, - {6, 7}, - {8, 10}, - {12, 16} - }, new int[]{4, 9})); + Assertions.assertArrayEquals( + new int[][] { + {1, 2}, + {3, 10}, + {12, 16} + }, + solution1.insert( + new int[][] { + {1, 2}, + {3, 5}, + {6, 7}, + {8, 10}, + {12, 16} + }, + new int[] {4, 9})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_581Test.java b/src/test/java/com/fishercoder/firstthousand/_581Test.java index 1cc61b5b9c..f5da2c1173 100644 --- a/src/test/java/com/fishercoder/firstthousand/_581Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_581Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._581; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _581Test { private _581.Solution1 solution1; private _581.Solution2 solution2; @@ -21,14 +21,14 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 4}; + nums = new int[] {1, 2, 3, 4}; assertEquals(0, solution1.findUnsortedSubarray(nums)); assertEquals(0, solution2.findUnsortedSubarray(nums)); } @Test public void test2() { - nums = new int[]{2, 6, 4, 8, 10, 9, 15}; + nums = new int[] {2, 6, 4, 8, 10, 9, 15}; assertEquals(5, solution1.findUnsortedSubarray(nums)); assertEquals(5, solution2.findUnsortedSubarray(nums)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_582Test.java b/src/test/java/com/fishercoder/firstthousand/_582Test.java index f00e3577aa..62ecb4f54e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_582Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_582Test.java @@ -1,17 +1,14 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._582; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._582; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/18/17. - */ +/** Created by fishercoder on 5/18/17. */ public class _582Test { private _582.Solution1 solution1; private static List pid; diff --git a/src/test/java/com/fishercoder/firstthousand/_583Test.java b/src/test/java/com/fishercoder/firstthousand/_583Test.java index 8da5278a23..05f97356e5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_583Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_583Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._583; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/18/17. - */ +/** Created by fishercoder on 5/18/17. */ public class _583Test { private _583.Solution1 solution1; private static String word1; diff --git a/src/test/java/com/fishercoder/firstthousand/_588Test.java b/src/test/java/com/fishercoder/firstthousand/_588Test.java index 2fc2ad2049..c0381ef3e6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_588Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_588Test.java @@ -1,24 +1,20 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._588; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._588; import java.util.ArrayList; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/23/17. - */ +/** Created by fishercoder on 5/23/17. */ public class _588Test { private _588.Solution1.FileSystem fileSystem; @BeforeEach - public void setup() { - } + public void setup() {} @Test public void test1() { diff --git a/src/test/java/com/fishercoder/firstthousand/_589Test.java b/src/test/java/com/fishercoder/firstthousand/_589Test.java index 5ea16060d5..febfb73ce7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_589Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_589Test.java @@ -1,31 +1,30 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.Node; import com.fishercoder.solutions.firstthousand._589; +import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _589Test { - private _589.Solution1 solution1; - private static Node root; - private static List expectedPreOrder; + private _589.Solution1 solution1; + private static Node root; + private static List expectedPreOrder; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _589.Solution1(); - } + solution1 = new _589.Solution1(); + } - @Test - @Disabled //todo: Node.createNaryTree method hasn't been implemented yet - public void test1() { - expectedPreOrder = Arrays.asList(1, 3, 5, 6, 2, 4); - root = Node.createNaryTree(expectedPreOrder); - assertEquals(expectedPreOrder, solution1.preorder(root)); - } + @Test + @Disabled // todo: Node.createNaryTree method hasn't been implemented yet + public void test1() { + expectedPreOrder = Arrays.asList(1, 3, 5, 6, 2, 4); + root = Node.createNaryTree(expectedPreOrder); + assertEquals(expectedPreOrder, solution1.preorder(root)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_58Test.java b/src/test/java/com/fishercoder/firstthousand/_58Test.java index 8c0c079b21..944facc135 100644 --- a/src/test/java/com/fishercoder/firstthousand/_58Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_58Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._58; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _58Test { private _58.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_591Test.java b/src/test/java/com/fishercoder/firstthousand/_591Test.java index 537e41678a..d5f2ebba54 100644 --- a/src/test/java/com/fishercoder/firstthousand/_591Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_591Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._591; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _591Test { private _591.Solution1 test; @@ -21,6 +21,9 @@ public void test1() { @Test public void test2() { - assertEquals(false, test.isValid("This is the first line ]]>"));//tag_name is too long (> 9) + assertEquals( + false, + test.isValid( + "This is the first line ]]>")); // tag_name is too long (> 9) } } diff --git a/src/test/java/com/fishercoder/firstthousand/_592Test.java b/src/test/java/com/fishercoder/firstthousand/_592Test.java index 38da8bb721..7ec319b828 100644 --- a/src/test/java/com/fishercoder/firstthousand/_592Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_592Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._592; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/23/17. - */ +/** Created by fishercoder on 5/23/17. */ public class _592Test { private _592.Solution1 test; private static String expression; diff --git a/src/test/java/com/fishercoder/firstthousand/_593Test.java b/src/test/java/com/fishercoder/firstthousand/_593Test.java index 7146b13ffd..e66e5c8ce4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_593Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_593Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._593; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/22/17. - */ +/** Created by fishercoder on 5/22/17. */ public class _593Test { private _593.Solution1 solution1; private static int[] p1; @@ -23,28 +21,28 @@ public void setup() { @Test public void test1() { - p1 = new int[]{0, 0}; - p2 = new int[]{1, 1}; - p3 = new int[]{1, 0}; - p4 = new int[]{0, 1}; + p1 = new int[] {0, 0}; + p2 = new int[] {1, 1}; + p3 = new int[] {1, 0}; + p4 = new int[] {0, 1}; assertEquals(true, solution1.validSquare(p1, p2, p3, p4)); } @Test public void test2() { - p1 = new int[]{1, 1}; - p2 = new int[]{5, 3}; - p3 = new int[]{3, 5}; - p4 = new int[]{7, 7}; + p1 = new int[] {1, 1}; + p2 = new int[] {5, 3}; + p3 = new int[] {3, 5}; + p4 = new int[] {7, 7}; assertEquals(false, solution1.validSquare(p1, p2, p3, p4)); } @Test public void test3() { - p1 = new int[]{0, 0}; - p2 = new int[]{0, 0}; - p3 = new int[]{0, 0}; - p4 = new int[]{0, 0}; + p1 = new int[] {0, 0}; + p2 = new int[] {0, 0}; + p3 = new int[] {0, 0}; + p4 = new int[] {0, 0}; System.out.println(solution1.noDuplicate(p1, p2, p3, p4)); assertEquals(false, solution1.validSquare(p1, p2, p3, p4)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_594Test.java b/src/test/java/com/fishercoder/firstthousand/_594Test.java index 5ae9bb8433..8d6a8211d7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_594Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_594Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._594; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/20/17. - */ +/** Created by fishercoder on 5/20/17. */ public class _594Test { private _594.Solution1 solution1; private static int[] nums; @@ -20,7 +18,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 2, 2, 5, 2, 3, 7}; + nums = new int[] {1, 3, 2, 2, 5, 2, 3, 7}; assertEquals(5, solution1.findLHS(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_598Test.java b/src/test/java/com/fishercoder/firstthousand/_598Test.java index eb9c47f2fc..7df6b4fbd3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_598Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_598Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._598; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _598Test { private _598.Solution1 solution1; @@ -17,7 +17,12 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.maxCount(3, 3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,2],[3,3]"))); + assertEquals( + 4, + solution1.maxCount( + 3, + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,2],[3,3]"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_5Test.java b/src/test/java/com/fishercoder/firstthousand/_5Test.java index 06932c8365..8e10e4c84a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_5Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_5Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._5; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _5Test { private _5.Solution1 solution1; private _5.Solution2 solution2; @@ -26,5 +26,4 @@ public void test1() { assertEquals("aba", solution2.longestPalindrome(s)); assertEquals("bab", solution3.longestPalindrome(s)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_600Test.java b/src/test/java/com/fishercoder/firstthousand/_600Test.java index 85f41aa660..d135383120 100644 --- a/src/test/java/com/fishercoder/firstthousand/_600Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_600Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._600; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/28/17. - */ +/** Created by fishercoder on 5/28/17. */ public class _600Test { private _600.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_604Test.java b/src/test/java/com/fishercoder/firstthousand/_604Test.java index 254636260b..da83888d84 100644 --- a/src/test/java/com/fishercoder/firstthousand/_604Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_604Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._604; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _604Test { private _604.Solution1.StringIterator test; diff --git a/src/test/java/com/fishercoder/firstthousand/_605Test.java b/src/test/java/com/fishercoder/firstthousand/_605Test.java index 53a3417083..b06175740e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_605Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_605Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._605; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _605Test { private _605.Solution1 solution1; private _605.Solution2 solution2; @@ -20,140 +20,140 @@ public void setup() { @Test public void test1() { - flowerbed = new int[]{1, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 1}; n = 1; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test2() { - flowerbed = new int[]{1, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 1}; n = 2; assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test3() { - flowerbed = new int[]{1, 0, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 0, 1}; n = 2; assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test4() { - flowerbed = new int[]{1, 0, 1, 0, 1, 0, 1}; + flowerbed = new int[] {1, 0, 1, 0, 1, 0, 1}; n = 1; assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test5() { - flowerbed = new int[]{0, 0, 1, 0, 1}; + flowerbed = new int[] {0, 0, 1, 0, 1}; n = 1; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test6() { - flowerbed = new int[]{1, 0, 0, 0, 1, 0, 0}; + flowerbed = new int[] {1, 0, 0, 0, 1, 0, 0}; n = 2; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test7() { - flowerbed = new int[]{0, 0, 1, 0, 0}; + flowerbed = new int[] {0, 0, 1, 0, 0}; n = 2; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test8() { - flowerbed = new int[]{1}; + flowerbed = new int[] {1}; n = 0; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test9() { - flowerbed = new int[]{0}; + flowerbed = new int[] {0}; n = 0; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test10() { - flowerbed = new int[]{0}; + flowerbed = new int[] {0}; n = 1; assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); } @Test public void test11() { - flowerbed = new int[]{1, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 1}; n = 1; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test12() { - flowerbed = new int[]{1, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 1}; n = 2; assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test13() { - flowerbed = new int[]{1, 0, 0, 0, 0, 1}; + flowerbed = new int[] {1, 0, 0, 0, 0, 1}; n = 2; assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test14() { - flowerbed = new int[]{1, 0, 1, 0, 1, 0, 1}; + flowerbed = new int[] {1, 0, 1, 0, 1, 0, 1}; n = 1; assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test15() { - flowerbed = new int[]{0, 0, 1, 0, 1}; + flowerbed = new int[] {0, 0, 1, 0, 1}; n = 1; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test16() { - flowerbed = new int[]{1, 0, 0, 0, 1, 0, 0}; + flowerbed = new int[] {1, 0, 0, 0, 1, 0, 0}; n = 2; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test17() { - flowerbed = new int[]{0, 0, 1, 0, 0}; + flowerbed = new int[] {0, 0, 1, 0, 0}; n = 2; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test18() { - flowerbed = new int[]{1}; + flowerbed = new int[] {1}; n = 0; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test19() { - flowerbed = new int[]{0}; + flowerbed = new int[] {0}; n = 0; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } @Test public void test20() { - flowerbed = new int[]{0}; + flowerbed = new int[] {0}; n = 1; assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_606Test.java b/src/test/java/com/fishercoder/firstthousand/_606Test.java index d5afbeae28..996bfe8f29 100644 --- a/src/test/java/com/fishercoder/firstthousand/_606Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_606Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._606; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _606Test { private _606.Solution1 solution1; private _606.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_609Test.java b/src/test/java/com/fishercoder/firstthousand/_609Test.java index c665662557..4097764e9a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_609Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_609Test.java @@ -2,11 +2,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._609; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.List; - public class _609Test { private _609.Solution1 solution1; private static String[] paths; @@ -19,7 +18,13 @@ public void setup() { @Test public void test1() { - paths = new String[]{"root/a 1.txt(abcd) 2.txt(efgh)", "root/c 3.txt(abcd)", "root/c/d 4.txt(efgh)", "root 4.txt(efgh)"}; + paths = + new String[] { + "root/a 1.txt(abcd) 2.txt(efgh)", + "root/c 3.txt(abcd)", + "root/c/d 4.txt(efgh)", + "root 4.txt(efgh)" + }; actual = solution1.findDuplicate(paths); CommonUtils.printListList(actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_60Test.java b/src/test/java/com/fishercoder/firstthousand/_60Test.java index c8f49184fd..f2e3d21044 100644 --- a/src/test/java/com/fishercoder/firstthousand/_60Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_60Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._60; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _60Test { private _60.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_611Test.java b/src/test/java/com/fishercoder/firstthousand/_611Test.java index 6691bb15f5..0fccbd3548 100644 --- a/src/test/java/com/fishercoder/firstthousand/_611Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_611Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._611; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _611Test { private _611.Solution1 solution1; private static int[] nums; @@ -17,14 +17,66 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 2, 3, 4}; + nums = new int[] {2, 2, 3, 4}; assertEquals(3, solution1.triangleNumber(nums)); } @Test public void test2() { - nums = new int[]{85, 88, 57, 88, 61, 71, 24, 12, 11, 37, 37, 72, 43, 22, 65, 79, 34, 41, 37, 74, 28, 25, 73, 44, 11, 84, 29, 33, 21, 87, 87, 21, 14, 47, 45, 31, 40, 33, 85, 99, 47, 29, 13, 82, 56, 33, 47, 11, 80, 59, 16, 16, 57, 53, 37, 20, 90, 84, 97, 39, 50, 22, 44, 54, 67, 69, 46, 58, 11, 29, 89, 10, 89, 30, 12, 55, 30, 32, 23, 74, 69, 19, 48, 72, 42, 12, 19, 88, 39, 32, 98, 89, 99, 19, 78, 35, 45, 16, 22, 73, 86, 76, 39, 50, 40, 85, 85, 61, 71, 97, 48, 39, 21, 39, 35, 11, 58, 94, 37, 50, 13, 78, 67, 23, 24, 53, 98, 41, 85, 90, 85, 92, 31, 11, 46, 88, 83, 68, 87, 33, 13, 43, 95, 39, 33, 40, 47, 95, 28, 52, 91, 60, 19, 76, 80, 75, 51, 64, 67, 33, 43, 47, 15, 80, 36, 78, 33, 98, 18, 15, 77, 100, 60, 28, 51, 86, 30, 67, 48, 43, 62, 23, 82, 26, 93, 99, 19, 93, 21, 22, 34, 100, 46, 94, 42, 58, 31, 27, 81, 47, 90, 53, 85, 69, 41, 29, 73, 26, 23, 54, 59, 83, 99, 19, 28, 96, 15, 56, 40, 32, 32, 42, 85, 43, 71, 36, 98, 74, 38, 91, 11, 79, 62, 24, 34, 29, 10, 31, 54, 59, 97, 35, 23, 92, 72, 96, 52, 45, 57, 39, 69, 53, 89, 46, 44, 66, 43, 60, 62, 28, 53, 72, 82, 63, 92, 39, 20, 56, 72, 25, 36, 33, 60, 92, 29, 40, 21, 53, 45, 53, 80, 56, 42, 67, 79, 11, 39, 11, 77, 82, 97, 91, 55, 96, 73, 48, 26, 11, 90, 40, 28, 21, 35, 99, 25, 73, 39, 62, 66, 50, 72, 58, 26, 91, 96, 88, 98, 25, 99, 27, 26, 26, 40, 43, 80, 21, 99, 25, 94, 61, 32, 49, 40, 67, 91, 99, 17, 99, 76, 34, 21, 100, 14, 98, 68, 83, 54, 21, 52, 84, 37, 87, 100, 69, 43, 76, 31, 31, 39, 29, 90, 82, 37, 26, 36, 11, 37, 95, 26, 43, 29, 66, 70, 99, 88, 44, 37, 96, 83, 38, 44, 50, 48, 10, 98, 67, 58, 66, 74, 91, 24, 19, 82, 94, 94, 58, 89, 73, 92, 80, 19, 76, 60, 23, 54, 78, 55, 46, 20, 27, 88, 23, 93, 16, 60, 97, 67, 78, 86, 83, 73, 48, 32, 39, 83, 49, 58, 82, 50, 99, 67, 39, 79, 48, 76, 82, 72, 92, 32, 98, 97, 82, 44, 37, 11, 50, 94, 51, 89, 100, 46, 95, 10, 99, 39, 68, 81, 34, 61, 78, 95, 54, 85, 31, 74, 38, 95, 85, 88, 45, 78, 35, 82, 42, 19, 12, 89, 24, 42, 88, 57, 79, 82, 13, 22, 64, 66, 42, 73, 44, 54, 68, 70, 15, 27, 44, 72, 44, 49, 42, 40, 26, 50, 33, 24, 56, 79, 68, 100, 41, 42, 92, 89, 27, 50, 100, 35, 54, 89, 98, 32, 80, 15, 90, 66, 53, 27, 77, 82, 97, 58, 95, 70, 24, 79, 27, 29, 54, 90, 25, 76, 26, 90, 79, 67, 31, 85, 15, 74, 22, 59, 20, 71, 62, 15, 48, 31, 48, 91, 89, 19, 51, 17, 60, 13, 65, 44, 89, 19, 45, 72, 84, 94, 98, 21, 89, 24, 10, 19, 14, 26, 68, 100, 44, 26, 21, 65, 14, 79, 93, 48, 29, 60, 47, 84, 54, 13, 89, 45, 91, 29, 15, 65, 52, 39, 59, 13, 25, 59, 91, 22, 74, 77, 62, 95, 28, 86, 30, 24, 61, 53, 12, 16, 89, 79, 64, 36, 66, 47, 40, 13, 94, 28, 51, 64, 79, 38, 28, 54, 99, 11, 69, 22, 42, 89, 36, 62, 96, 32, 50, 24, 45, 90, 46, 13, 31, 84, 39, 84, 51, 34, 97, 13, 49, 10, 43, 42, 47, 86, 33, 76, 72, 39, 26, 77, 70, 100, 93, 64, 20, 80, 76, 48, 56, 32, 38, 56, 67, 15, 14, 14, 11, 61, 44, 31, 57, 39, 65, 71, 16, 68, 75, 47, 81, 55, 16, 80, 63, 10, 73, 81, 20, 20, 20, 34, 37, 40, 43, 44, 13, 89, 31, 75, 54, 37, 62, 76, 63, 94, 65, 82, 51, 69, 56, 76, 45, 12, 55, 25, 29, 65, 49, 16, 43, 48, 65, 20, 39, 81, 81, 61, 85, 73, 51, 81, 30, 18, 62, 54, 85, 85, 80, 59, 63, 37, 58, 32, 48, 84, 64, 50, 47, 99, 49, 62, 69, 60, 100, 67, 50, 16, 22, 65, 97, 58, 23, 70, 27, 14, 91, 84, 38, 91, 37, 31, 53, 100, 45, 29, 64, 75, 94, 70, 89, 78, 81, 70, 18, 79, 70, 83, 70, 61, 15, 42, 70, 77, 45, 36, 59, 65, 71, 41, 82, 89, 64, 48, 67, 89, 28, 20, 10, 99, 23, 27, 65, 77, 32, 96, 98, 59, 64, 99, 21, 77, 65, 43, 37, 62, 64, 78, 91, 57, 98, 75, 62, 92, 61, 27, 40, 51, 66, 55, 60, 44, 83, 71, 38, 34, 32, 72, 22, 45, 89, 26, 96, 87, 59, 92, 14, 94, 80, 44, 36, 94, 36, 21, 18, 95, 80, 88, 95, 87, 86, 53, 14, 55, 10, 24, 13, 11, 10, 61, 47, 76, 94, 75, 85, 25, 22, 22, 76, 40, 43, 69, 87, 30, 66, 43, 74, 70, 30, 94, 32, 47, 88, 95, 67, 25, 59, 64, 12, 20, 44, 48, 84, 21, 34, 63, 79, 21, 13, 33, 71, 16, 45, 37, 34, 39, 24, 64, 67, 42, 64, 65, 55, 89, 96, 72, 58, 54, 17, 43, 30, 54, 27, 82, 66, 17, 43, 41, 38, 84, 37, 93, 70, 75, 53, 81, 35, 87, 70, 77, 52, 92, 90, 19, 45, 33, 58, 20, 77, 88, 37, 49, 82, 22, 24, 63, 47}; + nums = + new int[] { + 85, 88, 57, 88, 61, 71, 24, 12, 11, 37, 37, 72, 43, 22, 65, 79, 34, 41, 37, 74, + 28, 25, 73, 44, 11, 84, 29, 33, 21, 87, 87, 21, 14, 47, 45, 31, 40, 33, 85, 99, + 47, 29, 13, 82, 56, 33, 47, 11, 80, 59, 16, 16, 57, 53, 37, 20, 90, 84, 97, 39, + 50, 22, 44, 54, 67, 69, 46, 58, 11, 29, 89, 10, 89, 30, 12, 55, 30, 32, 23, 74, + 69, 19, 48, 72, 42, 12, 19, 88, 39, 32, 98, 89, 99, 19, 78, 35, 45, 16, 22, 73, + 86, 76, 39, 50, 40, 85, 85, 61, 71, 97, 48, 39, 21, 39, 35, 11, 58, 94, 37, 50, + 13, 78, 67, 23, 24, 53, 98, 41, 85, 90, 85, 92, 31, 11, 46, 88, 83, 68, 87, 33, + 13, 43, 95, 39, 33, 40, 47, 95, 28, 52, 91, 60, 19, 76, 80, 75, 51, 64, 67, 33, + 43, 47, 15, 80, 36, 78, 33, 98, 18, 15, 77, 100, 60, 28, 51, 86, 30, 67, 48, 43, + 62, 23, 82, 26, 93, 99, 19, 93, 21, 22, 34, 100, 46, 94, 42, 58, 31, 27, 81, 47, + 90, 53, 85, 69, 41, 29, 73, 26, 23, 54, 59, 83, 99, 19, 28, 96, 15, 56, 40, 32, + 32, 42, 85, 43, 71, 36, 98, 74, 38, 91, 11, 79, 62, 24, 34, 29, 10, 31, 54, 59, + 97, 35, 23, 92, 72, 96, 52, 45, 57, 39, 69, 53, 89, 46, 44, 66, 43, 60, 62, 28, + 53, 72, 82, 63, 92, 39, 20, 56, 72, 25, 36, 33, 60, 92, 29, 40, 21, 53, 45, 53, + 80, 56, 42, 67, 79, 11, 39, 11, 77, 82, 97, 91, 55, 96, 73, 48, 26, 11, 90, 40, + 28, 21, 35, 99, 25, 73, 39, 62, 66, 50, 72, 58, 26, 91, 96, 88, 98, 25, 99, 27, + 26, 26, 40, 43, 80, 21, 99, 25, 94, 61, 32, 49, 40, 67, 91, 99, 17, 99, 76, 34, + 21, 100, 14, 98, 68, 83, 54, 21, 52, 84, 37, 87, 100, 69, 43, 76, 31, 31, 39, + 29, 90, 82, 37, 26, 36, 11, 37, 95, 26, 43, 29, 66, 70, 99, 88, 44, 37, 96, 83, + 38, 44, 50, 48, 10, 98, 67, 58, 66, 74, 91, 24, 19, 82, 94, 94, 58, 89, 73, 92, + 80, 19, 76, 60, 23, 54, 78, 55, 46, 20, 27, 88, 23, 93, 16, 60, 97, 67, 78, 86, + 83, 73, 48, 32, 39, 83, 49, 58, 82, 50, 99, 67, 39, 79, 48, 76, 82, 72, 92, 32, + 98, 97, 82, 44, 37, 11, 50, 94, 51, 89, 100, 46, 95, 10, 99, 39, 68, 81, 34, 61, + 78, 95, 54, 85, 31, 74, 38, 95, 85, 88, 45, 78, 35, 82, 42, 19, 12, 89, 24, 42, + 88, 57, 79, 82, 13, 22, 64, 66, 42, 73, 44, 54, 68, 70, 15, 27, 44, 72, 44, 49, + 42, 40, 26, 50, 33, 24, 56, 79, 68, 100, 41, 42, 92, 89, 27, 50, 100, 35, 54, + 89, 98, 32, 80, 15, 90, 66, 53, 27, 77, 82, 97, 58, 95, 70, 24, 79, 27, 29, 54, + 90, 25, 76, 26, 90, 79, 67, 31, 85, 15, 74, 22, 59, 20, 71, 62, 15, 48, 31, 48, + 91, 89, 19, 51, 17, 60, 13, 65, 44, 89, 19, 45, 72, 84, 94, 98, 21, 89, 24, 10, + 19, 14, 26, 68, 100, 44, 26, 21, 65, 14, 79, 93, 48, 29, 60, 47, 84, 54, 13, 89, + 45, 91, 29, 15, 65, 52, 39, 59, 13, 25, 59, 91, 22, 74, 77, 62, 95, 28, 86, 30, + 24, 61, 53, 12, 16, 89, 79, 64, 36, 66, 47, 40, 13, 94, 28, 51, 64, 79, 38, 28, + 54, 99, 11, 69, 22, 42, 89, 36, 62, 96, 32, 50, 24, 45, 90, 46, 13, 31, 84, 39, + 84, 51, 34, 97, 13, 49, 10, 43, 42, 47, 86, 33, 76, 72, 39, 26, 77, 70, 100, 93, + 64, 20, 80, 76, 48, 56, 32, 38, 56, 67, 15, 14, 14, 11, 61, 44, 31, 57, 39, 65, + 71, 16, 68, 75, 47, 81, 55, 16, 80, 63, 10, 73, 81, 20, 20, 20, 34, 37, 40, 43, + 44, 13, 89, 31, 75, 54, 37, 62, 76, 63, 94, 65, 82, 51, 69, 56, 76, 45, 12, 55, + 25, 29, 65, 49, 16, 43, 48, 65, 20, 39, 81, 81, 61, 85, 73, 51, 81, 30, 18, 62, + 54, 85, 85, 80, 59, 63, 37, 58, 32, 48, 84, 64, 50, 47, 99, 49, 62, 69, 60, 100, + 67, 50, 16, 22, 65, 97, 58, 23, 70, 27, 14, 91, 84, 38, 91, 37, 31, 53, 100, 45, + 29, 64, 75, 94, 70, 89, 78, 81, 70, 18, 79, 70, 83, 70, 61, 15, 42, 70, 77, 45, + 36, 59, 65, 71, 41, 82, 89, 64, 48, 67, 89, 28, 20, 10, 99, 23, 27, 65, 77, 32, + 96, 98, 59, 64, 99, 21, 77, 65, 43, 37, 62, 64, 78, 91, 57, 98, 75, 62, 92, 61, + 27, 40, 51, 66, 55, 60, 44, 83, 71, 38, 34, 32, 72, 22, 45, 89, 26, 96, 87, 59, + 92, 14, 94, 80, 44, 36, 94, 36, 21, 18, 95, 80, 88, 95, 87, 86, 53, 14, 55, 10, + 24, 13, 11, 10, 61, 47, 76, 94, 75, 85, 25, 22, 22, 76, 40, 43, 69, 87, 30, 66, + 43, 74, 70, 30, 94, 32, 47, 88, 95, 67, 25, 59, 64, 12, 20, 44, 48, 84, 21, 34, + 63, 79, 21, 13, 33, 71, 16, 45, 37, 34, 39, 24, 64, 67, 42, 64, 65, 55, 89, 96, + 72, 58, 54, 17, 43, 30, 54, 27, 82, 66, 17, 43, 41, 38, 84, 37, 93, 70, 75, 53, + 81, 35, 87, 70, 77, 52, 92, 90, 19, 45, 33, 58, 20, 77, 88, 37, 49, 82, 22, 24, + 63, 47 + }; assertEquals(105489315, solution1.triangleNumber(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_617Test.java b/src/test/java/com/fishercoder/firstthousand/_617Test.java index 7a08a7e709..9a6b5f7054 100644 --- a/src/test/java/com/fishercoder/firstthousand/_617Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_617Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._617; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _617Test { private _617.Solution1 solution1; private _617.Solution2 solution2; @@ -21,12 +20,19 @@ public void setup() { @Test public void test1() { - assertEquals(TreeUtils.constructBinaryTree(Arrays.asList(3, 4, 5, 5, 4, null, 7)), solution1.mergeTrees(TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, 5)), TreeUtils.constructBinaryTree(Arrays.asList(2, 1, 3, null, 4, null, 7)))); + assertEquals( + TreeUtils.constructBinaryTree(Arrays.asList(3, 4, 5, 5, 4, null, 7)), + solution1.mergeTrees( + TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, 5)), + TreeUtils.constructBinaryTree(Arrays.asList(2, 1, 3, null, 4, null, 7)))); } @Test public void test2() { - assertEquals(TreeUtils.constructBinaryTree(Arrays.asList(3, 4, 5, 5, 4, null, 7)), solution2.mergeTrees(TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, 5)), TreeUtils.constructBinaryTree(Arrays.asList(2, 1, 3, null, 4, null, 7)))); + assertEquals( + TreeUtils.constructBinaryTree(Arrays.asList(3, 4, 5, 5, 4, null, 7)), + solution2.mergeTrees( + TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, 5)), + TreeUtils.constructBinaryTree(Arrays.asList(2, 1, 3, null, 4, null, 7)))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_61Test.java b/src/test/java/com/fishercoder/firstthousand/_61Test.java index f86dfdadc5..676a3f1b89 100644 --- a/src/test/java/com/fishercoder/firstthousand/_61Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_61Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.solutions.firstthousand._61; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _61Test { private _61.Solution1 solution1; private static ListNode expected; diff --git a/src/test/java/com/fishercoder/firstthousand/_621Test.java b/src/test/java/com/fishercoder/firstthousand/_621Test.java index 6a81a37b26..2539752c02 100644 --- a/src/test/java/com/fishercoder/firstthousand/_621Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_621Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._621; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _621Test { private _621.Solution1 solution1; private static char[] tasks; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - tasks = new char[]{'A', 'A', 'A', 'B', 'B', 'B'}; + tasks = new char[] {'A', 'A', 'A', 'B', 'B', 'B'}; assertEquals(8, solution1.leastInterval(tasks, 2)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_622Test.java b/src/test/java/com/fishercoder/firstthousand/_622Test.java index 6d6386a307..9d359084c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_622Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_622Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._622; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _622Test { private _622.Solution1.MyCircularQueue myCircularQueue; @@ -21,5 +21,4 @@ public void test1() { assertEquals(true, myCircularQueue.enQueue(4)); assertEquals(4, myCircularQueue.Rear()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_623Test.java b/src/test/java/com/fishercoder/firstthousand/_623Test.java index 50689ea998..68af49e419 100644 --- a/src/test/java/com/fishercoder/firstthousand/_623Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_623Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._623; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _623Test { private _623.Solution1 solution1; @@ -20,7 +19,8 @@ public void setup() { @Test public void test1() { - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(4, 1, 1, 2, null, null, 6, 3, 1, 5)); + TreeNode expected = + TreeUtils.constructBinaryTree(Arrays.asList(4, 1, 1, 2, null, null, 6, 3, 1, 5)); TreeUtils.printBinaryTree(expected); TreeNode inputTree = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 3, 1, 5)); TreeUtils.printBinaryTree(inputTree); @@ -29,7 +29,8 @@ public void test1() { @Test public void test2() { - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, null, 1, 1, 3, null, null, 1)); + TreeNode expected = + TreeUtils.constructBinaryTree(Arrays.asList(4, 2, null, 1, 1, 3, null, null, 1)); TreeUtils.printBinaryTree(expected); TreeNode inputTree = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, null, 3, 1)); TreeUtils.printBinaryTree(inputTree); @@ -38,7 +39,9 @@ public void test2() { @Test public void test3() { - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 5, 1, 1, 1, 1, 3, null, null, 1, 6, null, null, 7)); + TreeNode expected = + TreeUtils.constructBinaryTree( + Arrays.asList(4, 2, 5, 1, 1, 1, 1, 3, null, null, 1, 6, null, null, 7)); TreeUtils.printBinaryTree(expected); TreeNode inputTree = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 5, 3, 1, 6, 7)); TreeUtils.printBinaryTree(inputTree); @@ -46,5 +49,4 @@ public void test3() { TreeUtils.printBinaryTree(actual); assertEquals(expected, actual); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_628Test.java b/src/test/java/com/fishercoder/firstthousand/_628Test.java index 79bbdeda5e..8a793bedd7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_628Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_628Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._628; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _628Test { private _628.Solution1 solution1; private static int[] nums; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; assertEquals(6, solution1.maximumProduct(nums)); } @Test public void test2() { - nums = new int[]{1, 2, 3, 4}; + nums = new int[] {1, 2, 3, 4}; assertEquals(24, solution1.maximumProduct(nums)); } @Test public void test3() { - nums = new int[]{-4, -3, -2, -1, 60}; + nums = new int[] {-4, -3, -2, -1, 60}; assertEquals(720, solution1.maximumProduct(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_62Test.java b/src/test/java/com/fishercoder/firstthousand/_62Test.java index 67c4957f2b..389f391dd8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_62Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_62Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._62; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _62Test { private _62.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_630Test.java b/src/test/java/com/fishercoder/firstthousand/_630Test.java index 90d5fac83d..f1c5e0ee03 100644 --- a/src/test/java/com/fishercoder/firstthousand/_630Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_630Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._630; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _630Test { private _630.Solution1 solution1; private static int[][] courses; @@ -17,14 +17,14 @@ public void setup() { @Test public void test1() { - courses = new int[][]{ - {100, 200}, - {200, 1300}, - {1000, 1250}, - {2000, 3200}, - {300, 1200} - }; + courses = + new int[][] { + {100, 200}, + {200, 1300}, + {1000, 1250}, + {2000, 3200}, + {300, 1200} + }; assertEquals(4, solution1.scheduleCourse(courses)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_631Test.java b/src/test/java/com/fishercoder/firstthousand/_631Test.java index 5d3e6d30a1..0d315a5a21 100644 --- a/src/test/java/com/fishercoder/firstthousand/_631Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_631Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._631; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _631Test { private _631.Solution1.Excel excel; @@ -19,9 +19,8 @@ public void test1() { @Test public void test2() { excel = new _631.Solution1.Excel(3, 'C'); - assertEquals(0, excel.sum(1, 'A', new String[]{"A2"})); + assertEquals(0, excel.sum(1, 'A', new String[] {"A2"})); excel.set(2, 'A', 1); assertEquals(1, excel.get(1, 'A')); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_635Test.java b/src/test/java/com/fishercoder/firstthousand/_635Test.java index 147ba94581..1c7eb820a6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_635Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_635Test.java @@ -1,19 +1,15 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._635; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._635; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 9/9/17. - */ +/** Created by fishercoder on 9/9/17. */ public class _635Test { private _635.Solution1.LogSystem logSystem; private static List expected; @@ -35,7 +31,8 @@ public void test1() { logSystem.put(2, "2017:01:01:22:59:59"); logSystem.put(3, "2016:01:01:00:00:00"); expected = Arrays.asList(1, 2, 3); - assertEquals(expected, logSystem.retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Year")); + assertEquals( + expected, logSystem.retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Year")); } @Test @@ -44,7 +41,7 @@ public void test2() { logSystem.put(2, "2017:01:01:22:59:59"); logSystem.put(3, "2016:01:01:00:00:00"); expected = Arrays.asList(1, 2); - assertEquals(expected, logSystem.retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Hour")); + assertEquals( + expected, logSystem.retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Hour")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_636Test.java b/src/test/java/com/fishercoder/firstthousand/_636Test.java index fc14a0ff14..72a64113b2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_636Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_636Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._636; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _636Test { private _636.Solution1 solution1; @@ -18,7 +17,9 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{3, 4}, solution1.exclusiveTime(2, Arrays.asList("0:start:0", "1:start:2", "1:end:5", "0:end:6"))); + assertArrayEquals( + new int[] {3, 4}, + solution1.exclusiveTime( + 2, Arrays.asList("0:start:0", "1:start:2", "1:end:5", "0:end:6"))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_63Test.java b/src/test/java/com/fishercoder/firstthousand/_63Test.java index 2909370573..dac8d386b5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_63Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_63Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._63; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _63Test { private _63.Solution1 solution1; private static int[][] obstacleGrid; @@ -17,28 +17,28 @@ public void setup() { @Test public void test1() { - obstacleGrid = new int[][]{ - {0, 0}, - {0, 1}, - }; + obstacleGrid = + new int[][] { + {0, 0}, + {0, 1}, + }; assertEquals(0, solution1.uniquePathsWithObstacles(obstacleGrid)); } @Test public void test2() { - obstacleGrid = new int[][]{ - {0, 0, 0}, - {0, 1, 0}, - {0, 0, 0}, - }; + obstacleGrid = + new int[][] { + {0, 0, 0}, + {0, 1, 0}, + {0, 0, 0}, + }; assertEquals(2, solution1.uniquePathsWithObstacles(obstacleGrid)); } @Test public void test3() { - int[][] obstacleGrid = new int[][]{ - {1, 0} - }; + int[][] obstacleGrid = new int[][] {{1, 0}}; assertEquals(0, solution1.uniquePathsWithObstacles(obstacleGrid)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_643Test.java b/src/test/java/com/fishercoder/firstthousand/_643Test.java index 29a520ed74..dc5b275f1f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_643Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_643Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._643; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _643Test { private _643.Solution1 solution1; private static int[] nums; @@ -17,19 +17,29 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 12, -5, -6, 50, 3}; + nums = new int[] {1, 12, -5, -6, 50, 3}; assertEquals(12.75, solution1.findMaxAverage(nums, 4), 0.01); } @Test public void test2() { - nums = new int[]{-1}; + nums = new int[] {-1}; assertEquals(-1.0, solution1.findMaxAverage(nums, 1), 0.01); } @Test public void test3() { - nums = new int[]{-6662, 5432, -8558, -8935, 8731, -3083, 4115, 9931, -4006, -3284, -3024, 1714, -2825, -2374, -2750, -959, 6516, 9356, 8040, -2169, -9490, -3068, 6299, 7823, -9767, 5751, -7897, 6680, -1293, -3486, -6785, 6337, -9158, -4183, 6240, -2846, -2588, -5458, -9576, -1501, -908, -5477, 7596, -8863, -4088, 7922, 8231, -4928, 7636, -3994, -243, -1327, 8425, -3468, -4218, -364, 4257, 5690, 1035, 6217, 8880, 4127, -6299, -1831, 2854, -4498, -6983, -677, 2216, -1938, 3348, 4099, 3591, 9076, 942, 4571, -4200, 7271, -6920, -1886, 662, 7844, 3658, -6562, -2106, -296, -3280, 8909, -8352, -9413, 3513, 1352, -8825}; + nums = + new int[] { + -6662, 5432, -8558, -8935, 8731, -3083, 4115, 9931, -4006, -3284, -3024, 1714, + -2825, -2374, -2750, -959, 6516, 9356, 8040, -2169, -9490, -3068, 6299, 7823, + -9767, 5751, -7897, 6680, -1293, -3486, -6785, 6337, -9158, -4183, 6240, -2846, + -2588, -5458, -9576, -1501, -908, -5477, 7596, -8863, -4088, 7922, 8231, -4928, + 7636, -3994, -243, -1327, 8425, -3468, -4218, -364, 4257, 5690, 1035, 6217, + 8880, 4127, -6299, -1831, 2854, -4498, -6983, -677, 2216, -1938, 3348, 4099, + 3591, 9076, 942, 4571, -4200, 7271, -6920, -1886, 662, 7844, 3658, -6562, -2106, + -296, -3280, 8909, -8352, -9413, 3513, 1352, -8825 + }; assertEquals(37.25555555555555, solution1.findMaxAverage(nums, 90), 0.01); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_645Test.java b/src/test/java/com/fishercoder/firstthousand/_645Test.java index 4ea8fedfbd..9b401f195e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_645Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_645Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._645; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _645Test { private _645.Solution1 solution1; private static int[] nums; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 2, 4}; - assertArrayEquals(new int[]{2, 3}, solution1.findErrorNums(nums)); + nums = new int[] {1, 2, 2, 4}; + assertArrayEquals(new int[] {2, 3}, solution1.findErrorNums(nums)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_646Test.java b/src/test/java/com/fishercoder/firstthousand/_646Test.java index 82e32b1b01..8bdfb7556f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_646Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_646Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._646; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _646Test { private _646.Solution1 solution1; @@ -21,37 +21,40 @@ public void setup() { @Test public void test1() { - pairs = new int[][]{ - {1, 2}, - {2, 3}, - {5, 6}, - {3, 4} - }; + pairs = + new int[][] { + {1, 2}, + {2, 3}, + {5, 6}, + {3, 4} + }; assertEquals(3, solution1.findLongestChain(pairs)); assertEquals(3, solution2.findLongestChain(pairs)); } @Test public void test2() { - pairs = new int[][]{ - {9, 10}, - {-9, 9}, - {-6, 1}, - {-4, 1}, - {8, 10}, - {7, 10}, - {9, 10}, - {2, 10} - }; + pairs = + new int[][] { + {9, 10}, + {-9, 9}, + {-6, 1}, + {-4, 1}, + {8, 10}, + {7, 10}, + {9, 10}, + {2, 10} + }; assertEquals(2, solution1.findLongestChain(pairs)); assertEquals(2, solution2.findLongestChain(pairs)); } @Test public void test3() { - pairs = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[-6,9],[1,6],[8,10],[-1,4],[-6,-2],[-9,8],[-5,3],[0,3]"); + pairs = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[-6,9],[1,6],[8,10],[-1,4],[-6,-2],[-9,8],[-5,3],[0,3]"); assertEquals(3, solution1.findLongestChain(pairs)); assertEquals(3, solution2.findLongestChain(pairs)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_647Test.java b/src/test/java/com/fishercoder/firstthousand/_647Test.java index ac6d091b89..042731ae96 100644 --- a/src/test/java/com/fishercoder/firstthousand/_647Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_647Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._647; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _647Test { private _647.Solution1 solution1; private _647.Solution2 solution2; @@ -21,5 +21,4 @@ public void test1() { assertEquals(3, solution1.countSubstrings("abc")); assertEquals(3, solution2.countSubstrings("abc")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_648Test.java b/src/test/java/com/fishercoder/firstthousand/_648Test.java index 8d445040a6..624cbba3cc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_648Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_648Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._648; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._648; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _648Test { private _648.Solution1 solution1; @@ -28,36 +27,40 @@ public void test1() { @Test public void test2() { - dict = Arrays.asList("e", "k", "c", "harqp", "h", "gsafc", "vn", "lqp", "soy", "mr", "x", - "iitgm", "sb", "oo", "spj", "gwmly", "iu", "z", "f", "ha", "vds", - "v", "vpx", "fir", "t", "xo", "apifm", "tlznm", "kkv", "nxyud", "j", - "qp", "omn", "zoxp", "mutu", "i", "nxth", "dwuer", "sadl", "pv", "w", - "mding", "mubem", "xsmwc", "vl", "farov", "twfmq", "ljhmr", "q", "bbzs", - "kd", "kwc", "a", "buq", "sm", "yi", "nypa", "xwz", "si", "amqx", "iy", "eb", - "qvgt", "twy", "rf", "dc", "utt", "mxjfu", "hm", "trz", "lzh", "lref", "qbx", - "fmemr", "gil", "go", "qggh", "uud", "trnhf", "gels", "dfdq", "qzkx", "qxw"); - sentence = "ikkbp miszkays wqjferqoxjwvbieyk gvcfldkiavww vhokchxz dvypwyb " - + "bxahfzcfanteibiltins ueebf lqhflvwxksi dco kddxmckhvqifbuzkhstp wc " - + "ytzzlm gximjuhzfdjuamhsu gdkbmhpnvy ifvifheoxqlbosfww mengfdydekwttkhbzenk wjhmmyltmeufqvcpcxg " - + "hthcuovils ldipovluo aiprogn nusquzpmnogtjkklfhta klxvvlvyh nxzgnrveghc mpppfhzjkbucv cqcft " - + "uwmahhqradjtf iaaasabqqzmbcig zcpvpyypsmodtoiif qjuiqtfhzcpnmtk yzfragcextvx ivnvgkaqs " - + "iplazv jurtsyh gzixfeugj rnukjgtjpim hscyhgoru aledyrmzwhsz xbahcwfwm hzd ygelddphxnbh " - + "rvjxtlqfnlmwdoezh zawfkko iwhkcddxgpqtdrjrcv bbfj mhs nenrqfkbf spfpazr " - + "wrkjiwyf cw dtd cqibzmuuhukwylrnld dtaxhddidfwqs bgnnoxgyynol hg " - + "dijhrrpnwjlju muzzrrsypzgwvblf zbugltrnyzbg hktdviastoireyiqf qvufxgcixvhrjqtna ipfzhuvgo daee " - + "r nlipyfszvxlwqw yoq dewpgtcrzausqwhh qzsaobsghgm ichlpsjlsrwzhbyfhm ksenb " - + "bqprarpgnyemzwifqzz oai pnqottd nygesjtlpala qmxixtooxtbrzyorn gyvukjpc s mxhlkdaycskj uvwmerplaibeknltuvd ocnn " - + "frotscysdyclrc ckcttaceuuxzcghw pxbd oklwhcppuziixpvihihp"; - assertEquals("i miszkays w gvcfldkiavww v dvypwyb bxahfzcfanteibiltins ueebf " - + "lqhflvwxksi dc k w ytzzlm gximjuhzfdjuamhsu gdkbmhpnvy i mengfdydekwttkhbzenk w " - + "h ldipovluo a nusquzpmnogtjkklfhta k nxzgnrveghc mpppfhzjkbucv c uwmahhqradjtf i z " - + "q yzfragcextvx i i j gzixfeugj rnukjgtjpim h a x h " - + "ygelddphxnbh rvjxtlqfnlmwdoezh z i bbfj mhs nenrqfkbf " - + "spfpazr w c dtd c dtaxhddidfwqs bgnnoxgyynol h " - + "dijhrrpnwjlju muzzrrsypzgwvblf z h q i daee r nlipyfszvxlwqw " - + "yoq dewpgtcrzausqwhh q i k bqprarpgnyemzwifqzz " - + "oai pnqottd nygesjtlpala q gyvukjpc s mxhlkdaycskj " - + "uvwmerplaibeknltuvd ocnn f c pxbd oklwhcppuziixpvihihp", solution1.replaceWords(dict, sentence)); + dict = + Arrays.asList( + "e", "k", "c", "harqp", "h", "gsafc", "vn", "lqp", "soy", "mr", "x", + "iitgm", "sb", "oo", "spj", "gwmly", "iu", "z", "f", "ha", "vds", "v", + "vpx", "fir", "t", "xo", "apifm", "tlznm", "kkv", "nxyud", "j", "qp", "omn", + "zoxp", "mutu", "i", "nxth", "dwuer", "sadl", "pv", "w", "mding", "mubem", + "xsmwc", "vl", "farov", "twfmq", "ljhmr", "q", "bbzs", "kd", "kwc", "a", + "buq", "sm", "yi", "nypa", "xwz", "si", "amqx", "iy", "eb", "qvgt", "twy", + "rf", "dc", "utt", "mxjfu", "hm", "trz", "lzh", "lref", "qbx", "fmemr", + "gil", "go", "qggh", "uud", "trnhf", "gels", "dfdq", "qzkx", "qxw"); + sentence = + "ikkbp miszkays wqjferqoxjwvbieyk gvcfldkiavww vhokchxz dvypwyb " + + "bxahfzcfanteibiltins ueebf lqhflvwxksi dco kddxmckhvqifbuzkhstp wc " + + "ytzzlm gximjuhzfdjuamhsu gdkbmhpnvy ifvifheoxqlbosfww mengfdydekwttkhbzenk wjhmmyltmeufqvcpcxg " + + "hthcuovils ldipovluo aiprogn nusquzpmnogtjkklfhta klxvvlvyh nxzgnrveghc mpppfhzjkbucv cqcft " + + "uwmahhqradjtf iaaasabqqzmbcig zcpvpyypsmodtoiif qjuiqtfhzcpnmtk yzfragcextvx ivnvgkaqs " + + "iplazv jurtsyh gzixfeugj rnukjgtjpim hscyhgoru aledyrmzwhsz xbahcwfwm hzd ygelddphxnbh " + + "rvjxtlqfnlmwdoezh zawfkko iwhkcddxgpqtdrjrcv bbfj mhs nenrqfkbf spfpazr " + + "wrkjiwyf cw dtd cqibzmuuhukwylrnld dtaxhddidfwqs bgnnoxgyynol hg " + + "dijhrrpnwjlju muzzrrsypzgwvblf zbugltrnyzbg hktdviastoireyiqf qvufxgcixvhrjqtna ipfzhuvgo daee " + + "r nlipyfszvxlwqw yoq dewpgtcrzausqwhh qzsaobsghgm ichlpsjlsrwzhbyfhm ksenb " + + "bqprarpgnyemzwifqzz oai pnqottd nygesjtlpala qmxixtooxtbrzyorn gyvukjpc s mxhlkdaycskj uvwmerplaibeknltuvd ocnn " + + "frotscysdyclrc ckcttaceuuxzcghw pxbd oklwhcppuziixpvihihp"; + assertEquals( + "i miszkays w gvcfldkiavww v dvypwyb bxahfzcfanteibiltins ueebf " + + "lqhflvwxksi dc k w ytzzlm gximjuhzfdjuamhsu gdkbmhpnvy i mengfdydekwttkhbzenk w " + + "h ldipovluo a nusquzpmnogtjkklfhta k nxzgnrveghc mpppfhzjkbucv c uwmahhqradjtf i z " + + "q yzfragcextvx i i j gzixfeugj rnukjgtjpim h a x h " + + "ygelddphxnbh rvjxtlqfnlmwdoezh z i bbfj mhs nenrqfkbf " + + "spfpazr w c dtd c dtaxhddidfwqs bgnnoxgyynol h " + + "dijhrrpnwjlju muzzrrsypzgwvblf z h q i daee r nlipyfszvxlwqw " + + "yoq dewpgtcrzausqwhh q i k bqprarpgnyemzwifqzz " + + "oai pnqottd nygesjtlpala q gyvukjpc s mxhlkdaycskj " + + "uvwmerplaibeknltuvd ocnn f c pxbd oklwhcppuziixpvihihp", + solution1.replaceWords(dict, sentence)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_649Test.java b/src/test/java/com/fishercoder/firstthousand/_649Test.java index 67306faa44..8f84355791 100644 --- a/src/test/java/com/fishercoder/firstthousand/_649Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_649Test.java @@ -1,14 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._649; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/8/17. - */ +/** Created by fishercoder on 5/8/17. */ public class _649Test { private _649.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_64Test.java b/src/test/java/com/fishercoder/firstthousand/_64Test.java index 5bc609f05b..d007079793 100644 --- a/src/test/java/com/fishercoder/firstthousand/_64Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_64Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._64; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _64Test { private _64.Solution1 solution1; private static int[][] grid; @@ -17,26 +17,28 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {1, 2}, - {1, 1} - }; + grid = + new int[][] { + {1, 2}, + {1, 1} + }; assertEquals(3, solution1.minPathSum(grid)); } @Test public void test2() { - grid = new int[][]{{1}}; + grid = new int[][] {{1}}; assertEquals(1, solution1.minPathSum(grid)); } @Test public void test3() { - grid = new int[][]{ - {1, 3, 1}, - {1, 5, 1}, - {4, 2, 1} - }; + grid = + new int[][] { + {1, 3, 1}, + {1, 5, 1}, + {4, 2, 1} + }; assertEquals(7, solution1.minPathSum(grid)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_650Test.java b/src/test/java/com/fishercoder/firstthousand/_650Test.java index 47af9635c1..45f99dc7bf 100644 --- a/src/test/java/com/fishercoder/firstthousand/_650Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_650Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._650; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _650Test { private _650.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_651Test.java b/src/test/java/com/fishercoder/firstthousand/_651Test.java index a428b7dbc7..d5e09c1fb6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_651Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_651Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._651; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _651Test { private _651.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_652Test.java b/src/test/java/com/fishercoder/firstthousand/_652Test.java index 803310a8a4..d739c95f31 100644 --- a/src/test/java/com/fishercoder/firstthousand/_652Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_652Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.solutions.firstthousand._652; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _652Test { private _652.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_653Test.java b/src/test/java/com/fishercoder/firstthousand/_653Test.java index 1301d47f3e..1678473ce2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_653Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_653Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._653; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _653Test { private _653.Solution1 solution1; @@ -51,16 +49,10 @@ public void test3() { @Test public void test4() { /** - * 2 - * / \ - * 0 3 - * / \ - * -4 1 + * 2 / \ 0 3 / \ -4 1 * - * target = 1; - * expected = true; - * */ - + *

target = 1; expected = true; + */ root = TreeUtils.constructBinaryTree(new ArrayList<>(Arrays.asList(2, 0, -4, 1, 3))); expected = true; assertEquals(expected, solution1.findTarget(root, -1)); @@ -75,19 +67,23 @@ public void test5() { @Test public void test6() { - root = TreeUtils.constructBinaryTree(new ArrayList<>(Arrays.asList( - 3393, 2264, 4972, 1908, 3252, 4128, 5140, 965, 2018, - 3082, null, 3838, 4196, 5085, null, 559, 1187, null, 2143, 2968, - null, 3810, 3957, null, 4825, null, null, 0, 908, 1135, 1659, null, - null, 2764, null, 3581, null, null, 4106, 4498, null, null, - 498, 821, null, null, null, 1262, 1826, 2513, 2910, 3486, 3708, - null, null, 4377, 4673, 231, null, null, null, null, 1482, - null, null, 2386, 2690, null, null, null, null, null, null, 4349, null, - null, null, 170, 376, 1421, 1613, null, null, 2534, null, - null, null, 96, null, null, null, 1303))); + root = + TreeUtils.constructBinaryTree( + new ArrayList<>( + Arrays.asList( + 3393, 2264, 4972, 1908, 3252, 4128, 5140, 965, 2018, 3082, + null, 3838, 4196, 5085, null, 559, 1187, null, 2143, 2968, + null, 3810, 3957, null, 4825, null, null, 0, 908, 1135, + 1659, null, null, 2764, null, 3581, null, null, 4106, 4498, + null, null, 498, 821, null, null, null, 1262, 1826, 2513, + 2910, 3486, 3708, null, null, 4377, 4673, 231, null, null, + null, null, 1482, null, null, 2386, 2690, null, null, null, + null, null, null, 4349, null, null, null, 170, 376, 1421, + 1613, null, null, 2534, null, null, null, 96, null, null, + null, 1303))); expected = true; assertEquals(expected, solution1.findTarget(root, 5831)); -// TreeUtils.printBinaryTree(root); -// assertEquals(expected, mapSolution.findTarget(root, 5831)); + // TreeUtils.printBinaryTree(root); + // assertEquals(expected, mapSolution.findTarget(root, 5831)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_654Test.java b/src/test/java/com/fishercoder/firstthousand/_654Test.java index a1bec7c212..8c8ee834c0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_654Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_654Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._654; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _654Test { private static int[] nums; private static TreeNode expected; @@ -24,7 +23,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 2, 1, 6, 0, 5}; + nums = new int[] {3, 2, 1, 6, 0, 5}; expected = TreeUtils.constructBinaryTree(Arrays.asList(6, 3, 5, null, 2, 0, null, null, 1)); assertEquals(expected, solution1.constructMaximumBinaryTree(nums)); assertEquals(expected, solution2.constructMaximumBinaryTree(nums)); diff --git a/src/test/java/com/fishercoder/firstthousand/_655Test.java b/src/test/java/com/fishercoder/firstthousand/_655Test.java index e8072eca8b..19b40cea49 100644 --- a/src/test/java/com/fishercoder/firstthousand/_655Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_655Test.java @@ -1,17 +1,16 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._655; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _655Test { private static List> expected; @@ -50,7 +49,9 @@ public void test2() { @Test public void test3() { - root = TreeUtils.constructBinaryTree(Arrays.asList(3, null, 30, 10, null, null, 15, null, 45)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(3, null, 30, 10, null, null, 15, null, 45)); TreeUtils.printBinaryTree(root); CommonUtils.printListList(solution1.printTree(root)); System.out.println(solution1.printTree(root)); diff --git a/src/test/java/com/fishercoder/firstthousand/_656Test.java b/src/test/java/com/fishercoder/firstthousand/_656Test.java index b78f8a58ef..25d3252965 100644 --- a/src/test/java/com/fishercoder/firstthousand/_656Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_656Test.java @@ -1,18 +1,15 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._656; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._656; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/25/17. - */ +/** Created by fishercoder on 5/25/17. */ public class _656Test { private _656.Solution1 solution1; private static int[] A; @@ -25,7 +22,7 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 2, 4, -1, 2}; + A = new int[] {1, 2, 4, -1, 2}; expected = new ArrayList<>(Arrays.asList(1, 3, 5)); assertEquals(expected, solution1.cheapestJump(A, 2)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_658Test.java b/src/test/java/com/fishercoder/firstthousand/_658Test.java index ec95b949db..618d9e272e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_658Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_658Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._658; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._658; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _658Test { private _658.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_659Test.java b/src/test/java/com/fishercoder/firstthousand/_659Test.java index de8fbd4aa7..8ac7aabf23 100644 --- a/src/test/java/com/fishercoder/firstthousand/_659Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_659Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._659; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _659Test { private _659.Solution1 solution1; private static int[] nums; @@ -17,117 +17,262 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 3, 4, 5}; + nums = new int[] {1, 2, 3, 3, 4, 5}; assertEquals(true, solution1.isPossible(nums)); } @Test public void test2() { - nums = new int[]{1, 2, 3, 3, 4, 4, 5, 5}; + nums = new int[] {1, 2, 3, 3, 4, 4, 5, 5}; assertEquals(true, solution1.isPossible(nums)); } @Test public void test3() { - nums = new int[]{1, 2, 3, 4, 4, 5}; + nums = new int[] {1, 2, 3, 4, 4, 5}; assertEquals(false, solution1.isPossible(nums)); } @Test public void test4() { - /**This is one cool test case from Leetcode...*/ - nums = new int[]{ - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; + /** This is one cool test case from Leetcode... */ + nums = + new int[] { + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100 + }; assertEquals(true, solution1.isPossible(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_65Test.java b/src/test/java/com/fishercoder/firstthousand/_65Test.java index 013ebb40ff..a8abbcb7c3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_65Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_65Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._65; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _65Test { private _65.Solution1 solution1; private _65.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_661Test.java b/src/test/java/com/fishercoder/firstthousand/_661Test.java index 3cb3498d6d..394e34ca95 100644 --- a/src/test/java/com/fishercoder/firstthousand/_661Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_661Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._661; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _661Test { private _661.Solution1 solution1; private static int[][] M; @@ -18,17 +18,19 @@ public void setup() { @Test public void test1() { - M = new int[][]{ - {1, 1, 1}, - {1, 0, 1}, - {1, 1, 1} - }; - expected = M = new int[][]{ - {0, 0, 0}, - {0, 0, 0}, - {0, 0, 0} - }; + M = + new int[][] { + {1, 1, 1}, + {1, 0, 1}, + {1, 1, 1} + }; + expected = + M = + new int[][] { + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }; assertArrayEquals(expected, solution1.imageSmoother(M)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_662Test.java b/src/test/java/com/fishercoder/firstthousand/_662Test.java index eb3c668e4a..1820132f69 100644 --- a/src/test/java/com/fishercoder/firstthousand/_662Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_662Test.java @@ -1,16 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._662; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _662Test { private _662.Solution1 solution1; private static TreeNode root; @@ -44,9 +43,13 @@ public void test3() { @Test @Disabled - /**TODO: need to figure out how to pass in the input for the 4th example on Leetcode*/ + /** TODO: need to figure out how to pass in the input for the 4th example on Leetcode */ public void test4() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, 5, null, null, 9, 6, null, null, null, null, null, null, 7)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 3, 2, 5, null, null, 9, 6, null, null, null, null, null, null, + 7)); expected = 8; assertEquals(expected, solution1.widthOfBinaryTree(root)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_663Test.java b/src/test/java/com/fishercoder/firstthousand/_663Test.java index 9c7bb59f3d..976bf4fdd7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_663Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_663Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._663; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _663Test { private _663.Solution1 solution1; private static TreeNode root; @@ -51,5 +50,4 @@ public void test4() { expected = false; assertEquals(expected, solution1.checkEqualTree(root)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_664Test.java b/src/test/java/com/fishercoder/firstthousand/_664Test.java index a6af6e9424..87748eaa4a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_664Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_664Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._664; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _664Test { private _664.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(2, solution1.strangePrinter("aba")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_665Test.java b/src/test/java/com/fishercoder/firstthousand/_665Test.java index 3cfc0a8b40..458aeeaafd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_665Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_665Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._665; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _665Test { private _665.Solution1 solution1; private static int[] nums; @@ -17,62 +17,61 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 2, 3}; + nums = new int[] {4, 2, 3}; assertEquals(true, solution1.checkPossibility(nums)); } @Test public void test2() { - nums = new int[]{4, 2, 1}; + nums = new int[] {4, 2, 1}; assertEquals(false, solution1.checkPossibility(nums)); } @Test public void test3() { - nums = new int[]{3, 4, 2, 3}; + nums = new int[] {3, 4, 2, 3}; assertEquals(false, solution1.checkPossibility(nums)); } @Test public void test4() { - nums = new int[]{2, 3, 3, 2, 4}; + nums = new int[] {2, 3, 3, 2, 4}; assertEquals(true, solution1.checkPossibility(nums)); } @Test public void test5() { - nums = new int[]{2, 3, 3, 2, 2, 4}; + nums = new int[] {2, 3, 3, 2, 2, 4}; assertEquals(false, solution1.checkPossibility(nums)); } @Test public void test6() { - nums = new int[]{2, 3, 3, 2, 2, 2, 4}; + nums = new int[] {2, 3, 3, 2, 2, 2, 4}; assertEquals(false, solution1.checkPossibility(nums)); } @Test public void test7() { - nums = new int[]{3, 3, 2, 2}; + nums = new int[] {3, 3, 2, 2}; assertEquals(false, solution1.checkPossibility(nums)); } @Test public void test8() { - nums = new int[]{-1, 4, 2, 3}; + nums = new int[] {-1, 4, 2, 3}; assertEquals(true, solution1.checkPossibility(nums)); } @Test public void test9() { - nums = new int[]{1, 2, 4, 5, 3}; + nums = new int[] {1, 2, 4, 5, 3}; assertEquals(true, solution1.checkPossibility(nums)); } @Test public void test10() { - nums = new int[]{1, 2, 4, 5, 3, 6}; + nums = new int[] {1, 2, 4, 5, 3, 6}; assertEquals(true, solution1.checkPossibility(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_666Test.java b/src/test/java/com/fishercoder/firstthousand/_666Test.java index a862e44d1f..d2b9d3abc9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_666Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_666Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._666; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _666Test { private _666.Solution1 solution1; private _666.Solution2 solution2; @@ -26,23 +25,22 @@ public void cleanUp() { @Test public void test1() { - nums = new int[]{113, 215, 221}; + nums = new int[] {113, 215, 221}; assertEquals(12, solution1.pathSum(nums)); assertEquals(12, solution2.pathSum(nums)); } @Test public void test2() { - nums = new int[]{113, 221}; + nums = new int[] {113, 221}; assertEquals(4, solution1.pathSum(nums)); assertEquals(4, solution2.pathSum(nums)); } @Test public void test3() { - nums = new int[]{113, 214, 221, 348, 487}; + nums = new int[] {113, 214, 221, 348, 487}; assertEquals(26, solution1.pathSum(nums)); assertEquals(26, solution2.pathSum(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_667Test.java b/src/test/java/com/fishercoder/firstthousand/_667Test.java index 3c1b97144a..ed890df115 100644 --- a/src/test/java/com/fishercoder/firstthousand/_667Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_667Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._667; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _667Test { private _667.Solutoin1 solution1; private _667.Solutoin2 solution2; @@ -20,7 +20,7 @@ public void setup() { @Test public void test1() { - expected = new int[]{1, 2, 3}; + expected = new int[] {1, 2, 3}; assertArrayEquals(expected, solution1.constructArray(3, 1)); assertArrayEquals(expected, solution2.constructArray(3, 1)); } @@ -48,5 +48,4 @@ public void test5() { CommonUtils.printArray(solution1.constructArray(5, 2)); CommonUtils.printArray(solution2.constructArray(5, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_668Test.java b/src/test/java/com/fishercoder/firstthousand/_668Test.java index 3e0ad97118..a75cdfc302 100644 --- a/src/test/java/com/fishercoder/firstthousand/_668Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_668Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._668; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _668Test { private _668.Solution1 solution1; private _668.Solution2 solution2; @@ -30,8 +30,8 @@ public void test2() { @Test public void test3() { -// assertEquals(31666344, solution1.findKthNumber(9895, 28405, 100787757));//this will run into OOM error, so comment out + // assertEquals(31666344, solution1.findKthNumber(9895, 28405, 100787757));//this + // will run into OOM error, so comment out assertEquals(31666344, solution2.findKthNumber(9895, 28405, 100787757)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_669Test.java b/src/test/java/com/fishercoder/firstthousand/_669Test.java index 77b7b5e7e3..81e520419c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_669Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_669Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._669; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _669Test { private _669.Solution1 solution1; private static TreeNode root; @@ -33,5 +32,4 @@ public void test2() { expected = TreeUtils.constructBinaryTree(Arrays.asList(3, 2, null, 1)); assertEquals(expected, solution1.trimBST(root, 1, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_66Test.java b/src/test/java/com/fishercoder/firstthousand/_66Test.java index a6a2cc78c6..da972e9b3f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_66Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_66Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._66; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _66Test { private _66.Solution1 solution1; private _66.Solution2 solution2; @@ -19,38 +19,37 @@ public void setup() { @Test public void test1() { - digits = new int[]{9, 9, 9, 9}; - assertArrayEquals(new int[]{1, 0, 0, 0, 0}, solution1.plusOne(digits)); + digits = new int[] {9, 9, 9, 9}; + assertArrayEquals(new int[] {1, 0, 0, 0, 0}, solution1.plusOne(digits)); } @Test public void test2() { - digits = new int[]{8, 9, 9, 9}; - assertArrayEquals(new int[]{9, 0, 0, 0}, solution1.plusOne(digits)); + digits = new int[] {8, 9, 9, 9}; + assertArrayEquals(new int[] {9, 0, 0, 0}, solution1.plusOne(digits)); } @Test public void test3() { - digits = new int[]{2, 4, 9, 3, 9}; - assertArrayEquals(new int[]{2, 4, 9, 4, 0}, solution1.plusOne(digits)); + digits = new int[] {2, 4, 9, 3, 9}; + assertArrayEquals(new int[] {2, 4, 9, 4, 0}, solution1.plusOne(digits)); } @Test public void test4() { - digits = new int[]{9, 9, 9, 9, 9}; - assertArrayEquals(new int[]{1, 0, 0, 0, 0, 0}, solution2.plusOne(digits)); + digits = new int[] {9, 9, 9, 9, 9}; + assertArrayEquals(new int[] {1, 0, 0, 0, 0, 0}, solution2.plusOne(digits)); } @Test public void test5() { - digits = new int[]{8, 9, 9, 9, 9}; - assertArrayEquals(new int[]{9, 0, 0, 0, 0}, solution2.plusOne(digits)); + digits = new int[] {8, 9, 9, 9, 9}; + assertArrayEquals(new int[] {9, 0, 0, 0, 0}, solution2.plusOne(digits)); } @Test public void test6() { - digits = new int[]{2, 4, 9, 4, 9}; - assertArrayEquals(new int[]{2, 4, 9, 5, 0}, solution2.plusOne(digits)); + digits = new int[] {2, 4, 9, 4, 9}; + assertArrayEquals(new int[] {2, 4, 9, 5, 0}, solution2.plusOne(digits)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_670Test.java b/src/test/java/com/fishercoder/firstthousand/_670Test.java index ae613621e9..50d8fbe65e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_670Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_670Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._670; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _670Test { private _670.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(98213, solution1.maximumSwap(91283)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_671Test.java b/src/test/java/com/fishercoder/firstthousand/_671Test.java index ff86d281e3..9de1a94417 100644 --- a/src/test/java/com/fishercoder/firstthousand/_671Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_671Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._671; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _671Test { private _671.Solution1 solution1; private static TreeNode root; @@ -30,5 +29,4 @@ public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(2, 2, 2)); assertEquals(-1, solution1.findSecondMinimumValue(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_672Test.java b/src/test/java/com/fishercoder/firstthousand/_672Test.java index 2a8ab83d10..61694d3973 100644 --- a/src/test/java/com/fishercoder/firstthousand/_672Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_672Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._672; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _672Test { private _672.Solution1 solution1; private _672.Solution2 solution2; @@ -105,5 +105,4 @@ public void test15() { assertEquals(8, solution1.flipLights(7, 5)); assertEquals(8, solution2.flipLights(7, 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_673Test.java b/src/test/java/com/fishercoder/firstthousand/_673Test.java index 59485a5044..c26cd319c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_673Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_673Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._673; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _673Test { private _673.Solution1 solution1; private static int[] nums; @@ -19,14 +19,13 @@ public void setup() { @Test @Disabled public void test1() { - nums = new int[]{1, 3, 5, 4, 7}; + nums = new int[] {1, 3, 5, 4, 7}; assertEquals(2, solution1.findNumberOfLIS(nums)); } @Test public void test2() { - nums = new int[]{2, 2, 2, 2, 2}; + nums = new int[] {2, 2, 2, 2, 2}; assertEquals(5, solution1.findNumberOfLIS(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_674Test.java b/src/test/java/com/fishercoder/firstthousand/_674Test.java index fb996742fa..02f68cb6ff 100644 --- a/src/test/java/com/fishercoder/firstthousand/_674Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_674Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._674; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _674Test { private _674.Solution1 solution1; private static int[] nums; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 5, 4, 7}; + nums = new int[] {1, 3, 5, 4, 7}; assertEquals(3, solution1.findLengthOfLCIS(nums)); } @Test public void test2() { - nums = new int[]{2, 2, 2, 2, 2}; + nums = new int[] {2, 2, 2, 2, 2}; assertEquals(1, solution1.findLengthOfLCIS(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_675Test.java b/src/test/java/com/fishercoder/firstthousand/_675Test.java index a658af3fb4..34705f2ecb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_675Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_675Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.ArrayUtils; import com.fishercoder.solutions.firstthousand._675; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _675Test { private _675.Solution1 solution1; @@ -49,39 +48,45 @@ public void test3() { @Test public void test4() { - forest = ArrayUtils.buildList(new int[][]{ - {2, 3, 4, 9}, - {0, 0, 5, 10}, - {8, 7, 6, 12}, - }); + forest = + ArrayUtils.buildList( + new int[][] { + {2, 3, 4, 9}, + {0, 0, 5, 10}, + {8, 7, 6, 12}, + }); assertEquals(13, solution1.cutOffTree(forest)); } @Test public void test5() { - forest = ArrayUtils.buildList(new int[][]{ - {0, 0, 0, 3528, 2256, 9394, 3153}, - {8740, 1758, 6319, 3400, 4502, 7475, 6812}, - {0, 0, 3079, 6312, 0, 0, 0}, - {6828, 0, 0, 0, 0, 0, 8145}, - {6964, 4631, 0, 0, 0, 4811, 0}, - {0, 0, 0, 0, 9734, 4696, 4246}, - {3413, 8887, 0, 4766, 0, 0, 0}, - {7739, 0, 0, 2920, 0, 5321, 2250}, - {3032, 0, 3015, 0, 3269, 8582, 0}}); + forest = + ArrayUtils.buildList( + new int[][] { + {0, 0, 0, 3528, 2256, 9394, 3153}, + {8740, 1758, 6319, 3400, 4502, 7475, 6812}, + {0, 0, 3079, 6312, 0, 0, 0}, + {6828, 0, 0, 0, 0, 0, 8145}, + {6964, 4631, 0, 0, 0, 4811, 0}, + {0, 0, 0, 0, 9734, 4696, 4246}, + {3413, 8887, 0, 4766, 0, 0, 0}, + {7739, 0, 0, 2920, 0, 5321, 2250}, + {3032, 0, 3015, 0, 3269, 8582, 0} + }); assertEquals(-1, solution1.cutOffTree(forest)); } @Test public void test6() { - forest = ArrayUtils.buildList(new int[][]{ - {54581641, 64080174, 24346381, 69107959}, - {86374198, 61363882, 68783324, 79706116}, - {668150, 92178815, 89819108, 94701471}, - {83920491, 22724204, 46281641, 47531096}, - {89078499, 18904913, 25462145, 60813308} - }); + forest = + ArrayUtils.buildList( + new int[][] { + {54581641, 64080174, 24346381, 69107959}, + {86374198, 61363882, 68783324, 79706116}, + {668150, 92178815, 89819108, 94701471}, + {83920491, 22724204, 46281641, 47531096}, + {89078499, 18904913, 25462145, 60813308} + }); assertEquals(57, solution1.cutOffTree(forest)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_676Test.java b/src/test/java/com/fishercoder/firstthousand/_676Test.java index b2919984b3..2f8ff0f223 100644 --- a/src/test/java/com/fishercoder/firstthousand/_676Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_676Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._676; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _676Test { private _676.Solution1.MagicDictionary magicDictionarySol1; @@ -22,7 +21,7 @@ public void cleanup() { @Test public void test1() { - magicDictionarySol1.buildDict(new String[]{"hello", "leetcode"}); + magicDictionarySol1.buildDict(new String[] {"hello", "leetcode"}); assertEquals(false, magicDictionarySol1.search("hello")); assertEquals(true, magicDictionarySol1.search("hhllo")); assertEquals(false, magicDictionarySol1.search("hell")); diff --git a/src/test/java/com/fishercoder/firstthousand/_678Test.java b/src/test/java/com/fishercoder/firstthousand/_678Test.java index e2ee9698d6..d953377274 100644 --- a/src/test/java/com/fishercoder/firstthousand/_678Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_678Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._678; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _678Test { private _678.Solution1 solution1; private _678.Solution2 solution2; @@ -41,9 +41,18 @@ public void test3() { @Test public void test4() { - assertEquals(false, solution1.checkValidString("(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); - assertEquals(false, solution2.checkValidString("(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); - assertEquals(false, solution3.checkValidString("(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); + assertEquals( + false, + solution1.checkValidString( + "(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); + assertEquals( + false, + solution2.checkValidString( + "(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); + assertEquals( + false, + solution3.checkValidString( + "(((()))())))*))())()(**(((())(()(*()((((())))*())(())*(*(()(*)))()*())**((()(()))())(*(*))*))())")); } @Test @@ -52,5 +61,4 @@ public void test5() { assertEquals(true, solution2.checkValidString("(((******)))")); assertEquals(true, solution3.checkValidString("(((******)))")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_679Test.java b/src/test/java/com/fishercoder/firstthousand/_679Test.java index 4f7abf670c..7636332698 100644 --- a/src/test/java/com/fishercoder/firstthousand/_679Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_679Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._679; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _679Test { private _679.Solution1 solution1; @@ -16,28 +16,27 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.judgePoint24(new int[]{4,1,8,7})); + assertEquals(true, solution1.judgePoint24(new int[] {4, 1, 8, 7})); } @Test public void test2() { - assertEquals(false, solution1.judgePoint24(new int[]{1,2,1,2})); + assertEquals(false, solution1.judgePoint24(new int[] {1, 2, 1, 2})); } @Test public void test3() { -// 8 / (1 - 2/3) = 24 - assertEquals(true, solution1.judgePoint24(new int[]{1,2,3,8})); + // 8 / (1 - 2/3) = 24 + assertEquals(true, solution1.judgePoint24(new int[] {1, 2, 3, 8})); } @Test public void test4() { - assertEquals(true, solution1.judgePoint24(new int[]{1,3,4,6})); + assertEquals(true, solution1.judgePoint24(new int[] {1, 3, 4, 6})); } @Test public void test5() { - assertEquals(true, solution1.judgePoint24(new int[]{1,9,1,2})); + assertEquals(true, solution1.judgePoint24(new int[] {1, 9, 1, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_67Test.java b/src/test/java/com/fishercoder/firstthousand/_67Test.java index 2a8483b2d2..63ee6d337a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_67Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_67Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._67; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _67Test { private _67.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_680Test.java b/src/test/java/com/fishercoder/firstthousand/_680Test.java index 59189d193a..687226b591 100644 --- a/src/test/java/com/fishercoder/firstthousand/_680Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_680Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._680; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _680Test { private _680.Solution1 solution1; private _680.Solution2 solution2; @@ -57,4 +57,4 @@ public void test7() { assertEquals(false, solution1.validPalindrome("abc")); assertEquals(false, solution2.validPalindrome("abc")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_681Test.java b/src/test/java/com/fishercoder/firstthousand/_681Test.java index afcb9304e1..f05f48f6fd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_681Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_681Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._681; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _681Test { private _681.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("19:39", solution1.nextClosestTime("19:34")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_682Test.java b/src/test/java/com/fishercoder/firstthousand/_682Test.java index e127035af4..7129f5f241 100644 --- a/src/test/java/com/fishercoder/firstthousand/_682Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_682Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._682; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _682Test { private _682.Solution1 solution1; private static String[] ops; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - ops = new String[]{"5", "2", "C", "D", "+"}; + ops = new String[] {"5", "2", "C", "D", "+"}; assertEquals(30, solution1.calPoints(ops)); } @Test public void test2() { - ops = new String[]{"5", "-2", "4", "C", "D", "9", "+", "+"}; + ops = new String[] {"5", "-2", "4", "C", "D", "9", "+", "+"}; assertEquals(27, solution1.calPoints(ops)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_683Test.java b/src/test/java/com/fishercoder/firstthousand/_683Test.java index ec388c46ba..cb7db00b9d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_683Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_683Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._683; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _683Test { private _683.Solution1 solution1; private static int[] flowers; @@ -18,16 +18,15 @@ public void setup() { @Test public void test1() { - flowers = new int[]{1, 3, 2}; + flowers = new int[] {1, 3, 2}; k = 1; assertEquals(2, solution1.kEmptySlots(flowers, k)); } @Test public void test2() { - flowers = new int[]{1, 2, 3}; + flowers = new int[] {1, 2, 3}; k = 1; assertEquals(-1, solution1.kEmptySlots(flowers, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_684Test.java b/src/test/java/com/fishercoder/firstthousand/_684Test.java index 78d2a8b99b..d746367e54 100644 --- a/src/test/java/com/fishercoder/firstthousand/_684Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_684Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._684; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _684Test { private _684.Solution1 solution1; private static int[][] edges; @@ -18,57 +18,60 @@ public void setup() { @Test public void test1() { - edges = new int[][]{ - {1, 2}, - {1, 3}, - {2, 3} - }; - expected = new int[]{2, 3}; + edges = + new int[][] { + {1, 2}, + {1, 3}, + {2, 3} + }; + expected = new int[] {2, 3}; assertArrayEquals(expected, solution1.findRedundantConnection(edges)); } @Test public void test2() { - edges = new int[][]{ - {1, 2}, - {2, 3}, - {3, 4}, - {1, 4}, - {1, 5} - }; - expected = new int[]{1, 4}; + edges = + new int[][] { + {1, 2}, + {2, 3}, + {3, 4}, + {1, 4}, + {1, 5} + }; + expected = new int[] {1, 4}; assertArrayEquals(expected, solution1.findRedundantConnection(edges)); } @Test public void test3() { - edges = new int[][]{ - {9, 10}, - {5, 8}, - {2, 6}, - {1, 5}, - {3, 8}, - {4, 9}, - {8, 10}, - {4, 10}, - {6, 8}, - {7, 9} - }; - expected = new int[]{4, 10}; + edges = + new int[][] { + {9, 10}, + {5, 8}, + {2, 6}, + {1, 5}, + {3, 8}, + {4, 9}, + {8, 10}, + {4, 10}, + {6, 8}, + {7, 9} + }; + expected = new int[] {4, 10}; assertArrayEquals(expected, solution1.findRedundantConnection(edges)); } @Test public void test4() { - edges = new int[][]{ - {1, 2}, - {2, 3}, - {1, 5}, - {3, 4}, - {1, 4} - }; - expected = new int[]{1, 4}; + edges = + new int[][] { + {1, 2}, + {2, 3}, + {1, 5}, + {3, 4}, + {1, 4} + }; + expected = new int[] {1, 4}; assertArrayEquals(expected, solution1.findRedundantConnection(edges)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_685Test.java b/src/test/java/com/fishercoder/firstthousand/_685Test.java index 937111c7e1..8962f7c38e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_685Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_685Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._685; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _685Test { private _685.Solution1 solution1; private _685.Solution2 solution2; @@ -20,39 +20,42 @@ public void setup() { @Test public void test1() { - edges = new int[][]{ - {2, 1}, - {3, 1}, - {4, 2}, - {1, 4} - }; - expected = new int[]{2, 1}; + edges = + new int[][] { + {2, 1}, + {3, 1}, + {4, 2}, + {1, 4} + }; + expected = new int[] {2, 1}; assertArrayEquals(expected, solution1.findRedundantDirectedConnection(edges)); assertArrayEquals(expected, solution2.findRedundantDirectedConnection(edges)); } @Test public void test2() { - edges = new int[][]{ - {2, 1}, - {1, 4}, - {4, 3}, - {3, 2} - }; - expected = new int[]{3, 2}; + edges = + new int[][] { + {2, 1}, + {1, 4}, + {4, 3}, + {3, 2} + }; + expected = new int[] {3, 2}; assertArrayEquals(expected, solution1.findRedundantDirectedConnection(edges)); assertArrayEquals(expected, solution2.findRedundantDirectedConnection(edges)); } @Test public void test3() { - edges = new int[][]{ - {1, 2}, - {1, 3}, - {2, 3}, - }; - expected = new int[]{2, 3}; -// assertArrayEquals(expected, solution1.findRedundantDirectedConnection(edges)); + edges = + new int[][] { + {1, 2}, + {1, 3}, + {2, 3}, + }; + expected = new int[] {2, 3}; + // assertArrayEquals(expected, solution1.findRedundantDirectedConnection(edges)); assertArrayEquals(expected, solution2.findRedundantDirectedConnection(edges)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_686Test.java b/src/test/java/com/fishercoder/firstthousand/_686Test.java index 0d7091486f..1dcf28d042 100644 --- a/src/test/java/com/fishercoder/firstthousand/_686Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_686Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._686; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _686Test { private _686.Solution1 solution1; private _686.Solution2 solution2; @@ -48,10 +48,15 @@ public void test5() { @Test public void test6() { - assertEquals(-1, solution1.repeatedStringMatch("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaba")); - assertEquals(-1, solution2.repeatedStringMatch("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaba")); + assertEquals( + -1, + solution1.repeatedStringMatch( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaba")); + assertEquals( + -1, + solution2.repeatedStringMatch( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaba")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_687Test.java b/src/test/java/com/fishercoder/firstthousand/_687Test.java index fb745b8b95..35ed371dce 100644 --- a/src/test/java/com/fishercoder/firstthousand/_687Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_687Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._687; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _687Test { private _687.Solution1 solution1; private static TreeNode root; @@ -40,10 +39,149 @@ public void test3() { } @Test - public void test4() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 5, 8, 9, 7, 7, 8, 1, 4, 8, 1, 9, 0, 8, 7, 1, 7, 4, 2, 9, 8, 2, 4, null, null, 9, null, null, null, 6, 0, 9, 4, 1, 0, 1, 8, 9, 0, 1, 8, 9, 1, 0, 9, 6, 2, 5, null, 2, 3, 0, 2, 4, 8, 8, 8, 5, 0, 0, 9, 4, 9, 1, null, 0, 7, 2, 2, 3, null, 6, 1, 0, 8, 9, 9, 9, 4, 8, 4, 3, 4, 4, 0, null, null, 8, 3, 8, null, null, 0, null, 0, 4, 9, 1, 2, null, 4, 4, 0, 4, 3, 5, 5, 7, 4, 1, 6, null, 1, 0, null, null, null, 2, 8, 7, 7, null, null, 0, 2, 5, 5, 9, 3, 3, null, 7, 6, 6, 7, 9, 8, 1, 7, 7, 7, 2, 6, null, 7, null, 4, 6, 4, 6, null, null, 9, 1, null, null, null, 5, 5, 5, 4, 2, 2, 8, 5, 1, 1, 3, 1, 3, 7, null, 2, null, 9, 1, 4, 4, 7, 7, null, 1, 5, 6, 2, 7, 3, null, 9, 1, null, 2, 4, 4, 8, null, null, 7, null, 6, null, 7, 4, 3, 5, 8, 4, 8, 5, null, null, 8, null, null, null, 4, 4, null, null, null, null, 8, 3, 5, 5, null, null, null, 1, 2, 0, null, null, 9, 3, null, 8, 3, 7, 1, 8, 9, 0, 1, 8, 2, null, 4, null, null, 8, null, null, null, null, 2, null, 4, 8, 5, 5, 3, 1, null, null, 6, null, 1, null, null, 6, null, null, null, null, 7, 3, null, null, null, 8, 6, 4, null, 6, 9, 0, 7, 8, null, null, 0, 6, 7, null, null, 0, 0, 7, 2, 3, 2, null, 0, 2, 3, null, 0, 1, 7, 9, 0, 7, null, null, null, null, 5, 8, 2, 6, 3, 2, 0, 4, null, null, 0, 9, 1, 1, 1, null, 1, 3, null, 7, 9, 1, 3, 3, 8, null, null, null, null, 6, null, null, null, null, 9, 8, 1, 3, 8, 3, 0, 6, null, null, 8, 5, 6, 5, 2, 1, null, 5, null, 7, 0, 0, null, 9, 3, 9, null, 3, 0, 0, 9, 1, 7, 0, 2, null, 6, 8, 5, null, null, null, null, null, 7, null, 2, 5, null, null, 9, null, null, null, null, null, null, null, null, null, null, null, 4, 1, null, 3, 6, 6, 2, 5, 5, 9, null, null, 7, 8, null, null, 2, 7, 3, 7, 2, 5, null, 1, 3, 4, null, null, 8, 3, 6, 9, null, 1, null, null, null, null, 9, 7, 5, 2, null, 5, null, 6, 4, 5, null, 1, 2, 0, 6, null, 1, 6, null, null, 5, null, 7, 8, 4, 7, 8, 6, 4, null, 5, 6, 7, 9, 1, 0, 4, null, null, null, 6, 4, 8, 4, 5, null, 0, 4, 4, 0, 1, 7, 1, null, 1, null, 3, 6, null, null, null, null, 8, null, 5, 0, 7, 5, null, null, 5, 8, null, null, 3, null, null, 8, null, 2, 4, null, null, null, null, null, null, null, 9, null, 9, null, 9, null, null, null, null, 7, 1, null, null, 2, null, null, 5, 5, 5, 5, 6, 4, null, null, 1, 6, 4, 0, null, 0, 6, 3, 0, null, 5, 5, null, null, null, null, 2, null, 3, 6, null, 3, 0, 5, 0, 1, 0, 3, 4, 9, 9, 2, 7, 3, 8, 6, 9, null, 5, 8, null, null, null, null, 9, 8, 0, 7, null, null, 8, 8, 6, 6, 0, 2, 7, 4, 2, 3, 8, 6, 4, null, 8, null, null, null, 2, 0, null, 1, 3, 5, 4, 2, 2, 5, 8, 8, null, 3, 0, null, 1, 6, 0, null, null, 9, null, 2, null, 6, 8, 2, null, null, 5, null, null, null, 9, 6, 6, 4, 2, 0, null, null, 1, null, 0, null, null, null, 6, 6, null, null, null, 4, 7, 9, null, 0, 1, null, null, 9, null, null, null, 4, null, 8, null, null, null, null, null, null, 4, null, 6, null, 3, null, null, 5, 1, 2, 5, null, 0, 7, 8, null, 7, null, null, 4, null, 4, 4, null, 2, null, 6, null, null, null, 7, null, null, null, null, 6, 4, null, 6, null, 6, 9, null, null, null, 9, 6, null, 9, null, 3, null, 2, null, 7, 7, null, null, 0, null, 6, 3, null, null, null, null, null, null, 1, null, null, null, 6, 9, 7, null, 7, null, 9, 3, 3, null, null, null, null, 4, null, null, 3, null, null, null, 3, 9, null, 0, 3, 1, 9, 6, 7, 9, 4, 8, null, null, 6, null, 1, 3, 7, null, null, null, 3, null, 2, null, 8, 1, 1, null, null, 6, null, 7, 3, 5, null, 6, 3, 4, null, null, 5, 7, 1, null, null, 6, 4, 6, null, null, null, null, 5, 7, 0, 7, 0, null, 5, 8, 5, 5, 4, 5, null, null, null, null, null, null, 1, 7, null, null, 7, null, 9, 9, 6, 4, null, null, 3, 2, 1, null, 0, null, 0, 6, null, null, null, 1, 5, null, null, null, 8, null, null, null, null, 3, 4, 8, null, null, 9, 6, 4, null, null, null, null, 8, 9, null, 1, null, null, null, 7, null, null, null, null, null, 9, null, null, null, 4, 1, 6, 7, 0, null, null, null, 7, null, null, 8, null, null, null, null, null, null, null, 4, null, 9, null, null, null, null, 3, 0, 6, null, 5, null, 9, 9, null, null, 4, 3, 4, null, null, null, null, 8, null, 5, null, null, null, null, 5, 2, null, null, null, null, null, null, null, 2, null, null, 2, 1, 8, 5, null, 0, null, 0, 3, 2, 4, 5, null, null, null, null, null, 7, null, null, 0, null, 0, null, null, null, 0, 3, 9, null, null, null, null, 5, null, null, 0, 5, 0, 0, null, 9, null, null, null, null, null, null, null, null, 8, null, 9, 3, 5, 9, 0, 5, 9, null, null, 9, 4, null, 0, 2, 0, null, null, 7, null, 7, null, 5, 7, 8, 7, null, null, null, 3, 0, 3, null, null, null, null, null, 4, 5, null, null, 2, 3, null, 2, null, null, 7, null, null, 9, null, null, 9, 7, 1, null, null, 1, 6, 1, 8, null, null, 5, null, null, 3, 7, 9, 6, null, null, null, null, 1, null, null, null, 3, 7, 3, 2, 3, 3, null, 1, null, null, null, 1, null, null, 4, 3, 4, 8, 7, null, 0, 3, 0, null, 1, 1, null, null, null, null, null, 5, null, 6, 0, null, 3, 1, null, 6, null, null, 4, 0, 1, null, 6, 1, null, null, 9, 6, 4, 9, 0, 8, 9, 3, 3, 6, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 8, 5, 8, 3, 5, 4, null, 6, null, 0, null, null, 6, null, 4, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, 3, null, null, 1, null, 2, 4, null, null, null, 6, null, null, null, 6, null, 5, null, null, null, null, 1, null, null, 3, null, 1, null, 7, 1, null, null, 7, 1, 3, 4, 8, null, null, null, null, null, 4, null, null, 4, null, null, null, 7, null, 6, null, null, 1, null, null, null, 7, 3, 3, null, null, null, null, 3, 0, null, null, 4, null, null, null, null, null, null, null, null, null, null, 8, null, null, 9, null, null, 6, 6, 5, 2, null, 8, 3, 8, null, null, null, null, 6, 7, 0, null, null, null, null, 1, 1, 5, null, 0, 5, null, 5, null, null, null, 1, 2, null, 2, 9, 1, null, 2, 4, 1, null, null, null, 1, 8, 4, 4, 5, 2, null, null, 6, 4, 7, 5, 2, 9, null, 4, null, null, null, null, null, 3, null, null, 5, 9, null, null, null, null, 9, null, 9, null, null, null, 2, null, 1, 9, null, null, null, null, null, 1, 9, 3, null, null, 1, 9, null, 5, 2, 1, 0, null, null, 1, 9, 8, 4, 7, null, null, 5, 7, null, null, null, null, 1, 2, 8, null, 6, 0, null, null, null, null, 0, null, null, null, 6, null, 2, 3, 0, 9, null, null, 1, 4, 6, null, 8, null, null, 5, null, 3, 0, null, 6, null, null, null, null, null, 2, null, null, null, null, null, null, 2, 5, 8, 6, 9, null, null, null, 8, null, null, 9, 6, null, null, null, null, 3, null, null, null, null, 9, null, null, 2, null, null, null, null, null, null, 8, 8, null, null, null, null, null, 9, null, 6, null, 2, 5, null, null, 1, 2, null, 4, null, null, 4, null, null, 3, 5, null, 3, 3, null, null, 1, null, null, null, null, 4, null, 2, 3, null, 4, 5, 3, null, 7, null, null, null, 7, 6, null, null, 1, 3, null, 4, 9, 8, null, null, 0, null, 3, 4, null, 8, null, 1, null, null, 2, 2, null, null, 4, null, null, null, 3, null, null, 2, null, null, null, 4, null, 5, null, null, null, null, 2, null, 5, null, null, null, null, null, null, 2, 7, 5, null, 6, null, null, null, null, 2, null, 0, null, 3, null, 1, null, 9, 4, null, 3, null, null, null, null, null, null, null, 5, 5, 7, null, null, 1, null, 4, 6, null, null, null, 2, null, 5, 9, 0, 6, 2, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 7, null, 2, 9, null, null, 1, null, null, null, 1, 6, null, 6, null, null, 0, 8, null, 4, null, null, null, null, 4, null, null, 0, null, 6, 0, null, null, null, 4, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 0, 5, 4, 2, 6, 4, 5, 3, 4, null, null, 5, null, null, null, null, 4, null, null, 3, 6, 2, 0, null, 6, 6, null, null, null, null, 0, 6, null, null, null, 3, 9, 4, null, null, null, null, null, 0, null, null, 6, 7, 0, null, 9, 2, null, 3, 3, null, null, 8, null, 3, null, null, null, 8, 5, 3, null, 2, 4, null, 9, 6, 9, null, null, null, null, 6, null, 6, null, 5, 3, null, null, null, null, 4, null, null, null, 9, 0, 9, 7, 1, 1, null, 1, null, 1, 6, null, 5, null, 6, null, null, 1, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, 6, 1, null, 0, 2, null, null, 0, null, null, 0, null, null, null, null, null, 3, null, null, 8, null, null, 5, 3, 3, null, null, null, null, null, null, null, 3, null, null, 0, 8, 7, null, null, 8, 1, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 5, 2, null, 2, 6, null, null, null, null, null, null, null, 1, 5, 0, null, null, 2, null, 7, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, 3, null, null, 4, null, null, 2, null, null, null, null, 0, 3, null, null, null, null, null, 7, null, 8, null, null, null, null, 8, 5, null, 3, 4, null, null, null, 8, null, null, null, null, null, null, null, null, null, 3, 7, null, null, null, 4, 0, 3, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 0, null, null, null, 2, null, null, null, 8, 2, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, 2, 5, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 0, 5)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 5, 8, 9, 7, 7, 8, 1, 4, 8, 1, 9, 0, 8, 7, 1, 7, 4, 2, 9, 8, 2, 4, + null, null, 9, null, null, null, 6, 0, 9, 4, 1, 0, 1, 8, 9, 0, 1, 8, + 9, 1, 0, 9, 6, 2, 5, null, 2, 3, 0, 2, 4, 8, 8, 8, 5, 0, 0, 9, 4, 9, + 1, null, 0, 7, 2, 2, 3, null, 6, 1, 0, 8, 9, 9, 9, 4, 8, 4, 3, 4, 4, + 0, null, null, 8, 3, 8, null, null, 0, null, 0, 4, 9, 1, 2, null, 4, + 4, 0, 4, 3, 5, 5, 7, 4, 1, 6, null, 1, 0, null, null, null, 2, 8, 7, + 7, null, null, 0, 2, 5, 5, 9, 3, 3, null, 7, 6, 6, 7, 9, 8, 1, 7, 7, + 7, 2, 6, null, 7, null, 4, 6, 4, 6, null, null, 9, 1, null, null, + null, 5, 5, 5, 4, 2, 2, 8, 5, 1, 1, 3, 1, 3, 7, null, 2, null, 9, 1, + 4, 4, 7, 7, null, 1, 5, 6, 2, 7, 3, null, 9, 1, null, 2, 4, 4, 8, + null, null, 7, null, 6, null, 7, 4, 3, 5, 8, 4, 8, 5, null, null, 8, + null, null, null, 4, 4, null, null, null, null, 8, 3, 5, 5, null, + null, null, 1, 2, 0, null, null, 9, 3, null, 8, 3, 7, 1, 8, 9, 0, 1, + 8, 2, null, 4, null, null, 8, null, null, null, null, 2, null, 4, 8, + 5, 5, 3, 1, null, null, 6, null, 1, null, null, 6, null, null, null, + null, 7, 3, null, null, null, 8, 6, 4, null, 6, 9, 0, 7, 8, null, + null, 0, 6, 7, null, null, 0, 0, 7, 2, 3, 2, null, 0, 2, 3, null, 0, + 1, 7, 9, 0, 7, null, null, null, null, 5, 8, 2, 6, 3, 2, 0, 4, null, + null, 0, 9, 1, 1, 1, null, 1, 3, null, 7, 9, 1, 3, 3, 8, null, null, + null, null, 6, null, null, null, null, 9, 8, 1, 3, 8, 3, 0, 6, null, + null, 8, 5, 6, 5, 2, 1, null, 5, null, 7, 0, 0, null, 9, 3, 9, null, + 3, 0, 0, 9, 1, 7, 0, 2, null, 6, 8, 5, null, null, null, null, null, + 7, null, 2, 5, null, null, 9, null, null, null, null, null, null, + null, null, null, null, null, 4, 1, null, 3, 6, 6, 2, 5, 5, 9, null, + null, 7, 8, null, null, 2, 7, 3, 7, 2, 5, null, 1, 3, 4, null, null, + 8, 3, 6, 9, null, 1, null, null, null, null, 9, 7, 5, 2, null, 5, + null, 6, 4, 5, null, 1, 2, 0, 6, null, 1, 6, null, null, 5, null, 7, + 8, 4, 7, 8, 6, 4, null, 5, 6, 7, 9, 1, 0, 4, null, null, null, 6, 4, + 8, 4, 5, null, 0, 4, 4, 0, 1, 7, 1, null, 1, null, 3, 6, null, null, + null, null, 8, null, 5, 0, 7, 5, null, null, 5, 8, null, null, 3, + null, null, 8, null, 2, 4, null, null, null, null, null, null, null, + 9, null, 9, null, 9, null, null, null, null, 7, 1, null, null, 2, + null, null, 5, 5, 5, 5, 6, 4, null, null, 1, 6, 4, 0, null, 0, 6, 3, + 0, null, 5, 5, null, null, null, null, 2, null, 3, 6, null, 3, 0, 5, + 0, 1, 0, 3, 4, 9, 9, 2, 7, 3, 8, 6, 9, null, 5, 8, null, null, null, + null, 9, 8, 0, 7, null, null, 8, 8, 6, 6, 0, 2, 7, 4, 2, 3, 8, 6, 4, + null, 8, null, null, null, 2, 0, null, 1, 3, 5, 4, 2, 2, 5, 8, 8, + null, 3, 0, null, 1, 6, 0, null, null, 9, null, 2, null, 6, 8, 2, + null, null, 5, null, null, null, 9, 6, 6, 4, 2, 0, null, null, 1, + null, 0, null, null, null, 6, 6, null, null, null, 4, 7, 9, null, 0, + 1, null, null, 9, null, null, null, 4, null, 8, null, null, null, + null, null, null, 4, null, 6, null, 3, null, null, 5, 1, 2, 5, null, + 0, 7, 8, null, 7, null, null, 4, null, 4, 4, null, 2, null, 6, null, + null, null, 7, null, null, null, null, 6, 4, null, 6, null, 6, 9, + null, null, null, 9, 6, null, 9, null, 3, null, 2, null, 7, 7, null, + null, 0, null, 6, 3, null, null, null, null, null, null, 1, null, + null, null, 6, 9, 7, null, 7, null, 9, 3, 3, null, null, null, null, + 4, null, null, 3, null, null, null, 3, 9, null, 0, 3, 1, 9, 6, 7, 9, + 4, 8, null, null, 6, null, 1, 3, 7, null, null, null, 3, null, 2, + null, 8, 1, 1, null, null, 6, null, 7, 3, 5, null, 6, 3, 4, null, + null, 5, 7, 1, null, null, 6, 4, 6, null, null, null, null, 5, 7, 0, + 7, 0, null, 5, 8, 5, 5, 4, 5, null, null, null, null, null, null, 1, + 7, null, null, 7, null, 9, 9, 6, 4, null, null, 3, 2, 1, null, 0, + null, 0, 6, null, null, null, 1, 5, null, null, null, 8, null, null, + null, null, 3, 4, 8, null, null, 9, 6, 4, null, null, null, null, 8, + 9, null, 1, null, null, null, 7, null, null, null, null, null, 9, + null, null, null, 4, 1, 6, 7, 0, null, null, null, 7, null, null, 8, + null, null, null, null, null, null, null, 4, null, 9, null, null, + null, null, 3, 0, 6, null, 5, null, 9, 9, null, null, 4, 3, 4, null, + null, null, null, 8, null, 5, null, null, null, null, 5, 2, null, + null, null, null, null, null, null, 2, null, null, 2, 1, 8, 5, null, + 0, null, 0, 3, 2, 4, 5, null, null, null, null, null, 7, null, null, + 0, null, 0, null, null, null, 0, 3, 9, null, null, null, null, 5, + null, null, 0, 5, 0, 0, null, 9, null, null, null, null, null, null, + null, null, 8, null, 9, 3, 5, 9, 0, 5, 9, null, null, 9, 4, null, 0, + 2, 0, null, null, 7, null, 7, null, 5, 7, 8, 7, null, null, null, 3, + 0, 3, null, null, null, null, null, 4, 5, null, null, 2, 3, null, 2, + null, null, 7, null, null, 9, null, null, 9, 7, 1, null, null, 1, 6, + 1, 8, null, null, 5, null, null, 3, 7, 9, 6, null, null, null, null, + 1, null, null, null, 3, 7, 3, 2, 3, 3, null, 1, null, null, null, 1, + null, null, 4, 3, 4, 8, 7, null, 0, 3, 0, null, 1, 1, null, null, + null, null, null, 5, null, 6, 0, null, 3, 1, null, 6, null, null, 4, + 0, 1, null, 6, 1, null, null, 9, 6, 4, 9, 0, 8, 9, 3, 3, 6, null, + null, null, null, null, null, null, null, null, null, null, null, 2, + null, null, null, null, null, 8, 5, 8, 3, 5, 4, null, 6, null, 0, + null, null, 6, null, 4, 3, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, 7, 3, null, null, 1, null, + 2, 4, null, null, null, 6, null, null, null, 6, null, 5, null, null, + null, null, 1, null, null, 3, null, 1, null, 7, 1, null, null, 7, 1, + 3, 4, 8, null, null, null, null, null, 4, null, null, 4, null, null, + null, 7, null, 6, null, null, 1, null, null, null, 7, 3, 3, null, + null, null, null, 3, 0, null, null, 4, null, null, null, null, null, + null, null, null, null, null, 8, null, null, 9, null, null, 6, 6, 5, + 2, null, 8, 3, 8, null, null, null, null, 6, 7, 0, null, null, null, + null, 1, 1, 5, null, 0, 5, null, 5, null, null, null, 1, 2, null, 2, + 9, 1, null, 2, 4, 1, null, null, null, 1, 8, 4, 4, 5, 2, null, null, + 6, 4, 7, 5, 2, 9, null, 4, null, null, null, null, null, 3, null, + null, 5, 9, null, null, null, null, 9, null, 9, null, null, null, 2, + null, 1, 9, null, null, null, null, null, 1, 9, 3, null, null, 1, 9, + null, 5, 2, 1, 0, null, null, 1, 9, 8, 4, 7, null, null, 5, 7, null, + null, null, null, 1, 2, 8, null, 6, 0, null, null, null, null, 0, + null, null, null, 6, null, 2, 3, 0, 9, null, null, 1, 4, 6, null, 8, + null, null, 5, null, 3, 0, null, 6, null, null, null, null, null, 2, + null, null, null, null, null, null, 2, 5, 8, 6, 9, null, null, null, + 8, null, null, 9, 6, null, null, null, null, 3, null, null, null, + null, 9, null, null, 2, null, null, null, null, null, null, 8, 8, + null, null, null, null, null, 9, null, 6, null, 2, 5, null, null, 1, + 2, null, 4, null, null, 4, null, null, 3, 5, null, 3, 3, null, null, + 1, null, null, null, null, 4, null, 2, 3, null, 4, 5, 3, null, 7, + null, null, null, 7, 6, null, null, 1, 3, null, 4, 9, 8, null, null, + 0, null, 3, 4, null, 8, null, 1, null, null, 2, 2, null, null, 4, + null, null, null, 3, null, null, 2, null, null, null, 4, null, 5, + null, null, null, null, 2, null, 5, null, null, null, null, null, + null, 2, 7, 5, null, 6, null, null, null, null, 2, null, 0, null, 3, + null, 1, null, 9, 4, null, 3, null, null, null, null, null, null, + null, 5, 5, 7, null, null, 1, null, 4, 6, null, null, null, 2, null, + 5, 9, 0, 6, 2, null, null, null, null, null, null, null, null, null, + null, null, null, 5, null, 7, null, 2, 9, null, null, 1, null, null, + null, 1, 6, null, 6, null, null, 0, 8, null, 4, null, null, null, + null, 4, null, null, 0, null, 6, 0, null, null, null, 4, null, null, + null, null, null, 0, null, null, null, null, null, null, null, null, + null, null, null, null, 0, 5, 4, 2, 6, 4, 5, 3, 4, null, null, 5, + null, null, null, null, 4, null, null, 3, 6, 2, 0, null, 6, 6, null, + null, null, null, 0, 6, null, null, null, 3, 9, 4, null, null, null, + null, null, 0, null, null, 6, 7, 0, null, 9, 2, null, 3, 3, null, + null, 8, null, 3, null, null, null, 8, 5, 3, null, 2, 4, null, 9, 6, + 9, null, null, null, null, 6, null, 6, null, 5, 3, null, null, null, + null, 4, null, null, null, 9, 0, 9, 7, 1, 1, null, 1, null, 1, 6, + null, 5, null, 6, null, null, 1, null, null, null, null, null, null, + 5, null, null, null, null, null, 3, null, 6, 1, null, 0, 2, null, + null, 0, null, null, 0, null, null, null, null, null, 3, null, null, + 8, null, null, 5, 3, 3, null, null, null, null, null, null, null, 3, + null, null, 0, 8, 7, null, null, 8, 1, null, null, null, null, null, + null, 7, null, null, null, null, null, null, null, null, null, null, + null, 5, 2, null, 2, 6, null, null, null, null, null, null, null, 1, + 5, 0, null, null, 2, null, 7, null, null, 6, null, null, null, null, + null, null, null, null, null, null, null, null, null, 8, null, null, + null, null, 3, null, null, 4, null, null, 2, null, null, null, null, + 0, 3, null, null, null, null, null, 7, null, 8, null, null, null, + null, 8, 5, null, 3, 4, null, null, null, 8, null, null, null, null, + null, null, null, null, null, 3, 7, null, null, null, 4, 0, 3, null, + null, 6, null, null, null, null, null, null, null, null, null, null, + null, null, 8, null, null, null, null, null, 2, null, null, null, + null, null, null, null, null, null, 0, null, null, null, 2, null, + null, null, 8, 2, null, null, null, null, null, null, null, 8, null, + null, null, null, null, null, null, null, null, null, 2, null, null, + null, 2, 5, null, null, null, null, null, null, null, null, null, + null, null, 2, null, null, null, null, null, 8, null, null, null, + null, null, null, null, null, null, null, 0, 5)); assertEquals(2, solution1.longestUnivaluePath(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_688Test.java b/src/test/java/com/fishercoder/firstthousand/_688Test.java index 7f5e29f275..b98a2e4a04 100644 --- a/src/test/java/com/fishercoder/firstthousand/_688Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_688Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._688; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _688Test { private _688.Solution1 solution1; private _688.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_689Test.java b/src/test/java/com/fishercoder/firstthousand/_689Test.java index 18e375517d..7c0a8a4e9d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_689Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_689Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._689; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _689Test { private _689.Solution1 solution1; private static int[] nums; @@ -19,8 +19,8 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 1, 2, 6, 7, 5, 1}; - expected = new int[]{0, 3, 5}; + nums = new int[] {1, 2, 1, 2, 6, 7, 5, 1}; + expected = new int[] {0, 3, 5}; k = 2; assertArrayEquals(expected, solution1.maxSumOfThreeSubarrays(nums, 2)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_68Test.java b/src/test/java/com/fishercoder/firstthousand/_68Test.java index 11003b7ade..8887bb9ecd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_68Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_68Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._68; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _68Test { private _68.Solution1 solution1; private static String[] words; @@ -20,21 +19,24 @@ public void setup() { @Test public void test1() { words = - new String[]{"This", "is", "a", "good", "test!", "\n", "What", "do", "you", "\n", "think?", - "\n", "I", "think", "so", "too!"}; - assertEquals(Arrays.asList( - "This is a good", - "test! \n What do", - "you \n think? \n I", - "think so too! "), solution1.fullJustify(words, 16)); + new String[] { + "This", "is", "a", "good", "test!", "\n", "What", "do", "you", "\n", "think?", + "\n", "I", "think", "so", "too!" + }; + assertEquals( + Arrays.asList( + "This is a good", + "test! \n What do", + "you \n think? \n I", + "think so too! "), + solution1.fullJustify(words, 16)); } @Test public void test2() { - words = new String[]{"This", "is", "an", "example", "of", "text", "justification."}; - assertEquals(Arrays.asList( - "This is an", - "example of text", - "justification. "), solution1.fullJustify(words, 16)); + words = new String[] {"This", "is", "an", "example", "of", "text", "justification."}; + assertEquals( + Arrays.asList("This is an", "example of text", "justification. "), + solution1.fullJustify(words, 16)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_690Test.java b/src/test/java/com/fishercoder/firstthousand/_690Test.java index e2e21919e4..5dda2e4834 100644 --- a/src/test/java/com/fishercoder/firstthousand/_690Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_690Test.java @@ -1,19 +1,16 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.Employee; import com.fishercoder.solutions.firstthousand._690; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/18/17. - */ +/** Created by fishercoder on 5/18/17. */ public class _690Test { private _690.Solution1 solution1; private static List employees; @@ -26,23 +23,26 @@ public void setupForEachTest() { @Test public void test1() { - employees = new ArrayList(Arrays.asList( - new Employee(1, 5, Arrays.asList(2,3)), - new Employee(2, 3, Arrays.asList()), - new Employee(3, 3, Arrays.asList()))); + employees = + new ArrayList( + Arrays.asList( + new Employee(1, 5, Arrays.asList(2, 3)), + new Employee(2, 3, Arrays.asList()), + new Employee(3, 3, Arrays.asList()))); id = 1; assertEquals(11, solution1.getImportance(employees, id)); } @Test public void test2() { - employees = new ArrayList(Arrays.asList( - new Employee(1, 5, Arrays.asList(2,3)), - new Employee(2, 3, Arrays.asList(4)), - new Employee(3, 4, Arrays.asList()), - new Employee(4, 1, Arrays.asList()))); + employees = + new ArrayList( + Arrays.asList( + new Employee(1, 5, Arrays.asList(2, 3)), + new Employee(2, 3, Arrays.asList(4)), + new Employee(3, 4, Arrays.asList()), + new Employee(4, 1, Arrays.asList()))); id = 1; assertEquals(13, solution1.getImportance(employees, id)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_692Test.java b/src/test/java/com/fishercoder/firstthousand/_692Test.java index ce2b958e7d..d01abb59bc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_692Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_692Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._692; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._692; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _692Test { private _692.Solution1 solution1; @@ -23,10 +22,9 @@ public void setup() { @Test public void test1() { - words = new String[]{"i", "love", "leetcode", "i", "love", "coding"}; + words = new String[] {"i", "love", "leetcode", "i", "love", "coding"}; actual = solution1.topKFrequent(words, 2); expected = new ArrayList<>(Arrays.asList("i", "love")); assertEquals(expected, actual); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_694Test.java b/src/test/java/com/fishercoder/firstthousand/_694Test.java index d2438f6e77..4b6dbd4a4e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_694Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_694Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._694; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _694Test { private _694.Solution1 solution1; private static int[][] grid; @@ -17,23 +17,25 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {1, 1, 0, 1, 1}, - {1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1}, - {1, 1, 0, 1, 1} - }; + grid = + new int[][] { + {1, 1, 0, 1, 1}, + {1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1}, + {1, 1, 0, 1, 1} + }; assertEquals(3, solution1.numDistinctIslands(grid)); } @Test public void test2() { - grid = new int[][]{ - {1, 1, 0, 0, 0}, - {1, 1, 0, 0, 0}, - {0, 0, 0, 1, 1}, - {0, 0, 0, 1, 1} - }; + grid = + new int[][] { + {1, 1, 0, 0, 0}, + {1, 1, 0, 0, 0}, + {0, 0, 0, 1, 1}, + {0, 0, 0, 1, 1} + }; assertEquals(1, solution1.numDistinctIslands(grid)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_695Test.java b/src/test/java/com/fishercoder/firstthousand/_695Test.java index 26abce0bea..ca7baaefd1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_695Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_695Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._695; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _695Test { private _695.Solution1 solution1; private _695.Solution2 solution2; @@ -20,94 +20,98 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}, - {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0} - }; + grid = + new int[][] { + {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, + {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0} + }; assertEquals(6, solution1.maxAreaOfIsland(grid)); } @Test public void test2() { - grid = new int[][]{ - {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}, - {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0} - }; + grid = + new int[][] { + {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, + {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0} + }; assertEquals(6, solution2.maxAreaOfIsland(grid)); } @Test public void test3() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]"); assertEquals(4, solution2.maxAreaOfIsland(grid)); } @Test public void test4() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," - + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," + + "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"); assertEquals(2500, solution2.maxAreaOfIsland(grid)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_697Test.java b/src/test/java/com/fishercoder/firstthousand/_697Test.java index 088e82c883..f4dcc43364 100644 --- a/src/test/java/com/fishercoder/firstthousand/_697Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_697Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._697; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _697Test { private _697.Solution1 solution1; private _697.Solution2 solution2; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1}; + nums = new int[] {1}; assertEquals(1, solution1.findShortestSubArray(nums)); assertEquals(1, solution2.findShortestSubArray(nums)); assertEquals(1, solution3.findShortestSubArray(nums)); @@ -29,7 +29,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{1, 2, 2, 3, 1}; + nums = new int[] {1, 2, 2, 3, 1}; assertEquals(2, solution1.findShortestSubArray(nums)); assertEquals(2, solution2.findShortestSubArray(nums)); assertEquals(2, solution3.findShortestSubArray(nums)); @@ -37,7 +37,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{1, 2, 2, 3, 1, 1}; + nums = new int[] {1, 2, 2, 3, 1, 1}; assertEquals(6, solution1.findShortestSubArray(nums)); assertEquals(6, solution2.findShortestSubArray(nums)); assertEquals(6, solution3.findShortestSubArray(nums)); @@ -45,7 +45,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{1, 2, 2, 3, 1, 1, 5}; + nums = new int[] {1, 2, 2, 3, 1, 1, 5}; assertEquals(6, solution1.findShortestSubArray(nums)); assertEquals(6, solution2.findShortestSubArray(nums)); assertEquals(6, solution3.findShortestSubArray(nums)); @@ -53,10 +53,9 @@ public void test4() { @Test public void test5() { - nums = new int[]{1, 2, 2, 3, 1, 4, 2}; + nums = new int[] {1, 2, 2, 3, 1, 4, 2}; assertEquals(6, solution1.findShortestSubArray(nums)); assertEquals(6, solution2.findShortestSubArray(nums)); assertEquals(6, solution3.findShortestSubArray(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_698Test.java b/src/test/java/com/fishercoder/firstthousand/_698Test.java index 9a76bd2156..a0771d8bd7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_698Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_698Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._698; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _698Test { private _698.Solution1 solution1; private _698.Solution2 solution2; @@ -20,66 +20,69 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 3, 2, 3, 5, 2, 1}; + nums = new int[] {4, 3, 2, 3, 5, 2, 1}; k = 4; assertEquals(true, solution1.canPartitionKSubsets(nums, k)); } @Test public void test2() { - nums = new int[]{-1, 1, 0, 0}; + nums = new int[] {-1, 1, 0, 0}; k = 4; assertEquals(false, solution1.canPartitionKSubsets(nums, k)); } @Test public void test3() { - nums = new int[]{4, 3, 2, 3, 5, 2, 1}; + nums = new int[] {4, 3, 2, 3, 5, 2, 1}; k = 4; assertEquals(true, solution2.canPartitionKSubsets(nums, k)); } @Test public void test4() { - nums = new int[]{-1, 1, 0, 0}; + nums = new int[] {-1, 1, 0, 0}; k = 4; assertEquals(false, solution2.canPartitionKSubsets(nums, k)); } @Test public void test5() { - nums = new int[]{2, 2, 2, 2, 3, 4, 5}; + nums = new int[] {2, 2, 2, 2, 3, 4, 5}; k = 4; assertEquals(false, solution2.canPartitionKSubsets(nums, k)); } @Test public void test6() { - nums = new int[]{1, 2, 3, 4}; + nums = new int[] {1, 2, 3, 4}; k = 3; assertEquals(false, solution2.canPartitionKSubsets(nums, k)); } @Test public void test7() { - nums = new int[]{1, 1, 1, 1, 2, 2, 2, 2}; + nums = new int[] {1, 1, 1, 1, 2, 2, 2, 2}; k = 3; assertEquals(true, solution2.canPartitionKSubsets(nums, k)); } @Test public void test8() { - /**This test case clearly shows how backtracking plays out beautifully!*/ - nums = new int[]{3522, 181, 521, 515, 304, 123, 2512, 312, 922, 407, 146, 1932, 4037, 2646, 3871, 269}; + /** This test case clearly shows how backtracking plays out beautifully! */ + nums = + new int[] { + 3522, 181, 521, 515, 304, 123, 2512, 312, 922, 407, 146, 1932, 4037, 2646, 3871, + 269 + }; k = 5; assertEquals(true, solution2.canPartitionKSubsets(nums, k)); } @Test public void test9() { - nums = new int[]{1, 2, 3, 5}; + nums = new int[] {1, 2, 3, 5}; k = 2; assertEquals(false, solution2.canPartitionKSubsets(nums, k)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_699Test.java b/src/test/java/com/fishercoder/firstthousand/_699Test.java index 4cb8f5e936..d336363d1b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_699Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_699Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._699; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _699Test { private _699.Solution1 solution1; private static int[][] positions; @@ -19,11 +18,12 @@ public void setup() { @Test public void test1() { - positions = new int[][]{ - {1, 2}, - {2, 3}, - {6, 1} - }; + positions = + new int[][] { + {1, 2}, + {2, 3}, + {6, 1} + }; assertEquals(Arrays.asList(2, 5, 5), solution1.fallingSquares(positions)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_69Test.java b/src/test/java/com/fishercoder/firstthousand/_69Test.java index 92bb2f11d8..0ea616e813 100644 --- a/src/test/java/com/fishercoder/firstthousand/_69Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_69Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._69; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _69Test { private _69.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_6Test.java b/src/test/java/com/fishercoder/firstthousand/_6Test.java index ff6020596e..f193da17ee 100644 --- a/src/test/java/com/fishercoder/firstthousand/_6Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_6Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._6; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _6Test { private _6.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("PAHNAPLSIIGYIR", solution1.convert("PAYPALISHIRING", 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_700Test.java b/src/test/java/com/fishercoder/firstthousand/_700Test.java index 13bbc14969..683352bda8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_700Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_700Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._700; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _700Test { private _700.Solution1 solution1; private static TreeNode root; diff --git a/src/test/java/com/fishercoder/firstthousand/_701Test.java b/src/test/java/com/fishercoder/firstthousand/_701Test.java index cba340c352..a0bbb08ea5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_701Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_701Test.java @@ -3,11 +3,10 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._701; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _701Test { private _701.Solution1 solution1; private _701.Solution2 solution2; @@ -21,7 +20,9 @@ public void setup() { @Test public void test1() { int val = 88; - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(61, 46, 66, 43, null, null, null, 39, null, null, null)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(61, 46, 66, 43, null, null, null, 39, null, null, null)); TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution1.insertIntoBST(root, val)); } @@ -29,7 +30,9 @@ public void test1() { @Test public void test2() { int val = 88; - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(61, 46, 66, 43, null, null, null, 39, null, null, null)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(61, 46, 66, 43, null, null, null, 39, null, null, null)); TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution2.insertIntoBST(root, val)); } @@ -41,5 +44,4 @@ public void test3() { TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution2.insertIntoBST(root, val)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_703Test.java b/src/test/java/com/fishercoder/firstthousand/_703Test.java index fa601a954e..a7d20078f7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_703Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_703Test.java @@ -1,17 +1,17 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._703; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _703Test { private _703.Solution1.KthLargest solution1; private static int[] A; @Test public void test1() { - solution1 = new _703.Solution1.KthLargest(3, new int[]{4, 5, 8, 2}); + solution1 = new _703.Solution1.KthLargest(3, new int[] {4, 5, 8, 2}); assertEquals(4, solution1.add(3)); assertEquals(5, solution1.add(5)); assertEquals(5, solution1.add(10)); diff --git a/src/test/java/com/fishercoder/firstthousand/_704Test.java b/src/test/java/com/fishercoder/firstthousand/_704Test.java index 42aa4313eb..c9f71a3f3c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_704Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_704Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._704; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _704Test { private _704.Solution1 solution1; private _704.Solution2 solution2; @@ -19,38 +19,38 @@ public void setup() { @Test public void test1() { - nums = new int[]{-1, 0, 3, 5, 9, 12}; + nums = new int[] {-1, 0, 3, 5, 9, 12}; assertEquals(4, solution1.search(nums, 9)); } @Test public void test2() { - nums = new int[]{-1, 0, 3, 5, 9, 12}; + nums = new int[] {-1, 0, 3, 5, 9, 12}; assertEquals(-1, solution1.search(nums, 2)); } @Test public void test3() { - nums = new int[]{5}; + nums = new int[] {5}; assertEquals(0, solution1.search(nums, 5)); assertEquals(0, solution2.search(nums, 5)); } @Test public void test4() { - nums = new int[]{-1, 0}; + nums = new int[] {-1, 0}; assertEquals(1, solution1.search(nums, 0)); } @Test public void test5() { - nums = new int[]{-1, 0, 3, 5, 9, 12}; + nums = new int[] {-1, 0, 3, 5, 9, 12}; assertEquals(1, solution1.search(nums, 0)); } @Test public void test6() { - nums = new int[]{2, 5}; + nums = new int[] {2, 5}; assertEquals(-1, solution2.search(nums, 0)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_706Test.java b/src/test/java/com/fishercoder/firstthousand/_706Test.java index 71ec5bd65a..a0ba9fea20 100644 --- a/src/test/java/com/fishercoder/firstthousand/_706Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_706Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._706; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _706Test { private _706.Solution2.MyHashMap myHashMap; @@ -21,5 +21,4 @@ public void test1() { myHashMap.remove(2); assertEquals(-1, myHashMap.get(2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_709Test.java b/src/test/java/com/fishercoder/firstthousand/_709Test.java index e607a20279..27b2a53cda 100644 --- a/src/test/java/com/fishercoder/firstthousand/_709Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_709Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._709; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _709Test { private _709.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_70Test.java b/src/test/java/com/fishercoder/firstthousand/_70Test.java index c1d81b6f9d..14a2093469 100644 --- a/src/test/java/com/fishercoder/firstthousand/_70Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_70Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._70; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _70Test { private _70.Solution1 solution1; private _70.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_712Test.java b/src/test/java/com/fishercoder/firstthousand/_712Test.java index 7fd8080f7f..76dcc35acc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_712Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_712Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._712; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _712Test { private _712.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(403, solution1.minimumDeleteSum("delete", "leet")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_713Test.java b/src/test/java/com/fishercoder/firstthousand/_713Test.java index 289dfb8a76..b943808706 100644 --- a/src/test/java/com/fishercoder/firstthousand/_713Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_713Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._713; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _713Test { private _713.Solution1 solution1; private static int[] nums; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; k = 0; assertEquals(0, solution1.numSubarrayProductLessThanK(nums, k)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_714Test.java b/src/test/java/com/fishercoder/firstthousand/_714Test.java index 2779781f15..576ccf598d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_714Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_714Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._714; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _714Test { private _714.Solution1 solution1; private _714.Solution2 solution2; @@ -20,7 +20,7 @@ public void setup() { @Test public void test1() { - prices = new int[]{1, 3, 2, 8, 4, 9}; + prices = new int[] {1, 3, 2, 8, 4, 9}; fee = 2; assertEquals(8, solution1.maxProfit(prices, fee)); assertEquals(8, solution2.maxProfit(prices, fee)); @@ -28,7 +28,7 @@ public void test1() { @Test public void test2() { - prices = new int[]{1, 3, 7, 5, 10, 3}; + prices = new int[] {1, 3, 7, 5, 10, 3}; fee = 3; assertEquals(6, solution1.maxProfit(prices, fee)); assertEquals(6, solution2.maxProfit(prices, fee)); @@ -36,10 +36,9 @@ public void test2() { @Test public void test3() { - prices = new int[]{1, 4, 6, 2, 8, 3, 10, 14}; + prices = new int[] {1, 4, 6, 2, 8, 3, 10, 14}; fee = 3; assertEquals(13, solution1.maxProfit(prices, fee)); assertEquals(13, solution2.maxProfit(prices, fee)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_716Test.java b/src/test/java/com/fishercoder/firstthousand/_716Test.java index a7fb187a81..6655aa0c44 100644 --- a/src/test/java/com/fishercoder/firstthousand/_716Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_716Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._716; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _716Test { private _716.Solution1.MaxStack maxStackSolution1; private _716.Solution2.MaxStack maxStackSolution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_718Test.java b/src/test/java/com/fishercoder/firstthousand/_718Test.java index dc1d6bd61a..4a67f31e60 100644 --- a/src/test/java/com/fishercoder/firstthousand/_718Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_718Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._718; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _718Test { private _718.Solution1 solution1; private _718.Solution2 solution2; @@ -18,20 +18,199 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.findLength(new int[]{1, 2, 3, 2, 1}, new int[]{3, 2, 1, 4, 7})); - assertEquals(3, solution2.findLength(new int[]{1, 2, 3, 2, 1}, new int[]{3, 2, 1, 4, 7})); + assertEquals(3, solution1.findLength(new int[] {1, 2, 3, 2, 1}, new int[] {3, 2, 1, 4, 7})); + assertEquals(3, solution2.findLength(new int[] {1, 2, 3, 2, 1}, new int[] {3, 2, 1, 4, 7})); } @Test public void test2() { - assertEquals(5, solution1.findLength(new int[]{0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0})); - assertEquals(5, solution2.findLength(new int[]{0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0})); + assertEquals(5, solution1.findLength(new int[] {0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0})); + assertEquals(5, solution2.findLength(new int[] {0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0})); } @Test public void test3() { - assertEquals(681, solution1.findLength(new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); - assertEquals(681, solution2.findLength(new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); + assertEquals( + 681, + solution1.findLength( + new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + })); + assertEquals( + 681, + solution2.findLength( + new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + })); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_719Test.java b/src/test/java/com/fishercoder/firstthousand/_719Test.java index c0ef73eec3..66e079d036 100644 --- a/src/test/java/com/fishercoder/firstthousand/_719Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_719Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._719; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _719Test { private _719.Solution1 solution1; private _719.Solution2 solution2; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 1}; + nums = new int[] {1, 3, 1}; assertEquals(0, solution1.smallestDistancePair(nums, 1)); assertEquals(0, solution2.smallestDistancePair(nums, 1)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_71Test.java b/src/test/java/com/fishercoder/firstthousand/_71Test.java index 8dd5909874..569d9dc9f0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_71Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_71Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._71; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _71Test { private _71.Solution1 solution1; private _71.Solution2 solution2; @@ -38,8 +38,10 @@ public void test4() { @Test public void test5() { -// assertEquals("/home/user/Pictures", solution1.simplifyPath("/home/user/Documents/../Pictures")); - assertEquals("/home/user/Pictures", solution2.simplifyPath("/home/user/Documents/../Pictures")); + // assertEquals("/home/user/Pictures", + // solution1.simplifyPath("/home/user/Documents/../Pictures")); + assertEquals( + "/home/user/Pictures", solution2.simplifyPath("/home/user/Documents/../Pictures")); } @Test diff --git a/src/test/java/com/fishercoder/firstthousand/_720Test.java b/src/test/java/com/fishercoder/firstthousand/_720Test.java index a824da926f..cfa748e07a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_720Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_720Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._720; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _720Test { private _720.Solution1 solution1; private static String[] words; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - words = new String[]{"w", "wo", "wor", "worl", "world"}; + words = new String[] {"w", "wo", "wor", "worl", "world"}; assertEquals("world", solution1.longestWord(words)); } @Test public void test2() { - words = new String[]{"a", "banana", "app", "appl", "ap", "apply", "apple"}; + words = new String[] {"a", "banana", "app", "appl", "ap", "apply", "apple"}; assertEquals("apple", solution1.longestWord(words)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_721Test.java b/src/test/java/com/fishercoder/firstthousand/_721Test.java index 7d451cf4bd..e25ce1e157 100644 --- a/src/test/java/com/fishercoder/firstthousand/_721Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_721Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; import com.fishercoder.solutions.firstthousand._721; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _721Test { private _721.Solution1 solution1; @@ -23,9 +22,12 @@ public void setup() { @Test public void test1() throws Exception { accounts = new ArrayList<>(); - List account1 = new ArrayList<>(Arrays.asList("John", "johnsmith@mail.com", "john00@mail.com")); + List account1 = + new ArrayList<>(Arrays.asList("John", "johnsmith@mail.com", "john00@mail.com")); List account2 = new ArrayList<>(Arrays.asList("John", "johnnybravo@mail.com")); - List account3 = new ArrayList<>(Arrays.asList("John", "johnsmith@mail.com", "john_newyork@mail.com")); + List account3 = + new ArrayList<>( + Arrays.asList("John", "johnsmith@mail.com", "john_newyork@mail.com")); List account4 = new ArrayList<>(Arrays.asList("Mary", "mary@mail.com")); accounts.add(account1); accounts.add(account2); @@ -34,7 +36,13 @@ public void test1() throws Exception { expected = new ArrayList<>(); List expected1 = new ArrayList<>(Arrays.asList("Mary", "mary@mail.com")); - List expected2 = new ArrayList<>(Arrays.asList("John", "john00@mail.com", "john_newyork@mail.com", "johnsmith@mail.com")); + List expected2 = + new ArrayList<>( + Arrays.asList( + "John", + "john00@mail.com", + "john_newyork@mail.com", + "johnsmith@mail.com")); List expected3 = new ArrayList<>(Arrays.asList("John", "johnnybravo@mail.com")); expected.add(expected1); expected.add(expected2); @@ -44,8 +52,9 @@ public void test1() throws Exception { assertEqualsIgnoreOrdering(expected, solution2.accountsMerge(accounts)); } - private void assertEqualsIgnoreOrdering(List> expected, List> actual) throws Exception { - //TODO: implement this method + private void assertEqualsIgnoreOrdering(List> expected, List> actual) + throws Exception { + // TODO: implement this method if (true) { return; } else { @@ -56,11 +65,18 @@ private void assertEqualsIgnoreOrdering(List> expected, List(); - List account1 = new ArrayList<>(Arrays.asList("Alex", "Alex5@m.co", "Alex4@m.co", "Alex0@m.co")); - List account2 = new ArrayList<>(Arrays.asList("Ethan", "Ethan3@m.co", "Ethan3@m.co", "Ethan0@m.co")); - List account3 = new ArrayList<>(Arrays.asList("Kevin", "Kevin4@m.co", "Kevin2@m.co", "Kevin2@m.co")); - List account4 = new ArrayList<>(Arrays.asList("Gabe", "Gabe0@m.co", "Gabe3@m.co", "Gabe2@m.co")); - List account5 = new ArrayList<>(Arrays.asList("Gabe", "Gabe3@m.co", "Gabe4@m.co", "Gabe2@m.co")); + List account1 = + new ArrayList<>(Arrays.asList("Alex", "Alex5@m.co", "Alex4@m.co", "Alex0@m.co")); + List account2 = + new ArrayList<>( + Arrays.asList("Ethan", "Ethan3@m.co", "Ethan3@m.co", "Ethan0@m.co")); + List account3 = + new ArrayList<>( + Arrays.asList("Kevin", "Kevin4@m.co", "Kevin2@m.co", "Kevin2@m.co")); + List account4 = + new ArrayList<>(Arrays.asList("Gabe", "Gabe0@m.co", "Gabe3@m.co", "Gabe2@m.co")); + List account5 = + new ArrayList<>(Arrays.asList("Gabe", "Gabe3@m.co", "Gabe4@m.co", "Gabe2@m.co")); accounts.add(account1); accounts.add(account2); accounts.add(account3); @@ -68,10 +84,16 @@ public void test2() throws Exception { accounts.add(account5); expected = new ArrayList<>(); - List expected1 = new ArrayList<>(Arrays.asList("Alex", "Alex0@m.co", "Alex4@m.co", "Alex5@m.co")); - List expected2 = new ArrayList<>(Arrays.asList("Kevin", "Kevin2@m.co", "Kevin4@m.co")); - List expected3 = new ArrayList<>(Arrays.asList("Ethan", "Ethan0@m.co", "Ethan3@m.co")); - List expected4 = new ArrayList<>(Arrays.asList("Gabe", "Gabe0@m.co", "Gabe2@m.co", "Gabe3@m.co", "Gabe4@m.co")); + List expected1 = + new ArrayList<>(Arrays.asList("Alex", "Alex0@m.co", "Alex4@m.co", "Alex5@m.co")); + List expected2 = + new ArrayList<>(Arrays.asList("Kevin", "Kevin2@m.co", "Kevin4@m.co")); + List expected3 = + new ArrayList<>(Arrays.asList("Ethan", "Ethan0@m.co", "Ethan3@m.co")); + List expected4 = + new ArrayList<>( + Arrays.asList( + "Gabe", "Gabe0@m.co", "Gabe2@m.co", "Gabe3@m.co", "Gabe4@m.co")); expected.add(expected1); expected.add(expected2); expected.add(expected3); @@ -84,11 +106,16 @@ public void test2() throws Exception { @Test public void test3() throws Exception { accounts = new ArrayList<>(); - List account1 = new ArrayList<>(Arrays.asList("David", "David0@m.co", "David1@m.co")); - List account2 = new ArrayList<>(Arrays.asList("David", "David3@m.co", "David4@m.co")); - List account3 = new ArrayList<>(Arrays.asList("David", "David4@m.co", "David5@m.co")); - List account4 = new ArrayList<>(Arrays.asList("David", "David2@m.co", "David3@m.co")); - List account5 = new ArrayList<>(Arrays.asList("David", "David1@m.co", "David2@m.co")); + List account1 = + new ArrayList<>(Arrays.asList("David", "David0@m.co", "David1@m.co")); + List account2 = + new ArrayList<>(Arrays.asList("David", "David3@m.co", "David4@m.co")); + List account3 = + new ArrayList<>(Arrays.asList("David", "David4@m.co", "David5@m.co")); + List account4 = + new ArrayList<>(Arrays.asList("David", "David2@m.co", "David3@m.co")); + List account5 = + new ArrayList<>(Arrays.asList("David", "David1@m.co", "David2@m.co")); accounts.add(account1); accounts.add(account2); accounts.add(account3); @@ -96,11 +123,19 @@ public void test3() throws Exception { accounts.add(account5); expected = new ArrayList<>(); - List expected1 = new ArrayList<>(Arrays.asList("David", "David0@m.co", "David1@m.co", "David2@m.co", "David3@m.co", "David4@m.co", "David5@m.co")); + List expected1 = + new ArrayList<>( + Arrays.asList( + "David", + "David0@m.co", + "David1@m.co", + "David2@m.co", + "David3@m.co", + "David4@m.co", + "David5@m.co")); expected.add(expected1); assertEqualsIgnoreOrdering(expected, solution1.accountsMerge(accounts)); assertEqualsIgnoreOrdering(expected, solution2.accountsMerge(accounts)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_722Test.java b/src/test/java/com/fishercoder/firstthousand/_722Test.java index fde96c8fe8..2fa65f2681 100644 --- a/src/test/java/com/fishercoder/firstthousand/_722Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_722Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._722; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _722Test { private _722.Solution1 solution1; @@ -18,36 +17,78 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("int main()", "{ ", " ", "int a, b, c;", "a = b + c;", "}"), solution1.removeComments(new String[]{"/*Test program */", "int main()", "{ ", " // variable declaration ", "int a, b, c;", "/* This is a test", " multiline ", " comment for ", " testing */", "a = b + c;", "}"})); + assertEquals( + Arrays.asList("int main()", "{ ", " ", "int a, b, c;", "a = b + c;", "}"), + solution1.removeComments( + new String[] { + "/*Test program */", + "int main()", + "{ ", + " // variable declaration ", + "int a, b, c;", + "/* This is a test", + " multiline ", + " comment for ", + " testing */", + "a = b + c;", + "}" + })); } @Test public void test2() { - assertEquals(Arrays.asList("ab"), solution1.removeComments(new String[]{"a/*comment", "line", "more_comment*/b"})); + assertEquals( + Arrays.asList("ab"), + solution1.removeComments(new String[] {"a/*comment", "line", "more_comment*/b"})); } @Test public void test3() { - assertEquals(Arrays.asList("struct Node{", " ", " int size;", " int val;", "};"), - solution1.removeComments(new String[]{"struct Node{", " /*/ declare members;/**/", " int size;", " /**/int val;", "};"})); + assertEquals( + Arrays.asList("struct Node{", " ", " int size;", " int val;", "};"), + solution1.removeComments( + new String[] { + "struct Node{", + " /*/ declare members;/**/", + " int size;", + " /**/int val;", + "};" + })); } @Test public void test4() { - assertEquals(Arrays.asList("main() {", " double s = 33;", " cout << s;", "}"), - solution1.removeComments(new String[]{"main() {", "/* here is commments", " // still comments */", " double s = 33;", " cout << s;", "}"})); + assertEquals( + Arrays.asList("main() {", " double s = 33;", " cout << s;", "}"), + solution1.removeComments( + new String[] { + "main() {", + "/* here is commments", + " // still comments */", + " double s = 33;", + " cout << s;", + "}" + })); } @Test public void test5() { - assertEquals(Arrays.asList("void func(int k) {", " k = k*2/4;", " k = k/2;*/", "}"), - solution1.removeComments(new String[]{"void func(int k) {", "// this function does nothing /*", " k = k*2/4;", " k = k/2;*/", "}"})); + assertEquals( + Arrays.asList("void func(int k) {", " k = k*2/4;", " k = k/2;*/", "}"), + solution1.removeComments( + new String[] { + "void func(int k) {", + "// this function does nothing /*", + " k = k*2/4;", + " k = k/2;*/", + "}" + })); } @Test public void test6() { - assertEquals(Arrays.asList("a", "blank", "df"), - solution1.removeComments(new String[]{"a//*b/*/c", "blank", "d/*/e/*/f"})); + assertEquals( + Arrays.asList("a", "blank", "df"), + solution1.removeComments(new String[] {"a//*b/*/c", "blank", "d/*/e/*/f"})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_723Test.java b/src/test/java/com/fishercoder/firstthousand/_723Test.java index 83c2109480..7d7e66ae55 100644 --- a/src/test/java/com/fishercoder/firstthousand/_723Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_723Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._723; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _723Test { private _723.Solution1 solution1; private static int[][] board; @@ -18,31 +18,33 @@ public void setup() { @Test public void test1() { - board = new int[][]{ - {110, 5, 112, 113, 114}, - {210, 211, 5, 213, 214}, - {310, 311, 3, 313, 314}, - {410, 411, 412, 5, 414}, - {5, 1, 512, 3, 3}, - {610, 4, 1, 613, 614}, - {710, 1, 2, 713, 714}, - {810, 1, 2, 1, 1}, - {1, 1, 2, 2, 2}, - {4, 1, 4, 4, 1014}, - }; - - expected = new int[][]{ - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {110, 0, 0, 0, 114}, - {210, 0, 0, 0, 214}, - {310, 0, 0, 113, 314}, - {410, 0, 0, 213, 414}, - {610, 211, 112, 313, 614}, - {710, 311, 412, 613, 714}, - {810, 411, 512, 713, 1014} - }; + board = + new int[][] { + {110, 5, 112, 113, 114}, + {210, 211, 5, 213, 214}, + {310, 311, 3, 313, 314}, + {410, 411, 412, 5, 414}, + {5, 1, 512, 3, 3}, + {610, 4, 1, 613, 614}, + {710, 1, 2, 713, 714}, + {810, 1, 2, 1, 1}, + {1, 1, 2, 2, 2}, + {4, 1, 4, 4, 1014}, + }; + + expected = + new int[][] { + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {110, 0, 0, 0, 114}, + {210, 0, 0, 0, 214}, + {310, 0, 0, 113, 314}, + {410, 0, 0, 213, 414}, + {610, 211, 112, 313, 614}, + {710, 311, 412, 613, 714}, + {810, 411, 512, 713, 1014} + }; assert2dArrayEquals(expected, solution1.candyCrush(board)); } @@ -51,5 +53,4 @@ private void assert2dArrayEquals(int[][] expected, int[][] actual) { assertArrayEquals(expected[i], actual[i]); } } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_724Test.java b/src/test/java/com/fishercoder/firstthousand/_724Test.java index ffe5cb0aae..7439323364 100644 --- a/src/test/java/com/fishercoder/firstthousand/_724Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_724Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._724; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _724Test { private _724.Solution1 solution1; private _724.Solution2 solution2; @@ -19,49 +19,49 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 7, 3, 6, 5, 6}; + nums = new int[] {1, 7, 3, 6, 5, 6}; assertEquals(3, solution1.pivotIndex(nums)); } @Test public void test2() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; assertEquals(-1, solution1.pivotIndex(nums)); } @Test public void test3() { - nums = new int[]{-1, -1, -1, 0, 1, 1}; + nums = new int[] {-1, -1, -1, 0, 1, 1}; assertEquals(0, solution1.pivotIndex(nums)); } @Test public void test4() { - nums = new int[]{-1, -1, 0, 1, 1, 0}; + nums = new int[] {-1, -1, 0, 1, 1, 0}; assertEquals(5, solution1.pivotIndex(nums)); } @Test public void test5() { - nums = new int[]{1, 7, 3, 6, 5, 6}; + nums = new int[] {1, 7, 3, 6, 5, 6}; assertEquals(3, solution2.pivotIndex(nums)); } @Test public void test6() { - nums = new int[]{1, 2, 3}; + nums = new int[] {1, 2, 3}; assertEquals(-1, solution2.pivotIndex(nums)); } @Test public void test7() { - nums = new int[]{-1, -1, -1, 0, 1, 1}; + nums = new int[] {-1, -1, -1, 0, 1, 1}; assertEquals(0, solution2.pivotIndex(nums)); } @Test public void test8() { - nums = new int[]{-1, -1, 0, 1, 1, 0}; + nums = new int[] {-1, -1, 0, 1, 1, 0}; assertEquals(5, solution2.pivotIndex(nums)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_725Test.java b/src/test/java/com/fishercoder/firstthousand/_725Test.java index 7df7589e92..cdee40f75e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_725Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_725Test.java @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - root = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3}); + root = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3}); k = 5; actual = solution1.splitListToParts(root, k); for (ListNode head : actual) { @@ -31,7 +31,7 @@ public void test1() { @Test public void test2() { - root = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); + root = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); k = 3; actual = solution1.splitListToParts(root, k); for (ListNode head : actual) { @@ -41,7 +41,7 @@ public void test2() { @Test public void test3() { - root = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3}); + root = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3}); k = 5; actual = solution2.splitListToParts(root, k); for (ListNode head : actual) { @@ -51,12 +51,11 @@ public void test3() { @Test public void test4() { - root = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); + root = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); k = 3; actual = solution2.splitListToParts(root, k); for (ListNode head : actual) { LinkedListUtils.printList(head); } } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_726Test.java b/src/test/java/com/fishercoder/firstthousand/_726Test.java index 347b05dae7..03918ac893 100644 --- a/src/test/java/com/fishercoder/firstthousand/_726Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_726Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._726; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _726Test { private _726.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_727Test.java b/src/test/java/com/fishercoder/firstthousand/_727Test.java index 142ee8584f..c2ea867eae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_727Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_727Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._727; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _727Test { private _727.Solution1 solution1; private _727.Solution2 solution2; @@ -33,5 +33,4 @@ public void test2() { assertEquals("l", solution1.minWindow(S, T)); assertEquals("l", solution2.minWindow(S, T)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_728Test.java b/src/test/java/com/fishercoder/firstthousand/_728Test.java index ab27e28d07..8a7b729e40 100644 --- a/src/test/java/com/fishercoder/firstthousand/_728Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_728Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._728; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._728; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _728Test { private _728.Solution1 solution1; @@ -23,5 +22,4 @@ public void test1() { expected = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22); assertEquals(expected, solution1.selfDividingNumbers(1, 22)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_72Test.java b/src/test/java/com/fishercoder/firstthousand/_72Test.java index 3464acfe4e..b3de516243 100644 --- a/src/test/java/com/fishercoder/firstthousand/_72Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_72Test.java @@ -1,16 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._72; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _72Test { private _72.Solution1 solution1; private _72.Solution2 solution2; - @BeforeEach public void setup() { solution1 = new _72.Solution1(); diff --git a/src/test/java/com/fishercoder/firstthousand/_733Test.java b/src/test/java/com/fishercoder/firstthousand/_733Test.java index be8e06fd4b..147f212503 100644 --- a/src/test/java/com/fishercoder/firstthousand/_733Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_733Test.java @@ -17,23 +17,24 @@ public void setup() { @Test public void test1() { - image = new int[][]{ - {1, 1, 1}, - {1, 1, 0}, - {1, 0, 1} - }; + image = + new int[][] { + {1, 1, 1}, + {1, 1, 0}, + {1, 0, 1} + }; result = solution1.floodFill(image, 1, 1, 2); CommonUtils.print2DIntArray(result); } @Test public void test2() { - image = new int[][]{ - {0, 0, 0}, - {0, 0, 0} - }; + image = + new int[][] { + {0, 0, 0}, + {0, 0, 0} + }; result = solution1.floodFill(image, 0, 0, 2); CommonUtils.print2DIntArray(result); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_734Test.java b/src/test/java/com/fishercoder/firstthousand/_734Test.java index 42c942cf9a..8cf94d22c1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_734Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_734Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._734; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _734Test { private _734.Solution1 solution1; private static String[] words1; @@ -19,60 +19,61 @@ public void setup() { @Test public void test1() { - words1 = new String[]{"great", "acting", "skills"}; - words2 = new String[]{"fine", "drama", "talent"}; - pairs = new String[][]{ - {"great", "fine"}, - {"acting", "drama"}, - {"skills", "talent"} - }; + words1 = new String[] {"great", "acting", "skills"}; + words2 = new String[] {"fine", "drama", "talent"}; + pairs = + new String[][] { + {"great", "fine"}, + {"acting", "drama"}, + {"skills", "talent"} + }; assertEquals(true, solution1.areSentencesSimilar(words1, words2, pairs)); } @Test public void test2() { - String[] words1 = new String[]{"one", "excellent", "meal"}; - String[] words2 = new String[]{"one", "good", "dinner"}; - String[][] pairs = new String[][]{ - {"great", "good"}, - {"extraordinary", "good"}, - {"well", "good"}, - {"wonderful", "good"}, - {"excellent", "good"}, - {"dinner", "meal"}, - {"fine", "good"}, - {"nice", "good"}, - {"any", "one"}, - {"unique", "one"}, - {"some", "one"}, - {"the", "one"}, - {"an", "one"}, - {"single", "one"}, - {"a", "one"}, - {"keep", "own"}, - {"truck", "car"}, - {"super", "very"}, - {"really", "very"}, - {"actually", "very"}, - {"extremely", "very"}, - {"have", "own"}, - {"possess", "own"}, - {"lunch", "meal"}, - {"super", "meal"}, - {"food", "meal"}, - {"breakfast", "meal"}, - {"brunch", "meal"}, - {"wagon", "car"}, - {"automobile", "car"}, - {"auto", "car"}, - {"fruits", "meal"}, - {"vehicle", "car"}, - {"entertain", "have"}, - {"drink", "have"}, - {"eat", "have"}, - {"take", "have"}, - }; + String[] words1 = new String[] {"one", "excellent", "meal"}; + String[] words2 = new String[] {"one", "good", "dinner"}; + String[][] pairs = + new String[][] { + {"great", "good"}, + {"extraordinary", "good"}, + {"well", "good"}, + {"wonderful", "good"}, + {"excellent", "good"}, + {"dinner", "meal"}, + {"fine", "good"}, + {"nice", "good"}, + {"any", "one"}, + {"unique", "one"}, + {"some", "one"}, + {"the", "one"}, + {"an", "one"}, + {"single", "one"}, + {"a", "one"}, + {"keep", "own"}, + {"truck", "car"}, + {"super", "very"}, + {"really", "very"}, + {"actually", "very"}, + {"extremely", "very"}, + {"have", "own"}, + {"possess", "own"}, + {"lunch", "meal"}, + {"super", "meal"}, + {"food", "meal"}, + {"breakfast", "meal"}, + {"brunch", "meal"}, + {"wagon", "car"}, + {"automobile", "car"}, + {"auto", "car"}, + {"fruits", "meal"}, + {"vehicle", "car"}, + {"entertain", "have"}, + {"drink", "have"}, + {"eat", "have"}, + {"take", "have"}, + }; assertEquals(true, solution1.areSentencesSimilar(words1, words2, pairs)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_735Test.java b/src/test/java/com/fishercoder/firstthousand/_735Test.java index 0cd081bd7b..2b86783d79 100644 --- a/src/test/java/com/fishercoder/firstthousand/_735Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_735Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._735; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _735Test { private _735.Solution1 solution1; private _735.Solution2 solution2; @@ -24,8 +24,8 @@ public void setup() { @Test public void test1() { - asteroids = new int[]{5, 10, -5}; - expected = new int[]{5, 10}; + asteroids = new int[] {5, 10, -5}; + expected = new int[] {5, 10}; assertArrayEquals(expected, solution1.asteroidCollision(asteroids)); assertArrayEquals(expected, solution2.asteroidCollision(asteroids)); assertArrayEquals(expected, solution3.asteroidCollision(asteroids)); @@ -34,59 +34,58 @@ public void test1() { @Test public void test2() { - asteroids = new int[]{8, -8}; + asteroids = new int[] {8, -8}; asteroids = solution1.asteroidCollision(asteroids); - expected = new int[]{}; + expected = new int[] {}; assertArrayEquals(expected, asteroids); assertArrayEquals(expected, solution4.asteroidCollision(asteroids)); } @Test public void test3() { - asteroids = new int[]{10, 2, -5}; + asteroids = new int[] {10, 2, -5}; asteroids = solution1.asteroidCollision(asteroids); - expected = new int[]{10}; + expected = new int[] {10}; assertArrayEquals(expected, asteroids); assertArrayEquals(expected, solution4.asteroidCollision(asteroids)); } @Test public void test4() { - asteroids = new int[]{-2, 1, 2, -2}; + asteroids = new int[] {-2, 1, 2, -2}; asteroids = solution1.asteroidCollision(asteroids); - expected = new int[]{-2, 1}; + expected = new int[] {-2, 1}; assertArrayEquals(expected, asteroids); assertArrayEquals(expected, solution4.asteroidCollision(asteroids)); } @Test public void test5() { - asteroids = new int[]{-2, -2, -2, 1}; + asteroids = new int[] {-2, -2, -2, 1}; asteroids = solution1.asteroidCollision(asteroids); - expected = new int[]{-2, -2, -2, 1}; + expected = new int[] {-2, -2, -2, 1}; assertArrayEquals(expected, asteroids); assertArrayEquals(expected, solution4.asteroidCollision(asteroids)); } @Test public void test6() { - asteroids = new int[]{-2, -1, 1, 2}; + asteroids = new int[] {-2, -1, 1, 2}; asteroids = solution1.asteroidCollision(asteroids); - assertArrayEquals(new int[]{-2, -1, 1, 2}, asteroids); + assertArrayEquals(new int[] {-2, -1, 1, 2}, asteroids); } @Test public void test7() { - asteroids = new int[]{-2, -2, 1, -2}; + asteroids = new int[] {-2, -2, 1, -2}; asteroids = solution1.asteroidCollision(asteroids); - assertArrayEquals(new int[]{-2, -2, -2}, asteroids); + assertArrayEquals(new int[] {-2, -2, -2}, asteroids); } @Test public void test8() { - asteroids = new int[]{-4, -1, 10, 2, -1, 8, -9, -6, 5, 2}; + asteroids = new int[] {-4, -1, 10, 2, -1, 8, -9, -6, 5, 2}; asteroids = solution1.asteroidCollision(asteroids); - assertArrayEquals(new int[]{-4, -1, 10, 5, 2}, asteroids); + assertArrayEquals(new int[] {-4, -1, 10, 5, 2}, asteroids); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_737Test.java b/src/test/java/com/fishercoder/firstthousand/_737Test.java index 544779969e..0e7d93d4af 100644 --- a/src/test/java/com/fishercoder/firstthousand/_737Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_737Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._737; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _737Test { private _737.Solution1 solution1; private static String[] words1; @@ -19,337 +19,544 @@ public void setup() { @Test public void test1() { - words1 = new String[]{"great", "acting", "skills"}; - words2 = new String[]{"fine", "drama", "talent"}; - pairs = new String[][]{ - {"great", "fine"}, - {"acting", "drama"}, - {"skills", "talent"} - }; + words1 = new String[] {"great", "acting", "skills"}; + words2 = new String[] {"fine", "drama", "talent"}; + pairs = + new String[][] { + {"great", "fine"}, + {"acting", "drama"}, + {"skills", "talent"} + }; assertEquals(true, solution1.areSentencesSimilarTwo(words1, words2, pairs)); } @Test public void test2() { - words1 = new String[]{"great", "acting", "skills"}; - words2 = new String[]{"fine", "drama", "talent"}; - pairs = new String[][]{ - {"great", "good"}, - {"fine", "good"}, - {"drama", "acting"}, - {"skills", "talent"} - }; + words1 = new String[] {"great", "acting", "skills"}; + words2 = new String[] {"fine", "drama", "talent"}; + pairs = + new String[][] { + {"great", "good"}, + {"fine", "good"}, + {"drama", "acting"}, + {"skills", "talent"} + }; assertEquals(true, solution1.areSentencesSimilarTwo(words1, words2, pairs)); } - @Test public void test3() { - String[] words1 = new String[]{"one", "excellent", "meal"}; - String[] words2 = new String[]{"one", "good", "dinner"}; - String[][] pairs = new String[][]{ - {"great", "good"}, - {"extraordinary", "good"}, - {"well", "good"}, - {"wonderful", "good"}, - {"excellent", "good"}, - {"dinner", "meal"}, - {"fine", "good"}, - {"nice", "good"}, - {"any", "one"}, - {"unique", "one"}, - {"some", "one"}, - {"the", "one"}, - {"an", "one"}, - {"single", "one"}, - {"a", "one"}, - {"keep", "own"}, - {"truck", "car"}, - {"super", "very"}, - {"really", "very"}, - {"actually", "very"}, - {"extremely", "very"}, - {"have", "own"}, - {"possess", "own"}, - {"lunch", "meal"}, - {"super", "meal"}, - {"food", "meal"}, - {"breakfast", "meal"}, - {"brunch", "meal"}, - {"wagon", "car"}, - {"automobile", "car"}, - {"auto", "car"}, - {"fruits", "meal"}, - {"vehicle", "car"}, - {"entertain", "have"}, - {"drink", "have"}, - {"eat", "have"}, - {"take", "have"}, - }; + String[] words1 = new String[] {"one", "excellent", "meal"}; + String[] words2 = new String[] {"one", "good", "dinner"}; + String[][] pairs = + new String[][] { + {"great", "good"}, + {"extraordinary", "good"}, + {"well", "good"}, + {"wonderful", "good"}, + {"excellent", "good"}, + {"dinner", "meal"}, + {"fine", "good"}, + {"nice", "good"}, + {"any", "one"}, + {"unique", "one"}, + {"some", "one"}, + {"the", "one"}, + {"an", "one"}, + {"single", "one"}, + {"a", "one"}, + {"keep", "own"}, + {"truck", "car"}, + {"super", "very"}, + {"really", "very"}, + {"actually", "very"}, + {"extremely", "very"}, + {"have", "own"}, + {"possess", "own"}, + {"lunch", "meal"}, + {"super", "meal"}, + {"food", "meal"}, + {"breakfast", "meal"}, + {"brunch", "meal"}, + {"wagon", "car"}, + {"automobile", "car"}, + {"auto", "car"}, + {"fruits", "meal"}, + {"vehicle", "car"}, + {"entertain", "have"}, + {"drink", "have"}, + {"eat", "have"}, + {"take", "have"}, + }; assertEquals(true, solution1.areSentencesSimilarTwo(words1, words2, pairs)); } @Test public void test4() { - words1 = new String[]{"jrocadcojmybpxmuj", "livgsrfvgtovcurzq", "mnrdscqkycodx", "wgcjlntupylayse", "tglnshmqlmkqqfbpf", "uzlxmaoro", "narvuaqmmkqhd", "xozoyaqxtbustrymo", "jrocadcojmybpxmuj", "ainlwrwabqcwq", "qnjidlmwmxxjgntez", "bbchthovla", "vaufbmwdrupcxpg", "zwwgloilddclufwze", "tyxrlpmcy", "wtjtdrlm", "edurtetzseifez", "yzxogkunvohdmro", "livgsrfvgtovcurzq", "wmpvjvzljhnaxvp", "rqbswlkw", "umlzibkkpsyvpdol", "jkcmceinlyhi", "wlvmfxbleuot", "aeloeauxmc", "ooyllkxg", "wlvmfxbleuot", "cuewcvuy", "vaufbmwdrupcxpg", "bbchthovla", "arigdtezmyz", "yzxogkunvohdmro", "wrszraxxdum", "dhmiuqhqlsprxy", "xpmxtfyvjrnujyxjh", "bfxbncez", "cjjkmybleu", "mnrdscqkycodx", "mzfpofjn", "livgsrfvgtovcurzq", "shfzcyboj", "xozoyaqxtbustrymo", "xozoyaqxtbustrymo", "orlzzpytpzazxr", "filnwifbukdqijgr", "fllqjtnxwmfoou", "mkmawbogphdttd", "rthpxoxyyiy", "dkhfozltuckwog", "wmpvjvzljhnaxvp", "dhmiuqhqlsprxy", "yltljjairlkrmdq", "cuewcvuy", "subzoyxjkfiwmfb", "mzvbgcizeeth", "narvuaqmmkqhd", "tglnshmqlmkqqfbpf", "rpesfkhfjucj", "xrgfejybbkezgor", "vaufbmwdrupcxpg", "czlgbqzffodsoxng", "suvvqdiceuogcmv", "fllqjtnxwmfoou", "yltljjairlkrmdq", "bubwouozgs", "mnrdscqkycodx", "rqbswlkw", "ooyllkxg", "livgsrfvgtovcurzq", "rthpxoxyyiy", "pyzcbpjhntpefbq", "wtjtdrlm", "rztcppnmud", "inuzvkgolupxelcal", "pdxsxjop", "wmpvjvzljhnaxvp", "xydwvemqvtgvzl", "hqpnoczciajvkbdy", "rvihrzzkt", "jzquemjzpvfbka", "gkqrglav", "qyaxqaqxiwr", "mzvbgcizeeth", "umlzibkkpsyvpdol", "vaufbmwdrupcxpg", "ooyllkxg", "arigdtezmyz", "bubwouozgs", "wtjtdrlm", "xozoyaqxtbustrymo", "jrocadcojmybpxmuj", "rnlryins", "fllqjtnxwmfoou", "livgsrfvgtovcurzq", "czlgbqzffodsoxng", "hlcsiukaroscfg", "bfxbncez", "ainlwrwabqcwq", "vaufbmwdrupcxpg", "vaufbmwdrupcxpg"}; - words2 = new String[]{"jrocadcojmybpxmuj", "livgsrfvgtovcurzq", "mnrdscqkycodx", "wgcjlntupylayse", "bbchthovla", "bfxbncez", "ztisufueqzequ", "yutahdply", "suvvqdiceuogcmv", "ainlwrwabqcwq", "fquzrlhdsnuwhhu", "tglnshmqlmkqqfbpf", "vaufbmwdrupcxpg", "zwwgloilddclufwze", "livgsrfvgtovcurzq", "wtjtdrlm", "edurtetzseifez", "ecqfdkebnamkfglk", "livgsrfvgtovcurzq", "wmpvjvzljhnaxvp", "ryubcgbzmxc", "pzlmeboecybxmetz", "hqpnoczciajvkbdy", "xpmxtfyvjrnujyxjh", "zwwgloilddclufwze", "khcyhttaaxp", "wlvmfxbleuot", "jzquemjzpvfbka", "vaufbmwdrupcxpg", "tglnshmqlmkqqfbpf", "mzvbgcizeeth", "cjjkmybleu", "orlzzpytpzazxr", "dhmiuqhqlsprxy", "mzfpofjn", "bfxbncez", "inuzvkgolupxelcal", "inhzsspqltvl", "wlvmfxbleuot", "livgsrfvgtovcurzq", "orlzzpytpzazxr", "yutahdply", "yutahdply", "orlzzpytpzazxr", "gdziaihbagl", "yltljjairlkrmdq", "mkmawbogphdttd", "aotjpvanljxe", "aeloeauxmc", "wmpvjvzljhnaxvp", "dhmiuqhqlsprxy", "yltljjairlkrmdq", "dnaaehrekqms", "khcyhttaaxp", "mzvbgcizeeth", "narvuaqmmkqhd", "rvihrzzkt", "bfufqsusp", "xrgfejybbkezgor", "vaufbmwdrupcxpg", "czlgbqzffodsoxng", "jrocadcojmybpxmuj", "yltljjairlkrmdq", "yltljjairlkrmdq", "bubwouozgs", "inhzsspqltvl", "bsybvehdny", "subzoyxjkfiwmfb", "livgsrfvgtovcurzq", "stkglpqdjzxmnlito", "evepphnzuw", "xrgfejybbkezgor", "rztcppnmud", "cjjkmybleu", "qyaxqaqxiwr", "ibwfxvxswjbecab", "xydwvemqvtgvzl", "hqpnoczciajvkbdy", "tglnshmqlmkqqfbpf", "dnaaehrekqms", "gkqrglav", "bfxbncez", "qvwvgzxqihvk", "umlzibkkpsyvpdol", "vaufbmwdrupcxpg", "khcyhttaaxp", "arigdtezmyz", "bubwouozgs", "fllqjtnxwmfoou", "xozoyaqxtbustrymo", "jrocadcojmybpxmuj", "rnlryins", "wtjtdrlm", "livgsrfvgtovcurzq", "gkqrglav", "orileazg", "uzlxmaoro", "ainlwrwabqcwq", "vaufbmwdrupcxpg", "vaufbmwdrupcxpg"}; - pairs = new String[][]{ - {"yutahdply", "yutahdply"}, - {"xozoyaqxtbustrymo", "xozoyaqxtbustrymo"}, - {"xozoyaqxtbustrymo", "xozoyaqxtbustrymo"}, - {"yutahdply", "yutahdply"}, - {"shfzcyboj", "orlzzpytpzazxr"}, - {"suvvqdiceuogcmv", "llrzqdnoxbscnkqy"}, - {"jkcmceinlyhi", "hqpnoczciajvkbdy"}, - {"hqpnoczciajvkbdy", "hqpnoczciajvkbdy"}, - {"rztcppnmud", "vdjccijgqk"}, - {"vdjccijgqk", "vdjccijgqk"}, - {"jkcmceinlyhi", "hqpnoczciajvkbdy"}, - {"rztcppnmud", "rztcppnmud"}, - {"vdjccijgqk", "vdjccijgqk"}, - {"hqpnoczciajvkbdy", "hqpnoczciajvkbdy"}, - {"umlzibkkpsyvpdol", "ryubcgbzmxc"}, - {"ryubcgbzmxc", "ryubcgbzmxc"}, - {"pzlmeboecybxmetz", "bsybvehdny"}, - {"rqbswlkw", "bsybvehdny"}, - {"bsybvehdny", "bsybvehdny"}, - {"umlzibkkpsyvpdol", "umlzibkkpsyvpdol"}, - {"ryubcgbzmxc", "ryubcgbzmxc"}, - {"rqbswlkw", "rqbswlkw"}, - {"pzlmeboecybxmetz", "pzlmeboecybxmetz"}, - {"bsybvehdny", "bsybvehdny"}, - {"dkhfozltuckwog", "zwwgloilddclufwze"}, - {"zfmpxgrevxp", "pyzcbpjhntpefbq"}, - {"gkqrglav", "czlgbqzffodsoxng"}, - {"tyxrlpmcy", "livgsrfvgtovcurzq"}, - {"shsgrqol", "cufxsgbpjgqvk"}, - {"rphnhtvnihyfkrgv", "yykdqtkkdacpbwtbq"}, - {"dhmiuqhqlsprxy", "ztisufueqzequ"}, - {"ibwfxvxswjbecab", "xydwvemqvtgvzl"}, - {"mkmawbogphdttd", "ainlwrwabqcwq"}, - {"pdxsxjop", "uzlxmaoro"}, - {"ooyllkxg", "khcyhttaaxp"}, - {"jrocadcojmybpxmuj", "jrocadcojmybpxmuj"}, - {"lkopigreodypvude", "lkopigreodypvude"}, - {"hqpnoczciajvkbdy", "rztcppnmud"}, - {"llrzqdnoxbscnkqy", "jrocadcojmybpxmuj"}, - {"cuewcvuy", "jzquemjzpvfbka"}, - {"wlvmfxbleuot", "bfufqsusp"}, - {"bfufqsusp", "bfufqsusp"}, - {"xpmxtfyvjrnujyxjh", "rpesfkhfjucj"}, - {"mzfpofjn", "rpesfkhfjucj"}, - {"rpesfkhfjucj", "rpesfkhfjucj"}, - {"xpmxtfyvjrnujyxjh", "mzfpofjn"}, - {"wlvmfxbleuot", "bfufqsusp"}, - {"rpesfkhfjucj", "xpmxtfyvjrnujyxjh"}, - {"cuewcvuy", "dnaaehrekqms"}, - {"dnaaehrekqms", "dnaaehrekqms"}, - {"rpesfkhfjucj", "wlvmfxbleuot"}, - {"lkopigreodypvude", "mzvbgcizeeth"}, - {"tglnshmqlmkqqfbpf", "bbchthovla"}, - {"orileazg", "filnwifbukdqijgr"}, - {"yltljjairlkrmdq", "xrgfejybbkezgor"}, - {"inuzvkgolupxelcal", "hgxrhkanzvzmsjpzl"}, - {"jzquemjzpvfbka", "iziepzqne"}, - {"muaskefecskjghzn", "iziepzqne"}, - {"hhrllhedyy", "wzflhbbgtc"}, - {"cemnayjhlnj", "hgtyntdmrgjh"}, - {"iziepzqne", "iziepzqne"}, - {"cuewcvuy", "dnaaehrekqms"}, - {"muaskefecskjghzn", "iziepzqne"}, - {"jzquemjzpvfbka", "muaskefecskjghzn"}, - {"dnaaehrekqms", "dnaaehrekqms"}, - {"jrocadcojmybpxmuj", "jrocadcojmybpxmuj"}, - {"llrzqdnoxbscnkqy", "suvvqdiceuogcmv"}, - {"suvvqdiceuogcmv", "suvvqdiceuogcmv"}, - {"bbchthovla", "bbchthovla"}, - {"rvihrzzkt", "tglnshmqlmkqqfbpf"}, - {"filnwifbukdqijgr", "pkirimjwvyxs"}, - {"tglnshmqlmkqqfbpf", "tglnshmqlmkqqfbpf"}, - {"rvihrzzkt", "tglnshmqlmkqqfbpf"}, - {"bbchthovla", "bbchthovla"}, - {"tglnshmqlmkqqfbpf", "tglnshmqlmkqqfbpf"}, - {"hjogoueazw", "lkopigreodypvude"}, - {"lkopigreodypvude", "lkopigreodypvude"}, - {"mzvbgcizeeth", "arigdtezmyz"}, - {"qvwvgzxqihvk", "arigdtezmyz"}, - {"arigdtezmyz", "arigdtezmyz"}, - {"mzvbgcizeeth", "arigdtezmyz"}, - {"qvwvgzxqihvk", "qvwvgzxqihvk"}, - {"hjogoueazw", "hjogoueazw"}, - {"subzoyxjkfiwmfb", "khcyhttaaxp"}, - {"subzoyxjkfiwmfb", "subzoyxjkfiwmfb"}, - {"khcyhttaaxp", "subzoyxjkfiwmfb"}, - {"ooyllkxg", "ooyllkxg"}, - {"orlzzpytpzazxr", "orlzzpytpzazxr"}, - {"oufzmjgplt", "oufzmjgplt"}, - {"shfzcyboj", "shfzcyboj"}, - {"oufzmjgplt", "oufzmjgplt"}, - {"orlzzpytpzazxr", "oufzmjgplt"}, - {"wrszraxxdum", "wrszraxxdum"}, - {"wrszraxxdum", "wrszraxxdum"}, - {"shfzcyboj", "wrszraxxdum"}, - {"yutahdply", "xozoyaqxtbustrymo"}, - {"umlzibkkpsyvpdol", "pzlmeboecybxmetz"}, - {"hgxrhkanzvzmsjpzl", "gwkkpxuvgp"}, - {"xrgfejybbkezgor", "wtjtdrlm"}, - {"wtjtdrlm", "wtjtdrlm"}, - {"yltljjairlkrmdq", "fllqjtnxwmfoou"}, - {"xrgfejybbkezgor", "wtjtdrlm"}, - {"filnwifbukdqijgr", "pkirimjwvyxs"}, - {"pkirimjwvyxs", "pkirimjwvyxs"}, - {"gdziaihbagl", "orileazg"}, - {"orileazg", "orileazg"}, - {"gdziaihbagl", "orileazg"}, - {"hlcsiukaroscfg", "orileazg"}, - {"hlcsiukaroscfg", "hlcsiukaroscfg"}, - {"gdziaihbagl", "gdziaihbagl"}, - {"ainlwrwabqcwq", "ainlwrwabqcwq"}, - {"uzlxmaoro", "bfxbncez"}, - {"qyaxqaqxiwr", "qyaxqaqxiwr"}, - {"pdxsxjop", "pdxsxjop"}, - {"pdxsxjop", "pdxsxjop"}, - {"subzoyxjkfiwmfb", "subzoyxjkfiwmfb"}, - {"uzlxmaoro", "bfxbncez"}, - {"bfxbncez", "bfxbncez"}, - {"qyaxqaqxiwr", "pdxsxjop"}, - {"ooyllkxg", "ooyllkxg"}, - {"hgxrhkanzvzmsjpzl", "ecqfdkebnamkfglk"}, - {"gwkkpxuvgp", "ecqfdkebnamkfglk"}, - {"ecqfdkebnamkfglk", "ecqfdkebnamkfglk"}, - {"yzxogkunvohdmro", "yzxogkunvohdmro"}, - {"inuzvkgolupxelcal", "yzxogkunvohdmro"}, - {"yzxogkunvohdmro", "yzxogkunvohdmro"}, - {"cjjkmybleu", "yzxogkunvohdmro"}, - {"inuzvkgolupxelcal", "inuzvkgolupxelcal"}, - {"ecqfdkebnamkfglk", "gwkkpxuvgp"}, - {"dwojnswr", "dkhfozltuckwog"}, - {"yltljjairlkrmdq", "fllqjtnxwmfoou"}, - {"fllqjtnxwmfoou", "fllqjtnxwmfoou"}, - {"wzflhbbgtc", "zzdvolqtndzfjvqqr"}, - {"dkhfozltuckwog", "dkhfozltuckwog"}, - {"zfmpxgrevxp", "stkglpqdjzxmnlito"}, - {"wzflhbbgtc", "wzflhbbgtc"}, - {"cjjkmybleu", "cjjkmybleu"}, - {"wgcjlntupylayse", "wgcjlntupylayse"}, - {"vyrvelteblnqaabc", "vyrvelteblnqaabc"}, - {"bvxiilsnsarhsyl", "zzdvolqtndzfjvqqr"}, - {"stkglpqdjzxmnlito", "stkglpqdjzxmnlito"}, - {"cemnayjhlnj", "cemnayjhlnj"}, - {"cemnayjhlnj", "cemnayjhlnj"}, - {"hgtyntdmrgjh", "hgtyntdmrgjh"}, - {"rnlryins", "vyrvelteblnqaabc"}, - {"hhrllhedyy", "vyrvelteblnqaabc"}, - {"rnlryins", "rnlryins"}, - {"fquzrlhdsnuwhhu", "zzdvolqtndzfjvqqr"}, - {"zzdvolqtndzfjvqqr", "bvxiilsnsarhsyl"}, - {"wmpvjvzljhnaxvp", "wmpvjvzljhnaxvp"}, - {"qnjidlmwmxxjgntez", "vyrvelteblnqaabc"}, - {"fquzrlhdsnuwhhu", "zzdvolqtndzfjvqqr"}, - {"zzdvolqtndzfjvqqr", "zzdvolqtndzfjvqqr"}, - {"edurtetzseifez", "rphnhtvnihyfkrgv"}, - {"wgcjlntupylayse", "wgcjlntupylayse"}, - {"zwwgloilddclufwze", "aeloeauxmc"}, - {"rphnhtvnihyfkrgv", "rphnhtvnihyfkrgv"}, - {"aeloeauxmc", "aeloeauxmc"}, - {"hgtyntdmrgjh", "wgcjlntupylayse"}, - {"rphnhtvnihyfkrgv", "rphnhtvnihyfkrgv"}, - {"cufxsgbpjgqvk", "cufxsgbpjgqvk"}, - {"mnrdscqkycodx", "shsgrqol"}, - {"qnjidlmwmxxjgntez", "hhrllhedyy"}, - {"shsgrqol", "shsgrqol"}, - {"vyrvelteblnqaabc", "qnjidlmwmxxjgntez"}, - {"zwwgloilddclufwze", "aeloeauxmc"}, - {"evepphnzuw", "rthpxoxyyiy"}, - {"rthpxoxyyiy", "rthpxoxyyiy"}, - {"aotjpvanljxe", "aotjpvanljxe"}, - {"aotjpvanljxe", "stkglpqdjzxmnlito"}, - {"dkhfozltuckwog", "dwojnswr"}, - {"rthpxoxyyiy", "pyzcbpjhntpefbq"}, - {"evepphnzuw", "evepphnzuw"}, - {"aeloeauxmc", "aeloeauxmc"}, - {"zfmpxgrevxp", "aotjpvanljxe"}, - {"stkglpqdjzxmnlito", "aotjpvanljxe"}, - {"bubwouozgs", "mkmawbogphdttd"}, - {"pyzcbpjhntpefbq", "rthpxoxyyiy"}, - {"gkqrglav", "gkqrglav"}, - {"czlgbqzffodsoxng", "czlgbqzffodsoxng"}, - {"yykdqtkkdacpbwtbq", "yykdqtkkdacpbwtbq"}, - {"dhmiuqhqlsprxy", "dhmiuqhqlsprxy"}, - {"ztisufueqzequ", "ztisufueqzequ"}, - {"ztisufueqzequ", "narvuaqmmkqhd"}, - {"narvuaqmmkqhd", "narvuaqmmkqhd"}, - {"narvuaqmmkqhd", "narvuaqmmkqhd"}, - {"ibwfxvxswjbecab", "ibwfxvxswjbecab"}, - {"dhmiuqhqlsprxy", "dhmiuqhqlsprxy"}, - {"xydwvemqvtgvzl", "wmpvjvzljhnaxvp"}, - {"wmpvjvzljhnaxvp", "wmpvjvzljhnaxvp"}, - {"xydwvemqvtgvzl", "wmpvjvzljhnaxvp"}, - {"ibwfxvxswjbecab", "ibwfxvxswjbecab"}, - {"bubwouozgs", "mkmawbogphdttd"}, - {"mkmawbogphdttd", "mkmawbogphdttd"}, - {"ainlwrwabqcwq", "ainlwrwabqcwq"}, - {"mkmawbogphdttd", "mkmawbogphdttd"}, - {"edurtetzseifez", "edurtetzseifez"}, - {"inhzsspqltvl", "inhzsspqltvl"}, - {"cufxsgbpjgqvk", "inhzsspqltvl"}, - {"yykdqtkkdacpbwtbq", "yykdqtkkdacpbwtbq"}, - {"mnrdscqkycodx", "mnrdscqkycodx"}, - {"shsgrqol", "shsgrqol"}, - {"cufxsgbpjgqvk", "inhzsspqltvl"}, - {"livgsrfvgtovcurzq", "livgsrfvgtovcurzq"}, - {"tyxrlpmcy", "tyxrlpmcy"}, - {"livgsrfvgtovcurzq", "livgsrfvgtovcurzq"}, - {"tyxrlpmcy", "tyxrlpmcy"}, - {"czlgbqzffodsoxng", "czlgbqzffodsoxng"}, - {"gkqrglav", "gkqrglav"}, - }; + words1 = + new String[] { + "jrocadcojmybpxmuj", + "livgsrfvgtovcurzq", + "mnrdscqkycodx", + "wgcjlntupylayse", + "tglnshmqlmkqqfbpf", + "uzlxmaoro", + "narvuaqmmkqhd", + "xozoyaqxtbustrymo", + "jrocadcojmybpxmuj", + "ainlwrwabqcwq", + "qnjidlmwmxxjgntez", + "bbchthovla", + "vaufbmwdrupcxpg", + "zwwgloilddclufwze", + "tyxrlpmcy", + "wtjtdrlm", + "edurtetzseifez", + "yzxogkunvohdmro", + "livgsrfvgtovcurzq", + "wmpvjvzljhnaxvp", + "rqbswlkw", + "umlzibkkpsyvpdol", + "jkcmceinlyhi", + "wlvmfxbleuot", + "aeloeauxmc", + "ooyllkxg", + "wlvmfxbleuot", + "cuewcvuy", + "vaufbmwdrupcxpg", + "bbchthovla", + "arigdtezmyz", + "yzxogkunvohdmro", + "wrszraxxdum", + "dhmiuqhqlsprxy", + "xpmxtfyvjrnujyxjh", + "bfxbncez", + "cjjkmybleu", + "mnrdscqkycodx", + "mzfpofjn", + "livgsrfvgtovcurzq", + "shfzcyboj", + "xozoyaqxtbustrymo", + "xozoyaqxtbustrymo", + "orlzzpytpzazxr", + "filnwifbukdqijgr", + "fllqjtnxwmfoou", + "mkmawbogphdttd", + "rthpxoxyyiy", + "dkhfozltuckwog", + "wmpvjvzljhnaxvp", + "dhmiuqhqlsprxy", + "yltljjairlkrmdq", + "cuewcvuy", + "subzoyxjkfiwmfb", + "mzvbgcizeeth", + "narvuaqmmkqhd", + "tglnshmqlmkqqfbpf", + "rpesfkhfjucj", + "xrgfejybbkezgor", + "vaufbmwdrupcxpg", + "czlgbqzffodsoxng", + "suvvqdiceuogcmv", + "fllqjtnxwmfoou", + "yltljjairlkrmdq", + "bubwouozgs", + "mnrdscqkycodx", + "rqbswlkw", + "ooyllkxg", + "livgsrfvgtovcurzq", + "rthpxoxyyiy", + "pyzcbpjhntpefbq", + "wtjtdrlm", + "rztcppnmud", + "inuzvkgolupxelcal", + "pdxsxjop", + "wmpvjvzljhnaxvp", + "xydwvemqvtgvzl", + "hqpnoczciajvkbdy", + "rvihrzzkt", + "jzquemjzpvfbka", + "gkqrglav", + "qyaxqaqxiwr", + "mzvbgcizeeth", + "umlzibkkpsyvpdol", + "vaufbmwdrupcxpg", + "ooyllkxg", + "arigdtezmyz", + "bubwouozgs", + "wtjtdrlm", + "xozoyaqxtbustrymo", + "jrocadcojmybpxmuj", + "rnlryins", + "fllqjtnxwmfoou", + "livgsrfvgtovcurzq", + "czlgbqzffodsoxng", + "hlcsiukaroscfg", + "bfxbncez", + "ainlwrwabqcwq", + "vaufbmwdrupcxpg", + "vaufbmwdrupcxpg" + }; + words2 = + new String[] { + "jrocadcojmybpxmuj", + "livgsrfvgtovcurzq", + "mnrdscqkycodx", + "wgcjlntupylayse", + "bbchthovla", + "bfxbncez", + "ztisufueqzequ", + "yutahdply", + "suvvqdiceuogcmv", + "ainlwrwabqcwq", + "fquzrlhdsnuwhhu", + "tglnshmqlmkqqfbpf", + "vaufbmwdrupcxpg", + "zwwgloilddclufwze", + "livgsrfvgtovcurzq", + "wtjtdrlm", + "edurtetzseifez", + "ecqfdkebnamkfglk", + "livgsrfvgtovcurzq", + "wmpvjvzljhnaxvp", + "ryubcgbzmxc", + "pzlmeboecybxmetz", + "hqpnoczciajvkbdy", + "xpmxtfyvjrnujyxjh", + "zwwgloilddclufwze", + "khcyhttaaxp", + "wlvmfxbleuot", + "jzquemjzpvfbka", + "vaufbmwdrupcxpg", + "tglnshmqlmkqqfbpf", + "mzvbgcizeeth", + "cjjkmybleu", + "orlzzpytpzazxr", + "dhmiuqhqlsprxy", + "mzfpofjn", + "bfxbncez", + "inuzvkgolupxelcal", + "inhzsspqltvl", + "wlvmfxbleuot", + "livgsrfvgtovcurzq", + "orlzzpytpzazxr", + "yutahdply", + "yutahdply", + "orlzzpytpzazxr", + "gdziaihbagl", + "yltljjairlkrmdq", + "mkmawbogphdttd", + "aotjpvanljxe", + "aeloeauxmc", + "wmpvjvzljhnaxvp", + "dhmiuqhqlsprxy", + "yltljjairlkrmdq", + "dnaaehrekqms", + "khcyhttaaxp", + "mzvbgcizeeth", + "narvuaqmmkqhd", + "rvihrzzkt", + "bfufqsusp", + "xrgfejybbkezgor", + "vaufbmwdrupcxpg", + "czlgbqzffodsoxng", + "jrocadcojmybpxmuj", + "yltljjairlkrmdq", + "yltljjairlkrmdq", + "bubwouozgs", + "inhzsspqltvl", + "bsybvehdny", + "subzoyxjkfiwmfb", + "livgsrfvgtovcurzq", + "stkglpqdjzxmnlito", + "evepphnzuw", + "xrgfejybbkezgor", + "rztcppnmud", + "cjjkmybleu", + "qyaxqaqxiwr", + "ibwfxvxswjbecab", + "xydwvemqvtgvzl", + "hqpnoczciajvkbdy", + "tglnshmqlmkqqfbpf", + "dnaaehrekqms", + "gkqrglav", + "bfxbncez", + "qvwvgzxqihvk", + "umlzibkkpsyvpdol", + "vaufbmwdrupcxpg", + "khcyhttaaxp", + "arigdtezmyz", + "bubwouozgs", + "fllqjtnxwmfoou", + "xozoyaqxtbustrymo", + "jrocadcojmybpxmuj", + "rnlryins", + "wtjtdrlm", + "livgsrfvgtovcurzq", + "gkqrglav", + "orileazg", + "uzlxmaoro", + "ainlwrwabqcwq", + "vaufbmwdrupcxpg", + "vaufbmwdrupcxpg" + }; + pairs = + new String[][] { + {"yutahdply", "yutahdply"}, + {"xozoyaqxtbustrymo", "xozoyaqxtbustrymo"}, + {"xozoyaqxtbustrymo", "xozoyaqxtbustrymo"}, + {"yutahdply", "yutahdply"}, + {"shfzcyboj", "orlzzpytpzazxr"}, + {"suvvqdiceuogcmv", "llrzqdnoxbscnkqy"}, + {"jkcmceinlyhi", "hqpnoczciajvkbdy"}, + {"hqpnoczciajvkbdy", "hqpnoczciajvkbdy"}, + {"rztcppnmud", "vdjccijgqk"}, + {"vdjccijgqk", "vdjccijgqk"}, + {"jkcmceinlyhi", "hqpnoczciajvkbdy"}, + {"rztcppnmud", "rztcppnmud"}, + {"vdjccijgqk", "vdjccijgqk"}, + {"hqpnoczciajvkbdy", "hqpnoczciajvkbdy"}, + {"umlzibkkpsyvpdol", "ryubcgbzmxc"}, + {"ryubcgbzmxc", "ryubcgbzmxc"}, + {"pzlmeboecybxmetz", "bsybvehdny"}, + {"rqbswlkw", "bsybvehdny"}, + {"bsybvehdny", "bsybvehdny"}, + {"umlzibkkpsyvpdol", "umlzibkkpsyvpdol"}, + {"ryubcgbzmxc", "ryubcgbzmxc"}, + {"rqbswlkw", "rqbswlkw"}, + {"pzlmeboecybxmetz", "pzlmeboecybxmetz"}, + {"bsybvehdny", "bsybvehdny"}, + {"dkhfozltuckwog", "zwwgloilddclufwze"}, + {"zfmpxgrevxp", "pyzcbpjhntpefbq"}, + {"gkqrglav", "czlgbqzffodsoxng"}, + {"tyxrlpmcy", "livgsrfvgtovcurzq"}, + {"shsgrqol", "cufxsgbpjgqvk"}, + {"rphnhtvnihyfkrgv", "yykdqtkkdacpbwtbq"}, + {"dhmiuqhqlsprxy", "ztisufueqzequ"}, + {"ibwfxvxswjbecab", "xydwvemqvtgvzl"}, + {"mkmawbogphdttd", "ainlwrwabqcwq"}, + {"pdxsxjop", "uzlxmaoro"}, + {"ooyllkxg", "khcyhttaaxp"}, + {"jrocadcojmybpxmuj", "jrocadcojmybpxmuj"}, + {"lkopigreodypvude", "lkopigreodypvude"}, + {"hqpnoczciajvkbdy", "rztcppnmud"}, + {"llrzqdnoxbscnkqy", "jrocadcojmybpxmuj"}, + {"cuewcvuy", "jzquemjzpvfbka"}, + {"wlvmfxbleuot", "bfufqsusp"}, + {"bfufqsusp", "bfufqsusp"}, + {"xpmxtfyvjrnujyxjh", "rpesfkhfjucj"}, + {"mzfpofjn", "rpesfkhfjucj"}, + {"rpesfkhfjucj", "rpesfkhfjucj"}, + {"xpmxtfyvjrnujyxjh", "mzfpofjn"}, + {"wlvmfxbleuot", "bfufqsusp"}, + {"rpesfkhfjucj", "xpmxtfyvjrnujyxjh"}, + {"cuewcvuy", "dnaaehrekqms"}, + {"dnaaehrekqms", "dnaaehrekqms"}, + {"rpesfkhfjucj", "wlvmfxbleuot"}, + {"lkopigreodypvude", "mzvbgcizeeth"}, + {"tglnshmqlmkqqfbpf", "bbchthovla"}, + {"orileazg", "filnwifbukdqijgr"}, + {"yltljjairlkrmdq", "xrgfejybbkezgor"}, + {"inuzvkgolupxelcal", "hgxrhkanzvzmsjpzl"}, + {"jzquemjzpvfbka", "iziepzqne"}, + {"muaskefecskjghzn", "iziepzqne"}, + {"hhrllhedyy", "wzflhbbgtc"}, + {"cemnayjhlnj", "hgtyntdmrgjh"}, + {"iziepzqne", "iziepzqne"}, + {"cuewcvuy", "dnaaehrekqms"}, + {"muaskefecskjghzn", "iziepzqne"}, + {"jzquemjzpvfbka", "muaskefecskjghzn"}, + {"dnaaehrekqms", "dnaaehrekqms"}, + {"jrocadcojmybpxmuj", "jrocadcojmybpxmuj"}, + {"llrzqdnoxbscnkqy", "suvvqdiceuogcmv"}, + {"suvvqdiceuogcmv", "suvvqdiceuogcmv"}, + {"bbchthovla", "bbchthovla"}, + {"rvihrzzkt", "tglnshmqlmkqqfbpf"}, + {"filnwifbukdqijgr", "pkirimjwvyxs"}, + {"tglnshmqlmkqqfbpf", "tglnshmqlmkqqfbpf"}, + {"rvihrzzkt", "tglnshmqlmkqqfbpf"}, + {"bbchthovla", "bbchthovla"}, + {"tglnshmqlmkqqfbpf", "tglnshmqlmkqqfbpf"}, + {"hjogoueazw", "lkopigreodypvude"}, + {"lkopigreodypvude", "lkopigreodypvude"}, + {"mzvbgcizeeth", "arigdtezmyz"}, + {"qvwvgzxqihvk", "arigdtezmyz"}, + {"arigdtezmyz", "arigdtezmyz"}, + {"mzvbgcizeeth", "arigdtezmyz"}, + {"qvwvgzxqihvk", "qvwvgzxqihvk"}, + {"hjogoueazw", "hjogoueazw"}, + {"subzoyxjkfiwmfb", "khcyhttaaxp"}, + {"subzoyxjkfiwmfb", "subzoyxjkfiwmfb"}, + {"khcyhttaaxp", "subzoyxjkfiwmfb"}, + {"ooyllkxg", "ooyllkxg"}, + {"orlzzpytpzazxr", "orlzzpytpzazxr"}, + {"oufzmjgplt", "oufzmjgplt"}, + {"shfzcyboj", "shfzcyboj"}, + {"oufzmjgplt", "oufzmjgplt"}, + {"orlzzpytpzazxr", "oufzmjgplt"}, + {"wrszraxxdum", "wrszraxxdum"}, + {"wrszraxxdum", "wrszraxxdum"}, + {"shfzcyboj", "wrszraxxdum"}, + {"yutahdply", "xozoyaqxtbustrymo"}, + {"umlzibkkpsyvpdol", "pzlmeboecybxmetz"}, + {"hgxrhkanzvzmsjpzl", "gwkkpxuvgp"}, + {"xrgfejybbkezgor", "wtjtdrlm"}, + {"wtjtdrlm", "wtjtdrlm"}, + {"yltljjairlkrmdq", "fllqjtnxwmfoou"}, + {"xrgfejybbkezgor", "wtjtdrlm"}, + {"filnwifbukdqijgr", "pkirimjwvyxs"}, + {"pkirimjwvyxs", "pkirimjwvyxs"}, + {"gdziaihbagl", "orileazg"}, + {"orileazg", "orileazg"}, + {"gdziaihbagl", "orileazg"}, + {"hlcsiukaroscfg", "orileazg"}, + {"hlcsiukaroscfg", "hlcsiukaroscfg"}, + {"gdziaihbagl", "gdziaihbagl"}, + {"ainlwrwabqcwq", "ainlwrwabqcwq"}, + {"uzlxmaoro", "bfxbncez"}, + {"qyaxqaqxiwr", "qyaxqaqxiwr"}, + {"pdxsxjop", "pdxsxjop"}, + {"pdxsxjop", "pdxsxjop"}, + {"subzoyxjkfiwmfb", "subzoyxjkfiwmfb"}, + {"uzlxmaoro", "bfxbncez"}, + {"bfxbncez", "bfxbncez"}, + {"qyaxqaqxiwr", "pdxsxjop"}, + {"ooyllkxg", "ooyllkxg"}, + {"hgxrhkanzvzmsjpzl", "ecqfdkebnamkfglk"}, + {"gwkkpxuvgp", "ecqfdkebnamkfglk"}, + {"ecqfdkebnamkfglk", "ecqfdkebnamkfglk"}, + {"yzxogkunvohdmro", "yzxogkunvohdmro"}, + {"inuzvkgolupxelcal", "yzxogkunvohdmro"}, + {"yzxogkunvohdmro", "yzxogkunvohdmro"}, + {"cjjkmybleu", "yzxogkunvohdmro"}, + {"inuzvkgolupxelcal", "inuzvkgolupxelcal"}, + {"ecqfdkebnamkfglk", "gwkkpxuvgp"}, + {"dwojnswr", "dkhfozltuckwog"}, + {"yltljjairlkrmdq", "fllqjtnxwmfoou"}, + {"fllqjtnxwmfoou", "fllqjtnxwmfoou"}, + {"wzflhbbgtc", "zzdvolqtndzfjvqqr"}, + {"dkhfozltuckwog", "dkhfozltuckwog"}, + {"zfmpxgrevxp", "stkglpqdjzxmnlito"}, + {"wzflhbbgtc", "wzflhbbgtc"}, + {"cjjkmybleu", "cjjkmybleu"}, + {"wgcjlntupylayse", "wgcjlntupylayse"}, + {"vyrvelteblnqaabc", "vyrvelteblnqaabc"}, + {"bvxiilsnsarhsyl", "zzdvolqtndzfjvqqr"}, + {"stkglpqdjzxmnlito", "stkglpqdjzxmnlito"}, + {"cemnayjhlnj", "cemnayjhlnj"}, + {"cemnayjhlnj", "cemnayjhlnj"}, + {"hgtyntdmrgjh", "hgtyntdmrgjh"}, + {"rnlryins", "vyrvelteblnqaabc"}, + {"hhrllhedyy", "vyrvelteblnqaabc"}, + {"rnlryins", "rnlryins"}, + {"fquzrlhdsnuwhhu", "zzdvolqtndzfjvqqr"}, + {"zzdvolqtndzfjvqqr", "bvxiilsnsarhsyl"}, + {"wmpvjvzljhnaxvp", "wmpvjvzljhnaxvp"}, + {"qnjidlmwmxxjgntez", "vyrvelteblnqaabc"}, + {"fquzrlhdsnuwhhu", "zzdvolqtndzfjvqqr"}, + {"zzdvolqtndzfjvqqr", "zzdvolqtndzfjvqqr"}, + {"edurtetzseifez", "rphnhtvnihyfkrgv"}, + {"wgcjlntupylayse", "wgcjlntupylayse"}, + {"zwwgloilddclufwze", "aeloeauxmc"}, + {"rphnhtvnihyfkrgv", "rphnhtvnihyfkrgv"}, + {"aeloeauxmc", "aeloeauxmc"}, + {"hgtyntdmrgjh", "wgcjlntupylayse"}, + {"rphnhtvnihyfkrgv", "rphnhtvnihyfkrgv"}, + {"cufxsgbpjgqvk", "cufxsgbpjgqvk"}, + {"mnrdscqkycodx", "shsgrqol"}, + {"qnjidlmwmxxjgntez", "hhrllhedyy"}, + {"shsgrqol", "shsgrqol"}, + {"vyrvelteblnqaabc", "qnjidlmwmxxjgntez"}, + {"zwwgloilddclufwze", "aeloeauxmc"}, + {"evepphnzuw", "rthpxoxyyiy"}, + {"rthpxoxyyiy", "rthpxoxyyiy"}, + {"aotjpvanljxe", "aotjpvanljxe"}, + {"aotjpvanljxe", "stkglpqdjzxmnlito"}, + {"dkhfozltuckwog", "dwojnswr"}, + {"rthpxoxyyiy", "pyzcbpjhntpefbq"}, + {"evepphnzuw", "evepphnzuw"}, + {"aeloeauxmc", "aeloeauxmc"}, + {"zfmpxgrevxp", "aotjpvanljxe"}, + {"stkglpqdjzxmnlito", "aotjpvanljxe"}, + {"bubwouozgs", "mkmawbogphdttd"}, + {"pyzcbpjhntpefbq", "rthpxoxyyiy"}, + {"gkqrglav", "gkqrglav"}, + {"czlgbqzffodsoxng", "czlgbqzffodsoxng"}, + {"yykdqtkkdacpbwtbq", "yykdqtkkdacpbwtbq"}, + {"dhmiuqhqlsprxy", "dhmiuqhqlsprxy"}, + {"ztisufueqzequ", "ztisufueqzequ"}, + {"ztisufueqzequ", "narvuaqmmkqhd"}, + {"narvuaqmmkqhd", "narvuaqmmkqhd"}, + {"narvuaqmmkqhd", "narvuaqmmkqhd"}, + {"ibwfxvxswjbecab", "ibwfxvxswjbecab"}, + {"dhmiuqhqlsprxy", "dhmiuqhqlsprxy"}, + {"xydwvemqvtgvzl", "wmpvjvzljhnaxvp"}, + {"wmpvjvzljhnaxvp", "wmpvjvzljhnaxvp"}, + {"xydwvemqvtgvzl", "wmpvjvzljhnaxvp"}, + {"ibwfxvxswjbecab", "ibwfxvxswjbecab"}, + {"bubwouozgs", "mkmawbogphdttd"}, + {"mkmawbogphdttd", "mkmawbogphdttd"}, + {"ainlwrwabqcwq", "ainlwrwabqcwq"}, + {"mkmawbogphdttd", "mkmawbogphdttd"}, + {"edurtetzseifez", "edurtetzseifez"}, + {"inhzsspqltvl", "inhzsspqltvl"}, + {"cufxsgbpjgqvk", "inhzsspqltvl"}, + {"yykdqtkkdacpbwtbq", "yykdqtkkdacpbwtbq"}, + {"mnrdscqkycodx", "mnrdscqkycodx"}, + {"shsgrqol", "shsgrqol"}, + {"cufxsgbpjgqvk", "inhzsspqltvl"}, + {"livgsrfvgtovcurzq", "livgsrfvgtovcurzq"}, + {"tyxrlpmcy", "tyxrlpmcy"}, + {"livgsrfvgtovcurzq", "livgsrfvgtovcurzq"}, + {"tyxrlpmcy", "tyxrlpmcy"}, + {"czlgbqzffodsoxng", "czlgbqzffodsoxng"}, + {"gkqrglav", "gkqrglav"}, + }; assertEquals(true, solution1.areSentencesSimilarTwo(words1, words2, pairs)); } @Test public void test5() { - words1 = new String[]{"a", "very", "delicious", "meal"}; - words2 = new String[]{"one", "really", "good", "dinner"}; - pairs = new String[][]{ - {"great", "good"}, - {"extraordinary", "good"}, - {"well", "good"}, - {"wonderful", "good"}, - {"excellent", "good"}, - {"fine", "good"}, - {"nice", "good"}, - {"any", "one"}, - {"some", "one"}, - {"unique", "one"}, - {"the", "one"}, - {"an", "one"}, - {"single", "one"}, - {"a", "one"}, - {"truck", "car"}, - {"wagon", "car"}, - {"automobile", "car"}, - {"auto", "car"}, - {"vehicle", "car"}, - {"entertain", "have"}, - {"drink", "have"}, - {"eat", "have"}, - {"take", "have"}, - {"fruits", "meal"}, - {"brunch", "meal"}, - {"breakfast", "meal"}, - {"food", "meal"}, - {"dinner", "meal"}, - {"super", "meal"}, - {"lunch", "meal"}, - {"possess", "own"}, - {"keep", "own"}, - {"have", "own"}, - {"extremely", "very"}, - {"really", "very"}, - {"super", "very"}, - }; + words1 = new String[] {"a", "very", "delicious", "meal"}; + words2 = new String[] {"one", "really", "good", "dinner"}; + pairs = + new String[][] { + {"great", "good"}, + {"extraordinary", "good"}, + {"well", "good"}, + {"wonderful", "good"}, + {"excellent", "good"}, + {"fine", "good"}, + {"nice", "good"}, + {"any", "one"}, + {"some", "one"}, + {"unique", "one"}, + {"the", "one"}, + {"an", "one"}, + {"single", "one"}, + {"a", "one"}, + {"truck", "car"}, + {"wagon", "car"}, + {"automobile", "car"}, + {"auto", "car"}, + {"vehicle", "car"}, + {"entertain", "have"}, + {"drink", "have"}, + {"eat", "have"}, + {"take", "have"}, + {"fruits", "meal"}, + {"brunch", "meal"}, + {"breakfast", "meal"}, + {"food", "meal"}, + {"dinner", "meal"}, + {"super", "meal"}, + {"lunch", "meal"}, + {"possess", "own"}, + {"keep", "own"}, + {"have", "own"}, + {"extremely", "very"}, + {"really", "very"}, + {"super", "very"}, + }; assertEquals(false, solution1.areSentencesSimilarTwo(words1, words2, pairs)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_738Test.java b/src/test/java/com/fishercoder/firstthousand/_738Test.java index 18f4199b18..e93a64cac9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_738Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_738Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._738; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _738Test { private _738.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(9, solution1.monotoneIncreasingDigits(10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_739Test.java b/src/test/java/com/fishercoder/firstthousand/_739Test.java index 8126c2c132..27ff760e23 100644 --- a/src/test/java/com/fishercoder/firstthousand/_739Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_739Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._739; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _739Test { private _739.Solution1 solution1; private static int[] temperatures; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - temperatures = new int[]{73, 74, 75, 71, 69, 72, 76, 73}; - expected = new int[]{1, 1, 4, 2, 1, 1, 0, 0}; + temperatures = new int[] {73, 74, 75, 71, 69, 72, 76, 73}; + expected = new int[] {1, 1, 4, 2, 1, 1, 0, 0}; assertArrayEquals(expected, solution1.dailyTemperatures(temperatures)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_73Test.java b/src/test/java/com/fishercoder/firstthousand/_73Test.java index 81c523a77d..b25e0fad71 100644 --- a/src/test/java/com/fishercoder/firstthousand/_73Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_73Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._73; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _73Test { private _73.Solution1 solution1; private _73.Solution2 solution2; @@ -24,82 +24,89 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {0, 0, 0, 5}, - {4, 3, 1, 4}, - {0, 1, 1, 4}, - {1, 2, 1, 3}, - {0, 0, 1, 1} - }; + matrix = + new int[][] { + {0, 0, 0, 5}, + {4, 3, 1, 4}, + {0, 1, 1, 4}, + {1, 2, 1, 3}, + {0, 0, 1, 1} + }; solution1.setZeroes(matrix); - expected = new int[][]{ - {0, 0, 0, 0}, - {0, 0, 0, 4}, - {0, 0, 0, 0}, - {0, 0, 0, 3}, - {0, 0, 0, 0} - }; + expected = + new int[][] { + {0, 0, 0, 0}, + {0, 0, 0, 4}, + {0, 0, 0, 0}, + {0, 0, 0, 3}, + {0, 0, 0, 0} + }; assertArrayEquals(expected, matrix); } @Test public void test2() { - matrix = new int[][]{ - {0, 0, 0, 5}, - {4, 3, 1, 4}, - {0, 1, 1, 4}, - {1, 2, 1, 3}, - {0, 0, 1, 1} - }; + matrix = + new int[][] { + {0, 0, 0, 5}, + {4, 3, 1, 4}, + {0, 1, 1, 4}, + {1, 2, 1, 3}, + {0, 0, 1, 1} + }; solution2.setZeroes(matrix); - expected = new int[][]{ - {0, 0, 0, 0}, - {0, 0, 0, 4}, - {0, 0, 0, 0}, - {0, 0, 0, 3}, - {0, 0, 0, 0} - }; + expected = + new int[][] { + {0, 0, 0, 0}, + {0, 0, 0, 4}, + {0, 0, 0, 0}, + {0, 0, 0, 3}, + {0, 0, 0, 0} + }; assertArrayEquals(expected, matrix); } @Test public void test3() { - matrix = new int[][]{ - {0, 0, 0, 5}, - {4, 3, 1, 4}, - {0, 1, 1, 4}, - {1, 2, 1, 3}, - {0, 0, 1, 1} - }; + matrix = + new int[][] { + {0, 0, 0, 5}, + {4, 3, 1, 4}, + {0, 1, 1, 4}, + {1, 2, 1, 3}, + {0, 0, 1, 1} + }; solution3.setZeroes(matrix); - expected = new int[][]{ - {0, 0, 0, 0}, - {0, 0, 0, 4}, - {0, 0, 0, 0}, - {0, 0, 0, 3}, - {0, 0, 0, 0} - }; + expected = + new int[][] { + {0, 0, 0, 0}, + {0, 0, 0, 4}, + {0, 0, 0, 0}, + {0, 0, 0, 3}, + {0, 0, 0, 0} + }; assertArrayEquals(expected, matrix); } @Test public void test4() { - matrix = new int[][]{ - {0, 0, 0, 5}, - {4, 3, 1, 4}, - {0, 1, 1, 4}, - {1, 2, 1, 3}, - {0, 0, 1, 1} - }; + matrix = + new int[][] { + {0, 0, 0, 5}, + {4, 3, 1, 4}, + {0, 1, 1, 4}, + {1, 2, 1, 3}, + {0, 0, 1, 1} + }; solution4.setZeroes(matrix); - expected = new int[][]{ - {0, 0, 0, 0}, - {0, 0, 0, 4}, - {0, 0, 0, 0}, - {0, 0, 0, 3}, - {0, 0, 0, 0} - }; + expected = + new int[][] { + {0, 0, 0, 0}, + {0, 0, 0, 4}, + {0, 0, 0, 0}, + {0, 0, 0, 3}, + {0, 0, 0, 0} + }; assertArrayEquals(expected, matrix); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_740Test.java b/src/test/java/com/fishercoder/firstthousand/_740Test.java index fbff143274..dab9b04803 100644 --- a/src/test/java/com/fishercoder/firstthousand/_740Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_740Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._740; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _740Test { private _740.Solution1 solution1; private _740.Solution2 solution2; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 4, 2}; + nums = new int[] {3, 4, 2}; assertEquals(6, solution1.deleteAndEarn(nums)); assertEquals(6, solution2.deleteAndEarn(nums)); assertEquals(6, solution3.deleteAndEarn(nums)); @@ -29,7 +29,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{2, 2, 3, 3, 3, 4}; + nums = new int[] {2, 2, 3, 3, 3, 4}; assertEquals(9, solution1.deleteAndEarn(nums)); assertEquals(9, solution2.deleteAndEarn(nums)); assertEquals(9, solution3.deleteAndEarn(nums)); diff --git a/src/test/java/com/fishercoder/firstthousand/_742Test.java b/src/test/java/com/fishercoder/firstthousand/_742Test.java index e2b32fb94f..a834486999 100644 --- a/src/test/java/com/fishercoder/firstthousand/_742Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_742Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._742; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _742Test { private _742.Solution1 solution1; private static TreeNode root; @@ -33,7 +32,9 @@ public void test2() { @Test public void test3() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, null, null, 5, null, 6)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(1, 2, 3, 4, null, null, null, 5, null, 6)); TreeUtils.printBinaryTree(root); assertEquals(3, solution1.findClosestLeaf(root, 2)); } @@ -47,8 +48,74 @@ public void test4() { @Test public void test5() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, null, 3, null, 4, null, 5, null, 6, null, 7, null, 8, null, 9, null, 10, null, 11, null, 12, null, 13, null, 14, null, 15, null, 16, null, 17, null, 18, null, 19, null, 20, null, 21, null, 22, null, 23, null, 24, null, 25, null, 26, null, 27, null, 28, null, 29, null, 30, null, 31, null, 32, null, 33, null, 34, null, 35, null, 36, null, 37, null, 38, null, 39, null, 40, null, 41, null, 42, null, 43, null, 44, null, 45, null, 46, null, 47, null, 48, null, 49, null, 50, null, 51, null, 52, null, 53, null, 54, null, 55, null, 56, null, 57, null, 58, null, 59, null, 60, null, 61, null, 62, null, 63, null, 64, null, 65, null, 66, null, 67, null, 68, null, 69, null, 70, null, 71, null, 72, null, 73, null, 74, null, 75, null, 76, null, 77, null, 78, null, 79, null, 80, null, 81, null, 82, null, 83, null, 84, null, 85, null, 86, null, 87, null, 88, null, 89, null, 90, null, 91, null, 92, null, 93, null, 94, null, 95, null, 96, null, 97, null, 98, null, 99, null, 100, null, 101, null, 102, null, 103, null, 104, null, 105, null, 106, null, 107, null, 108, null, 109, null, 110, null, 111, null, 112, null, 113, null, 114, null, 115, null, 116, null, 117, null, 118, null, 119, null, 120, null, 121, null, 122, null, 123, null, 124, null, 125, null, 126, null, 127, null, 128, null, 129, null, 130, null, 131, null, 132, null, 133, null, 134, null, 135, null, 136, null, 137, null, 138, null, 139, null, 140, null, 141, null, 142, null, 143, null, 144, null, 145, null, 146, null, 147, null, 148, null, 149, null, 150, null, 151, null, 152, null, 153, null, 154, null, 155, null, 156, null, 157, null, 158, null, 159, null, 160, null, 161, null, 162, null, 163, null, 164, null, 165, null, 166, null, 167, null, 168, null, 169, null, 170, null, 171, null, 172, null, 173, null, 174, null, 175, null, 176, null, 177, null, 178, null, 179, null, 180, null, 181, null, 182, null, 183, null, 184, null, 185, null, 186, null, 187, null, 188, null, 189, null, 190, null, 191, null, 192, null, 193, null, 194, null, 195, null, 196, null, 197, null, 198, null, 199, null, 200, null, 201, null, 202, null, 203, null, 204, null, 205, null, 206, null, 207, null, 208, null, 209, null, 210, null, 211, null, 212, null, 213, null, 214, null, 215, null, 216, null, 217, null, 218, null, 219, null, 220, null, 221, null, 222, null, 223, null, 224, null, 225, null, 226, null, 227, null, 228, null, 229, null, 230, null, 231, null, 232, null, 233, null, 234, null, 235, null, 236, null, 237, null, 238, null, 239, null, 240, null, 241, null, 242, null, 243, null, 244, null, 245, null, 246, null, 247, null, 248, null, 249, null, 250, null, 251, null, 252, null, 253, null, 254, null, 255, null, 256, null, 257, null, 258, null, 259, null, 260, null, 261, null, 262, null, 263, null, 264, null, 265, null, 266, null, 267, null, 268, null, 269, null, 270, null, 271, null, 272, null, 273, null, 274, null, 275, null, 276, null, 277, null, 278, null, 279, null, 280, null, 281, null, 282, null, 283, null, 284, null, 285, null, 286, null, 287, null, 288, null, 289, null, 290, null, 291, null, 292, null, 293, null, 294, null, 295, null, 296, null, 297, null, 298, null, 299, null, 300, null, 301, null, 302, null, 303, null, 304, null, 305, null, 306, null, 307, null, 308, null, 309, null, 310, null, 311, null, 312, null, 313, null, 314, null, 315, null, 316, null, 317, null, 318, null, 319, null, 320, null, 321, null, 322, null, 323, null, 324, null, 325, null, 326, null, 327, null, 328, null, 329, null, 330, null, 331, null, 332, null, 333, null, 334, null, 335, null, 336, null, 337, null, 338, null, 339, null, 340, null, 341, null, 342, null, 343, null, 344, null, 345, null, 346, null, 347, null, 348, null, 349, null, 350, null, 351, null, 352, null, 353, null, 354, null, 355, null, 356, null, 357, null, 358, null, 359, null, 360, null, 361, null, 362, null, 363, null, 364, null, 365, null, 366, null, 367, null, 368, null, 369, null, 370, null, 371, null, 372, null, 373, null, 374, null, 375, null, 376, null, 377, null, 378, null, 379, null, 380, null, 381, null, 382, null, 383, null, 384, null, 385, null, 386, null, 387, null, 388, null, 389, null, 390, null, 391, null, 392, null, 393, null, 394, null, 395, null, 396, null, 397, null, 398, null, 399, null)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, null, 3, null, 4, null, 5, null, 6, null, 7, null, 8, null, 9, + null, 10, null, 11, null, 12, null, 13, null, 14, null, 15, null, + 16, null, 17, null, 18, null, 19, null, 20, null, 21, null, 22, + null, 23, null, 24, null, 25, null, 26, null, 27, null, 28, null, + 29, null, 30, null, 31, null, 32, null, 33, null, 34, null, 35, + null, 36, null, 37, null, 38, null, 39, null, 40, null, 41, null, + 42, null, 43, null, 44, null, 45, null, 46, null, 47, null, 48, + null, 49, null, 50, null, 51, null, 52, null, 53, null, 54, null, + 55, null, 56, null, 57, null, 58, null, 59, null, 60, null, 61, + null, 62, null, 63, null, 64, null, 65, null, 66, null, 67, null, + 68, null, 69, null, 70, null, 71, null, 72, null, 73, null, 74, + null, 75, null, 76, null, 77, null, 78, null, 79, null, 80, null, + 81, null, 82, null, 83, null, 84, null, 85, null, 86, null, 87, + null, 88, null, 89, null, 90, null, 91, null, 92, null, 93, null, + 94, null, 95, null, 96, null, 97, null, 98, null, 99, null, 100, + null, 101, null, 102, null, 103, null, 104, null, 105, null, 106, + null, 107, null, 108, null, 109, null, 110, null, 111, null, 112, + null, 113, null, 114, null, 115, null, 116, null, 117, null, 118, + null, 119, null, 120, null, 121, null, 122, null, 123, null, 124, + null, 125, null, 126, null, 127, null, 128, null, 129, null, 130, + null, 131, null, 132, null, 133, null, 134, null, 135, null, 136, + null, 137, null, 138, null, 139, null, 140, null, 141, null, 142, + null, 143, null, 144, null, 145, null, 146, null, 147, null, 148, + null, 149, null, 150, null, 151, null, 152, null, 153, null, 154, + null, 155, null, 156, null, 157, null, 158, null, 159, null, 160, + null, 161, null, 162, null, 163, null, 164, null, 165, null, 166, + null, 167, null, 168, null, 169, null, 170, null, 171, null, 172, + null, 173, null, 174, null, 175, null, 176, null, 177, null, 178, + null, 179, null, 180, null, 181, null, 182, null, 183, null, 184, + null, 185, null, 186, null, 187, null, 188, null, 189, null, 190, + null, 191, null, 192, null, 193, null, 194, null, 195, null, 196, + null, 197, null, 198, null, 199, null, 200, null, 201, null, 202, + null, 203, null, 204, null, 205, null, 206, null, 207, null, 208, + null, 209, null, 210, null, 211, null, 212, null, 213, null, 214, + null, 215, null, 216, null, 217, null, 218, null, 219, null, 220, + null, 221, null, 222, null, 223, null, 224, null, 225, null, 226, + null, 227, null, 228, null, 229, null, 230, null, 231, null, 232, + null, 233, null, 234, null, 235, null, 236, null, 237, null, 238, + null, 239, null, 240, null, 241, null, 242, null, 243, null, 244, + null, 245, null, 246, null, 247, null, 248, null, 249, null, 250, + null, 251, null, 252, null, 253, null, 254, null, 255, null, 256, + null, 257, null, 258, null, 259, null, 260, null, 261, null, 262, + null, 263, null, 264, null, 265, null, 266, null, 267, null, 268, + null, 269, null, 270, null, 271, null, 272, null, 273, null, 274, + null, 275, null, 276, null, 277, null, 278, null, 279, null, 280, + null, 281, null, 282, null, 283, null, 284, null, 285, null, 286, + null, 287, null, 288, null, 289, null, 290, null, 291, null, 292, + null, 293, null, 294, null, 295, null, 296, null, 297, null, 298, + null, 299, null, 300, null, 301, null, 302, null, 303, null, 304, + null, 305, null, 306, null, 307, null, 308, null, 309, null, 310, + null, 311, null, 312, null, 313, null, 314, null, 315, null, 316, + null, 317, null, 318, null, 319, null, 320, null, 321, null, 322, + null, 323, null, 324, null, 325, null, 326, null, 327, null, 328, + null, 329, null, 330, null, 331, null, 332, null, 333, null, 334, + null, 335, null, 336, null, 337, null, 338, null, 339, null, 340, + null, 341, null, 342, null, 343, null, 344, null, 345, null, 346, + null, 347, null, 348, null, 349, null, 350, null, 351, null, 352, + null, 353, null, 354, null, 355, null, 356, null, 357, null, 358, + null, 359, null, 360, null, 361, null, 362, null, 363, null, 364, + null, 365, null, 366, null, 367, null, 368, null, 369, null, 370, + null, 371, null, 372, null, 373, null, 374, null, 375, null, 376, + null, 377, null, 378, null, 379, null, 380, null, 381, null, 382, + null, 383, null, 384, null, 385, null, 386, null, 387, null, 388, + null, 389, null, 390, null, 391, null, 392, null, 393, null, 394, + null, 395, null, 396, null, 397, null, 398, null, 399, null)); assertEquals(399, solution1.findClosestLeaf(root, 100)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_743Test.java b/src/test/java/com/fishercoder/firstthousand/_743Test.java index efc503f3c4..e393b5a291 100644 --- a/src/test/java/com/fishercoder/firstthousand/_743Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_743Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._743; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _743Test { private _743.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_744Test.java b/src/test/java/com/fishercoder/firstthousand/_744Test.java index 36a9ea0900..e9f0bd5499 100644 --- a/src/test/java/com/fishercoder/firstthousand/_744Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_744Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._744; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _744Test { private _744.Solution1 solution1; private static char[] letters; @@ -17,38 +17,37 @@ public void setup() { @Test public void test1() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('c', solution1.nextGreatestLetter(letters, 'a')); } @Test public void test2() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('f', solution1.nextGreatestLetter(letters, 'c')); } @Test public void test3() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('f', solution1.nextGreatestLetter(letters, 'd')); } @Test public void test4() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('j', solution1.nextGreatestLetter(letters, 'g')); } @Test public void test5() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('c', solution1.nextGreatestLetter(letters, 'j')); } @Test public void test6() { - letters = new char[]{'c', 'f', 'j'}; + letters = new char[] {'c', 'f', 'j'}; assertEquals('c', solution1.nextGreatestLetter(letters, 'k')); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_746Test.java b/src/test/java/com/fishercoder/firstthousand/_746Test.java index 3427d50571..a9ef0014e3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_746Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_746Test.java @@ -1,29 +1,29 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._746; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _746Test { - private _746.Solution1 solution1; - private static int[] cost; + private _746.Solution1 solution1; + private static int[] cost; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _746.Solution1(); - } + solution1 = new _746.Solution1(); + } - @Test - public void test1() { - cost = new int[] {10, 15, 20}; - assertEquals(15, solution1.minCostClimbingStairs(cost)); - } + @Test + public void test1() { + cost = new int[] {10, 15, 20}; + assertEquals(15, solution1.minCostClimbingStairs(cost)); + } - @Test - public void test2() { - cost = new int[] {1, 100, 1, 1, 1, 100, 1, 1, 100, 1}; - assertEquals(6, solution1.minCostClimbingStairs(cost)); - } + @Test + public void test2() { + cost = new int[] {1, 100, 1, 1, 1, 100, 1, 1, 100, 1}; + assertEquals(6, solution1.minCostClimbingStairs(cost)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_747Test.java b/src/test/java/com/fishercoder/firstthousand/_747Test.java index e1c705ac41..47ac4ad866 100644 --- a/src/test/java/com/fishercoder/firstthousand/_747Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_747Test.java @@ -1,43 +1,43 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._747; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _747Test { - private _747.Solution1 solution1; - private _747.Solution2 solution2; - private static int[] nums; + private _747.Solution1 solution1; + private _747.Solution2 solution2; + private static int[] nums; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _747.Solution1(); - solution2 = new _747.Solution2(); - } - - @Test - public void test1() { - nums = new int[] {3, 6, 1, 0}; - assertEquals(1, solution1.dominantIndex(nums)); - } - - @Test - public void test2() { - nums = new int[] {3, 6, 1, 0}; - assertEquals(1, solution2.dominantIndex(nums)); - } - - @Test - public void test3() { - nums = new int[] {1, 2, 3, 4}; - assertEquals(-1, solution1.dominantIndex(nums)); - } - - @Test - public void test4() { - nums = new int[] {1, 2, 3, 4}; - assertEquals(-1, solution2.dominantIndex(nums)); - } + solution1 = new _747.Solution1(); + solution2 = new _747.Solution2(); + } + + @Test + public void test1() { + nums = new int[] {3, 6, 1, 0}; + assertEquals(1, solution1.dominantIndex(nums)); + } + + @Test + public void test2() { + nums = new int[] {3, 6, 1, 0}; + assertEquals(1, solution2.dominantIndex(nums)); + } + + @Test + public void test3() { + nums = new int[] {1, 2, 3, 4}; + assertEquals(-1, solution1.dominantIndex(nums)); + } + + @Test + public void test4() { + nums = new int[] {1, 2, 3, 4}; + assertEquals(-1, solution2.dominantIndex(nums)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_748Test.java b/src/test/java/com/fishercoder/firstthousand/_748Test.java index f13cbbea35..fbcea263c0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_748Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_748Test.java @@ -1,39 +1,51 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._748; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _748Test { - private _748.Solution1 solution1; - private static String[] words; - private static String licensePlate; + private _748.Solution1 solution1; + private static String[] words; + private static String licensePlate; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _748.Solution1(); - } + solution1 = new _748.Solution1(); + } - @Test - public void test1() { - words = new String[] {"step", "steps", "stripe", "stepple"}; - licensePlate = "1s3 PSt"; - assertEquals("steps", solution1.shortestCompletingWord(licensePlate, words)); - } + @Test + public void test1() { + words = new String[] {"step", "steps", "stripe", "stepple"}; + licensePlate = "1s3 PSt"; + assertEquals("steps", solution1.shortestCompletingWord(licensePlate, words)); + } - @Test - public void test2() { - words = new String[] {"looks", "pest", "stew", "show"}; - licensePlate = "1s3 456"; - assertEquals("pest", solution1.shortestCompletingWord(licensePlate, words)); - } + @Test + public void test2() { + words = new String[] {"looks", "pest", "stew", "show"}; + licensePlate = "1s3 456"; + assertEquals("pest", solution1.shortestCompletingWord(licensePlate, words)); + } - @Test - public void test3() { - words = new String[]{"suggest","letter","of","husband","easy","education","drug","prevent","writer","old"}; - licensePlate = "Ah71752"; - assertEquals("husband", solution1.shortestCompletingWord(licensePlate, words)); - } + @Test + public void test3() { + words = + new String[] { + "suggest", + "letter", + "of", + "husband", + "easy", + "education", + "drug", + "prevent", + "writer", + "old" + }; + licensePlate = "Ah71752"; + assertEquals("husband", solution1.shortestCompletingWord(licensePlate, words)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_74Test.java b/src/test/java/com/fishercoder/firstthousand/_74Test.java index c57e6a0592..e9da70c0a8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_74Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_74Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._74; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _74Test { private _74.Solution1 solution1; private static int target; @@ -19,11 +19,12 @@ public void setup() { @Test public void test1() { target = 3; - matrix = new int[][]{ - {1, 3, 5, 7}, - {10, 11, 16, 20}, - {23, 30, 34, 50}, - }; + matrix = + new int[][] { + {1, 3, 5, 7}, + {10, 11, 16, 20}, + {23, 30, 34, 50}, + }; assertEquals(true, solution1.searchMatrix(matrix, target)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_750Test.java b/src/test/java/com/fishercoder/firstthousand/_750Test.java index 4e9ed9c9d4..bd2a41c4b2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_750Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_750Test.java @@ -1,43 +1,46 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._750; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _750Test { - private _750.Solution1 solution1; - private static int[][] grid; + private _750.Solution1 solution1; + private static int[][] grid; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _750.Solution1(); - } + solution1 = new _750.Solution1(); + } - @Test - public void test1() { - grid = new int[][] { - {1, 0, 0, 1, 0}, - {0, 0, 1, 0, 1}, - {0, 0, 0, 1, 0}, - {1, 0, 1, 0, 1}}; - assertEquals(1, solution1.countCornerRectangles(grid)); - } + @Test + public void test1() { + grid = + new int[][] { + {1, 0, 0, 1, 0}, + {0, 0, 1, 0, 1}, + {0, 0, 0, 1, 0}, + {1, 0, 1, 0, 1} + }; + assertEquals(1, solution1.countCornerRectangles(grid)); + } - @Test - public void test2() { - grid = new int[][] { - {1, 1, 1}, - {1, 1, 1}, - {1, 1, 1}}; - assertEquals(9, solution1.countCornerRectangles(grid)); - } + @Test + public void test2() { + grid = + new int[][] { + {1, 1, 1}, + {1, 1, 1}, + {1, 1, 1} + }; + assertEquals(9, solution1.countCornerRectangles(grid)); + } - @Test - public void test3() { - grid = new int[][] { - {1, 1, 1, 1}}; - assertEquals(0, solution1.countCornerRectangles(grid)); - } + @Test + public void test3() { + grid = new int[][] {{1, 1, 1, 1}}; + assertEquals(0, solution1.countCornerRectangles(grid)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_752Test.java b/src/test/java/com/fishercoder/firstthousand/_752Test.java index 21da84d823..374dc2ea35 100644 --- a/src/test/java/com/fishercoder/firstthousand/_752Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_752Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._752; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _752Test { private _752.Solution1 solution1; @@ -16,7 +16,8 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.openLock(new String[]{"0201", "0101", "0102", "1212", "2002"}, "0202")); + assertEquals( + 6, + solution1.openLock(new String[] {"0201", "0101", "0102", "1212", "2002"}, "0202")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_754Test.java b/src/test/java/com/fishercoder/firstthousand/_754Test.java index b0e1ffecc8..a558f4d718 100644 --- a/src/test/java/com/fishercoder/firstthousand/_754Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_754Test.java @@ -1,96 +1,96 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._754; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _754Test { - private _754.Solution1 solution1; + private _754.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _754.Solution1(); - } - - @Test - public void test4() { - assertEquals(1, solution1.reachNumber(1)); - } - - @Test - public void test2() { - assertEquals(3, solution1.reachNumber(2)); - } - - @Test - public void test1() { - assertEquals(2, solution1.reachNumber(3)); - } - - @Test - public void test3() { - assertEquals(3, solution1.reachNumber(4)); - } - - @Test - public void test5() { - assertEquals(5, solution1.reachNumber(5)); - } - - @Test - public void test6() { - assertEquals(3, solution1.reachNumber(6)); - } - - @Test - public void test7() { - assertEquals(5, solution1.reachNumber(7)); - } - - @Test - public void test8() { - assertEquals(4, solution1.reachNumber(8)); - } - - @Test - public void test9() { - assertEquals(5, solution1.reachNumber(9)); - } - - @Test - public void test10() { - assertEquals(4, solution1.reachNumber(10)); - } - - @Test - public void test11() { - assertEquals(15, solution1.reachNumber(100)); - } - - @Test - public void test12() { - assertEquals(47, solution1.reachNumber(1000)); - } - - @Test - public void test13() { - assertEquals(143, solution1.reachNumber(10000)); - } - - @Test - public void test14() { - assertEquals(447, solution1.reachNumber(100000)); - } - - @Test - public void test15() { - assertEquals(1415, solution1.reachNumber(1000000)); - } - - @Test - public void test16() { - assertEquals(4472, solution1.reachNumber(10000000)); - } + solution1 = new _754.Solution1(); + } + + @Test + public void test4() { + assertEquals(1, solution1.reachNumber(1)); + } + + @Test + public void test2() { + assertEquals(3, solution1.reachNumber(2)); + } + + @Test + public void test1() { + assertEquals(2, solution1.reachNumber(3)); + } + + @Test + public void test3() { + assertEquals(3, solution1.reachNumber(4)); + } + + @Test + public void test5() { + assertEquals(5, solution1.reachNumber(5)); + } + + @Test + public void test6() { + assertEquals(3, solution1.reachNumber(6)); + } + + @Test + public void test7() { + assertEquals(5, solution1.reachNumber(7)); + } + + @Test + public void test8() { + assertEquals(4, solution1.reachNumber(8)); + } + + @Test + public void test9() { + assertEquals(5, solution1.reachNumber(9)); + } + + @Test + public void test10() { + assertEquals(4, solution1.reachNumber(10)); + } + + @Test + public void test11() { + assertEquals(15, solution1.reachNumber(100)); + } + + @Test + public void test12() { + assertEquals(47, solution1.reachNumber(1000)); + } + + @Test + public void test13() { + assertEquals(143, solution1.reachNumber(10000)); + } + + @Test + public void test14() { + assertEquals(447, solution1.reachNumber(100000)); + } + + @Test + public void test15() { + assertEquals(1415, solution1.reachNumber(1000000)); + } + + @Test + public void test16() { + assertEquals(4472, solution1.reachNumber(10000000)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_755Test.java b/src/test/java/com/fishercoder/firstthousand/_755Test.java index cad5067bf6..4a95154494 100644 --- a/src/test/java/com/fishercoder/firstthousand/_755Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_755Test.java @@ -1,88 +1,88 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._755; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _755Test { - private _755.Solution1 solution1; - private static int[] heights; - private static int[] expected; + private _755.Solution1 solution1; + private static int[] heights; + private static int[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _755.Solution1(); - } + solution1 = new _755.Solution1(); + } - @Test - public void test1() { - heights = new int[] {2, 1, 1, 2, 1, 2, 2}; - expected = new int[] {2, 2, 2, 3, 2, 2, 2}; - assertArrayEquals(expected, solution1.pourWater(heights, 4, 3)); - } + @Test + public void test1() { + heights = new int[] {2, 1, 1, 2, 1, 2, 2}; + expected = new int[] {2, 2, 2, 3, 2, 2, 2}; + assertArrayEquals(expected, solution1.pourWater(heights, 4, 3)); + } - @Test - public void test2() { - heights = new int[] {1, 2, 3, 4}; - expected = new int[] {2, 3, 3, 4}; - assertArrayEquals(expected, solution1.pourWater(heights, 2, 2)); - } + @Test + public void test2() { + heights = new int[] {1, 2, 3, 4}; + expected = new int[] {2, 3, 3, 4}; + assertArrayEquals(expected, solution1.pourWater(heights, 2, 2)); + } - @Test - public void test3() { - heights = new int[] {3, 1, 3}; - expected = new int[] {4, 4, 4}; - assertArrayEquals(expected, solution1.pourWater(heights, 5, 1)); - } + @Test + public void test3() { + heights = new int[] {3, 1, 3}; + expected = new int[] {4, 4, 4}; + assertArrayEquals(expected, solution1.pourWater(heights, 5, 1)); + } - @Test - public void test4() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {1, 2, 3, 4, 3, 3, 2, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 2, 5)); - } + @Test + public void test4() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {1, 2, 3, 4, 3, 3, 2, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 2, 5)); + } - @Test - public void test5() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {3, 4, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 5, 2)); - } + @Test + public void test5() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {3, 4, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 5, 2)); + } - @Test - public void test6() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {4, 4, 4, 4, 3, 3, 3, 3, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 10, 2)); - } + @Test + public void test6() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {4, 4, 4, 4, 3, 3, 3, 3, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 10, 2)); + } - @Test - public void test7() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {2, 3, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 2, 2)); - } + @Test + public void test7() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {2, 3, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 2, 2)); + } - @Test - public void test8() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {3, 3, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 3, 2)); - } + @Test + public void test8() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {3, 3, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 3, 2)); + } - @Test - public void test9() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {3, 3, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 4, 2)); - } + @Test + public void test9() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {3, 3, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 4, 2)); + } - @Test - public void test10() { - heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - expected = new int[] {3, 4, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; - assertArrayEquals(expected, solution1.pourWater(heights, 5, 2)); - } + @Test + public void test10() { + heights = new int[] {1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + expected = new int[] {3, 4, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1}; + assertArrayEquals(expected, solution1.pourWater(heights, 5, 2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_756Test.java b/src/test/java/com/fishercoder/firstthousand/_756Test.java index 9da0fe5ad1..2f7a86d55d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_756Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_756Test.java @@ -1,37 +1,37 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._756; import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _756Test { - private _756.Solution1 solution1; - private static List allowed; + private _756.Solution1 solution1; + private static List allowed; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _756.Solution1(); - } + solution1 = new _756.Solution1(); + } - @Test - public void test1() { - allowed = Arrays.asList("XYD", "YZE", "DEA", "FFF"); - assertEquals(true, solution1.pyramidTransition("XYZ", allowed)); - } + @Test + public void test1() { + allowed = Arrays.asList("XYD", "YZE", "DEA", "FFF"); + assertEquals(true, solution1.pyramidTransition("XYZ", allowed)); + } - @Test - public void test2() { - allowed = Arrays.asList("XXX", "XXY", "XYX", "XYY", "YXZ"); - assertEquals(false, solution1.pyramidTransition("XXYX", allowed)); - } + @Test + public void test2() { + allowed = Arrays.asList("XXX", "XXY", "XYX", "XYY", "YXZ"); + assertEquals(false, solution1.pyramidTransition("XXYX", allowed)); + } - @Test - public void test3() { - allowed = Arrays.asList("BCE", "BCF", "ABA", "CDA", "AEG", "FAG", "GGG"); - assertEquals(false, solution1.pyramidTransition("ABCD", allowed)); - } + @Test + public void test3() { + allowed = Arrays.asList("BCE", "BCF", "ABA", "CDA", "AEG", "FAG", "GGG"); + assertEquals(false, solution1.pyramidTransition("ABCD", allowed)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_757Test.java b/src/test/java/com/fishercoder/firstthousand/_757Test.java index c4a4e6f099..dcf9037a9a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_757Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_757Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._757; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _757Test { private _757.Solution solution; int[][] intervals; @@ -17,13 +17,16 @@ public void setup() { @Test public void test1() { - intervals = new int[][]{{1, 3}, {1, 4}, {2, 5}, {3, 5}}; + intervals = new int[][] {{1, 3}, {1, 4}, {2, 5}, {3, 5}}; assertEquals(3, solution.intersectionSizeTwo(intervals)); } @Test public void test2() { - intervals = new int[][]{{16, 18}, {11, 18}, {15, 23}, {1, 16}, {10, 16}, {6, 19}, {18, 20}, {7, 19}}; + intervals = + new int[][] { + {16, 18}, {11, 18}, {15, 23}, {1, 16}, {10, 16}, {6, 19}, {18, 20}, {7, 19} + }; assertEquals(4, solution.intersectionSizeTwo(intervals)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_758Test.java b/src/test/java/com/fishercoder/firstthousand/_758Test.java index 44500ae6a4..7cc5f82aa3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_758Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_758Test.java @@ -1,29 +1,29 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._758; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _758Test { - private _758.Solution1 solution1; - private static String[] words; + private _758.Solution1 solution1; + private static String[] words; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _758.Solution1(); - } + solution1 = new _758.Solution1(); + } - @Test - public void test1() { - words = new String[] {"ab", "bc"}; - assertEquals("aabcd", solution1.boldWords(words, "aabcd")); - } + @Test + public void test1() { + words = new String[] {"ab", "bc"}; + assertEquals("aabcd", solution1.boldWords(words, "aabcd")); + } - @Test - public void test2() { - words = new String[] {"ccb", "b", "d", "cba", "dc"}; - assertEquals("eeaadadadc", solution1.boldWords(words, "eeaadadadc")); - } + @Test + public void test2() { + words = new String[] {"ccb", "b", "d", "cba", "dc"}; + assertEquals("eeaadadadc", solution1.boldWords(words, "eeaadadadc")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_75Test.java b/src/test/java/com/fishercoder/firstthousand/_75Test.java index b3dfab4c76..1b857664ca 100644 --- a/src/test/java/com/fishercoder/firstthousand/_75Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_75Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._75; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _75Test { private _75.Solution1 solution1; private static int[] nums; @@ -17,94 +17,92 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 2, 1}; + nums = new int[] {2, 2, 1}; solution1.sortColors(nums); - assertArrayEquals(new int[]{1, 2, 2}, nums); + assertArrayEquals(new int[] {1, 2, 2}, nums); } @Test public void test2() { - nums = new int[]{0, 1, 2, 0, 2, 1}; + nums = new int[] {0, 1, 2, 0, 2, 1}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 0, 1, 1, 2, 2}, nums); + assertArrayEquals(new int[] {0, 0, 1, 1, 2, 2}, nums); } @Test public void test3() { - nums = new int[]{1, 0, 2}; + nums = new int[] {1, 0, 2}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 1, 2}, nums); + assertArrayEquals(new int[] {0, 1, 2}, nums); } @Test public void test4() { - nums = new int[]{1, 0}; + nums = new int[] {1, 0}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 1}, nums); + assertArrayEquals(new int[] {0, 1}, nums); } @Test public void test5() { - nums = new int[]{2}; + nums = new int[] {2}; solution1.sortColors(nums); - assertArrayEquals(new int[]{2}, nums); + assertArrayEquals(new int[] {2}, nums); } @Test public void test6() { - nums = new int[]{2, 0, 1}; + nums = new int[] {2, 0, 1}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 1, 2}, nums); + assertArrayEquals(new int[] {0, 1, 2}, nums); } @Test public void test7() { - nums = new int[]{0}; + nums = new int[] {0}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0}, nums); + assertArrayEquals(new int[] {0}, nums); } @Test public void test8() { - nums = new int[]{2, 2}; + nums = new int[] {2, 2}; solution1.sortColors(nums); - assertArrayEquals(new int[]{2, 2}, nums); + assertArrayEquals(new int[] {2, 2}, nums); } @Test public void test9() { - nums = new int[]{2}; + nums = new int[] {2}; solution1.sortColors(nums); - assertArrayEquals(new int[]{2}, nums); + assertArrayEquals(new int[] {2}, nums); } @Test public void test10() { - nums = new int[]{1}; + nums = new int[] {1}; solution1.sortColors(nums); - assertArrayEquals(new int[]{1}, nums); + assertArrayEquals(new int[] {1}, nums); } @Test public void test11() { - nums = new int[]{1, 2, 0}; + nums = new int[] {1, 2, 0}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 1, 2}, nums); + assertArrayEquals(new int[] {0, 1, 2}, nums); } @Test public void test12() { - nums = new int[]{1, 2, 1}; + nums = new int[] {1, 2, 1}; solution1.sortColors(nums); - assertArrayEquals(new int[]{1, 1, 2}, nums); + assertArrayEquals(new int[] {1, 1, 2}, nums); } @Test public void test13() { - nums = new int[]{2, 0, 2, 1, 1, 0}; + nums = new int[] {2, 0, 2, 1, 1, 0}; solution1.sortColors(nums); - assertArrayEquals(new int[]{0, 0, 1, 1, 2, 2}, nums); + assertArrayEquals(new int[] {0, 0, 1, 1, 2, 2}, nums); } - - } diff --git a/src/test/java/com/fishercoder/firstthousand/_760Test.java b/src/test/java/com/fishercoder/firstthousand/_760Test.java index 087c0e0dd8..55a9efd080 100644 --- a/src/test/java/com/fishercoder/firstthousand/_760Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_760Test.java @@ -1,27 +1,27 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._760; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _760Test { - private _760.Solution1 solution1; - private static int[] A; - private static int[] B; - private static int[] expected; + private _760.Solution1 solution1; + private static int[] A; + private static int[] B; + private static int[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _760.Solution1(); - } + solution1 = new _760.Solution1(); + } - @Test - public void test1() { - A = new int[] {12, 28, 46, 32, 50}; - B = new int[] {50, 12, 32, 46, 28}; - expected = new int[] {1, 4, 3, 2, 0}; - assertArrayEquals(expected, solution1.anagramMappings(A, B)); - } + @Test + public void test1() { + A = new int[] {12, 28, 46, 32, 50}; + B = new int[] {50, 12, 32, 46, 28}; + expected = new int[] {1, 4, 3, 2, 0}; + assertArrayEquals(expected, solution1.anagramMappings(A, B)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_762Test.java b/src/test/java/com/fishercoder/firstthousand/_762Test.java index 42eb86399e..c7ee7e1980 100644 --- a/src/test/java/com/fishercoder/firstthousand/_762Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_762Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._762; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _762Test { - private _762.Solution1 solution1; + private _762.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _762.Solution1(); - } + solution1 = new _762.Solution1(); + } - @Test - public void test1() { - assertEquals(4, solution1.countPrimeSetBits(6, 10)); - } + @Test + public void test1() { + assertEquals(4, solution1.countPrimeSetBits(6, 10)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_763Test.java b/src/test/java/com/fishercoder/firstthousand/_763Test.java index 4c1059ce28..7b196a142e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_763Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_763Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._763; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._763; import java.util.Arrays; import java.util.List; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _763Test { private _763.Solution1 solution1; private _763.Solution2 solution2; @@ -45,6 +43,4 @@ public void test3() { assertEquals(expected, solution1.partitionLabels(s)); assertEquals(expected, solution2.partitionLabels(s)); } - - } diff --git a/src/test/java/com/fishercoder/firstthousand/_764Test.java b/src/test/java/com/fishercoder/firstthousand/_764Test.java index 1483e0ef8e..520445cf0a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_764Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_764Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._764; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _764Test { private _764.Solution1 solution1; private _764.Solution2 solution2; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - mines = new int[][]{{0, 1}, {1, 0}, {1, 1}}; + mines = new int[][] {{0, 1}, {1, 0}, {1, 1}}; assertEquals(1, solution1.orderOfLargestPlusSign(2, mines)); assertEquals(1, solution2.orderOfLargestPlusSign(2, mines)); assertEquals(1, solution2.orderOfLargestPlusSign_initialVersion(2, mines)); @@ -27,10 +27,9 @@ public void test1() { @Test public void test2() { - mines = new int[][]{{4, 2}}; + mines = new int[][] {{4, 2}}; assertEquals(2, solution1.orderOfLargestPlusSign(5, mines)); assertEquals(2, solution2.orderOfLargestPlusSign(5, mines)); assertEquals(2, solution2.orderOfLargestPlusSign_initialVersion(5, mines)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_765Test.java b/src/test/java/com/fishercoder/firstthousand/_765Test.java index 43fe6dccf7..f4542aa244 100644 --- a/src/test/java/com/fishercoder/firstthousand/_765Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_765Test.java @@ -1,41 +1,41 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._765; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _765Test { - private _765.Solution1 solution1; - private static int[] row; + private _765.Solution1 solution1; + private static int[] row; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _765.Solution1(); - } - - @Test - public void test1() { - row = new int[] {0, 2, 1, 3}; - assertEquals(1, solution1.minSwapsCouples(row)); - } - - @Test - public void test2() { - row = new int[] {3, 2, 0, 1}; - assertEquals(0, solution1.minSwapsCouples(row)); - } - - @Test - public void test3() { - row = new int[] {0, 4, 7, 3, 1, 5, 2, 8, 6, 9}; - assertEquals(3, solution1.minSwapsCouples(row)); - } - - @Test - public void test4() { - row = new int[] {5, 6, 4, 0, 2, 1, 9, 3, 8, 7, 11, 10}; - assertEquals(4, solution1.minSwapsCouples(row)); - } + solution1 = new _765.Solution1(); + } + + @Test + public void test1() { + row = new int[] {0, 2, 1, 3}; + assertEquals(1, solution1.minSwapsCouples(row)); + } + + @Test + public void test2() { + row = new int[] {3, 2, 0, 1}; + assertEquals(0, solution1.minSwapsCouples(row)); + } + + @Test + public void test3() { + row = new int[] {0, 4, 7, 3, 1, 5, 2, 8, 6, 9}; + assertEquals(3, solution1.minSwapsCouples(row)); + } + + @Test + public void test4() { + row = new int[] {5, 6, 4, 0, 2, 1, 9, 3, 8, 7, 11, 10}; + assertEquals(4, solution1.minSwapsCouples(row)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_766Test.java b/src/test/java/com/fishercoder/firstthousand/_766Test.java index 30c5b9acf8..d3c78f125c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_766Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_766Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._766; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _766Test { private _766.Solution1 solution1; private static int[][] matrix; @@ -17,30 +17,33 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {1, 2, 3, 4}, - {5, 1, 2, 3}, - {9, 5, 1, 2} - }; + matrix = + new int[][] { + {1, 2, 3, 4}, + {5, 1, 2, 3}, + {9, 5, 1, 2} + }; assertEquals(true, solution1.isToeplitzMatrix(matrix)); } @Test public void test2() { - matrix = new int[][]{ - {1, 2}, - {2, 2}, - }; + matrix = + new int[][] { + {1, 2}, + {2, 2}, + }; assertEquals(false, solution1.isToeplitzMatrix(matrix)); } @Test public void test3() { - matrix = new int[][]{ - {1, 2, 3, 4, 5, 9}, - {5, 1, 2, 3, 4, 5}, - {9, 5, 1, 2, 3, 4} - }; + matrix = + new int[][] { + {1, 2, 3, 4, 5, 9}, + {5, 1, 2, 3, 4, 5}, + {9, 5, 1, 2, 3, 4} + }; assertEquals(true, solution1.isToeplitzMatrix(matrix)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_767Test.java b/src/test/java/com/fishercoder/firstthousand/_767Test.java index f82e6ba1a8..4959169b3a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_767Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_767Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._767; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _767Test { private _767.Solution1 solution1; private _767.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_769Test.java b/src/test/java/com/fishercoder/firstthousand/_769Test.java index fee8704950..e617ba696e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_769Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_769Test.java @@ -1,33 +1,33 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._769; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _769Test { - private _769.Solution1 solution1; - private _769.Solution2 solution2; - private static int[] arr; + private _769.Solution1 solution1; + private _769.Solution2 solution2; + private static int[] arr; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _769.Solution1(); - solution2 = new _769.Solution2(); - } + solution1 = new _769.Solution1(); + solution2 = new _769.Solution2(); + } - @Test - public void test1() { - arr = new int[] {4, 3, 2, 1, 0}; - assertEquals(1, solution1.maxChunksToSorted(arr)); - assertEquals(1, solution2.maxChunksToSorted(arr)); - } + @Test + public void test1() { + arr = new int[] {4, 3, 2, 1, 0}; + assertEquals(1, solution1.maxChunksToSorted(arr)); + assertEquals(1, solution2.maxChunksToSorted(arr)); + } - @Test - public void test2() { - arr = new int[] {1, 0, 2, 3, 4}; - assertEquals(4, solution1.maxChunksToSorted(arr)); - assertEquals(4, solution2.maxChunksToSorted(arr)); - } + @Test + public void test2() { + arr = new int[] {1, 0, 2, 3, 4}; + assertEquals(4, solution1.maxChunksToSorted(arr)); + assertEquals(4, solution2.maxChunksToSorted(arr)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_76Test.java b/src/test/java/com/fishercoder/firstthousand/_76Test.java index eda894578a..d9d1166fab 100644 --- a/src/test/java/com/fishercoder/firstthousand/_76Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_76Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._76; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _76Test { private _76.Solution1 solution1; private _76.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_771Test.java b/src/test/java/com/fishercoder/firstthousand/_771Test.java index 8355a405cf..dd3f04ce58 100644 --- a/src/test/java/com/fishercoder/firstthousand/_771Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_771Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._771; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _771Test { - private _771.Solution1 solution1; + private _771.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _771.Solution1(); - } + solution1 = new _771.Solution1(); + } - @Test - public void test1() { - assertEquals(3, solution1.numJewelsInStones("aA", "aAAbbbb")); - } + @Test + public void test1() { + assertEquals(3, solution1.numJewelsInStones("aA", "aAAbbbb")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_773Test.java b/src/test/java/com/fishercoder/firstthousand/_773Test.java index 6d437d1f58..fe295e44ae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_773Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_773Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._773; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _773Test { private _773.Solution1 solution1; private static int[][] board; @@ -17,20 +17,21 @@ public void setup() { @Test public void test1() { - board = new int[][]{ - {1, 2, 3}, - {4, 0, 5} - }; + board = + new int[][] { + {1, 2, 3}, + {4, 0, 5} + }; assertEquals(1, solution1.slidingPuzzle(board)); } @Test public void test2() { - board = new int[][]{ - {4, 1, 2}, - {5, 0, 3} - }; + board = + new int[][] { + {4, 1, 2}, + {5, 0, 3} + }; assertEquals(5, solution1.slidingPuzzle(board)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_775Test.java b/src/test/java/com/fishercoder/firstthousand/_775Test.java index f46b4ede06..707f64b48f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_775Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_775Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._775; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _775Test { private _775.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.isIdealPermutation(new int[]{0, 1})); + assertEquals(true, solution1.isIdealPermutation(new int[] {0, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_776Test.java b/src/test/java/com/fishercoder/firstthousand/_776Test.java index aababc60e4..cbdf91ebff 100644 --- a/src/test/java/com/fishercoder/firstthousand/_776Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_776Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._776; @@ -7,34 +9,32 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _776Test { - private _776.Solution1 solution1; - private _776.Solution2 solution2; - private static TreeNode root; - private static TreeNode small; - private static TreeNode big; + private _776.Solution1 solution1; + private _776.Solution2 solution2; + private static TreeNode root; + private static TreeNode small; + private static TreeNode big; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _776.Solution1(); - solution2 = new _776.Solution2(); - } + solution1 = new _776.Solution1(); + solution2 = new _776.Solution2(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, 5, 7)); - small = TreeUtils.constructBinaryTree(Arrays.asList(2, 1)); - big = TreeUtils.constructBinaryTree(Arrays.asList(4, 3, 6, null, null, 5, 7)); - assertArrayEquals(new TreeNode[] {small, big}, solution1.splitBST(root, 2)); - } + @Test + public void test1() { + root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, 5, 7)); + small = TreeUtils.constructBinaryTree(Arrays.asList(2, 1)); + big = TreeUtils.constructBinaryTree(Arrays.asList(4, 3, 6, null, null, 5, 7)); + assertArrayEquals(new TreeNode[] {small, big}, solution1.splitBST(root, 2)); + } - @Test - public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, 5, 7)); - small = TreeUtils.constructBinaryTree(Arrays.asList(2, 1)); - big = TreeUtils.constructBinaryTree(Arrays.asList(4, 3, 6, null, null, 5, 7)); - assertArrayEquals(new TreeNode[] {small, big}, solution2.splitBST(root, 2)); - } + @Test + public void test2() { + root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, 5, 7)); + small = TreeUtils.constructBinaryTree(Arrays.asList(2, 1)); + big = TreeUtils.constructBinaryTree(Arrays.asList(4, 3, 6, null, null, 5, 7)); + assertArrayEquals(new TreeNode[] {small, big}, solution2.splitBST(root, 2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_777Test.java b/src/test/java/com/fishercoder/firstthousand/_777Test.java index e17cd1e338..25a65f1fae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_777Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_777Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.firstthousand._777; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _777Test { private _777.Solution1 solution1; @@ -75,5 +75,4 @@ public void test11() { public void test12() { assertFalse(solution1.canTransform("XXXXXLXXXLXXXX", "XXLXXXXXXXXLXX")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_779Test.java b/src/test/java/com/fishercoder/firstthousand/_779Test.java index 7421d1152d..6432aafee0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_779Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_779Test.java @@ -1,42 +1,42 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._779; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _779Test { - private _779.Solution1 solution1; - private _779.Solution2 solution2; + private _779.Solution1 solution1; + private _779.Solution2 solution2; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _779.Solution1(); - solution2 = new _779.Solution2(); - } - - @Test - public void test1() { - assertEquals(0, solution1.kthGrammar(1, 1)); - assertEquals(0, solution2.kthGrammar(1, 1)); - } - - @Test - public void test2() { - assertEquals(0, solution1.kthGrammar(2, 1)); - assertEquals(0, solution2.kthGrammar(2, 1)); - } - - @Test - public void test3() { - assertEquals(1, solution1.kthGrammar(2, 2)); - assertEquals(1, solution2.kthGrammar(2, 2)); - } - - @Test - public void test4() { - assertEquals(1, solution1.kthGrammar(4, 5)); - assertEquals(1, solution2.kthGrammar(4, 5)); - } + solution1 = new _779.Solution1(); + solution2 = new _779.Solution2(); + } + + @Test + public void test1() { + assertEquals(0, solution1.kthGrammar(1, 1)); + assertEquals(0, solution2.kthGrammar(1, 1)); + } + + @Test + public void test2() { + assertEquals(0, solution1.kthGrammar(2, 1)); + assertEquals(0, solution2.kthGrammar(2, 1)); + } + + @Test + public void test3() { + assertEquals(1, solution1.kthGrammar(2, 2)); + assertEquals(1, solution2.kthGrammar(2, 2)); + } + + @Test + public void test4() { + assertEquals(1, solution1.kthGrammar(4, 5)); + assertEquals(1, solution2.kthGrammar(4, 5)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_781Test.java b/src/test/java/com/fishercoder/firstthousand/_781Test.java index 56eb130b9b..6321cf90db 100644 --- a/src/test/java/com/fishercoder/firstthousand/_781Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_781Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._781; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _781Test { private _781.Solution1 solution1; @@ -16,31 +16,31 @@ public void setup() { @Test public void test1() { - assertEquals(5, solution1.numRabbits(new int[]{1, 1, 2})); + assertEquals(5, solution1.numRabbits(new int[] {1, 1, 2})); } @Test public void test2() { - assertEquals(11, solution1.numRabbits(new int[]{10, 10, 10})); + assertEquals(11, solution1.numRabbits(new int[] {10, 10, 10})); } @Test public void test3() { - assertEquals(0, solution1.numRabbits(new int[]{})); + assertEquals(0, solution1.numRabbits(new int[] {})); } @Test public void test4() { - assertEquals(5, solution1.numRabbits(new int[]{1, 0, 1, 0, 0})); + assertEquals(5, solution1.numRabbits(new int[] {1, 0, 1, 0, 0})); } @Test public void test5() { - assertEquals(7, solution1.numRabbits(new int[]{1, 1, 1, 2, 2, 2})); + assertEquals(7, solution1.numRabbits(new int[] {1, 1, 1, 2, 2, 2})); } @Test public void test6() { - assertEquals(13, solution1.numRabbits(new int[]{2, 1, 2, 2, 2, 2, 2, 2, 1, 1})); + assertEquals(13, solution1.numRabbits(new int[] {2, 1, 2, 2, 2, 2, 2, 2, 1, 1})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_783Test.java b/src/test/java/com/fishercoder/firstthousand/_783Test.java index fabe1d89ff..736b7c6fe8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_783Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_783Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._783; @@ -7,21 +9,19 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _783Test { - private _783.Solution1 solution1; - private static TreeNode root; + private _783.Solution1 solution1; + private static TreeNode root; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _783.Solution1(); - } + solution1 = new _783.Solution1(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, null, null)); - TreeUtils.printBinaryTree(root); - assertEquals(1, solution1.minDiffInBST(root)); - } + @Test + public void test1() { + root = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 1, 3, null, null)); + TreeUtils.printBinaryTree(root); + assertEquals(1, solution1.minDiffInBST(root)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_784Test.java b/src/test/java/com/fishercoder/firstthousand/_784Test.java index e6bedf9ef0..868e2ae106 100644 --- a/src/test/java/com/fishercoder/firstthousand/_784Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_784Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._784; +import static org.assertj.core.api.Assertions.assertThat; +import com.fishercoder.solutions.firstthousand._784; import java.util.Arrays; import java.util.List; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.assertThat; - public class _784Test { private _784.Solution1 solution1; private _784.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_785Test.java b/src/test/java/com/fishercoder/firstthousand/_785Test.java index 9d6192622f..9fa2a29cdc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_785Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_785Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._785; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _785Test { private _785.Solution1 solution1; private _785.Solution2 solution2; @@ -17,12 +17,14 @@ public class _785Test { public void setup() { solution1 = new _785.Solution1(); solution2 = new _785.Solution2(); - graph = new int[][]{}; + graph = new int[][] {}; } @Test public void test1() { - graph = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,3],[0,2],[0,1,3],[0,2]"); + graph = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,3],[0,2],[0,1,3],[0,2]"); CommonUtils.print2DIntArray(graph); assertFalse(solution1.isBipartite(graph)); assertFalse(solution2.isBipartite(graph)); @@ -30,7 +32,9 @@ public void test1() { @Test public void test2() { - graph = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3],[0,2],[1,3],[0,2]"); + graph = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3],[0,2],[1,3],[0,2]"); CommonUtils.print2DIntArray(graph); assertTrue(solution1.isBipartite(graph)); assertTrue(solution2.isBipartite(graph)); diff --git a/src/test/java/com/fishercoder/firstthousand/_788Test.java b/src/test/java/com/fishercoder/firstthousand/_788Test.java index 6da99ce534..f332227f8f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_788Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_788Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._788; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _788Test { private _788.Solution1 solution1; private _788.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_789Test.java b/src/test/java/com/fishercoder/firstthousand/_789Test.java index 5cf3bad187..8887e6f74e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_789Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_789Test.java @@ -1,15 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._789; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by varunu28 on 1/01/19. - */ - +/** Created by varunu28 on 1/01/19. */ public class _789Test { private _789.Solution test; @@ -18,19 +15,18 @@ public void setup() { test = new _789.Solution(); } - @Test public void test1() { - assertEquals(true, test.escapeGhosts(new int[][]{{1, 0}, {0, 3}}, new int[]{0, 1})); + assertEquals(true, test.escapeGhosts(new int[][] {{1, 0}, {0, 3}}, new int[] {0, 1})); } @Test public void test2() { - assertEquals(false, test.escapeGhosts(new int[][]{{1, 0}}, new int[]{2, 0})); + assertEquals(false, test.escapeGhosts(new int[][] {{1, 0}}, new int[] {2, 0})); } @Test public void test3() { - assertEquals(false, test.escapeGhosts(new int[][]{{2, 0}}, new int[]{1, 0})); + assertEquals(false, test.escapeGhosts(new int[][] {{2, 0}}, new int[] {1, 0})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_78Test.java b/src/test/java/com/fishercoder/firstthousand/_78Test.java index 841068aacd..da21fe9589 100644 --- a/src/test/java/com/fishercoder/firstthousand/_78Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_78Test.java @@ -19,16 +19,16 @@ public void setup() { @Test public void test1() { - CommonUtils.printListList(solution1.subsets(new int[]{1, 2, 3})); + CommonUtils.printListList(solution1.subsets(new int[] {1, 2, 3})); } @Test public void test2() { - CommonUtils.printListList(solution2.subsets(new int[]{1, 2, 3})); + CommonUtils.printListList(solution2.subsets(new int[] {1, 2, 3})); } @Test public void test3() { - CommonUtils.printListList(solution3.subsets(new int[]{1, 2, 3})); + CommonUtils.printListList(solution3.subsets(new int[] {1, 2, 3})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_791Test.java b/src/test/java/com/fishercoder/firstthousand/_791Test.java index ff345017d0..448d247731 100644 --- a/src/test/java/com/fishercoder/firstthousand/_791Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_791Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._791; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _791Test { private _791.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_792Test.java b/src/test/java/com/fishercoder/firstthousand/_792Test.java index dabb8ebb65..0a4aa1309f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_792Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_792Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._792; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _792Test { private _792.Solution1 solution1; @@ -16,33 +16,140 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numMatchingSubseq("abcde", new String[]{"a", "bb", "acd", "ace"})); + assertEquals( + 3, solution1.numMatchingSubseq("abcde", new String[] {"a", "bb", "acd", "ace"})); } @Test public void test2() { - assertEquals(2, solution1.numMatchingSubseq("dsahjpjauf", new String[]{"ahjpjau", "ja", "ahbwzgqnuk", "tnmlanowax"})); + assertEquals( + 2, + solution1.numMatchingSubseq( + "dsahjpjauf", new String[] {"ahjpjau", "ja", "ahbwzgqnuk", "tnmlanowax"})); } @Test public void test3() { - assertEquals(2, solution1.numMatchingSubseq("vvvvvvvvm", new String[]{"vvm", "vm", "vn"})); + assertEquals(2, solution1.numMatchingSubseq("vvvvvvvvm", new String[] {"vvm", "vm", "vn"})); } @Test public void test4() { - assertEquals(1, solution1.numMatchingSubseq("vvvvvvvvm", new String[]{"vm"})); + assertEquals(1, solution1.numMatchingSubseq("vvvvvvvvm", new String[] {"vm"})); } @Test public void test5() { - assertEquals(1, solution1.numMatchingSubseq("vvvvvvvvm", new String[]{"vvm"})); + assertEquals(1, solution1.numMatchingSubseq("vvvvvvvvm", new String[] {"vvm"})); } @Test public void test6() { - assertEquals(51, solution1.numMatchingSubseq("ricogwqznwxxcpueelcobbbkuvxxrvgyehsudccpsnuxpcqobtvwkuvsubiidjtccoqvuahijyefbpqhbejuisksutsowhufsygtwteiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoiundjscnlhbrhookmioxqighkxfugpeekgtdofwzemelpyjsdeeppapjoliqlhbrbghqjezzaxuwyrbczodtrhsvnaxhcjiyiphbglyolnswlvtlbmkrsurrcsgdzutwgjofowhryrubnxkahocqjzwwagqidjhwbunvlchojtbvnzdzqpvrazfcxtvhkruvuturdicnucvndigovkzrqiyastqpmfmuouycodvsyjajekhvyjyrydhxkdhffyytldcdlxqbaszbuxsacqwqnhrewhagldzhryzdmmrwnxhaqfezeeabuacyswollycgiowuuudrgzmwnxaezuqlsfvchjfloczlwbefksxsbanrektvibbwxnokzkhndmdhweyeycamjeplecewpnpbshhidnzwopdjuwbecarkgapyjfgmanuavzrxricbgagblomyseyvoeurekqjyljosvbneofjzxtaizjypbcxnbfeibrfjwyjqrisuybfxpvqywqjdlyznmojdhbeomyjqptltpugzceyzenflfnhrptuugyfsghluythksqhmxlmggtcbdddeoincygycdpehteiugqbptyqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmwwxzjckmaptilrbfpjxiarmwalhbdjiwbaknvcqovwcqiekzfskpbhgxpyomekqvzpqyirelpadooxjhsyxjkfqavbaoqqvvknqryhotjritrkvdveyapjfsfzenfpuazdrfdofhudqbfnzxnvpluwicurrtshyvevkriudayyysepzqfgqwhgobwyhxltligahroyshfndydvffd", - new String[]{"iowuuudrgzmw", "azfcxtvhkruvuturdicnucvndigovkzrq", "ylmmo", "maptilrbfpjxiarmwalhbd", "oqvuahijyefbpqhbejuisksutsowhufsygtwteiqyligsnbqgl", "ytldcdlxqbaszbuxsacqwqnhrewhagldzhr", "zeeab", "cqie", "pvrazfcxtvhkruvuturdicnucvndigovkzrqiya", "zxnvpluwicurrtshyvevkriudayyysepzq", "wyhxltligahroyshfn", "nhrewhagldzhryzdmmrwn", "yqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmw", "nhrptuugyfsghluythksqhmxlmggtcbdd", "yligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoiundjsc", "zdrfdofhudqbfnzxnvpluwicurrtshyvevkriudayyysepzq", "ncygycdpehteiugqbptyqbvokpwovbnplshnzafun", "gdzutwgjofowhryrubnxkahocqjzww", "eppapjoliqlhbrbgh", "qwhgobwyhxltligahroys", "dzutwgjofowhryrubnxkah", "rydhxkdhffyytldcdlxqbaszbuxs", "tyqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmwwxzjc", "khvyjyrydhxkdhffyytldcdlxqbasz", "jajekhvyjyrydhxkdhffyytldcdlxqbaszbuxsacqwqn", "ppapjoliqlhbrbghq", "zmwwxzjckmaptilrbfpjxiarm", "nxkahocqjzwwagqidjhwbunvlchoj", "ybfxpvqywqjdlyznmojdhbeomyjqptltp", "udrgzmwnxae", "nqglnpjvwddvdlmjjyzmww", "swlvtlbmkrsurrcsgdzutwgjofowhryrubn", "hudqbfnzxnvpluwicurr", "xaezuqlsfvchjf", "tvibbwxnokzkhndmdhweyeycamjeplec", "olnswlvtlbmkrsurrcsgdzu", "qiyastqpmfmuouycodvsyjajekhvyjyrydhxkdhffyyt", "eiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwyl", "cgiowuuudrgzmwnxaezuqlsfvchjflocz", "rxric", "cygycdpehteiugqbptyqbvokpwovbnplshnzaf", "g", "surrcsgd", "yzenflfnhrptuugyfsghluythksqh", "gdzutwgjofowhryrubnxkahocqjzwwagqid", "ddeoincygycdpeh", "yznmojdhbeomyjqptltpugzceyzenflfnhrptuug", "ejuisks", "teiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoi", "mrwnxhaqfezeeabuacyswollycgio", "qfskkpfakjretogrokmxemjjbvgmmqrfdxlkfvycwalbdeumav", "wjgjhlrpvhqozvvkifhftnfqcfjmmzhtxsoqbeduqmnpvimagq", "ibxhtobuolmllbasaxlanjgalgmbjuxmqpadllryaobcucdeqc", "ydlddogzvzttizzzjohfsenatvbpngarutztgdqczkzoenbxzv", "rmsakibpprdrttycxglfgtjlifznnnlkgjqseguijfctrcahbb", "pqquuarnoybphojyoyizhuyjfgwdlzcmkdbdqzatgmabhnpuyh", "akposmzwykwrenlcrqwrrvsfqxzohrramdajwzlseguupjfzvd", "vyldyqpvmnoemzeyxslcoysqfpvvotenkmehqvopynllvwhxzr", "ysyskgrbolixwmffygycvgewxqnxvjsfefpmxrtsqsvpowoctw", "oqjgumitldivceezxgoiwjgozfqcnkergctffspdxdbnmvjago", "bpfgqhlkvevfazcmpdqakonkudniuobhqzypqlyocjdngltywn", "ttucplgotbiceepzfxdebvluioeeitzmesmoxliuwqsftfmvlg", "xhkklcwblyjmdyhfscmeffmmerxdioseybombzxjatkkltrvzq", "qkvvbrgbzzfhzizulssaxupyqwniqradvkjivedckjrinrlxgi", "itjudnlqncbspswkbcwldkwujlshwsgziontsobirsvskmjbrq", "nmfgxfeqgqefxqivxtdrxeelsucufkhivijmzgioxioosmdpwx", "ihygxkykuczvyokuveuchermxceexajilpkcxjjnwmdbwnxccl", "etvcfbmadfxlprevjjnojxwonnnwjnamgrfwohgyhievupsdqd", "ngskodiaxeswtqvjaqyulpedaqcchcuktfjlzyvddfeblnczmh", "vnmntdvhaxqltluzwwwwrbpqwahebgtmhivtkadczpzabgcjzx", "yjqqdvoxxxjbrccoaqqspqlsnxcnderaewsaqpkigtiqoqopth", "wdytqvztzbdzffllbxexxughdvetajclynypnzaokqizfxqrjl", "yvvwkphuzosvvntckxkmvuflrubigexkivyzzaimkxvqitpixo", "lkdgtxmbgsenzmrlccmsunaezbausnsszryztfhjtezssttmsr", "idyybesughzyzfdiibylnkkdeatqjjqqjbertrcactapbcarzb", "ujiajnirancrfdvrfardygbcnzkqsvujkhcegdfibtcuxzbpds", "jjtkmalhmrknaasskjnixzwjgvusbozslrribgazdhaylaxobj", "nizuzttgartfxiwcsqchizlxvvnebqdtkmghtcyzjmgyzszwgi", "egtvislckyltpfogtvfbtxbsssuwvjcduxjnjuvnqyiykvmrxl", "ozvzwalcvaobxbicbwjrububyxlmfcokdxcrkvuehbnokkzala", "azhukctuheiwghkalboxfnuofwopsrutamthzyzlzkrlsefwcz", "yhvjjzsxlescylsnvmcxzcrrzgfhbsdsvdfcykwifzjcjjbmmu", "tspdebnuhrgnmhhuplbzvpkkhfpeilbwkkbgfjiuwrdmkftphk", "jvnbeqzaxecwxspuxhrngmvnkvulmgobvsnqyxdplrnnwfhfqq", "bcbkgwpfmmqwmzjgmflichzhrjdjxbcescfijfztpxpxvbzjch", "bdrkibtxygyicjcfnzigghdekmgoybvfwshxqnjlctcdkiunob", "koctqrqvfftflwsvssnokdotgtxalgegscyeotcrvyywmzescq", "boigqjvosgxpsnklxdjaxtrhqlyvanuvnpldmoknmzugnubfoa", "jjtxbxyazxldpnbxzgslgguvgyevyliywihuqottxuyowrwfar", "zqsacrwcysmkfbpzxoaszgqqsvqglnblmxhxtjqmnectaxntvb", "izcakfitdhgujdborjuhtwubqcoppsgkqtqoqyswjfldsbfcct", "rroiqffqzenlerchkvmjsbmoybisjafcdzgeppyhojoggdlpzq", "xwjqfobmmqomhczwufwlesolvmbtvpdxejzslxrvnijhvevxmc", "ccrubahioyaxuwzloyhqyluwoknxnydbedenrccljoydfxwaxy", "jjoeiuncnvixvhhynaxbkmlurwxcpukredieqlilgkupminjaj", "pdbsbjnrqzrbmewmdkqqhcpzielskcazuliiatmvhcaksrusae", "nizbnxpqbzsihakkadsbtgxovyuebgtzvrvbowxllkzevktkuu", "hklskdbopqjwdrefpgoxaoxzevpdaiubejuaxxbrhzbamdznrr", "uccnuegvmkqtagudujuildlwefbyoywypakjrhiibrxdmsspjl", "awinuyoppufjxgqvcddleqdhbkmolxqyvsqprnwcoehpturicf"})); + assertEquals( + 51, + solution1.numMatchingSubseq( + "ricogwqznwxxcpueelcobbbkuvxxrvgyehsudccpsnuxpcqobtvwkuvsubiidjtccoqvuahijyefbpqhbejuisksutsowhufsygtwteiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoiundjscnlhbrhookmioxqighkxfugpeekgtdofwzemelpyjsdeeppapjoliqlhbrbghqjezzaxuwyrbczodtrhsvnaxhcjiyiphbglyolnswlvtlbmkrsurrcsgdzutwgjofowhryrubnxkahocqjzwwagqidjhwbunvlchojtbvnzdzqpvrazfcxtvhkruvuturdicnucvndigovkzrqiyastqpmfmuouycodvsyjajekhvyjyrydhxkdhffyytldcdlxqbaszbuxsacqwqnhrewhagldzhryzdmmrwnxhaqfezeeabuacyswollycgiowuuudrgzmwnxaezuqlsfvchjfloczlwbefksxsbanrektvibbwxnokzkhndmdhweyeycamjeplecewpnpbshhidnzwopdjuwbecarkgapyjfgmanuavzrxricbgagblomyseyvoeurekqjyljosvbneofjzxtaizjypbcxnbfeibrfjwyjqrisuybfxpvqywqjdlyznmojdhbeomyjqptltpugzceyzenflfnhrptuugyfsghluythksqhmxlmggtcbdddeoincygycdpehteiugqbptyqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmwwxzjckmaptilrbfpjxiarmwalhbdjiwbaknvcqovwcqiekzfskpbhgxpyomekqvzpqyirelpadooxjhsyxjkfqavbaoqqvvknqryhotjritrkvdveyapjfsfzenfpuazdrfdofhudqbfnzxnvpluwicurrtshyvevkriudayyysepzqfgqwhgobwyhxltligahroyshfndydvffd", + new String[] { + "iowuuudrgzmw", + "azfcxtvhkruvuturdicnucvndigovkzrq", + "ylmmo", + "maptilrbfpjxiarmwalhbd", + "oqvuahijyefbpqhbejuisksutsowhufsygtwteiqyligsnbqgl", + "ytldcdlxqbaszbuxsacqwqnhrewhagldzhr", + "zeeab", + "cqie", + "pvrazfcxtvhkruvuturdicnucvndigovkzrqiya", + "zxnvpluwicurrtshyvevkriudayyysepzq", + "wyhxltligahroyshfn", + "nhrewhagldzhryzdmmrwn", + "yqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmw", + "nhrptuugyfsghluythksqhmxlmggtcbdd", + "yligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoiundjsc", + "zdrfdofhudqbfnzxnvpluwicurrtshyvevkriudayyysepzq", + "ncygycdpehteiugqbptyqbvokpwovbnplshnzafun", + "gdzutwgjofowhryrubnxkahocqjzww", + "eppapjoliqlhbrbgh", + "qwhgobwyhxltligahroys", + "dzutwgjofowhryrubnxkah", + "rydhxkdhffyytldcdlxqbaszbuxs", + "tyqbvokpwovbnplshnzafunqglnpjvwddvdlmjjyzmwwxzjc", + "khvyjyrydhxkdhffyytldcdlxqbasz", + "jajekhvyjyrydhxkdhffyytldcdlxqbaszbuxsacqwqn", + "ppapjoliqlhbrbghq", + "zmwwxzjckmaptilrbfpjxiarm", + "nxkahocqjzwwagqidjhwbunvlchoj", + "ybfxpvqywqjdlyznmojdhbeomyjqptltp", + "udrgzmwnxae", + "nqglnpjvwddvdlmjjyzmww", + "swlvtlbmkrsurrcsgdzutwgjofowhryrubn", + "hudqbfnzxnvpluwicurr", + "xaezuqlsfvchjf", + "tvibbwxnokzkhndmdhweyeycamjeplec", + "olnswlvtlbmkrsurrcsgdzu", + "qiyastqpmfmuouycodvsyjajekhvyjyrydhxkdhffyyt", + "eiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwyl", + "cgiowuuudrgzmwnxaezuqlsfvchjflocz", + "rxric", + "cygycdpehteiugqbptyqbvokpwovbnplshnzaf", + "g", + "surrcsgd", + "yzenflfnhrptuugyfsghluythksqh", + "gdzutwgjofowhryrubnxkahocqjzwwagqid", + "ddeoincygycdpeh", + "yznmojdhbeomyjqptltpugzceyzenflfnhrptuug", + "ejuisks", + "teiqyligsnbqglqblhpdzzeurtdohdcbjvzgjwylmmoi", + "mrwnxhaqfezeeabuacyswollycgio", + "qfskkpfakjretogrokmxemjjbvgmmqrfdxlkfvycwalbdeumav", + "wjgjhlrpvhqozvvkifhftnfqcfjmmzhtxsoqbeduqmnpvimagq", + "ibxhtobuolmllbasaxlanjgalgmbjuxmqpadllryaobcucdeqc", + "ydlddogzvzttizzzjohfsenatvbpngarutztgdqczkzoenbxzv", + "rmsakibpprdrttycxglfgtjlifznnnlkgjqseguijfctrcahbb", + "pqquuarnoybphojyoyizhuyjfgwdlzcmkdbdqzatgmabhnpuyh", + "akposmzwykwrenlcrqwrrvsfqxzohrramdajwzlseguupjfzvd", + "vyldyqpvmnoemzeyxslcoysqfpvvotenkmehqvopynllvwhxzr", + "ysyskgrbolixwmffygycvgewxqnxvjsfefpmxrtsqsvpowoctw", + "oqjgumitldivceezxgoiwjgozfqcnkergctffspdxdbnmvjago", + "bpfgqhlkvevfazcmpdqakonkudniuobhqzypqlyocjdngltywn", + "ttucplgotbiceepzfxdebvluioeeitzmesmoxliuwqsftfmvlg", + "xhkklcwblyjmdyhfscmeffmmerxdioseybombzxjatkkltrvzq", + "qkvvbrgbzzfhzizulssaxupyqwniqradvkjivedckjrinrlxgi", + "itjudnlqncbspswkbcwldkwujlshwsgziontsobirsvskmjbrq", + "nmfgxfeqgqefxqivxtdrxeelsucufkhivijmzgioxioosmdpwx", + "ihygxkykuczvyokuveuchermxceexajilpkcxjjnwmdbwnxccl", + "etvcfbmadfxlprevjjnojxwonnnwjnamgrfwohgyhievupsdqd", + "ngskodiaxeswtqvjaqyulpedaqcchcuktfjlzyvddfeblnczmh", + "vnmntdvhaxqltluzwwwwrbpqwahebgtmhivtkadczpzabgcjzx", + "yjqqdvoxxxjbrccoaqqspqlsnxcnderaewsaqpkigtiqoqopth", + "wdytqvztzbdzffllbxexxughdvetajclynypnzaokqizfxqrjl", + "yvvwkphuzosvvntckxkmvuflrubigexkivyzzaimkxvqitpixo", + "lkdgtxmbgsenzmrlccmsunaezbausnsszryztfhjtezssttmsr", + "idyybesughzyzfdiibylnkkdeatqjjqqjbertrcactapbcarzb", + "ujiajnirancrfdvrfardygbcnzkqsvujkhcegdfibtcuxzbpds", + "jjtkmalhmrknaasskjnixzwjgvusbozslrribgazdhaylaxobj", + "nizuzttgartfxiwcsqchizlxvvnebqdtkmghtcyzjmgyzszwgi", + "egtvislckyltpfogtvfbtxbsssuwvjcduxjnjuvnqyiykvmrxl", + "ozvzwalcvaobxbicbwjrububyxlmfcokdxcrkvuehbnokkzala", + "azhukctuheiwghkalboxfnuofwopsrutamthzyzlzkrlsefwcz", + "yhvjjzsxlescylsnvmcxzcrrzgfhbsdsvdfcykwifzjcjjbmmu", + "tspdebnuhrgnmhhuplbzvpkkhfpeilbwkkbgfjiuwrdmkftphk", + "jvnbeqzaxecwxspuxhrngmvnkvulmgobvsnqyxdplrnnwfhfqq", + "bcbkgwpfmmqwmzjgmflichzhrjdjxbcescfijfztpxpxvbzjch", + "bdrkibtxygyicjcfnzigghdekmgoybvfwshxqnjlctcdkiunob", + "koctqrqvfftflwsvssnokdotgtxalgegscyeotcrvyywmzescq", + "boigqjvosgxpsnklxdjaxtrhqlyvanuvnpldmoknmzugnubfoa", + "jjtxbxyazxldpnbxzgslgguvgyevyliywihuqottxuyowrwfar", + "zqsacrwcysmkfbpzxoaszgqqsvqglnblmxhxtjqmnectaxntvb", + "izcakfitdhgujdborjuhtwubqcoppsgkqtqoqyswjfldsbfcct", + "rroiqffqzenlerchkvmjsbmoybisjafcdzgeppyhojoggdlpzq", + "xwjqfobmmqomhczwufwlesolvmbtvpdxejzslxrvnijhvevxmc", + "ccrubahioyaxuwzloyhqyluwoknxnydbedenrccljoydfxwaxy", + "jjoeiuncnvixvhhynaxbkmlurwxcpukredieqlilgkupminjaj", + "pdbsbjnrqzrbmewmdkqqhcpzielskcazuliiatmvhcaksrusae", + "nizbnxpqbzsihakkadsbtgxovyuebgtzvrvbowxllkzevktkuu", + "hklskdbopqjwdrefpgoxaoxzevpdaiubejuaxxbrhzbamdznrr", + "uccnuegvmkqtagudujuildlwefbyoywypakjrhiibrxdmsspjl", + "awinuyoppufjxgqvcddleqdhbkmolxqyvsqprnwcoehpturicf" + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_796Test.java b/src/test/java/com/fishercoder/firstthousand/_796Test.java index 482010a4e7..4a637c58b6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_796Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_796Test.java @@ -1,26 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._796; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _796Test { - private _796.Solution1 solution1; + private _796.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _796.Solution1(); - } + solution1 = new _796.Solution1(); + } - @Test - public void test1() { - assertEquals(true, solution1.rotateString("abcde", "cdeab")); - } + @Test + public void test1() { + assertEquals(true, solution1.rotateString("abcde", "cdeab")); + } - @Test - public void test2() { - assertEquals(false, solution1.rotateString("abcde", "abced")); - } + @Test + public void test2() { + assertEquals(false, solution1.rotateString("abcde", "abced")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_799Test.java b/src/test/java/com/fishercoder/firstthousand/_799Test.java index cbbb95bc02..f07118cd17 100644 --- a/src/test/java/com/fishercoder/firstthousand/_799Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_799Test.java @@ -1,51 +1,51 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._799; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _799Test { - private _799.Solution1 solution1; + private _799.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _799.Solution1(); - } - - @Test - public void test1() { - assertEquals(0.125, solution1.champagneTower(8, 3, 0), 0); - } - - @Test - public void test2() { - assertEquals(0.875, solution1.champagneTower(8, 3, 1), 0); - } - - @Test - public void test3() { - assertEquals(0.875, solution1.champagneTower(8, 3, 2), 0); - } - - @Test - public void test4() { - assertEquals(0.125, solution1.champagneTower(8, 3, 3), 0); - } - - @Test - public void test5() { - assertEquals(0.0, solution1.champagneTower(1, 1, 1), 0); - } - - @Test - public void test6() { - assertEquals(0.5, solution1.champagneTower(2, 1, 1), 0); - } - - @Test - public void test7() { - assertEquals(0.0, solution1.champagneTower(1000000000, 99, 99), 0); - } + solution1 = new _799.Solution1(); + } + + @Test + public void test1() { + assertEquals(0.125, solution1.champagneTower(8, 3, 0), 0); + } + + @Test + public void test2() { + assertEquals(0.875, solution1.champagneTower(8, 3, 1), 0); + } + + @Test + public void test3() { + assertEquals(0.875, solution1.champagneTower(8, 3, 2), 0); + } + + @Test + public void test4() { + assertEquals(0.125, solution1.champagneTower(8, 3, 3), 0); + } + + @Test + public void test5() { + assertEquals(0.0, solution1.champagneTower(1, 1, 1), 0); + } + + @Test + public void test6() { + assertEquals(0.5, solution1.champagneTower(2, 1, 1), 0); + } + + @Test + public void test7() { + assertEquals(0.0, solution1.champagneTower(1000000000, 99, 99), 0); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_79Test.java b/src/test/java/com/fishercoder/firstthousand/_79Test.java index 07953c4245..e31b09e745 100644 --- a/src/test/java/com/fishercoder/firstthousand/_79Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_79Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._79; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _79Test { private _79.Solution1 solution1; private _79.Solution2 solution2; @@ -22,21 +22,23 @@ public void setup() { @Test public void test1() { - board = new char[][]{ - {'A', 'B', 'C', 'E'}, - {'S', 'F', 'E', 'S'}, - {'A', 'D', 'E', 'E'}, - }; + board = + new char[][] { + {'A', 'B', 'C', 'E'}, + {'S', 'F', 'E', 'S'}, + {'A', 'D', 'E', 'E'}, + }; assertEquals(true, solution1.exist(board, "ABCEFSADEESE")); } @Test public void test2() { - board = new char[][]{ - {'A', 'B', 'C', 'E'}, - {'S', 'F', 'C', 'S'}, - {'A', 'D', 'E', 'E'}, - }; + board = + new char[][] { + {'A', 'B', 'C', 'E'}, + {'S', 'F', 'C', 'S'}, + {'A', 'D', 'E', 'E'}, + }; assertEquals(true, solution1.exist(board, "ABCCED")); assertEquals(true, solution1.exist(board, "SEE")); @@ -46,27 +48,29 @@ public void test2() { @Test public void test3() { - board = new char[][]{ - {'a'}, - {'a'}, - }; + board = + new char[][] { + {'a'}, {'a'}, + }; assertEquals(false, solution1.exist(board, "aaa")); } @Test public void test4() { - board = new char[][]{ - {'A', 'B', 'H', 'I'}, - {'K', 'E', 'H', 'S'}, - {'A', 'D', 'E', 'E'}, - }; + board = + new char[][] { + {'A', 'B', 'H', 'I'}, + {'K', 'E', 'H', 'S'}, + {'A', 'D', 'E', 'E'}, + }; assertEquals(true, solution2.exist(board, "ABHISHEK")); } @Test public void test5() { - board = CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"A\",\"B\",\"C\",\"E\"],[\"S\",\"F\",\"C\",\"S\"],[\"A\",\"D\",\"E\",\"E\"]"); + board = + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"A\",\"B\",\"C\",\"E\"],[\"S\",\"F\",\"C\",\"S\"],[\"A\",\"D\",\"E\",\"E\"]"); assertEquals(true, solution3.exist(board, "ABCCED")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_7Test.java b/src/test/java/com/fishercoder/firstthousand/_7Test.java index 76d57b8586..79ce50ebb7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_7Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_7Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._7; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _7Test { private _7.Solution1 solution1; private _7.Solution2 solution2; @@ -18,7 +18,7 @@ public void setup() { @Test public void test1() { - /**its reversed number is greater than Integer.MAX_VALUE, thus return 0*/ + /** its reversed number is greater than Integer.MAX_VALUE, thus return 0 */ assertEquals(0, solution1.reverse(1534236469)); System.out.println(Integer.MAX_VALUE); System.out.println(1534236469); @@ -34,5 +34,4 @@ public void test2() { public void test3() { assertEquals(-123, solution2.reverse(-321)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_800Test.java b/src/test/java/com/fishercoder/firstthousand/_800Test.java index 6a57c85aef..719785d311 100644 --- a/src/test/java/com/fishercoder/firstthousand/_800Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_800Test.java @@ -1,21 +1,21 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._800; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _800Test { - private _800.Solution1 solution1; + private _800.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _800.Solution1(); - } + solution1 = new _800.Solution1(); + } - @Test - public void test1() { - assertEquals("#11ee66", solution1.similarRGB("#09f166")); - } + @Test + public void test1() { + assertEquals("#11ee66", solution1.similarRGB("#09f166")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_802Test.java b/src/test/java/com/fishercoder/firstthousand/_802Test.java index 8c76a7203f..5d24ef4a01 100644 --- a/src/test/java/com/fishercoder/firstthousand/_802Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_802Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._802; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _802Test { private _802.Solution1 solution1; @@ -18,22 +17,23 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(2, 4, 5, 6), solution1.eventualSafeNodes(new int[][]{ - {1, 2}, {2, 3}, {5}, {0}, {5}, {}, {} - })); + assertEquals( + Arrays.asList(2, 4, 5, 6), + solution1.eventualSafeNodes(new int[][] {{1, 2}, {2, 3}, {5}, {0}, {5}, {}, {}})); } @Test public void test2() { - assertEquals(Arrays.asList(4), solution1.eventualSafeNodes(new int[][]{ - {1, 2, 3, 4}, {1, 2}, {3, 4}, {0, 4}, {} - })); + assertEquals( + Arrays.asList(4), + solution1.eventualSafeNodes( + new int[][] {{1, 2, 3, 4}, {1, 2}, {3, 4}, {0, 4}, {}})); } @Test public void test3() { - assertEquals(Arrays.asList(0, 1, 2, 3, 4), solution1.eventualSafeNodes(new int[][]{ - {}, {0, 2, 3, 4}, {3}, {4}, {} - })); + assertEquals( + Arrays.asList(0, 1, 2, 3, 4), + solution1.eventualSafeNodes(new int[][] {{}, {0, 2, 3, 4}, {3}, {4}, {}})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_804Test.java b/src/test/java/com/fishercoder/firstthousand/_804Test.java index 4d5f08f613..d33109c248 100644 --- a/src/test/java/com/fishercoder/firstthousand/_804Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_804Test.java @@ -1,23 +1,23 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._804; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _804Test { - private _804.Solution1 solution1; - private static String[] words; + private _804.Solution1 solution1; + private static String[] words; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _804.Solution1(); - } + solution1 = new _804.Solution1(); + } - @Test - public void test1() { - words = new String[] {"gin", "zen", "gig", "msg"}; - assertEquals(2, solution1.uniqueMorseRepresentations(words)); - } + @Test + public void test1() { + words = new String[] {"gin", "zen", "gig", "msg"}; + assertEquals(2, solution1.uniqueMorseRepresentations(words)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_806Test.java b/src/test/java/com/fishercoder/firstthousand/_806Test.java index 8c918d589c..899db9c61c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_806Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_806Test.java @@ -1,33 +1,38 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._806; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _806Test { - private _806.Solution1 solution1; - private static int[] widths; + private _806.Solution1 solution1; + private static int[] widths; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _806.Solution1(); - } + solution1 = new _806.Solution1(); + } - @Test - public void test1() { - widths = - new int[] {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10}; - assertArrayEquals(new int[] {3, 60}, solution1.numberOfLines(widths, "abcdefghijklmnopqrstuvwxyz")); - } + @Test + public void test1() { + widths = + new int[] { + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10 + }; + assertArrayEquals( + new int[] {3, 60}, solution1.numberOfLines(widths, "abcdefghijklmnopqrstuvwxyz")); + } - @Test - public void test2() { - widths = - new int[] {4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10}; - assertArrayEquals(new int[] {2, 4}, solution1.numberOfLines(widths, "bbbcccdddaaa")); - } + @Test + public void test2() { + widths = + new int[] { + 4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10 + }; + assertArrayEquals(new int[] {2, 4}, solution1.numberOfLines(widths, "bbbcccdddaaa")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_807Test.java b/src/test/java/com/fishercoder/firstthousand/_807Test.java index 98c6ef5b82..85b19c1172 100644 --- a/src/test/java/com/fishercoder/firstthousand/_807Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_807Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._807; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _807Test { private _807.Solution1 solution1; private static int[][] grid; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {3, 0, 8, 4}, - {2, 4, 5, 7}, - {9, 2, 6, 3}, - {0, 3, 1, 0} - }; + grid = + new int[][] { + {3, 0, 8, 4}, + {2, 4, 5, 7}, + {9, 2, 6, 3}, + {0, 3, 1, 0} + }; assertEquals(35, solution1.maxIncreaseKeepingSkyline(grid)); } - - } diff --git a/src/test/java/com/fishercoder/firstthousand/_809Test.java b/src/test/java/com/fishercoder/firstthousand/_809Test.java index 9fe0f80a3b..3f309a91fa 100644 --- a/src/test/java/com/fishercoder/firstthousand/_809Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_809Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._809; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _809Test { private _809.Solution1 solution1; private String[] words; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - words = new String[]{"hello", "hi", "helo"}; + words = new String[] {"hello", "hi", "helo"}; assertEquals(1, solution1.expressiveWords("heeellooo", words)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_80Test.java b/src/test/java/com/fishercoder/firstthousand/_80Test.java index 9377194312..04f4d7a4e3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_80Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_80Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._80; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _80Test { private _80.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(5, (solution1.removeDuplicates(new int[]{1, 1, 1, 2, 2, 3}))); + assertEquals(5, (solution1.removeDuplicates(new int[] {1, 1, 1, 2, 2, 3}))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_811Test.java b/src/test/java/com/fishercoder/firstthousand/_811Test.java index 3143cd5b8f..5a04ae7f17 100644 --- a/src/test/java/com/fishercoder/firstthousand/_811Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_811Test.java @@ -6,24 +6,26 @@ import org.junit.jupiter.api.Test; public class _811Test { - private _811.Solution1 solution1; - private static String[] cpdomains; + private _811.Solution1 solution1; + private static String[] cpdomains; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _811.Solution1(); - } + solution1 = new _811.Solution1(); + } - @Test - public void test1() { - cpdomains = new String[] {"9001 discuss.leetcode.com"}; - CommonUtils.print(solution1.subdomainVisits(cpdomains)); - } + @Test + public void test1() { + cpdomains = new String[] {"9001 discuss.leetcode.com"}; + CommonUtils.print(solution1.subdomainVisits(cpdomains)); + } - @Test - public void test2() { - cpdomains = - new String[] {"900 google.mail.com", "50 yahoo.com", "1 intel.mail.com", "5 wiki.org"}; - CommonUtils.print(solution1.subdomainVisits(cpdomains)); - } + @Test + public void test2() { + cpdomains = + new String[] { + "900 google.mail.com", "50 yahoo.com", "1 intel.mail.com", "5 wiki.org" + }; + CommonUtils.print(solution1.subdomainVisits(cpdomains)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_812Test.java b/src/test/java/com/fishercoder/firstthousand/_812Test.java index 1a44b97d77..4473a8ea16 100644 --- a/src/test/java/com/fishercoder/firstthousand/_812Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_812Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._812; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _812Test { private _812.Solution1 solution1; @@ -17,12 +17,21 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.largestTriangleArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0],[0,1],[1,0],[0,2],[2,0]")), 0.0000001); + assertEquals( + 2, + solution1.largestTriangleArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0],[0,1],[1,0],[0,2],[2,0]")), + 0.0000001); } @Test public void test2() { - assertEquals(1799.0, solution1.largestTriangleArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[-35,19],[40,19],[27,-20],[35,-3],[44,20],[22,-21],[35,33],[-19,42],[11,47],[11,37]")), 0.0000001); + assertEquals( + 1799.0, + solution1.largestTriangleArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[-35,19],[40,19],[27,-20],[35,-3],[44,20],[22,-21],[35,33],[-19,42],[11,47],[11,37]")), + 0.0000001); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_814Test.java b/src/test/java/com/fishercoder/firstthousand/_814Test.java index eece7e9a61..feaf961cb5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_814Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_814Test.java @@ -3,11 +3,10 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._814; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _814Test { private _814.Solution1 solution1; @@ -18,7 +17,9 @@ public void setup() { @Test public void test1() { - TreeUtils.printBinaryTree(solution1.pruneTree(TreeUtils.constructBinaryTree(Arrays.asList(1, null, 0, 0, 1)))); + TreeUtils.printBinaryTree( + solution1.pruneTree( + TreeUtils.constructBinaryTree(Arrays.asList(1, null, 0, 0, 1)))); } @Test @@ -27,5 +28,4 @@ public void test2() { TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution1.pruneTree(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_819Test.java b/src/test/java/com/fishercoder/firstthousand/_819Test.java index 5c1b80ab70..43d9918e6a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_819Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_819Test.java @@ -1,25 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._819; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _819Test { - private _819.Solution1 solution1; - private static String[] banned; + private _819.Solution1 solution1; + private static String[] banned; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _819.Solution1(); - } + solution1 = new _819.Solution1(); + } - @Test - public void test1() { - banned = new String[] {"hit"}; - assertEquals("ball", - solution1.mostCommonWord("Bob hit a ball, the hit BALL flew far after it was hit.", - banned)); - } + @Test + public void test1() { + banned = new String[] {"hit"}; + assertEquals( + "ball", + solution1.mostCommonWord( + "Bob hit a ball, the hit BALL flew far after it was hit.", banned)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_81Test.java b/src/test/java/com/fishercoder/firstthousand/_81Test.java index c19f819180..ebba202bb6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_81Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_81Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._81; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _81Test { private _81.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(true, (solution1.search(new int[]{2, 5, 6, 0, 0, 1, 2}, 0))); + assertEquals(true, (solution1.search(new int[] {2, 5, 6, 0, 0, 1, 2}, 0))); } @Test public void test2() { - assertEquals(false, (solution1.search(new int[]{2, 5, 6, 0, 0, 1, 2}, 3))); + assertEquals(false, (solution1.search(new int[] {2, 5, 6, 0, 0, 1, 2}, 3))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_821Test.java b/src/test/java/com/fishercoder/firstthousand/_821Test.java index ec29e209ed..68093d7123 100644 --- a/src/test/java/com/fishercoder/firstthousand/_821Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_821Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._821; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _821Test { private _821.Solution1 solution1; private _821.Solution2 solution2; @@ -19,13 +19,13 @@ public void setup() { @Test public void test1() { - expected = new int[]{3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0}; + expected = new int[] {3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0}; assertArrayEquals(expected, solution1.shortestToChar("loveleetcode", 'e')); } @Test public void test2() { - expected = new int[]{3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0}; + expected = new int[] {3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0}; assertArrayEquals(expected, solution2.shortestToChar("loveleetcode", 'e')); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_823Test.java b/src/test/java/com/fishercoder/firstthousand/_823Test.java index 2c360f5d08..ba8d7a1f7c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_823Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_823Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._823; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _823Test { private _823.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numFactoredBinaryTrees(new int[]{2, 4})); + assertEquals(3, solution1.numFactoredBinaryTrees(new int[] {2, 4})); } @Test public void test2() { - assertEquals(9, solution1.numFactoredBinaryTrees(new int[]{2, 3, 4, 6, 9})); + assertEquals(9, solution1.numFactoredBinaryTrees(new int[] {2, 3, 4, 6, 9})); } @Test public void test3() { - assertEquals(25, solution1.numFactoredBinaryTrees(new int[]{2, 3, 4, 8, 16, 18})); + assertEquals(25, solution1.numFactoredBinaryTrees(new int[] {2, 3, 4, 8, 16, 18})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_824Test.java b/src/test/java/com/fishercoder/firstthousand/_824Test.java index 9323f42733..6f8287fe80 100644 --- a/src/test/java/com/fishercoder/firstthousand/_824Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_824Test.java @@ -1,29 +1,30 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._824; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _824Test { - private _824.Solution1 solution1; + private _824.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _824.Solution1(); - } + solution1 = new _824.Solution1(); + } - @Test - public void test1() { - assertEquals("Imaa peaksmaaa oatGmaaaa atinLmaaaaa", - solution1.toGoatLatin("I speak Goat Latin")); - } + @Test + public void test1() { + assertEquals( + "Imaa peaksmaaa oatGmaaaa atinLmaaaaa", + solution1.toGoatLatin("I speak Goat Latin")); + } - @Test - public void test2() { - assertEquals( - "heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa", - solution1.toGoatLatin("The quick brown fox jumped over the lazy dog")); - } + @Test + public void test2() { + assertEquals( + "heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa", + solution1.toGoatLatin("The quick brown fox jumped over the lazy dog")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_826Test.java b/src/test/java/com/fishercoder/firstthousand/_826Test.java index d16e36c690..218d6d0ff8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_826Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_826Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._826; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _826Test { private _826.Solution1 solution1; @@ -16,16 +16,29 @@ public void setup() { @Test public void test1() { - assertEquals(100, solution1.maxProfitAssignment(new int[]{2, 4, 6, 8, 10}, new int[]{10, 20, 30, 40, 50}, new int[]{4, 5, 6, 7})); + assertEquals( + 100, + solution1.maxProfitAssignment( + new int[] {2, 4, 6, 8, 10}, + new int[] {10, 20, 30, 40, 50}, + new int[] {4, 5, 6, 7})); } @Test public void test2() { - assertEquals(324, solution1.maxProfitAssignment(new int[]{68, 35, 52, 47, 86}, new int[]{67, 17, 1, 81, 3}, new int[]{92, 10, 85, 84, 82})); + assertEquals( + 324, + solution1.maxProfitAssignment( + new int[] {68, 35, 52, 47, 86}, + new int[] {67, 17, 1, 81, 3}, + new int[] {92, 10, 85, 84, 82})); } @Test public void test3() { - assertEquals(190, solution1.maxProfitAssignment(new int[]{13, 37, 58}, new int[]{4, 90, 96}, new int[]{34, 73, 45})); + assertEquals( + 190, + solution1.maxProfitAssignment( + new int[] {13, 37, 58}, new int[] {4, 90, 96}, new int[] {34, 73, 45})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_82Test.java b/src/test/java/com/fishercoder/firstthousand/_82Test.java index ac3d6fc4af..ced2454626 100644 --- a/src/test/java/com/fishercoder/firstthousand/_82Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_82Test.java @@ -1,13 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._82; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _82Test { private _82.Solution1 solution1; @@ -21,15 +21,15 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 3, 4, 4, 5}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 2, 5}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 3, 4, 4, 5}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 2, 5}); assertEquals(expected, solution1.deleteDuplicates(head)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 1, 1, 2, 3}); - expected = LinkedListUtils.contructLinkedList(new int[]{2, 3}); + head = LinkedListUtils.contructLinkedList(new int[] {1, 1, 1, 2, 3}); + expected = LinkedListUtils.contructLinkedList(new int[] {2, 3}); assertEquals(expected, solution1.deleteDuplicates(head)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_830Test.java b/src/test/java/com/fishercoder/firstthousand/_830Test.java index 2c00e48817..70fba3a289 100644 --- a/src/test/java/com/fishercoder/firstthousand/_830Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_830Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._830; import java.util.ArrayList; import java.util.Arrays; @@ -7,36 +9,34 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _830Test { - private _830.Solution1 solution1; - private static List> expected; + private _830.Solution1 solution1; + private static List> expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _830.Solution1(); - } + solution1 = new _830.Solution1(); + } - @Test - public void test1() { - expected = new ArrayList<>(); - expected.add(Arrays.asList(3, 6)); - assertEquals(expected, solution1.largeGroupPositions("abbxxxxzzy")); - } + @Test + public void test1() { + expected = new ArrayList<>(); + expected.add(Arrays.asList(3, 6)); + assertEquals(expected, solution1.largeGroupPositions("abbxxxxzzy")); + } - @Test - public void test2() { - expected = new ArrayList<>(); - assertEquals(expected, solution1.largeGroupPositions("abc")); - } + @Test + public void test2() { + expected = new ArrayList<>(); + assertEquals(expected, solution1.largeGroupPositions("abc")); + } - @Test - public void test3() { - expected = new ArrayList<>(); - expected.add(Arrays.asList(3, 5)); - expected.add(Arrays.asList(6, 9)); - expected.add(Arrays.asList(12, 14)); - assertEquals(expected, solution1.largeGroupPositions("abcdddeeeeaabbbcd")); - } + @Test + public void test3() { + expected = new ArrayList<>(); + expected.add(Arrays.asList(3, 5)); + expected.add(Arrays.asList(6, 9)); + expected.add(Arrays.asList(12, 14)); + assertEquals(expected, solution1.largeGroupPositions("abcdddeeeeaabbbcd")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_832Test.java b/src/test/java/com/fishercoder/firstthousand/_832Test.java index 9ae23e9ffa..a5c9c175ec 100644 --- a/src/test/java/com/fishercoder/firstthousand/_832Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_832Test.java @@ -1,50 +1,54 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._832; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _832Test { - private _832.Solution1 solution1; - private static int[][] expected; - private static int[][] A; + private _832.Solution1 solution1; + private static int[][] expected; + private static int[][] A; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _832.Solution1(); - } + solution1 = new _832.Solution1(); + } - @Test - public void test1() { - A = new int[][] { - {1, 1, 0}, - {1, 0, 1}, - {0, 0, 0} - }; - expected = new int[][] { - {1, 0, 0}, - {0, 1, 0}, - {1, 1, 1} - }; - assertArrayEquals(expected, solution1.flipAndInvertImage(A)); - } + @Test + public void test1() { + A = + new int[][] { + {1, 1, 0}, + {1, 0, 1}, + {0, 0, 0} + }; + expected = + new int[][] { + {1, 0, 0}, + {0, 1, 0}, + {1, 1, 1} + }; + assertArrayEquals(expected, solution1.flipAndInvertImage(A)); + } - @Test - public void test2() { - A = new int[][] { - {1, 1, 0, 0}, - {1, 0, 0, 1}, - {0, 1, 1, 1}, - {1, 0, 1, 0} - }; - expected = new int[][] { - {1, 1, 0, 0}, - {0, 1, 1, 0}, - {0, 0, 0, 1}, - {1, 0, 1, 0} - }; - assertArrayEquals(expected, solution1.flipAndInvertImage(A)); - } + @Test + public void test2() { + A = + new int[][] { + {1, 1, 0, 0}, + {1, 0, 0, 1}, + {0, 1, 1, 1}, + {1, 0, 1, 0} + }; + expected = + new int[][] { + {1, 1, 0, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 1}, + {1, 0, 1, 0} + }; + assertArrayEquals(expected, solution1.flipAndInvertImage(A)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_836Test.java b/src/test/java/com/fishercoder/firstthousand/_836Test.java index 67b3315fcb..8663135bbd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_836Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_836Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._836; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _836Test { private _836.Solution1 solution1; @@ -16,11 +16,14 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.isRectangleOverlap(new int[]{0, 0, 2, 2}, new int[]{1, 1, 3, 3})); + assertEquals( + true, solution1.isRectangleOverlap(new int[] {0, 0, 2, 2}, new int[] {1, 1, 3, 3})); } @Test public void test2() { - assertEquals(false, solution1.isRectangleOverlap(new int[]{0, 0, 1, 1}, new int[]{1, 0, 2, 1})); + assertEquals( + false, + solution1.isRectangleOverlap(new int[] {0, 0, 1, 1}, new int[] {1, 0, 2, 1})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_838Test.java b/src/test/java/com/fishercoder/firstthousand/_838Test.java index 9e0066c1c6..75890b3227 100644 --- a/src/test/java/com/fishercoder/firstthousand/_838Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_838Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._838; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _838Test { private _838.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals("RRR.L", solution1.pushDominoes("R.R.L")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_83Test.java b/src/test/java/com/fishercoder/firstthousand/_83Test.java index 13a58f24a7..400d139003 100644 --- a/src/test/java/com/fishercoder/firstthousand/_83Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_83Test.java @@ -1,18 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._83; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 4/18/17. - */ +/** Created by fishercoder on 4/18/17. */ public class _83Test { private _83.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_840Test.java b/src/test/java/com/fishercoder/firstthousand/_840Test.java index 2246149221..7ae5467da7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_840Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_840Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._840; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _840Test { private _840.Solution1 test; private static int[][] grid; @@ -17,32 +17,34 @@ public void setUp() { @Test public void test1() { - grid = new int[][]{ - {4, 3, 8, 4}, - {9, 5, 1, 9}, - {2, 7, 6, 2} - }; + grid = + new int[][] { + {4, 3, 8, 4}, + {9, 5, 1, 9}, + {2, 7, 6, 2} + }; assertEquals(1, test.numMagicSquaresInside(grid)); } @Test public void test2() { - grid = new int[][]{ - {5, 5, 5}, - {5, 5, 5}, - {5, 5, 5} - }; + grid = + new int[][] { + {5, 5, 5}, + {5, 5, 5}, + {5, 5, 5} + }; assertEquals(0, test.numMagicSquaresInside(grid)); } @Test public void test3() { - grid = new int[][]{ - {10, 3, 5}, - {1, 6, 11}, - {7, 9, 2} - }; + grid = + new int[][] { + {10, 3, 5}, + {1, 6, 11}, + {7, 9, 2} + }; assertEquals(0, test.numMagicSquaresInside(grid)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_841Test.java b/src/test/java/com/fishercoder/firstthousand/_841Test.java index e4b42ec9ef..c837bedbb6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_841Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_841Test.java @@ -1,14 +1,13 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._841; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._841; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _841Test { private _841.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_844Test.java b/src/test/java/com/fishercoder/firstthousand/_844Test.java index a3f7ff54fb..0809c4d39e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_844Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_844Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._844; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _844Test { private _844.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(false, solution1.backspaceCompare("a#c", "b")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_848Test.java b/src/test/java/com/fishercoder/firstthousand/_848Test.java index 8c331d90e4..038a4e9d1b 100644 --- a/src/test/java/com/fishercoder/firstthousand/_848Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_848Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._848; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _848Test { private _848.Solution1 solution1; @@ -16,22 +16,30 @@ public void setup() { @Test public void test1() { - assertEquals("rpl", solution1.shiftingLetters("abc", new int[]{3, 5, 9})); + assertEquals("rpl", solution1.shiftingLetters("abc", new int[] {3, 5, 9})); } @Test public void test2() { - assertEquals("gfd", solution1.shiftingLetters("aaa", new int[]{1, 2, 3})); + assertEquals("gfd", solution1.shiftingLetters("aaa", new int[] {1, 2, 3})); } @Test public void test3() { - assertEquals("rul", solution1.shiftingLetters("ruu", new int[]{26, 9, 17})); + assertEquals("rul", solution1.shiftingLetters("ruu", new int[] {26, 9, 17})); } @Test public void test4() { - assertEquals("wqqwlcjnkphhsyvrkdod", solution1.shiftingLetters("mkgfzkkuxownxvfvxasy", new int[]{505870226, 437526072, 266740649, 224336793, 532917782, 311122363, 567754492, 595798950, 81520022, 684110326, 137742843, 275267355, 856903962, 148291585, 919054234, 467541837, 622939912, 116899933, 983296461, 536563513})); + assertEquals( + "wqqwlcjnkphhsyvrkdod", + solution1.shiftingLetters( + "mkgfzkkuxownxvfvxasy", + new int[] { + 505870226, 437526072, 266740649, 224336793, 532917782, 311122363, + 567754492, 595798950, 81520022, 684110326, 137742843, 275267355, + 856903962, 148291585, 919054234, 467541837, 622939912, 116899933, + 983296461, 536563513 + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_849Test.java b/src/test/java/com/fishercoder/firstthousand/_849Test.java index 1257553704..1ce1ce3c88 100644 --- a/src/test/java/com/fishercoder/firstthousand/_849Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_849Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._849; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _849Test { private _849.Solution1 solution1; @@ -19,13 +19,13 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.maxDistToClosest(new int[]{1, 0, 0, 0, 1, 0, 1})); - assertEquals(2, solution2.maxDistToClosest(new int[]{1, 0, 0, 0, 1, 0, 1})); + assertEquals(2, solution1.maxDistToClosest(new int[] {1, 0, 0, 0, 1, 0, 1})); + assertEquals(2, solution2.maxDistToClosest(new int[] {1, 0, 0, 0, 1, 0, 1})); } @Test public void test2() { - assertEquals(3, solution1.maxDistToClosest(new int[]{1, 0, 0, 0})); - assertEquals(3, solution2.maxDistToClosest(new int[]{1, 0, 0, 0})); + assertEquals(3, solution1.maxDistToClosest(new int[] {1, 0, 0, 0})); + assertEquals(3, solution2.maxDistToClosest(new int[] {1, 0, 0, 0})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_84Test.java b/src/test/java/com/fishercoder/firstthousand/_84Test.java index a83702d1b0..6fa5343069 100644 --- a/src/test/java/com/fishercoder/firstthousand/_84Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_84Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._84; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _84Test { private _84.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(10, (solution1.largestRectangleArea(new int[]{2, 1, 5, 6, 2, 3}))); + assertEquals(10, (solution1.largestRectangleArea(new int[] {2, 1, 5, 6, 2, 3}))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_851Test.java b/src/test/java/com/fishercoder/firstthousand/_851Test.java index 8e5e58945e..8bf2d121f1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_851Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_851Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._851; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _851Test { private _851.Solution1 solution1; @@ -16,32 +16,34 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{5, 5, 2, 5, 4, 5, 6, 7}, - solution1.loudAndRich(new int[][]{ - {1, 0}, {2, 1}, {3, 1}, {3, 7}, {4, 3}, {5, 3}, {6, 3} - }, new int[]{3, 2, 5, 4, 6, 1, 7, 0})); + assertArrayEquals( + new int[] {5, 5, 2, 5, 4, 5, 6, 7}, + solution1.loudAndRich( + new int[][] {{1, 0}, {2, 1}, {3, 1}, {3, 7}, {4, 3}, {5, 3}, {6, 3}}, + new int[] {3, 2, 5, 4, 6, 1, 7, 0})); } @Test public void test2() { - assertArrayEquals(new int[]{0}, solution1.loudAndRich(new int[][]{{}}, new int[]{0})); + assertArrayEquals(new int[] {0}, solution1.loudAndRich(new int[][] {{}}, new int[] {0})); } @Test public void test3() { - assertArrayEquals(new int[]{0, 1}, solution1.loudAndRich(new int[][]{{}}, new int[]{0, 1})); + assertArrayEquals( + new int[] {0, 1}, solution1.loudAndRich(new int[][] {{}}, new int[] {0, 1})); } @Test public void test4() { - assertArrayEquals(new int[]{0, 1}, solution1.loudAndRich(new int[][]{{}}, new int[]{1, 0})); + assertArrayEquals( + new int[] {0, 1}, solution1.loudAndRich(new int[][] {{}}, new int[] {1, 0})); } @Test public void test5() { - assertArrayEquals(new int[]{0, 1, 0}, solution1.loudAndRich(new int[][]{ - {0, 2}, {1, 2} - }, new int[]{0, 1, 2})); + assertArrayEquals( + new int[] {0, 1, 0}, + solution1.loudAndRich(new int[][] {{0, 2}, {1, 2}}, new int[] {0, 1, 2})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_852Test.java b/src/test/java/com/fishercoder/firstthousand/_852Test.java index eb31cf144e..84ac769454 100644 --- a/src/test/java/com/fishercoder/firstthousand/_852Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_852Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._852; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _852Test { private _852.Solution1 solution1; private static int[] A; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - A = new int[]{0, 1, 0}; + A = new int[] {0, 1, 0}; assertEquals(1, solution1.peakIndexInMountainArray(A)); } @Test public void test2() { - A = new int[]{0, 2, 1, 0}; + A = new int[] {0, 2, 1, 0}; assertEquals(1, solution1.peakIndexInMountainArray(A)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_856Test.java b/src/test/java/com/fishercoder/firstthousand/_856Test.java index e204cecd99..0bc66b4697 100644 --- a/src/test/java/com/fishercoder/firstthousand/_856Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_856Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._856; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _856Test { private _856.Solution1 solution1; @@ -58,5 +58,4 @@ public void test8() { public void test9() { assertEquals(12, solution1.scoreOfParentheses("(()()(()()))")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_859Test.java b/src/test/java/com/fishercoder/firstthousand/_859Test.java index 1426125117..578167fd0a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_859Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_859Test.java @@ -1,46 +1,46 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._859; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _859Test { - private _859.Solution1 solution1; + private _859.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _859.Solution1(); - } - - @Test - public void test1() { - assertEquals(true, solution1.buddyStrings("ab", "ba")); - } - - @Test - public void test2() { - assertEquals(false, solution1.buddyStrings("ab", "ab")); - } - - @Test - public void test3() { - assertEquals(true, solution1.buddyStrings("aa", "aa")); - } - - @Test - public void test4() { - assertEquals(true, solution1.buddyStrings("aaaaaaabc", "aaaaaaacb")); - } - - @Test - public void test5() { - assertEquals(false, solution1.buddyStrings("", "aa")); - } - - @Test - public void test6() { - assertEquals(true, solution1.buddyStrings("aaa", "aaa")); - } + solution1 = new _859.Solution1(); + } + + @Test + public void test1() { + assertEquals(true, solution1.buddyStrings("ab", "ba")); + } + + @Test + public void test2() { + assertEquals(false, solution1.buddyStrings("ab", "ab")); + } + + @Test + public void test3() { + assertEquals(true, solution1.buddyStrings("aa", "aa")); + } + + @Test + public void test4() { + assertEquals(true, solution1.buddyStrings("aaaaaaabc", "aaaaaaacb")); + } + + @Test + public void test5() { + assertEquals(false, solution1.buddyStrings("", "aa")); + } + + @Test + public void test6() { + assertEquals(true, solution1.buddyStrings("aaa", "aaa")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_85Test.java b/src/test/java/com/fishercoder/firstthousand/_85Test.java index d65e3cffd3..02fa63d5db 100644 --- a/src/test/java/com/fishercoder/firstthousand/_85Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_85Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._85; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _85Test { private _85.Solution1 solution1; @@ -16,12 +16,14 @@ public void setup() { @Test public void test1() { - assertEquals(6, (solution1.maximalRectangle(new char[][]{ - {'1', '0', '1', '0', '0'}, - {'1', '0', '1', '1', '1'}, - {'1', '1', '1', '1', '1'}, - {'1', '0', '0', '1', '0'} - }))); + assertEquals( + 6, + (solution1.maximalRectangle( + new char[][] { + {'1', '0', '1', '0', '0'}, + {'1', '0', '1', '1', '1'}, + {'1', '1', '1', '1', '1'}, + {'1', '0', '0', '1', '0'} + }))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_860Test.java b/src/test/java/com/fishercoder/firstthousand/_860Test.java index e95675c994..b816ccdb32 100644 --- a/src/test/java/com/fishercoder/firstthousand/_860Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_860Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._860; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _860Test { private _860.Solution1 test; @@ -18,31 +18,31 @@ public void setUp() { @Test public void test1() { - bills = new int[]{5, 5, 5, 10, 20}; + bills = new int[] {5, 5, 5, 10, 20}; assertEquals(true, test.lemonadeChange(bills)); } @Test public void test2() { - bills = new int[]{5, 5, 10}; + bills = new int[] {5, 5, 10}; assertEquals(true, test.lemonadeChange(bills)); } @Test public void test3() { - bills = new int[]{10, 10}; + bills = new int[] {10, 10}; assertEquals(false, test.lemonadeChange(bills)); } @Test public void test4() { - bills = new int[]{5, 5, 10, 10, 20}; + bills = new int[] {5, 5, 10, 10, 20}; assertEquals(false, test.lemonadeChange(bills)); } @Test public void test5() { - bills = new int[]{5, 5, 5, 20, 5, 5, 5, 10, 20, 5, 10, 20, 5, 20, 5, 10, 5, 5, 5, 5}; + bills = new int[] {5, 5, 5, 20, 5, 5, 5, 10, 20, 5, 10, 20, 5, 20, 5, 10, 5, 5, 5, 5}; assertEquals(false, test.lemonadeChange(bills)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_861Test.java b/src/test/java/com/fishercoder/firstthousand/_861Test.java index abe5014979..cbaa8d00b1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_861Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_861Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._861; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _861Test { private _861.Solution1 solution1; @@ -17,7 +17,10 @@ public void setup() { @Test public void test1() { - assertEquals(39, solution1.matrixScore(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0,1,1],[1,0,1,0],[1,1,0,0]"))); + assertEquals( + 39, + solution1.matrixScore( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0,1,1],[1,0,1,0],[1,1,0,0]"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_867Test.java b/src/test/java/com/fishercoder/firstthousand/_867Test.java index 92ba933027..a11af6e709 100644 --- a/src/test/java/com/fishercoder/firstthousand/_867Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_867Test.java @@ -1,12 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._867; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _867Test { private _867.Solution1 solution1; private static int[][] A; @@ -19,59 +18,50 @@ public void setup() { @Test public void test1() { - A = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; - result = new int[][]{ - {1, 4, 7}, - {2, 5, 8}, - {3, 6, 9} - }; + A = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; + result = + new int[][] { + {1, 4, 7}, + {2, 5, 8}, + {3, 6, 9} + }; assertArrayEquals(result, solution1.transpose(A)); } @Test public void test2() { - A = new int[][]{ - {1, 2, 3} - }; - result = new int[][]{ - {1}, - {2}, - {3} - }; + A = new int[][] {{1, 2, 3}}; + result = new int[][] {{1}, {2}, {3}}; assertArrayEquals(result, solution1.transpose(A)); } @Test public void test3() { - A = new int[][]{ - {1}, - {2}, - {3} - }; - result = new int[][]{ - {1, 2, 3} - }; + A = new int[][] {{1}, {2}, {3}}; + result = new int[][] {{1, 2, 3}}; assertArrayEquals(result, solution1.transpose(A)); } @Test public void test4() { - A = new int[][]{ - {1, 2, 3, 4}, - {5, 6, 7, 8}, - {9, 10, 11, 12} - }; - result = new int[][]{ - {1, 5, 9}, - {2, 6, 10}, - {3, 7, 11}, - {4, 8, 12} - }; + A = + new int[][] { + {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10, 11, 12} + }; + result = + new int[][] { + {1, 5, 9}, + {2, 6, 10}, + {3, 7, 11}, + {4, 8, 12} + }; assertArrayEquals(result, solution1.transpose(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_868Test.java b/src/test/java/com/fishercoder/firstthousand/_868Test.java index d02dc7b67f..a12729b799 100644 --- a/src/test/java/com/fishercoder/firstthousand/_868Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_868Test.java @@ -1,36 +1,36 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._868; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _868Test { - private _868.Solution1 solution1; + private _868.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _868.Solution1(); - } - - @Test - public void test1() { - assertEquals(2, solution1.binaryGap(22)); - } - - @Test - public void test2() { - assertEquals(2, solution1.binaryGap(5)); - } - - @Test - public void test3() { - assertEquals(1, solution1.binaryGap(6)); - } - - @Test - public void test4() { - assertEquals(0, solution1.binaryGap(8)); - } + solution1 = new _868.Solution1(); + } + + @Test + public void test1() { + assertEquals(2, solution1.binaryGap(22)); + } + + @Test + public void test2() { + assertEquals(2, solution1.binaryGap(5)); + } + + @Test + public void test3() { + assertEquals(1, solution1.binaryGap(6)); + } + + @Test + public void test4() { + assertEquals(0, solution1.binaryGap(8)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_86Test.java b/src/test/java/com/fishercoder/firstthousand/_86Test.java index 802f6fbd9c..d6489efe56 100644 --- a/src/test/java/com/fishercoder/firstthousand/_86Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_86Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._86; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _86Test { private _86.Solution1 solution1; private _86.Solution2 solution2; @@ -35,5 +34,4 @@ public void test2() { expected = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 2, 4, 3, 5)); assertEquals(expected, (solution2.partition(head, 3))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_870Test.java b/src/test/java/com/fishercoder/firstthousand/_870Test.java index e320537bc6..a5f211ca4c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_870Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_870Test.java @@ -5,8 +5,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _870Test { private _870.Solution1 solution1; @@ -17,17 +15,21 @@ public void setup() { @Test public void test1() { - CommonUtils.printArray(solution1.advantageCount(new int[]{2, 7, 11, 15}, new int[]{1, 10, 4, 11})); + CommonUtils.printArray( + solution1.advantageCount(new int[] {2, 7, 11, 15}, new int[] {1, 10, 4, 11})); } @Test public void test2() { - CommonUtils.printArray(solution1.advantageCount(new int[]{12, 24, 8, 32}, new int[]{13, 25, 32, 11})); + CommonUtils.printArray( + solution1.advantageCount(new int[] {12, 24, 8, 32}, new int[] {13, 25, 32, 11})); } @Test public void test3() { - CommonUtils.printArray(solution1.advantageCount(new int[]{15, 15, 4, 5, 0, 1, 7, 10, 3, 1, 10, 10, 8, 2, 3}, new int[]{4, 13, 14, 0, 14, 14, 12, 3, 15, 12, 2, 0, 6, 9, 0})); + CommonUtils.printArray( + solution1.advantageCount( + new int[] {15, 15, 4, 5, 0, 1, 7, 10, 3, 1, 10, 10, 8, 2, 3}, + new int[] {4, 13, 14, 0, 14, 14, 12, 3, 15, 12, 2, 0, 6, 9, 0})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_872Test.java b/src/test/java/com/fishercoder/firstthousand/_872Test.java index 275e49f06b..d215b8e6fc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_872Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_872Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._872; @@ -7,35 +9,35 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _872Test { - private _872.Solution1 solution1; - private static TreeNode root1; - private static TreeNode root2; + private _872.Solution1 solution1; + private static TreeNode root1; + private static TreeNode root2; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _872.Solution1(); - } + solution1 = new _872.Solution1(); + } - @Test - public void test1() { - root1 = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 6, 2, 7, 4, 1, 9, 8)); - root2 = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 6, 2, 7, 4, 1, 9, 8)); - TreeUtils.printBinaryTree(root1); - TreeUtils.printBinaryTree(root2); - assertEquals(true, solution1.leafSimilar(root1, root2)); - } + @Test + public void test1() { + root1 = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 6, 2, 7, 4, 1, 9, 8)); + root2 = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 6, 2, 7, 4, 1, 9, 8)); + TreeUtils.printBinaryTree(root1); + TreeUtils.printBinaryTree(root2); + assertEquals(true, solution1.leafSimilar(root1, root2)); + } - @Test - public void test2() { - root1 = - TreeUtils.constructBinaryTree(Arrays.asList(18, 35, 22, null, 103, 43, 101, 58, null, 97)); - TreeUtils.printBinaryTree(root1); - root2 = - TreeUtils.constructBinaryTree(Arrays.asList(94, 102, 17, 122, null, null, 54, 58, 101, 97)); - TreeUtils.printBinaryTree(root2); - assertEquals(false, solution1.leafSimilar(root1, root2)); - } + @Test + public void test2() { + root1 = + TreeUtils.constructBinaryTree( + Arrays.asList(18, 35, 22, null, 103, 43, 101, 58, null, 97)); + TreeUtils.printBinaryTree(root1); + root2 = + TreeUtils.constructBinaryTree( + Arrays.asList(94, 102, 17, 122, null, null, 54, 58, 101, 97)); + TreeUtils.printBinaryTree(root2); + assertEquals(false, solution1.leafSimilar(root1, root2)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_875Test.java b/src/test/java/com/fishercoder/firstthousand/_875Test.java index c89e21bd8d..ce8ca216aa 100644 --- a/src/test/java/com/fishercoder/firstthousand/_875Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_875Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._875; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _875Test { private _875.Solution1 solution1; @@ -16,42 +16,43 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.minEatingSpeed(new int[]{3, 6, 7, 11}, 8)); + assertEquals(4, solution1.minEatingSpeed(new int[] {3, 6, 7, 11}, 8)); } @Test public void test2() { - assertEquals(30, solution1.minEatingSpeed(new int[]{30, 11, 23, 4, 20}, 5)); + assertEquals(30, solution1.minEatingSpeed(new int[] {30, 11, 23, 4, 20}, 5)); } @Test public void test3() { - assertEquals(23, solution1.minEatingSpeed(new int[]{30, 11, 23, 4, 20}, 6)); + assertEquals(23, solution1.minEatingSpeed(new int[] {30, 11, 23, 4, 20}, 6)); } @Test public void test4() { - assertEquals(2, solution1.minEatingSpeed(new int[]{2, 2}, 2)); + assertEquals(2, solution1.minEatingSpeed(new int[] {2, 2}, 2)); } @Test public void test5() { - assertEquals(2, solution1.minEatingSpeed(new int[]{312884470}, 312884469)); + assertEquals(2, solution1.minEatingSpeed(new int[] {312884470}, 312884469)); } @Test public void test6() { - assertEquals(500000000, solution1.minEatingSpeed(new int[]{1000000000}, 2)); + assertEquals(500000000, solution1.minEatingSpeed(new int[] {1000000000}, 2)); } @Test public void test7() { - assertEquals(1, solution1.minEatingSpeed(new int[]{312884470}, 968709470)); + assertEquals(1, solution1.minEatingSpeed(new int[] {312884470}, 968709470)); } @Test public void test8() { - assertEquals(3, solution1.minEatingSpeed(new int[]{805306368, 805306368, 805306368}, 1000000000)); + assertEquals( + 3, + solution1.minEatingSpeed(new int[] {805306368, 805306368, 805306368}, 1000000000)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_876Test.java b/src/test/java/com/fishercoder/firstthousand/_876Test.java index ca6a4d2ddf..87953bfcb8 100644 --- a/src/test/java/com/fishercoder/firstthousand/_876Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_876Test.java @@ -1,16 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._876; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _876Test { private _876.Solution1 solution1; private static ListNode head; diff --git a/src/test/java/com/fishercoder/firstthousand/_877Test.java b/src/test/java/com/fishercoder/firstthousand/_877Test.java index d7ce01802d..fa208cc02e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_877Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_877Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._877; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _877Test { private _877.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.stoneGame(new int[]{5, 3, 4, 5})); + assertEquals(true, solution1.stoneGame(new int[] {5, 3, 4, 5})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_87Test.java b/src/test/java/com/fishercoder/firstthousand/_87Test.java index 4a1149717d..2dca0e4478 100644 --- a/src/test/java/com/fishercoder/firstthousand/_87Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_87Test.java @@ -1,31 +1,31 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._87; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _87Test { - private _87.Solution1 solution1; + private _87.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _87.Solution1(); - } + solution1 = new _87.Solution1(); + } - @Test - public void test1() { - assertEquals(true, solution1.isScramble("great", "rgeat")); - } + @Test + public void test1() { + assertEquals(true, solution1.isScramble("great", "rgeat")); + } - @Test - public void test2() { - assertEquals(true, solution1.isScramble("great", "rgtae")); - } + @Test + public void test2() { + assertEquals(true, solution1.isScramble("great", "rgtae")); + } - @Test - public void test3() { - assertEquals(true, solution1.isScramble("abc", "bca")); - } + @Test + public void test3() { + assertEquals(true, solution1.isScramble("abc", "bca")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_880Test.java b/src/test/java/com/fishercoder/firstthousand/_880Test.java index 45e7e8dc60..ac2a11dd37 100644 --- a/src/test/java/com/fishercoder/firstthousand/_880Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_880Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._880; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - @Disabled public class _880Test { private _880.Solution1 solution1; @@ -40,5 +40,4 @@ public void test4() { public void test5() { assertEquals("a", solution1.decodeAtIndex("a2b3c4d5e6f7g8h9", 10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_881Test.java b/src/test/java/com/fishercoder/firstthousand/_881Test.java index 5068debafc..26a05c97b4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_881Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_881Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._881; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _881Test { private _881.Solution1 solution1; @@ -16,27 +16,34 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.numRescueBoats(new int[]{1, 2}, 3)); + assertEquals(1, solution1.numRescueBoats(new int[] {1, 2}, 3)); } @Test public void test2() { - assertEquals(3, solution1.numRescueBoats(new int[]{3, 2, 2, 1}, 3)); + assertEquals(3, solution1.numRescueBoats(new int[] {3, 2, 2, 1}, 3)); } @Test public void test3() { - assertEquals(4, solution1.numRescueBoats(new int[]{3, 5, 3, 4}, 5)); + assertEquals(4, solution1.numRescueBoats(new int[] {3, 5, 3, 4}, 5)); } @Test public void test4() { - assertEquals(2, solution1.numRescueBoats(new int[]{2, 4}, 5)); + assertEquals(2, solution1.numRescueBoats(new int[] {2, 4}, 5)); } @Test public void test5() { - assertEquals(29, solution1.numRescueBoats(new int[]{4, 9, 3, 1, 1, 7, 6, 10, 10, 10, 1, 8, 8, 7, 8, 10, 7, 4, 6, 3, 6, 1, 2, 4, 8, 8, 4, 7, 1, 2, 10, 3, 4, 6, 3, 5, 3, 1, 2, 6, 1, 5, 4, 5, 1, 10, 5, 9, 10, 4}, 10)); + assertEquals( + 29, + solution1.numRescueBoats( + new int[] { + 4, 9, 3, 1, 1, 7, 6, 10, 10, 10, 1, 8, 8, 7, 8, 10, 7, 4, 6, 3, 6, 1, 2, + 4, 8, 8, 4, 7, 1, 2, 10, 3, 4, 6, 3, 5, 3, 1, 2, 6, 1, 5, 4, 5, 1, 10, + 5, 9, 10, 4 + }, + 10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_883Test.java b/src/test/java/com/fishercoder/firstthousand/_883Test.java index 0929c030c3..7564c45502 100644 --- a/src/test/java/com/fishercoder/firstthousand/_883Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_883Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._883; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _883Test { private _883.Solution1 solution1; private static int[][] grid; @@ -17,19 +17,17 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {2} - }; + grid = new int[][] {{2}}; assertEquals(5, solution1.projectionArea(grid)); } @Test public void test2() { - grid = new int[][]{ - {1, 2}, - {3, 4}, - }; + grid = + new int[][] { + {1, 2}, + {3, 4}, + }; assertEquals(17, solution1.projectionArea(grid)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_884Test.java b/src/test/java/com/fishercoder/firstthousand/_884Test.java index 25683fe581..fb8e062e59 100644 --- a/src/test/java/com/fishercoder/firstthousand/_884Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_884Test.java @@ -1,31 +1,31 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._884; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _884Test { - private _884.Solution1 solution1; - private static String[] expected; + private _884.Solution1 solution1; + private static String[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _884.Solution1(); - } + solution1 = new _884.Solution1(); + } - @Test - public void test1() { - expected = new String[] {"sweet", "sour"}; - assertArrayEquals(expected, - solution1.uncommonFromSentences("this apple is sweet", "this apple is sour")); - } + @Test + public void test1() { + expected = new String[] {"sweet", "sour"}; + assertArrayEquals( + expected, + solution1.uncommonFromSentences("this apple is sweet", "this apple is sour")); + } - @Test - public void test2() { - expected = new String[] {"banana"}; - assertArrayEquals(expected, - solution1.uncommonFromSentences("apple apple", "banana")); - } + @Test + public void test2() { + expected = new String[] {"banana"}; + assertArrayEquals(expected, solution1.uncommonFromSentences("apple apple", "banana")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_885Test.java b/src/test/java/com/fishercoder/firstthousand/_885Test.java index d478d282bc..3c0a1801b5 100644 --- a/src/test/java/com/fishercoder/firstthousand/_885Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_885Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._885; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _885Test { private _885.Solution1 solution1; private static int[][] expected; @@ -17,50 +17,51 @@ public void setup() { @Test public void test1() { - expected = new int[][]{ - {0, 0}, - {0, 1}, - {0, 2}, - {0, 3} - }; + expected = + new int[][] { + {0, 0}, + {0, 1}, + {0, 2}, + {0, 3} + }; assertArrayEquals(expected, solution1.spiralMatrixIII(1, 4, 0, 0)); } @Test public void test2() { - expected = new int[][]{ - {1, 4}, - {1, 5}, - {2, 5}, - {2, 4}, - {2, 3}, - {1, 3}, - {0, 3}, - {0, 4}, - {0, 5}, - {3, 5}, - {3, 4}, - {3, 3}, - {3, 2}, - {2, 2}, - {1, 2}, - {0, 2}, - {4, 5}, - {4, 4}, - {4, 3}, - {4, 2}, - {4, 1}, - {3, 1}, - {2, 1}, - {1, 1}, - {0, 1}, - {4, 0}, - {3, 0}, - {2, 0}, - {1, 0}, - {0, 0} - }; + expected = + new int[][] { + {1, 4}, + {1, 5}, + {2, 5}, + {2, 4}, + {2, 3}, + {1, 3}, + {0, 3}, + {0, 4}, + {0, 5}, + {3, 5}, + {3, 4}, + {3, 3}, + {3, 2}, + {2, 2}, + {1, 2}, + {0, 2}, + {4, 5}, + {4, 4}, + {4, 3}, + {4, 2}, + {4, 1}, + {3, 1}, + {2, 1}, + {1, 1}, + {0, 1}, + {4, 0}, + {3, 0}, + {2, 0}, + {1, 0}, + {0, 0} + }; assertArrayEquals(expected, solution1.spiralMatrixIII(5, 6, 1, 4)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_888Test.java b/src/test/java/com/fishercoder/firstthousand/_888Test.java index 552507c9d6..b02460b555 100644 --- a/src/test/java/com/fishercoder/firstthousand/_888Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_888Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._888; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _888Test { private _888.Solution1 solution1; @@ -16,33 +16,33 @@ public void setup() { @Test public void test1() { - int [] A = {1, 1}; - int [] B = {2, 2}; - int [] ans = {1, 2}; + int[] A = {1, 1}; + int[] B = {2, 2}; + int[] ans = {1, 2}; assertArrayEquals(ans, solution1.fairCandySwap(A, B)); } @Test public void test2() { - int [] A = {1, 2}; - int [] B = {2, 3}; - int [] ans = {1, 2}; + int[] A = {1, 2}; + int[] B = {2, 3}; + int[] ans = {1, 2}; assertArrayEquals(ans, solution1.fairCandySwap(A, B)); } @Test public void test3() { - int [] A = {2}; - int [] B = {1, 3}; - int [] ans = {2, 3}; + int[] A = {2}; + int[] B = {1, 3}; + int[] ans = {2, 3}; assertArrayEquals(ans, solution1.fairCandySwap(A, B)); } @Test public void test4() { - int [] A = {1, 2, 5}; - int [] B = {2, 4}; - int [] ans = {5, 4}; + int[] A = {1, 2, 5}; + int[] B = {2, 4}; + int[] ans = {5, 4}; assertArrayEquals(ans, solution1.fairCandySwap(A, B)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_88Test.java b/src/test/java/com/fishercoder/firstthousand/_88Test.java index 36613e7e95..a281d812a2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_88Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_88Test.java @@ -1,38 +1,38 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._88; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _88Test { - private _88.Solution1 solution1; - private int[] nums1; - private int[] nums2; - private int[] expected; + private _88.Solution1 solution1; + private int[] nums1; + private int[] nums2; + private int[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _88.Solution1(); - } + solution1 = new _88.Solution1(); + } - @Test - public void test1() { - nums1 = new int[] {2, 0}; - nums2 = new int[] {1}; - expected = new int[] {1, 2}; - solution1.merge(nums1, 1, nums2, 1); - assertArrayEquals(expected, nums1); - } + @Test + public void test1() { + nums1 = new int[] {2, 0}; + nums2 = new int[] {1}; + expected = new int[] {1, 2}; + solution1.merge(nums1, 1, nums2, 1); + assertArrayEquals(expected, nums1); + } - @Test - public void test2() { - nums1 = new int[] {4, 5, 6, 0, 0, 0}; - nums2 = new int[] {1, 2, 3}; - expected = new int[] {1, 2, 3, 4, 5, 6}; - solution1.merge(nums1, 3, nums2, 3); - assertArrayEquals(expected, nums1); - } + @Test + public void test2() { + nums1 = new int[] {4, 5, 6, 0, 0, 0}; + nums2 = new int[] {1, 2, 3}; + expected = new int[] {1, 2, 3, 4, 5, 6}; + solution1.merge(nums1, 3, nums2, 3); + assertArrayEquals(expected, nums1); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_890Test.java b/src/test/java/com/fishercoder/firstthousand/_890Test.java index a346cfa369..bd400789fc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_890Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_890Test.java @@ -1,24 +1,25 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._890; import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _890Test { - private _890.Solution1 solution1; + private _890.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _890.Solution1(); - } + solution1 = new _890.Solution1(); + } - @Test - public void test1() { - assertEquals(Arrays.asList("mee", "aqq"), - solution1.findAndReplacePattern(new String[] {"abc", "deq", "mee", "aqq", "dkd", "ccc"}, - "abb")); - } + @Test + public void test1() { + assertEquals( + Arrays.asList("mee", "aqq"), + solution1.findAndReplacePattern( + new String[] {"abc", "deq", "mee", "aqq", "dkd", "ccc"}, "abb")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_892Test.java b/src/test/java/com/fishercoder/firstthousand/_892Test.java index 918707e4d1..1607811456 100644 --- a/src/test/java/com/fishercoder/firstthousand/_892Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_892Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._892; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _892Test { private _892.Solution1 solution1; @@ -17,27 +17,42 @@ public void setup() { @Test public void test1() { - assertEquals(10, solution1.surfaceArea(new int[][]{{2}})); + assertEquals(10, solution1.surfaceArea(new int[][] {{2}})); } @Test public void test2() { - assertEquals(34, solution1.surfaceArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[3,4]"))); + assertEquals( + 34, + solution1.surfaceArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[3,4]"))); } @Test public void test3() { - assertEquals(16, solution1.surfaceArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,0],[0,2]"))); + assertEquals( + 16, + solution1.surfaceArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,0],[0,2]"))); } @Test public void test4() { - assertEquals(32, solution1.surfaceArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,1,1],[1,0,1],[1,1,1]"))); + assertEquals( + 32, + solution1.surfaceArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1,1],[1,0,1],[1,1,1]"))); } @Test public void test5() { - assertEquals(46, solution1.surfaceArea(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,2,2],[2,1,2],[2,2,2]"))); + assertEquals( + 46, + solution1.surfaceArea( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,2,2],[2,1,2],[2,2,2]"))); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_893Test.java b/src/test/java/com/fishercoder/firstthousand/_893Test.java index 18ecb1fac6..f1acfaa10e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_893Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_893Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._893; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _893Test { private _893.Solution1 solution1; private _893.Solution2 solution2; @@ -18,20 +18,33 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numSpecialEquivGroups(new String[]{"abcd", "cdab", "cbad", "xyzz", "zzxy", "zzyx"})); - assertEquals(3, solution2.numSpecialEquivGroups(new String[]{"abcd", "cdab", "cbad", "xyzz", "zzxy", "zzyx"})); + assertEquals( + 3, + solution1.numSpecialEquivGroups( + new String[] {"abcd", "cdab", "cbad", "xyzz", "zzxy", "zzyx"})); + assertEquals( + 3, + solution2.numSpecialEquivGroups( + new String[] {"abcd", "cdab", "cbad", "xyzz", "zzxy", "zzyx"})); } @Test public void test2() { - assertEquals(3, solution1.numSpecialEquivGroups(new String[]{"abc", "acb", "bac", "bca", "cab", "cba"})); - assertEquals(3, solution2.numSpecialEquivGroups(new String[]{"abc", "acb", "bac", "bca", "cab", "cba"})); + assertEquals( + 3, + solution1.numSpecialEquivGroups( + new String[] {"abc", "acb", "bac", "bca", "cab", "cba"})); + assertEquals( + 3, + solution2.numSpecialEquivGroups( + new String[] {"abc", "acb", "bac", "bca", "cab", "cba"})); } @Test public void test3() { - assertEquals(1, solution1.numSpecialEquivGroups(new String[]{"abcd", "cdab", "adcb", "cbad"})); - assertEquals(1, solution2.numSpecialEquivGroups(new String[]{"abcd", "cdab", "adcb", "cbad"})); + assertEquals( + 1, solution1.numSpecialEquivGroups(new String[] {"abcd", "cdab", "adcb", "cbad"})); + assertEquals( + 1, solution2.numSpecialEquivGroups(new String[] {"abcd", "cdab", "adcb", "cbad"})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_895Test.java b/src/test/java/com/fishercoder/firstthousand/_895Test.java index d84de88f4a..bfde964c6d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_895Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_895Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._895; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _895Test { private _895.Solution1.FreqStack freqStack; @@ -28,5 +28,4 @@ public void test1() { assertEquals(5, freqStack.pop()); assertEquals(4, freqStack.pop()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_896Test.java b/src/test/java/com/fishercoder/firstthousand/_896Test.java index faca515742..45ca7c766d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_896Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_896Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._896; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _896Test { private _896.Solution1 solution1; private static int[] nums; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 3, 2}; + nums = new int[] {1, 3, 2}; assertEquals(false, solution1.isMonotonic(nums)); } @Test public void test2() { - nums = new int[]{6, 5, 4, 4}; + nums = new int[] {6, 5, 4, 4}; assertEquals(true, solution1.isMonotonic(nums)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_897Test.java b/src/test/java/com/fishercoder/firstthousand/_897Test.java index 02f321f1f3..769f268cde 100644 --- a/src/test/java/com/fishercoder/firstthousand/_897Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_897Test.java @@ -8,21 +8,22 @@ import org.junit.jupiter.api.Test; public class _897Test { - private _897.Solution1 solution1; - private static TreeNode root; - private static TreeNode actual; + private _897.Solution1 solution1; + private static TreeNode root; + private static TreeNode actual; - @BeforeEach + @BeforeEach public void setup() { - solution1 = new _897.Solution1(); - } + solution1 = new _897.Solution1(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree( - Arrays.asList(5, 3, 6, 2, 4, null, 8, 1, null, null, null, 7, 9)); - TreeUtils.printBinaryTree(root); - actual = solution1.increasingBST(root); - TreeUtils.printBinaryTree(actual); - } + @Test + public void test1() { + root = + TreeUtils.constructBinaryTree( + Arrays.asList(5, 3, 6, 2, 4, null, 8, 1, null, null, null, 7, 9)); + TreeUtils.printBinaryTree(root); + actual = solution1.increasingBST(root); + TreeUtils.printBinaryTree(actual); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_89Test.java b/src/test/java/com/fishercoder/firstthousand/_89Test.java index d7428c1d00..af5721b649 100644 --- a/src/test/java/com/fishercoder/firstthousand/_89Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_89Test.java @@ -1,26 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._89; import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _89Test { - private _89.Solution1 solution1; - private _89.Solution2 solution2; + private _89.Solution1 solution1; + private _89.Solution2 solution2; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _89.Solution1(); - solution2 = new _89.Solution2(); - } + solution1 = new _89.Solution1(); + solution2 = new _89.Solution2(); + } - @Test - public void test1() { - assertEquals(Arrays.asList(0, 1, 3, 2, 6, 7, 5, 4), solution1.grayCode(3)); - assertEquals(Arrays.asList(0, 1, 3, 2, 6, 7, 5, 4), solution2.grayCode(3)); - } + @Test + public void test1() { + assertEquals(Arrays.asList(0, 1, 3, 2, 6, 7, 5, 4), solution1.grayCode(3)); + assertEquals(Arrays.asList(0, 1, 3, 2, 6, 7, 5, 4), solution2.grayCode(3)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_8Test.java b/src/test/java/com/fishercoder/firstthousand/_8Test.java index 392d6e4951..fc9ca51be0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_8Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_8Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._8; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _8Test { private _8.Solution1 solution1; @@ -58,5 +58,4 @@ public void test8() { public void test9() { assertEquals(2147483647, solution1.myAtoi("9223372036854775809")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_900Test.java b/src/test/java/com/fishercoder/firstthousand/_900Test.java index 9688dc3f09..a15f139a19 100644 --- a/src/test/java/com/fishercoder/firstthousand/_900Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_900Test.java @@ -1,35 +1,36 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._900; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _900Test { - private _900.Solution1.RLEIterator rleIterator; + private _900.Solution1.RLEIterator rleIterator; - @Test - public void test1() { - rleIterator = new _900.Solution1.RLEIterator(new int[] {3, 8, 0, 9, 2, 5}); - assertEquals(8, rleIterator.next(2)); - assertEquals(8, rleIterator.next(1)); - assertEquals(5, rleIterator.next(1)); - assertEquals(-1, rleIterator.next(2)); - } + @Test + public void test1() { + rleIterator = new _900.Solution1.RLEIterator(new int[] {3, 8, 0, 9, 2, 5}); + assertEquals(8, rleIterator.next(2)); + assertEquals(8, rleIterator.next(1)); + assertEquals(5, rleIterator.next(1)); + assertEquals(-1, rleIterator.next(2)); + } - @Test - public void test2() { - rleIterator = new _900.Solution1.RLEIterator( - new int[] {811, 903, 310, 730, 899, 684, 472, 100, 434, 611}); - assertEquals(903, rleIterator.next(358)); - assertEquals(903, rleIterator.next(345)); - assertEquals(730, rleIterator.next(154)); - assertEquals(684, rleIterator.next(265)); - assertEquals(684, rleIterator.next(73)); - assertEquals(684, rleIterator.next(220)); - assertEquals(684, rleIterator.next(138)); - assertEquals(684, rleIterator.next(4)); - assertEquals(684, rleIterator.next(170)); - assertEquals(684, rleIterator.next(88)); - } + @Test + public void test2() { + rleIterator = + new _900.Solution1.RLEIterator( + new int[] {811, 903, 310, 730, 899, 684, 472, 100, 434, 611}); + assertEquals(903, rleIterator.next(358)); + assertEquals(903, rleIterator.next(345)); + assertEquals(730, rleIterator.next(154)); + assertEquals(684, rleIterator.next(265)); + assertEquals(684, rleIterator.next(73)); + assertEquals(684, rleIterator.next(220)); + assertEquals(684, rleIterator.next(138)); + assertEquals(684, rleIterator.next(4)); + assertEquals(684, rleIterator.next(170)); + assertEquals(684, rleIterator.next(88)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_901Test.java b/src/test/java/com/fishercoder/firstthousand/_901Test.java index 6149d3b506..b3b9d4728d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_901Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_901Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._901; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _901Test { private _901.Solution1.StockSpanner stockSpanner; @@ -19,5 +19,4 @@ public void test1() { assertEquals(4, stockSpanner.next(75)); assertEquals(6, stockSpanner.next(85)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_904Test.java b/src/test/java/com/fishercoder/firstthousand/_904Test.java index 098a6a15e7..fcbceb50f7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_904Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_904Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._904; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _904Test { private _904.Solution1 solution1; private static int[] fruits; @@ -17,37 +17,37 @@ public void setup() { @Test public void test1() { - fruits = new int[]{1, 2, 1}; + fruits = new int[] {1, 2, 1}; assertEquals(3, solution1.totalFruit(fruits)); } @Test public void test2() { - fruits = new int[]{0, 1, 2, 2}; + fruits = new int[] {0, 1, 2, 2}; assertEquals(3, solution1.totalFruit(fruits)); } @Test public void test3() { - fruits = new int[]{1, 2, 3, 2, 2}; + fruits = new int[] {1, 2, 3, 2, 2}; assertEquals(4, solution1.totalFruit(fruits)); } @Test public void test4() { - fruits = new int[]{3, 3, 3, 1, 2, 1, 1, 2, 3, 3, 4}; + fruits = new int[] {3, 3, 3, 1, 2, 1, 1, 2, 3, 3, 4}; assertEquals(5, solution1.totalFruit(fruits)); } @Test public void test5() { - fruits = new int[]{0, 1, 6, 6, 4, 4, 6}; + fruits = new int[] {0, 1, 6, 6, 4, 4, 6}; assertEquals(5, solution1.totalFruit(fruits)); } @Test public void test6() { - fruits = new int[]{0, 1, 1, 4, 3}; + fruits = new int[] {0, 1, 1, 4, 3}; assertEquals(3, solution1.totalFruit(fruits)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_905Test.java b/src/test/java/com/fishercoder/firstthousand/_905Test.java index eac28df1a1..31be843cef 100644 --- a/src/test/java/com/fishercoder/firstthousand/_905Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_905Test.java @@ -17,14 +17,14 @@ public void setup() { @Test public void test1() { - A = new int[]{3, 1, 2, 4}; + A = new int[] {3, 1, 2, 4}; actual = solution1.sortArrayByParity(A); CommonUtils.printArray(actual); } @Test public void test2() { - A = new int[]{1, 3}; + A = new int[] {1, 3}; actual = solution1.sortArrayByParity(A); CommonUtils.printArray(actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_908Test.java b/src/test/java/com/fishercoder/firstthousand/_908Test.java index 447673c721..5bb552021c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_908Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_908Test.java @@ -1,40 +1,40 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._908; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _908Test { - private _908.Solution1 solution1; - private _908.Solution2 solution2; - private static int[] A; + private _908.Solution1 solution1; + private _908.Solution2 solution2; + private static int[] A; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _908.Solution1(); - solution2 = new _908.Solution2(); - } + solution1 = new _908.Solution1(); + solution2 = new _908.Solution2(); + } - @Test - public void test1() { - A = new int[] {1}; - assertEquals(0, solution1.smallestRangeI(A, 0)); - assertEquals(0, solution2.smallestRangeI(A, 0)); - } + @Test + public void test1() { + A = new int[] {1}; + assertEquals(0, solution1.smallestRangeI(A, 0)); + assertEquals(0, solution2.smallestRangeI(A, 0)); + } - @Test - public void test2() { - A = new int[] {0, 10}; - assertEquals(6, solution1.smallestRangeI(A, 2)); - assertEquals(6, solution2.smallestRangeI(A, 2)); - } + @Test + public void test2() { + A = new int[] {0, 10}; + assertEquals(6, solution1.smallestRangeI(A, 2)); + assertEquals(6, solution2.smallestRangeI(A, 2)); + } - @Test - public void test3() { - A = new int[] {1, 3, 6}; - assertEquals(0, solution1.smallestRangeI(A, 3)); - assertEquals(0, solution2.smallestRangeI(A, 3)); - } + @Test + public void test3() { + A = new int[] {1, 3, 6}; + assertEquals(0, solution1.smallestRangeI(A, 3)); + assertEquals(0, solution2.smallestRangeI(A, 3)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_90Test.java b/src/test/java/com/fishercoder/firstthousand/_90Test.java index 41dc75d4c5..48f714ad6c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_90Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_90Test.java @@ -19,17 +19,16 @@ public void setup() { @Test public void test1() { - CommonUtils.printListList(solution1.subsetsWithDup(new int[]{1, 2, 2})); + CommonUtils.printListList(solution1.subsetsWithDup(new int[] {1, 2, 2})); } @Test public void test2() { - CommonUtils.printListList(solution2.subsetsWithDup(new int[]{1, 2, 2})); + CommonUtils.printListList(solution2.subsetsWithDup(new int[] {1, 2, 2})); } @Test public void test3() { - CommonUtils.printListList(solution3.subsetsWithDup(new int[]{1, 2, 2})); + CommonUtils.printListList(solution3.subsetsWithDup(new int[] {1, 2, 2})); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_914Test.java b/src/test/java/com/fishercoder/firstthousand/_914Test.java index 4f97d8fb1f..7fabf6bb80 100644 --- a/src/test/java/com/fishercoder/firstthousand/_914Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_914Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._914; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _914Test { private _914.Solution1 solution1; private int[] arr; @@ -17,37 +17,37 @@ public void setup() { @Test public void test1() { - arr = new int[]{1}; + arr = new int[] {1}; assertEquals(false, solution1.hasGroupsSizeX(arr)); } @Test public void test2() { - arr = new int[]{1,1}; + arr = new int[] {1, 1}; assertEquals(true, solution1.hasGroupsSizeX(arr)); } @Test public void test3() { - arr = new int[]{1,1,1,1,2,2,2,2,2,2}; + arr = new int[] {1, 1, 1, 1, 2, 2, 2, 2, 2, 2}; assertEquals(true, solution1.hasGroupsSizeX(arr)); } @Test public void test4() { - arr = new int[]{1,1,1,2,2,2,3,3}; + arr = new int[] {1, 1, 1, 2, 2, 2, 3, 3}; assertEquals(false, solution1.hasGroupsSizeX(arr)); } @Test public void test5() { - arr = new int[]{0,0,1,1,1,1,2,2,3,4}; + arr = new int[] {0, 0, 1, 1, 1, 1, 2, 2, 3, 4}; assertEquals(false, solution1.hasGroupsSizeX(arr)); } @Test public void test6() { - arr = new int[]{1,2,3,4,4,3,2,1}; + arr = new int[] {1, 2, 3, 4, 4, 3, 2, 1}; assertEquals(true, solution1.hasGroupsSizeX(arr)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_917Test.java b/src/test/java/com/fishercoder/firstthousand/_917Test.java index 39aff28980..fe9499c9dd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_917Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_917Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._917; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _917Test { private _917.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals("Qedo1ct-eeLg=ntse-T!", solution1.reverseOnlyLetters("Test1ng-Leet=code-Q!")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_918Test.java b/src/test/java/com/fishercoder/firstthousand/_918Test.java index f03912ec6d..5b8cbe789e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_918Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_918Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._918; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _918Test { private _918.Solution1 solution1; private _918.Solution2 solution2; @@ -20,41 +20,41 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.maxSubarraySumCircular(new int[]{1, -2, 3, -2})); + assertEquals(3, solution1.maxSubarraySumCircular(new int[] {1, -2, 3, -2})); } @Test public void test2() { - assertEquals(10, solution1.maxSubarraySumCircular(new int[]{5, -3, 5})); + assertEquals(10, solution1.maxSubarraySumCircular(new int[] {5, -3, 5})); } @Test public void test3() { - assertEquals(4, solution1.maxSubarraySumCircular(new int[]{3, -1, 2, -1})); + assertEquals(4, solution1.maxSubarraySumCircular(new int[] {3, -1, 2, -1})); } @Test public void test4() { - assertEquals(3, solution1.maxSubarraySumCircular(new int[]{3, -2, 2, -3})); + assertEquals(3, solution1.maxSubarraySumCircular(new int[] {3, -2, 2, -3})); } @Test public void test5() { - assertEquals(-1, solution1.maxSubarraySumCircular(new int[]{-2, -3, -1})); + assertEquals(-1, solution1.maxSubarraySumCircular(new int[] {-2, -3, -1})); } @Test public void test6() { - assertEquals(10, solution1.maxSubarraySumCircular(new int[]{5, -3, 5})); + assertEquals(10, solution1.maxSubarraySumCircular(new int[] {5, -3, 5})); } @Test public void test7() { - assertEquals(10, solution2.maxSubarraySumCircular(new int[]{5, -3, 5})); + assertEquals(10, solution2.maxSubarraySumCircular(new int[] {5, -3, 5})); } @Test public void test8() { - assertEquals(10, solution3.maxSubarraySumCircular(new int[]{5, -3, 5})); + assertEquals(10, solution3.maxSubarraySumCircular(new int[] {5, -3, 5})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_919Test.java b/src/test/java/com/fishercoder/firstthousand/_919Test.java index 4a6363cdfa..a16e4c16a7 100644 --- a/src/test/java/com/fishercoder/firstthousand/_919Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_919Test.java @@ -1,28 +1,26 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._919; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _919Test { private _919.Solution1.CBTInserter cbtInserter; @BeforeEach - public void setup() { - } + public void setup() {} @Test public void test1() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(5, 14, 4, 5, 14, 16, 16, 20, 7, 13)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(5, 14, 4, 5, 14, 16, 16, 20, 7, 13)); cbtInserter = new _919.Solution1.CBTInserter(root); TreeUtils.printBinaryTree(cbtInserter.get_root()); assertEquals(14, cbtInserter.insert(8)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_91Test.java b/src/test/java/com/fishercoder/firstthousand/_91Test.java index 3afb598eae..890492fec2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_91Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_91Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._91; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _91Test { private _91.Solution1 solution1; private _91.Solution2 solution2; @@ -27,5 +27,4 @@ public void test2() { assertEquals(1, solution1.numDecodings("10")); assertEquals(1, solution2.numDecodings("10")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_921Test.java b/src/test/java/com/fishercoder/firstthousand/_921Test.java index 9c505947d7..ea8214dcdd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_921Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_921Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._921; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _921Test { private _921.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(1, solution1.minAddToMakeValid(")()")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_922Test.java b/src/test/java/com/fishercoder/firstthousand/_922Test.java index 16dfc858a8..64a45eb4ba 100644 --- a/src/test/java/com/fishercoder/firstthousand/_922Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_922Test.java @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 2, 5, 7}; + nums = new int[] {4, 2, 5, 7}; result = solution1.sortArrayByParityII(nums); CommonUtils.printArray(result); result = solution2.sortArrayByParityII(nums); @@ -32,7 +32,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{3, 1, 4, 2}; + nums = new int[] {3, 1, 4, 2}; result = solution1.sortArrayByParityII(nums); CommonUtils.printArray(result); result = solution2.sortArrayByParityII(nums); @@ -43,7 +43,7 @@ public void test2() { @Test public void test3() { - nums = new int[]{648, 831, 560, 986, 192, 424, 997, 829, 897, 843}; + nums = new int[] {648, 831, 560, 986, 192, 424, 997, 829, 897, 843}; result = solution1.sortArrayByParityII(nums); CommonUtils.printArray(result); result = solution2.sortArrayByParityII(nums); @@ -54,7 +54,7 @@ public void test3() { @Test public void test4() { - nums = new int[]{3, 4}; + nums = new int[] {3, 4}; result = solution1.sortArrayByParityII(nums); CommonUtils.printArray(result); result = solution2.sortArrayByParityII(nums); @@ -65,7 +65,7 @@ public void test4() { @Test public void test5() { - nums = new int[]{2, 3, 1, 1, 4, 0, 0, 4, 3, 3}; + nums = new int[] {2, 3, 1, 1, 4, 0, 0, 4, 3, 3}; result = solution1.sortArrayByParityII(nums); CommonUtils.printArray(result); result = solution2.sortArrayByParityII(nums); diff --git a/src/test/java/com/fishercoder/firstthousand/_923Test.java b/src/test/java/com/fishercoder/firstthousand/_923Test.java index 644f6d7894..ba49b079c9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_923Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_923Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._923; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _923Test { private _923.Solution1 solution1; @@ -16,6 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(20, solution1.threeSumMulti(new int[]{1, 1, 2, 2, 3, 3, 4, 4, 5, 5}, 8)); + assertEquals(20, solution1.threeSumMulti(new int[] {1, 1, 2, 2, 3, 3, 4, 4, 5, 5}, 8)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_925Test.java b/src/test/java/com/fishercoder/firstthousand/_925Test.java index ddc89f7e93..c3aca7a2db 100644 --- a/src/test/java/com/fishercoder/firstthousand/_925Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_925Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._925; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _925Test { private _925.Solution1 solution1; @@ -43,4 +43,4 @@ public void test5() { public void test6() { assertEquals(true, solution1.isLongPressedName("leelee", "lleeelee")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_929Test.java b/src/test/java/com/fishercoder/firstthousand/_929Test.java index 3e65a8a2a4..0174391971 100644 --- a/src/test/java/com/fishercoder/firstthousand/_929Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_929Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._929; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _929Test { private _929.Solution1 solution1; private static String[] emails; @@ -17,8 +17,12 @@ public void setup() { @Test public void test1() { - emails = new String[]{"test.email+alex@leetcode.com", "test.e.mail+bob.cathy@leetcode.com", "testemail+david@lee.tcode.com"}; + emails = + new String[] { + "test.email+alex@leetcode.com", + "test.e.mail+bob.cathy@leetcode.com", + "testemail+david@lee.tcode.com" + }; assertEquals(2, solution1.numUniqueEmails(emails)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_92Test.java b/src/test/java/com/fishercoder/firstthousand/_92Test.java index 1db0f98260..44caeb9372 100644 --- a/src/test/java/com/fishercoder/firstthousand/_92Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_92Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.firstthousand._92; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _92Test { private _92.Solution1 solution1; private _92.Solution2 solution2; @@ -31,5 +30,4 @@ public void test1() { head = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 2, 3, 4, 5)); assertEquals(expected, solution2.reverseBetween(head, 2, 4)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_931Test.java b/src/test/java/com/fishercoder/firstthousand/_931Test.java index d2f4b93634..3aae6a079d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_931Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_931Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._931; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _931Test { private _931.Solution1 solution1; private static int[][] A; @@ -17,12 +17,12 @@ public void setup() { @Test public void test1() { - A = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; + A = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; assertEquals(12, solution1.minFallingPathSum(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_933Test.java b/src/test/java/com/fishercoder/firstthousand/_933Test.java index 6b734b9efa..3a4a01fa51 100644 --- a/src/test/java/com/fishercoder/firstthousand/_933Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_933Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._933; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _933Test { private _933.Solution1.RecentCounter solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(1, solution1.ping(1)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_934Test.java b/src/test/java/com/fishercoder/firstthousand/_934Test.java index 63256ecc33..bf9e03cdae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_934Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_934Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._934; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _934Test { private _934.Solution1 solution1; @@ -16,24 +16,31 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.shortestBridge(new int[][]{ - {0, 1}, - {1, 0} - })); + assertEquals( + 1, + solution1.shortestBridge( + new int[][] { + {0, 1}, + {1, 0} + })); } @Test public void test2() { - assertEquals(2, solution1.shortestBridge(new int[][]{ - {0, 1, 0}, {0, 0, 0}, {0, 0, 1} - })); + assertEquals(2, solution1.shortestBridge(new int[][] {{0, 1, 0}, {0, 0, 0}, {0, 0, 1}})); } @Test public void test3() { - assertEquals(1, solution1.shortestBridge(new int[][]{ - {1, 1, 1, 1, 1}, {1, 0, 0, 0, 1}, {1, 0, 1, 0, 1}, {1, 0, 0, 0, 1}, {1, 1, 1, 1, 1} - })); + assertEquals( + 1, + solution1.shortestBridge( + new int[][] { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 1, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_935Test.java b/src/test/java/com/fishercoder/firstthousand/_935Test.java index c472e97e8c..80741b3e16 100644 --- a/src/test/java/com/fishercoder/firstthousand/_935Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_935Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._935; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _935Test { private _935.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_936Test.java b/src/test/java/com/fishercoder/firstthousand/_936Test.java index 1eb48629af..70ef2e5b0d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_936Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_936Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._936; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _936Test { private _936.Solution1 solution1; @@ -16,11 +16,11 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{0, 2}, solution1.movesToStamp("abc", "ababc")); + assertArrayEquals(new int[] {0, 2}, solution1.movesToStamp("abc", "ababc")); } @Test public void test2() { - assertArrayEquals(new int[]{}, solution1.movesToStamp("aye", "eyeye")); + assertArrayEquals(new int[] {}, solution1.movesToStamp("aye", "eyeye")); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_937Test.java b/src/test/java/com/fishercoder/firstthousand/_937Test.java index ba96df18ad..4a5f1e41cd 100644 --- a/src/test/java/com/fishercoder/firstthousand/_937Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_937Test.java @@ -1,33 +1,38 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._937; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _937Test { - private _937.Solution1 solution1; - private static String[] logs; - private static String[] expected; + private _937.Solution1 solution1; + private static String[] logs; + private static String[] expected; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _937.Solution1(); - } + solution1 = new _937.Solution1(); + } - @Test - public void test1() { - logs = new String[] {"a1 9 2 3 1", "g1 act car", "zo4 4 7", "ab1 off key dog", "a8 act zoo"}; - expected = - new String[] {"g1 act car", "a8 act zoo", "ab1 off key dog", "a1 9 2 3 1", "zo4 4 7"}; - assertArrayEquals(expected, solution1.reorderLogFiles(logs)); - } + @Test + public void test1() { + logs = + new String[] { + "a1 9 2 3 1", "g1 act car", "zo4 4 7", "ab1 off key dog", "a8 act zoo" + }; + expected = + new String[] { + "g1 act car", "a8 act zoo", "ab1 off key dog", "a1 9 2 3 1", "zo4 4 7" + }; + assertArrayEquals(expected, solution1.reorderLogFiles(logs)); + } - @Test - public void test2() { - logs = new String[] {"t kvr", "r 3 1", "i 403", "7 so", "t 54"}; - expected = new String[] {"t kvr", "7 so", "r 3 1", "i 403", "t 54"}; - assertArrayEquals(expected, solution1.reorderLogFiles(logs)); - } + @Test + public void test2() { + logs = new String[] {"t kvr", "r 3 1", "i 403", "7 so", "t 54"}; + expected = new String[] {"t kvr", "7 so", "r 3 1", "i 403", "t 54"}; + assertArrayEquals(expected, solution1.reorderLogFiles(logs)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_938Test.java b/src/test/java/com/fishercoder/firstthousand/_938Test.java index 6c4d26cdc8..ff4ff949cb 100644 --- a/src/test/java/com/fishercoder/firstthousand/_938Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_938Test.java @@ -1,5 +1,7 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._938; @@ -7,28 +9,26 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _938Test { - private _938.Solution1 solution1; - private static TreeNode root; + private _938.Solution1 solution1; + private static TreeNode root; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _938.Solution1(); - } + solution1 = new _938.Solution1(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(10, 5, 15, 3, 7, null, 18)); - TreeUtils.printBinaryTree(root); - assertEquals(32, solution1.rangeSumBST(root, 7, 15)); - } + @Test + public void test1() { + root = TreeUtils.constructBinaryTree(Arrays.asList(10, 5, 15, 3, 7, null, 18)); + TreeUtils.printBinaryTree(root); + assertEquals(32, solution1.rangeSumBST(root, 7, 15)); + } - @Test - public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(10, 5, 15, 3, 7, 13, 18, 1, null, 6)); - TreeUtils.printBinaryTree(root); - assertEquals(23, solution1.rangeSumBST(root, 6, 10)); - } + @Test + public void test2() { + root = TreeUtils.constructBinaryTree(Arrays.asList(10, 5, 15, 3, 7, 13, 18, 1, null, 6)); + TreeUtils.printBinaryTree(root); + assertEquals(23, solution1.rangeSumBST(root, 6, 10)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_93Test.java b/src/test/java/com/fishercoder/firstthousand/_93Test.java index 0af983302b..e710efdcac 100644 --- a/src/test/java/com/fishercoder/firstthousand/_93Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_93Test.java @@ -1,35 +1,33 @@ package com.fishercoder.firstthousand; -import com.fishercoder.solutions.firstthousand._93; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.firstthousand._93; import java.util.ArrayList; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _93Test { - private _93.Solution1 solution1; - private static List expected; - private static String s; + private _93.Solution1 solution1; + private static List expected; + private static String s; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _93.Solution1(); - } + solution1 = new _93.Solution1(); + } - @BeforeEach + @BeforeEach public void setupForEachTest() { - expected = new ArrayList<>(); - } + expected = new ArrayList<>(); + } - @Test - public void test1() { - s = "25525511135"; - expected.add("255.255.11.135"); - expected.add("255.255.111.35"); - assertEquals(expected, solution1.restoreIpAddresses(s)); - } + @Test + public void test1() { + s = "25525511135"; + expected.add("255.255.11.135"); + expected.add("255.255.111.35"); + assertEquals(expected, solution1.restoreIpAddresses(s)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_941Test.java b/src/test/java/com/fishercoder/firstthousand/_941Test.java index 5d8785a30d..2536a91d4c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_941Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_941Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._941; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _941Test { private _941.Solution1 solution1; private static int[] A; @@ -17,26 +17,25 @@ public void setup() { @Test public void test1() { - A = new int[]{0, 3, 2, 1}; + A = new int[] {0, 3, 2, 1}; assertEquals(true, solution1.validMountainArray(A)); } @Test public void test2() { - A = new int[]{2, 1}; + A = new int[] {2, 1}; assertEquals(false, solution1.validMountainArray(A)); } @Test public void test3() { - A = new int[]{3, 5, 5}; + A = new int[] {3, 5, 5}; assertEquals(false, solution1.validMountainArray(A)); } @Test public void test4() { - A = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + A = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; assertEquals(false, solution1.validMountainArray(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_942Test.java b/src/test/java/com/fishercoder/firstthousand/_942Test.java index a853c7bf09..fe55bce9de 100644 --- a/src/test/java/com/fishercoder/firstthousand/_942Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_942Test.java @@ -6,25 +6,25 @@ import org.junit.jupiter.api.Test; public class _942Test { - private _942.Solution1 solution1; + private _942.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _942.Solution1(); - } + solution1 = new _942.Solution1(); + } - @Test - public void test1() { - CommonUtils.printArray(solution1.diStringMatch("IDID")); - } + @Test + public void test1() { + CommonUtils.printArray(solution1.diStringMatch("IDID")); + } - @Test - public void test2() { - CommonUtils.printArray(solution1.diStringMatch("III")); - } + @Test + public void test2() { + CommonUtils.printArray(solution1.diStringMatch("III")); + } - @Test - public void test3() { - CommonUtils.printArray(solution1.diStringMatch("DDI")); - } + @Test + public void test3() { + CommonUtils.printArray(solution1.diStringMatch("DDI")); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_944Test.java b/src/test/java/com/fishercoder/firstthousand/_944Test.java index 229c1d9ece..12d485ad51 100644 --- a/src/test/java/com/fishercoder/firstthousand/_944Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_944Test.java @@ -1,35 +1,35 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._944; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _944Test { - private _944.Solution1 solution1; - private static String[] A; + private _944.Solution1 solution1; + private static String[] A; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _944.Solution1(); - } + solution1 = new _944.Solution1(); + } - @Test - public void test1() { - A = new String[] {"cba", "daf", "ghi"}; - assertEquals(1, solution1.minDeletionSize(A)); - } + @Test + public void test1() { + A = new String[] {"cba", "daf", "ghi"}; + assertEquals(1, solution1.minDeletionSize(A)); + } - @Test - public void test2() { - A = new String[] {"a", "b"}; - assertEquals(0, solution1.minDeletionSize(A)); - } + @Test + public void test2() { + A = new String[] {"a", "b"}; + assertEquals(0, solution1.minDeletionSize(A)); + } - @Test - public void test3() { - A = new String[] {"zyx", "wvu", "tsr"}; - assertEquals(3, solution1.minDeletionSize(A)); - } + @Test + public void test3() { + A = new String[] {"zyx", "wvu", "tsr"}; + assertEquals(3, solution1.minDeletionSize(A)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_945Test.java b/src/test/java/com/fishercoder/firstthousand/_945Test.java index 2d40efd207..295539559c 100644 --- a/src/test/java/com/fishercoder/firstthousand/_945Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_945Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._945; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _945Test { private _945.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 2, 1, 2, 1, 7}; + nums = new int[] {3, 2, 1, 2, 1, 7}; assertEquals(6, solution1.minIncrementForUnique(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_946Test.java b/src/test/java/com/fishercoder/firstthousand/_946Test.java index 35cc503658..3181fa52b3 100644 --- a/src/test/java/com/fishercoder/firstthousand/_946Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_946Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._946; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _946Test { private _946.Solution1 solution1; @@ -19,25 +19,43 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.validateStackSequences(new int[]{1, 2, 3, 4, 5}, new int[]{4, 5, 3, 2, 1})); - assertEquals(true, solution2.validateStackSequences(new int[]{1, 2, 3, 4, 5}, new int[]{4, 5, 3, 2, 1})); + assertEquals( + true, + solution1.validateStackSequences( + new int[] {1, 2, 3, 4, 5}, new int[] {4, 5, 3, 2, 1})); + assertEquals( + true, + solution2.validateStackSequences( + new int[] {1, 2, 3, 4, 5}, new int[] {4, 5, 3, 2, 1})); } @Test public void test2() { - assertEquals(false, solution1.validateStackSequences(new int[]{1, 2, 3, 4, 5}, new int[]{4, 3, 5, 1, 2})); - assertEquals(false, solution2.validateStackSequences(new int[]{1, 2, 3, 4, 5}, new int[]{4, 3, 5, 1, 2})); + assertEquals( + false, + solution1.validateStackSequences( + new int[] {1, 2, 3, 4, 5}, new int[] {4, 3, 5, 1, 2})); + assertEquals( + false, + solution2.validateStackSequences( + new int[] {1, 2, 3, 4, 5}, new int[] {4, 3, 5, 1, 2})); } @Test public void test3() { - assertEquals(true, solution1.validateStackSequences(new int[]{}, new int[]{})); - assertEquals(true, solution2.validateStackSequences(new int[]{}, new int[]{})); + assertEquals(true, solution1.validateStackSequences(new int[] {}, new int[] {})); + assertEquals(true, solution2.validateStackSequences(new int[] {}, new int[] {})); } @Test public void test4() { - assertEquals(false, solution1.validateStackSequences(new int[]{4, 0, 1, 2, 3}, new int[]{4, 2, 3, 0, 1})); - assertEquals(false, solution2.validateStackSequences(new int[]{4, 0, 1, 2, 3}, new int[]{4, 2, 3, 0, 1})); + assertEquals( + false, + solution1.validateStackSequences( + new int[] {4, 0, 1, 2, 3}, new int[] {4, 2, 3, 0, 1})); + assertEquals( + false, + solution2.validateStackSequences( + new int[] {4, 0, 1, 2, 3}, new int[] {4, 2, 3, 0, 1})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_94Test.java b/src/test/java/com/fishercoder/firstthousand/_94Test.java index d096f06519..52707c4769 100644 --- a/src/test/java/com/fishercoder/firstthousand/_94Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_94Test.java @@ -4,11 +4,10 @@ import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._94; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _94Test { private _94.Solution1 solution1; @@ -31,7 +30,10 @@ public void test1() { @Test public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9)); TreeUtils.printBinaryTree(root); inorder = solution1.inorderTraversal(root); CommonUtils.printList(inorder); @@ -44,5 +46,4 @@ public void test3() { inorder = solution2.inorderTraversal(root); CommonUtils.printList(inorder); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_950Test.java b/src/test/java/com/fishercoder/firstthousand/_950Test.java index 24a1dd4481..4247e2de73 100644 --- a/src/test/java/com/fishercoder/firstthousand/_950Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_950Test.java @@ -1,22 +1,23 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._950; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _950Test { - private _950.Solution1 solution1; + private _950.Solution1 solution1; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _950.Solution1(); - } + solution1 = new _950.Solution1(); + } - @Test - public void test1() { - assertArrayEquals(new int[] {2, 13, 3, 11, 5, 17, 7}, - solution1.deckRevealedIncreasing(new int[] {17, 13, 11, 2, 3, 5, 7})); - } + @Test + public void test1() { + assertArrayEquals( + new int[] {2, 13, 3, 11, 5, 17, 7}, + solution1.deckRevealedIncreasing(new int[] {17, 13, 11, 2, 3, 5, 7})); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_951Test.java b/src/test/java/com/fishercoder/firstthousand/_951Test.java index ae69397e23..cd34975e79 100644 --- a/src/test/java/com/fishercoder/firstthousand/_951Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_951Test.java @@ -1,16 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._951; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _951Test { private _951.Solution1 solution1; @@ -21,8 +20,12 @@ public void setup() { @Test public void test1() { - TreeNode root1 = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6, null, null, null, 7, 8)); - TreeNode root2 = TreeUtils.constructBinaryTree(Arrays.asList(1, 3, 2, null, 6, 4, 5, null, null, null, null, 8, 7)); + TreeNode root1 = + TreeUtils.constructBinaryTree( + Arrays.asList(1, 2, 3, 4, 5, 6, null, null, null, 7, 8)); + TreeNode root2 = + TreeUtils.constructBinaryTree( + Arrays.asList(1, 3, 2, null, 6, 4, 5, null, null, null, null, 8, 7)); assertTrue(solution1.flipEquiv(root1, root2)); } diff --git a/src/test/java/com/fishercoder/firstthousand/_953Test.java b/src/test/java/com/fishercoder/firstthousand/_953Test.java index 088d1da6a7..9e5b3c4727 100644 --- a/src/test/java/com/fishercoder/firstthousand/_953Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_953Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._953; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _953Test { private _953.Solution1 solution1; private _953.Solution2 solution2; @@ -20,7 +20,7 @@ public void setup() { @Test public void test1() { - words = new String[]{"hello", "leetcode"}; + words = new String[] {"hello", "leetcode"}; order = "hlabcdefgijkmnopqrstuvwxyz"; assertEquals(true, solution1.isAlienSorted(words, order)); assertEquals(true, solution2.isAlienSorted(words, order)); @@ -28,7 +28,7 @@ public void test1() { @Test public void test2() { - words = new String[]{"word", "world", "row"}; + words = new String[] {"word", "world", "row"}; order = "worldabcefghijkmnpqstuvxyz"; assertEquals(false, solution1.isAlienSorted(words, order)); assertEquals(false, solution2.isAlienSorted(words, order)); @@ -36,7 +36,7 @@ public void test2() { @Test public void test3() { - words = new String[]{"apple", "app"}; + words = new String[] {"apple", "app"}; order = "abcdefghijklmnopqrstuvwxyz"; assertEquals(false, solution1.isAlienSorted(words, order)); assertEquals(false, solution2.isAlienSorted(words, order)); diff --git a/src/test/java/com/fishercoder/firstthousand/_954Test.java b/src/test/java/com/fishercoder/firstthousand/_954Test.java index aecb0ae201..d0ddcc1626 100644 --- a/src/test/java/com/fishercoder/firstthousand/_954Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_954Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._954; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _954Test { private _954.Solution1 solution1; private static int[] A; @@ -17,43 +17,43 @@ public void setup() { @Test public void test1() { - A = new int[]{3, 1, 3, 6}; + A = new int[] {3, 1, 3, 6}; assertEquals(false, solution1.canReorderDoubled(A)); } @Test public void test2() { - A = new int[]{2, 1, 2, 6}; + A = new int[] {2, 1, 2, 6}; assertEquals(false, solution1.canReorderDoubled(A)); } @Test public void test3() { - A = new int[]{4, -2, 2, -4}; + A = new int[] {4, -2, 2, -4}; assertEquals(true, solution1.canReorderDoubled(A)); } @Test public void test4() { - A = new int[]{1, 2, 4, 16, 8, 4}; + A = new int[] {1, 2, 4, 16, 8, 4}; assertEquals(false, solution1.canReorderDoubled(A)); } @Test public void test5() { - A = new int[]{1, 2, 4, 8}; + A = new int[] {1, 2, 4, 8}; assertEquals(true, solution1.canReorderDoubled(A)); } @Test public void test6() { - A = new int[]{10, 20, 40, 80}; + A = new int[] {10, 20, 40, 80}; assertEquals(true, solution1.canReorderDoubled(A)); } @Test public void test7() { - A = new int[]{0, 0}; + A = new int[] {0, 0}; assertEquals(true, solution1.canReorderDoubled(A)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_957Test.java b/src/test/java/com/fishercoder/firstthousand/_957Test.java index e03f8f59bc..ce33b432a6 100644 --- a/src/test/java/com/fishercoder/firstthousand/_957Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_957Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._957; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _957Test { private _957.Solution1 solution1; private static int[] cells; @@ -17,26 +17,28 @@ public void setup() { @Test public void test1() { - cells = new int[]{0, 1, 0, 1, 1, 0, 0, 1}; - assertArrayEquals(new int[]{0, 0, 1, 1, 0, 0, 0, 0}, solution1.prisonAfterNDays(cells, 7)); + cells = new int[] {0, 1, 0, 1, 1, 0, 0, 1}; + assertArrayEquals(new int[] {0, 0, 1, 1, 0, 0, 0, 0}, solution1.prisonAfterNDays(cells, 7)); } @Test public void test2() { - cells = new int[]{1, 0, 0, 1, 0, 0, 1, 0}; - assertArrayEquals(new int[]{0, 0, 1, 1, 1, 1, 1, 0}, solution1.prisonAfterNDays(cells, 1000000000)); + cells = new int[] {1, 0, 0, 1, 0, 0, 1, 0}; + assertArrayEquals( + new int[] {0, 0, 1, 1, 1, 1, 1, 0}, solution1.prisonAfterNDays(cells, 1000000000)); } @Test public void test3() { - cells = new int[]{0, 1, 1, 1, 0, 0, 0, 0}; - assertArrayEquals(new int[]{0, 0, 1, 0, 0, 1, 1, 0}, solution1.prisonAfterNDays(cells, 99)); + cells = new int[] {0, 1, 1, 1, 0, 0, 0, 0}; + assertArrayEquals( + new int[] {0, 0, 1, 0, 0, 1, 1, 0}, solution1.prisonAfterNDays(cells, 99)); } @Test public void test4() { - cells = new int[]{0, 1, 1, 1, 1, 1, 1, 0}; - assertArrayEquals(new int[]{0, 0, 1, 1, 1, 1, 0, 0}, solution1.prisonAfterNDays(cells, 99)); + cells = new int[] {0, 1, 1, 1, 1, 1, 1, 0}; + assertArrayEquals( + new int[] {0, 0, 1, 1, 1, 1, 0, 0}, solution1.prisonAfterNDays(cells, 99)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_958Test.java b/src/test/java/com/fishercoder/firstthousand/_958Test.java index 72027d2b00..95b405189d 100644 --- a/src/test/java/com/fishercoder/firstthousand/_958Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_958Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._958; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _958Test { private _958.Solution1 solution1; @@ -35,5 +34,4 @@ public void test3() { TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 8)); assertEquals(true, solution1.isCompleteTree(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_95Test.java b/src/test/java/com/fishercoder/firstthousand/_95Test.java index 1aa6f5c85b..6c6e1ca280 100644 --- a/src/test/java/com/fishercoder/firstthousand/_95Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_95Test.java @@ -17,5 +17,4 @@ public void setup() { public void test1() { solution1.generateTrees(3).forEach(TreeUtils::printBinaryTree); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_961Test.java b/src/test/java/com/fishercoder/firstthousand/_961Test.java index 267de4e284..f49fb3845f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_961Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_961Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._961; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _961Test { private _961.Solution1 solution1; private static int[] A; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 2, 3, 3}; + A = new int[] {1, 2, 3, 3}; assertEquals(3, solution1.repeatedNTimes(A)); } @Test public void test2() { - A = new int[]{2, 1, 2, 5, 3, 2}; + A = new int[] {2, 1, 2, 5, 3, 2}; assertEquals(2, solution1.repeatedNTimes(A)); } @Test public void test3() { - A = new int[]{5, 1, 5, 2, 5, 3, 5, 4}; + A = new int[] {5, 1, 5, 2, 5, 3, 5, 4}; assertEquals(5, solution1.repeatedNTimes(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_965Test.java b/src/test/java/com/fishercoder/firstthousand/_965Test.java index 6af79399cf..00a73f5394 100644 --- a/src/test/java/com/fishercoder/firstthousand/_965Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_965Test.java @@ -1,33 +1,32 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._965; import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _965Test { - private _965.Solution1 solution1; - private static TreeNode root; + private _965.Solution1 solution1; + private static TreeNode root; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _965.Solution1(); - } + solution1 = new _965.Solution1(); + } - @Test - public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 1, 1, 1, 1, null, 1)); - assertEquals(true, solution1.isUnivalTree(root)); - } + @Test + public void test1() { + root = TreeUtils.constructBinaryTree(Arrays.asList(1, 1, 1, 1, 1, null, 1)); + assertEquals(true, solution1.isUnivalTree(root)); + } - @Test - public void test2() { - root = TreeUtils.constructBinaryTree(Arrays.asList(2, 2, 2, 5, 2)); - assertEquals(false, solution1.isUnivalTree(root)); - } + @Test + public void test2() { + root = TreeUtils.constructBinaryTree(Arrays.asList(2, 2, 2, 5, 2)); + assertEquals(false, solution1.isUnivalTree(root)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_966Test.java b/src/test/java/com/fishercoder/firstthousand/_966Test.java index f75fb13029..2a79f7af81 100644 --- a/src/test/java/com/fishercoder/firstthousand/_966Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_966Test.java @@ -1,18 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._966; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by varunu28 on 1/01/19. - */ - - +/** Created by varunu28 on 1/01/19. */ public class _966Test { private _966.Solution1 solution1; @@ -21,14 +16,19 @@ public void setup() { solution1 = new _966.Solution1(); } - @Test public void test1() { assertEquals( - Arrays.toString(new String[]{"kite","KiTe","KiTe","Hare","hare","","","KiTe","","KiTe"}), - Arrays.toString(solution1 - .spellchecker( - new String[]{"KiTe","kite","hare","Hare"}, - new String[]{"kite","Kite","KiTe","Hare","HARE","Hear","hear","keti","keet","keto"}))); + Arrays.toString( + new String[] { + "kite", "KiTe", "KiTe", "Hare", "hare", "", "", "KiTe", "", "KiTe" + }), + Arrays.toString( + solution1.spellchecker( + new String[] {"KiTe", "kite", "hare", "Hare"}, + new String[] { + "kite", "Kite", "KiTe", "Hare", "HARE", "Hear", "hear", "keti", + "keet", "keto" + }))); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_96Test.java b/src/test/java/com/fishercoder/firstthousand/_96Test.java index f293815a2b..0cc7bdbccc 100644 --- a/src/test/java/com/fishercoder/firstthousand/_96Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_96Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._96; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _96Test { private _96.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(5, solution1.numTrees(3)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_970Test.java b/src/test/java/com/fishercoder/firstthousand/_970Test.java index e41c8f6b8e..718d9e60a4 100644 --- a/src/test/java/com/fishercoder/firstthousand/_970Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_970Test.java @@ -1,15 +1,13 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._970; - import java.util.Arrays; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _970Test { private _970.Solution1 solution1; private _970.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_973Test.java b/src/test/java/com/fishercoder/firstthousand/_973Test.java index b0425b49ec..4ad35d1c59 100644 --- a/src/test/java/com/fishercoder/firstthousand/_973Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_973Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._973; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _973Test { private _973.Solution1 solution1; private _973.Solution2 solution2; @@ -18,13 +18,19 @@ public void setUp() { @Test public void test1() { - assertArrayEquals(new int[][]{{-2, 2}}, solution1.kClosest(new int[][]{{1, 3}, {-2, 2}}, 1)); - assertArrayEquals(new int[][]{{-2, 2}}, solution2.kClosest(new int[][]{{1, 3}, {-2, 2}}, 1)); + assertArrayEquals( + new int[][] {{-2, 2}}, solution1.kClosest(new int[][] {{1, 3}, {-2, 2}}, 1)); + assertArrayEquals( + new int[][] {{-2, 2}}, solution2.kClosest(new int[][] {{1, 3}, {-2, 2}}, 1)); } @Test public void test2() { - assertArrayEquals(new int[][]{{3, 3}, {-2, 4}}, solution1.kClosest(new int[][]{{3, 3}, {5, -1}, {-2, 4}}, 2)); - assertArrayEquals(new int[][]{{-2, 4}, {3, 3}}, solution2.kClosest(new int[][]{{3, 3}, {5, -1}, {-2, 4}}, 2)); + assertArrayEquals( + new int[][] {{3, 3}, {-2, 4}}, + solution1.kClosest(new int[][] {{3, 3}, {5, -1}, {-2, 4}}, 2)); + assertArrayEquals( + new int[][] {{-2, 4}, {3, 3}}, + solution2.kClosest(new int[][] {{3, 3}, {5, -1}, {-2, 4}}, 2)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_974Test.java b/src/test/java/com/fishercoder/firstthousand/_974Test.java index 2f1692ef5e..22f7f8a564 100644 --- a/src/test/java/com/fishercoder/firstthousand/_974Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_974Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._974; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _974Test { private _974.Solution1 test; @@ -17,6 +17,6 @@ public void setup() { @Test public void test1() { - assertEquals(7, test.subarraysDivByK(new int[]{4, 5, 0, -2, -3, 1}, 5)); + assertEquals(7, test.subarraysDivByK(new int[] {4, 5, 0, -2, -3, 1}, 5)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_976Test.java b/src/test/java/com/fishercoder/firstthousand/_976Test.java index f94800bd67..37a91910f0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_976Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_976Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._976; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _976Test { private _976.Solution1 test; @@ -17,21 +17,21 @@ public void setup() { @Test public void test1() { - assertEquals(5, test.largestPerimeter(new int[]{2, 1, 2})); + assertEquals(5, test.largestPerimeter(new int[] {2, 1, 2})); } @Test public void test2() { - assertEquals(0, test.largestPerimeter(new int[]{1, 2, 1})); + assertEquals(0, test.largestPerimeter(new int[] {1, 2, 1})); } @Test public void test3() { - assertEquals(10, test.largestPerimeter(new int[]{3, 2, 3, 4})); + assertEquals(10, test.largestPerimeter(new int[] {3, 2, 3, 4})); } @Test public void test4() { - assertEquals(8, test.largestPerimeter(new int[]{3, 6, 2, 3})); + assertEquals(8, test.largestPerimeter(new int[] {3, 6, 2, 3})); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_977Test.java b/src/test/java/com/fishercoder/firstthousand/_977Test.java index 5a269205a3..76a7019b7f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_977Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_977Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._977; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _977Test { private _977.Solution1 solution1; private _977.Solution2 solution2; @@ -19,15 +19,15 @@ public void setup() { @Test public void test1() { - A = new int[]{-4, -1, 0, 3, 10}; - assertArrayEquals(new int[]{0, 1, 9, 16, 100}, solution1.sortedSquares(A)); - assertArrayEquals(new int[]{0, 1, 9, 16, 100}, solution2.sortedSquares(A)); + A = new int[] {-4, -1, 0, 3, 10}; + assertArrayEquals(new int[] {0, 1, 9, 16, 100}, solution1.sortedSquares(A)); + assertArrayEquals(new int[] {0, 1, 9, 16, 100}, solution2.sortedSquares(A)); } @Test public void test2() { - A = new int[]{-7, -3, 2, 3, 11}; - assertArrayEquals(new int[]{4, 9, 9, 49, 121}, solution1.sortedSquares(A)); - assertArrayEquals(new int[]{4, 9, 9, 49, 121}, solution2.sortedSquares(A)); + A = new int[] {-7, -3, 2, 3, 11}; + assertArrayEquals(new int[] {4, 9, 9, 49, 121}, solution1.sortedSquares(A)); + assertArrayEquals(new int[] {4, 9, 9, 49, 121}, solution2.sortedSquares(A)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_979Test.java b/src/test/java/com/fishercoder/firstthousand/_979Test.java index f13a4a8fcf..60de4b31e1 100644 --- a/src/test/java/com/fishercoder/firstthousand/_979Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_979Test.java @@ -1,13 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._979; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _979Test { private _979.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/firstthousand/_97Test.java b/src/test/java/com/fishercoder/firstthousand/_97Test.java index 9a9cfdbcf8..ab09bb4ab0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_97Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_97Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._97; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _97Test { private _97.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(false, solution1.isInterleave("aabcc", "dbbca", "aadbbbaccc")); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_980Test.java b/src/test/java/com/fishercoder/firstthousand/_980Test.java index 796f1ae31f..173372c92a 100644 --- a/src/test/java/com/fishercoder/firstthousand/_980Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_980Test.java @@ -1,10 +1,10 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._980; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _980Test { private _980.Solution1 solution1; private static int[][] grid; @@ -12,33 +12,35 @@ public class _980Test { @Test public void test1() { solution1 = new _980.Solution1(); - grid = new int[][]{ - {1, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 2, -1}, - }; + grid = + new int[][] { + {1, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 2, -1}, + }; assertEquals(2, solution1.uniquePathsIII(grid)); } @Test public void test2() { solution1 = new _980.Solution1(); - grid = new int[][]{ - {1, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 2}, - }; + grid = + new int[][] { + {1, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 2}, + }; assertEquals(4, solution1.uniquePathsIII(grid)); } @Test public void test3() { solution1 = new _980.Solution1(); - grid = new int[][]{ - {0, 1}, - {2, 0}, - }; + grid = + new int[][] { + {0, 1}, + {2, 0}, + }; assertEquals(0, solution1.uniquePathsIII(grid)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/firstthousand/_985Test.java b/src/test/java/com/fishercoder/firstthousand/_985Test.java index 0006d4f75f..305ca7c8c2 100644 --- a/src/test/java/com/fishercoder/firstthousand/_985Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_985Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.firstthousand._985; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _985Test { private _985.Solution1 solution1; private static int[] expected; @@ -20,9 +20,9 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 2, 3, 4}; - queries = new int[][]{{1, 0}, {-3, 1}, {-4, 0}, {2, 3}}; - expected = new int[]{8, 6, 2, 4}; + A = new int[] {1, 2, 3, 4}; + queries = new int[][] {{1, 0}, {-3, 1}, {-4, 0}, {2, 3}}; + expected = new int[] {8, 6, 2, 4}; actual = solution1.sumEvenAfterQueries(A, queries); assertArrayEquals(expected, actual); } diff --git a/src/test/java/com/fishercoder/firstthousand/_986Test.java b/src/test/java/com/fishercoder/firstthousand/_986Test.java index 4b5740bd2e..b396e647ae 100644 --- a/src/test/java/com/fishercoder/firstthousand/_986Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_986Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._986; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _986Test { private _986.Solution1 solution1; private static int[][] A; @@ -20,30 +20,31 @@ public void setup() { @Test public void test1() { - A = new int[][]{ - {0, 2}, - {5, 10}, - {13, 23}, - {24, 25} - }; - B = new int[][]{ - {1, 5}, - {8, 12}, - {15, 24}, - {25, 26} - }; - expected = new int[][]{ - {1, 2}, - {5, 5}, - {8, 10}, - {15, 23}, - {24, 24}, - {25, 25} - }; + A = + new int[][] { + {0, 2}, + {5, 10}, + {13, 23}, + {24, 25} + }; + B = + new int[][] { + {1, 5}, + {8, 12}, + {15, 24}, + {25, 26} + }; + expected = + new int[][] { + {1, 2}, + {5, 5}, + {8, 10}, + {15, 23}, + {24, 24}, + {25, 25} + }; int[][] actual = solution1.intervalIntersection(A, B); CommonUtils.print2DIntArray(actual); assertArrayEquals(expected, actual); } - - } diff --git a/src/test/java/com/fishercoder/firstthousand/_987Test.java b/src/test/java/com/fishercoder/firstthousand/_987Test.java index 1f82ea7468..1e788b10ef 100644 --- a/src/test/java/com/fishercoder/firstthousand/_987Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_987Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._987; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _987Test { private _987.Solution1 solution1; @@ -27,7 +26,12 @@ public void setup() { @Test public void test1() { root = TreeUtils.constructBinaryTree(Arrays.asList(3, 9, 20, null, null, 15, 7)); - expected = Arrays.asList(Arrays.asList(9), Arrays.asList(3, 15), Arrays.asList(20), Arrays.asList(7)); + expected = + Arrays.asList( + Arrays.asList(9), + Arrays.asList(3, 15), + Arrays.asList(20), + Arrays.asList(7)); actual = solution1.verticalTraversal(root); assertEquals(expected, actual); actual = solution2.verticalTraversal(root); @@ -37,27 +41,52 @@ public void test1() { @Test public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); - expected = Arrays.asList(Arrays.asList(4), Arrays.asList(2), Arrays.asList(1, 5, 6), Arrays.asList(3), Arrays.asList(7)); + expected = + Arrays.asList( + Arrays.asList(4), + Arrays.asList(2), + Arrays.asList(1, 5, 6), + Arrays.asList(3), + Arrays.asList(7)); actual = solution1.verticalTraversal(root); assertEquals(expected, actual); } @Test public void test3() { - root = TreeUtils.constructBinaryTree(Arrays.asList(0, 5, 1, 9, null, 2, null, null, null, null, 3, 4, 8, 6, null, null, null, 7)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 0, 5, 1, 9, null, 2, null, null, null, null, 3, 4, 8, 6, null, null, + null, 7)); TreeUtils.printBinaryTree(root); - expected = Arrays.asList(Arrays.asList(9, 7), Arrays.asList(5, 6), Arrays.asList(0, 2, 4), Arrays.asList(1, 3), Arrays.asList(8)); + expected = + Arrays.asList( + Arrays.asList(9, 7), + Arrays.asList(5, 6), + Arrays.asList(0, 2, 4), + Arrays.asList(1, 3), + Arrays.asList(8)); actual = solution1.verticalTraversal(root); assertEquals(expected, actual); } @Test public void test4() { - root = TreeUtils.constructBinaryTree(Arrays.asList(0, 2, 1, 3, null, null, null, 4, 5, null, 7, 6, null, 10, 8, 11, 9)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 0, 2, 1, 3, null, null, null, 4, 5, null, 7, 6, null, 10, 8, 11, + 9)); TreeUtils.printBinaryTree(root); - expected = Arrays.asList(Arrays.asList(4, 10, 11), Arrays.asList(3, 6, 7), Arrays.asList(2, 5, 8, 9), Arrays.asList(0), Arrays.asList(1)); + expected = + Arrays.asList( + Arrays.asList(4, 10, 11), + Arrays.asList(3, 6, 7), + Arrays.asList(2, 5, 8, 9), + Arrays.asList(0), + Arrays.asList(1)); actual = solution1.verticalTraversal(root); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_988Test.java b/src/test/java/com/fishercoder/firstthousand/_988Test.java index 2ac6551492..9bd7365720 100644 --- a/src/test/java/com/fishercoder/firstthousand/_988Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_988Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._988; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _988Test { private _988.Solution1 solution1; private static TreeNode root; @@ -36,5 +35,4 @@ public void test3() { root = TreeUtils.constructBinaryTree(Arrays.asList(2, 2, 1, null, 1, 0, null, 0)); assertEquals("abc", solution1.smallestFromLeaf(root)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_989Test.java b/src/test/java/com/fishercoder/firstthousand/_989Test.java index defe8b968b..da48eb447f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_989Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_989Test.java @@ -1,42 +1,43 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._989; import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _989Test { - private _989.Solution1 solution1; - private static int[] A; + private _989.Solution1 solution1; + private static int[] A; - @BeforeEach + @BeforeEach public void setUp() { - solution1 = new _989.Solution1(); - } - - @Test - public void test1() { - A = new int[] {1, 2, 0, 0}; - assertEquals(Arrays.asList(1, 2, 3, 4), solution1.addToArrayForm(A, 34)); - } - - @Test - public void test2() { - A = new int[] {2, 7, 4}; - assertEquals(Arrays.asList(4, 5, 5), solution1.addToArrayForm(A, 181)); - } - - @Test - public void test3() { - A = new int[] {2, 1, 5}; - assertEquals(Arrays.asList(1, 0, 2, 1), solution1.addToArrayForm(A, 806)); - } - - @Test - public void test4() { - A = new int[] {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; - assertEquals(Arrays.asList(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), solution1.addToArrayForm(A, 1)); - } + solution1 = new _989.Solution1(); + } + + @Test + public void test1() { + A = new int[] {1, 2, 0, 0}; + assertEquals(Arrays.asList(1, 2, 3, 4), solution1.addToArrayForm(A, 34)); + } + + @Test + public void test2() { + A = new int[] {2, 7, 4}; + assertEquals(Arrays.asList(4, 5, 5), solution1.addToArrayForm(A, 181)); + } + + @Test + public void test3() { + A = new int[] {2, 1, 5}; + assertEquals(Arrays.asList(1, 0, 2, 1), solution1.addToArrayForm(A, 806)); + } + + @Test + public void test4() { + A = new int[] {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; + assertEquals( + Arrays.asList(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), solution1.addToArrayForm(A, 1)); + } } diff --git a/src/test/java/com/fishercoder/firstthousand/_98Test.java b/src/test/java/com/fishercoder/firstthousand/_98Test.java index 39b64a3e7f..a36126efe0 100644 --- a/src/test/java/com/fishercoder/firstthousand/_98Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_98Test.java @@ -1,18 +1,15 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._98; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Created by fishercoder on 5/17/17. - */ +/** Created by fishercoder on 5/17/17. */ public class _98Test { private _98.Solution1 solution1; private static TreeNode root; diff --git a/src/test/java/com/fishercoder/firstthousand/_993Test.java b/src/test/java/com/fishercoder/firstthousand/_993Test.java index 461cd4b4f7..0abe91f8d9 100644 --- a/src/test/java/com/fishercoder/firstthousand/_993Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_993Test.java @@ -1,15 +1,14 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.firstthousand._993; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _993Test { private _993.Solution1 solution1; private _993.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/firstthousand/_994Test.java b/src/test/java/com/fishercoder/firstthousand/_994Test.java index fbc75387a1..6e3f27e815 100644 --- a/src/test/java/com/fishercoder/firstthousand/_994Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_994Test.java @@ -1,12 +1,12 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.firstthousand._994; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _994Test { private _994.Solution1 solution1; private _994.Solution2 solution2; @@ -22,45 +22,48 @@ public void setUp() { @Test public void test1() { - grid = new int[][]{ - {2, 1, 1}, - {1, 1, 0}, - {0, 1, 1} - }; + grid = + new int[][] { + {2, 1, 1}, + {1, 1, 0}, + {0, 1, 1} + }; assertEquals(4, solution1.orangesRotting(grid)); } @Test public void test2() { - grid = new int[][]{ - {2, 1, 1}, - {0, 1, 1}, - {1, 0, 1} - }; + grid = + new int[][] { + {2, 1, 1}, + {0, 1, 1}, + {1, 0, 1} + }; assertEquals(-1, solution1.orangesRotting(grid)); } @Test public void test3() { - grid = new int[][]{ - {0, 2} - }; + grid = new int[][] {{0, 2}}; assertEquals(0, solution1.orangesRotting(grid)); } @Test public void test4() { - grid = new int[][]{ - {2, 1, 1}, - {1, 1, 0}, - {0, 1, 1} - }; + grid = + new int[][] { + {2, 1, 1}, + {1, 1, 0}, + {0, 1, 1} + }; assertEquals(4, solution2.orangesRotting(grid)); } @Test public void test5() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,0,0,1,0,1],[2,0,0,1,2,0]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,0,0,1,0,1],[2,0,0,1,2,0]"); assertEquals(-1, solution2.orangesRotting(grid)); } @@ -70,5 +73,4 @@ public void test6() { assertEquals(1, solution2.orangesRotting(grid)); assertEquals(1, solution3.orangesRotting(grid)); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_997Test.java b/src/test/java/com/fishercoder/firstthousand/_997Test.java index 2168fc8cc0..a130631617 100644 --- a/src/test/java/com/fishercoder/firstthousand/_997Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_997Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._997; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _997Test { private _997.Solution1 solution1; private _997.Solution2 solution2; @@ -19,38 +19,38 @@ public void setup() { @Test public void test1() { - trust = new int[][]{{1, 2}}; + trust = new int[][] {{1, 2}}; assertEquals(2, solution1.findJudge(2, trust)); assertEquals(2, solution2.findJudge(2, trust)); } @Test public void test2() { - trust = new int[][]{{1, 3}, {2, 3}}; + trust = new int[][] {{1, 3}, {2, 3}}; assertEquals(3, solution1.findJudge(3, trust)); } @Test public void test3() { - trust = new int[][]{{1, 2}, {2, 3}, {3, 1}}; + trust = new int[][] {{1, 2}, {2, 3}, {3, 1}}; assertEquals(-1, solution1.findJudge(3, trust)); } @Test public void test4() { - trust = new int[][]{{1, 2}, {2, 3}}; + trust = new int[][] {{1, 2}, {2, 3}}; assertEquals(-1, solution1.findJudge(3, trust)); } @Test public void test5() { - trust = new int[][]{{1, 3}, {1, 4}, {2, 3}, {2, 4}, {4, 3}}; + trust = new int[][] {{1, 3}, {1, 4}, {2, 3}, {2, 4}, {4, 3}}; assertEquals(3, solution1.findJudge(4, trust)); } @Test public void test6() { - trust = new int[][]{{1, 3}, {2, 3}, {3, 1}}; + trust = new int[][] {{1, 3}, {2, 3}, {3, 1}}; assertEquals(-1, solution1.findJudge(3, trust)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_999Test.java b/src/test/java/com/fishercoder/firstthousand/_999Test.java index b89615d63e..ac9a2a641e 100644 --- a/src/test/java/com/fishercoder/firstthousand/_999Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_999Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._999; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _999Test { private _999.Solution1 solution1; private static char[][] board; @@ -17,46 +17,49 @@ public void setup() { @Test public void test1() { - board = new char[][]{ - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', 'p', '.', '.', '.', '.'}, - {'.', '.', '.', 'R', '.', '.', '.', 'p'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', 'p', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - }; + board = + new char[][] { + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', 'p', '.', '.', '.', '.'}, + {'.', '.', '.', 'R', '.', '.', '.', 'p'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', 'p', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + }; assertEquals(3, solution1.numRookCaptures(board)); } @Test public void test2() { - board = new char[][]{ - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'}, - {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'}, - {'.', 'p', 'B', 'R', 'B', 'p', '.', '.'}, - {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'}, - {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - }; + board = + new char[][] { + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'}, + {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'}, + {'.', 'p', 'B', 'R', 'B', 'p', '.', '.'}, + {'.', 'p', 'p', 'B', 'p', 'p', '.', '.'}, + {'.', 'p', 'p', 'p', 'p', 'p', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + }; assertEquals(0, solution1.numRookCaptures(board)); } @Test public void test3() { - board = new char[][]{ - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', 'p', '.', '.', '.', '.'}, - {'.', '.', '.', 'p', '.', '.', '.', 'p'}, - {'p', 'p', '.', 'R', '.', 'p', 'B', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - {'.', '.', '.', 'B', '.', '.', '.', '.'}, - {'.', '.', '.', 'p', '.', '.', '.', '.'}, - {'.', '.', '.', '.', '.', '.', '.', '.'}, - }; + board = + new char[][] { + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', 'p', '.', '.', '.', '.'}, + {'.', '.', '.', 'p', '.', '.', '.', 'p'}, + {'p', 'p', '.', 'R', '.', 'p', 'B', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + {'.', '.', '.', 'B', '.', '.', '.', '.'}, + {'.', '.', '.', 'p', '.', '.', '.', '.'}, + {'.', '.', '.', '.', '.', '.', '.', '.'}, + }; assertEquals(3, solution1.numRookCaptures(board)); } } diff --git a/src/test/java/com/fishercoder/firstthousand/_99Test.java b/src/test/java/com/fishercoder/firstthousand/_99Test.java index b15e633c65..d2fc05c2ad 100644 --- a/src/test/java/com/fishercoder/firstthousand/_99Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_99Test.java @@ -35,5 +35,4 @@ public void test2() { solution1.recoverTree(root); TreeUtils.printBinaryTree(root); } - } diff --git a/src/test/java/com/fishercoder/firstthousand/_9Test.java b/src/test/java/com/fishercoder/firstthousand/_9Test.java index 6dc1baae9b..2868e4279f 100644 --- a/src/test/java/com/fishercoder/firstthousand/_9Test.java +++ b/src/test/java/com/fishercoder/firstthousand/_9Test.java @@ -1,11 +1,11 @@ package com.fishercoder.firstthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.firstthousand._9; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _9Test { private _9.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(false, solution1.isPalindrome(10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3004Test.java b/src/test/java/com/fishercoder/fourththousand/_3004Test.java index 47649d2d33..718e9576ef 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3004Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3004Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3004; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3004Test { private _3004.Solution1 solution1; @@ -16,36 +16,36 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.maximumSubtreeSize(new int[][]{ - {0, 1}, {0, 2}, {0, 3} - }, new int[]{1, 1, 2, 3})); + assertEquals( + 1, + solution1.maximumSubtreeSize( + new int[][] {{0, 1}, {0, 2}, {0, 3}}, new int[] {1, 1, 2, 3})); } @Test public void test2() { - assertEquals(4, solution1.maximumSubtreeSize(new int[][]{ - {0, 1}, {0, 2}, {0, 3} - }, new int[]{1, 1, 1, 1})); + assertEquals( + 4, + solution1.maximumSubtreeSize( + new int[][] {{0, 1}, {0, 2}, {0, 3}}, new int[] {1, 1, 1, 1})); } @Test public void test3() { - assertEquals(3, solution1.maximumSubtreeSize(new int[][]{ - {0, 1}, {0, 2}, {2, 3}, {2, 4} - }, new int[]{1, 2, 3, 3, 3})); + assertEquals( + 3, + solution1.maximumSubtreeSize( + new int[][] {{0, 1}, {0, 2}, {2, 3}, {2, 4}}, new int[] {1, 2, 3, 3, 3})); } @Test public void test4() { - assertEquals(1, solution1.maximumSubtreeSize(new int[][]{ - {} - }, new int[]{1})); + assertEquals(1, solution1.maximumSubtreeSize(new int[][] {{}}, new int[] {1})); } @Test public void test5() { - assertEquals(1, solution1.maximumSubtreeSize(new int[][]{ - {0, 1}, {1, 2} - }, new int[]{1, 1, 2})); + assertEquals( + 1, solution1.maximumSubtreeSize(new int[][] {{0, 1}, {1, 2}}, new int[] {1, 1, 2})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3006Test.java b/src/test/java/com/fishercoder/fourththousand/_3006Test.java index b2e18b42f1..172e39831c 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3006Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3006Test.java @@ -1,13 +1,12 @@ package com.fishercoder.fourththousand; -import com.fishercoder.solutions.fourththousand._3006; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.fourththousand._3006; import java.util.ArrayList; import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _3006Test { private _3006.Solution1 solution1; @@ -19,17 +18,21 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(16, 33), solution1.beautifulIndices("isawsquirrelnearmysquirrelhouseohmy", "my", "squirrel", 15)); + assertEquals( + Arrays.asList(16, 33), + solution1.beautifulIndices( + "isawsquirrelnearmysquirrelhouseohmy", "my", "squirrel", 15)); } @Test public void test2() { - assertEquals(new ArrayList<>(Arrays.asList(0)), solution1.beautifulIndices("bavgoc", "ba", "c", 6)); + assertEquals( + new ArrayList<>(Arrays.asList(0)), + solution1.beautifulIndices("bavgoc", "ba", "c", 6)); } @Test public void test3() { assertEquals(Arrays.asList(), solution1.beautifulIndices("lrtsi", "lrts", "i", 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3016Test.java b/src/test/java/com/fishercoder/fourththousand/_3016Test.java index 3f97e204d7..22d13bd3d7 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3016Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3016Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3016; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3016Test { private _3016.Solution1 solution1; @@ -18,4 +18,4 @@ public void setup() { public void test1() { assertEquals(24, solution1.minimumPushes("aabbccddeeffgghhiiiiii")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3038Test.java b/src/test/java/com/fishercoder/fourththousand/_3038Test.java index 7abbb87be5..ee20962723 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3038Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3038Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3038; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3038Test { private _3038.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 2, 3, 2, 4, 2, 3, 3, 1, 3}; + nums = new int[] {2, 2, 3, 2, 4, 2, 3, 3, 1, 3}; assertEquals(1, solution1.maxOperations(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3074Test.java b/src/test/java/com/fishercoder/fourththousand/_3074Test.java index f8597d3ead..2dc7bbfe32 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3074Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3074Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3074; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3074Test { private _3074.Solution1 solution1; private static int[] apple; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - apple = new int[]{1, 3, 2}; - capacity = new int[]{4, 3, 1, 5, 2}; + apple = new int[] {1, 3, 2}; + capacity = new int[] {4, 3, 1, 5, 2}; assertEquals(2, solution1.minimumBoxes(apple, capacity)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3079Test.java b/src/test/java/com/fishercoder/fourththousand/_3079Test.java index 536f875489..afd62fb9d0 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3079Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3079Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3079; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3079Test { private _3079.Solution1 solution1; @@ -16,11 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.sumOfEncryptedInt(new int[]{1, 2, 3})); + assertEquals(6, solution1.sumOfEncryptedInt(new int[] {1, 2, 3})); } @Test public void test2() { - assertEquals(66, solution1.sumOfEncryptedInt(new int[]{10, 21, 31})); + assertEquals(66, solution1.sumOfEncryptedInt(new int[] {10, 21, 31})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3083Test.java b/src/test/java/com/fishercoder/fourththousand/_3083Test.java index f9b2f49aea..0422d843a6 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3083Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3083Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.fourththousand._3083; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _3083Test { private _3083.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertTrue(solution1.isSubstringPresent("leetcode")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3090Test.java b/src/test/java/com/fishercoder/fourththousand/_3090Test.java index 4b6beb2323..bd4a61f720 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3090Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3090Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3090; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3090Test { private _3090.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(4, solution1.maximumLengthSubstring("bcbbbcba")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3095Test.java b/src/test/java/com/fishercoder/fourththousand/_3095Test.java index eb2c3a61ee..808bb594a3 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3095Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3095Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3095; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3095Test { private _3095.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minimumSubarrayLength(new int[]{2, 1, 8}, 10)); + assertEquals(3, solution1.minimumSubarrayLength(new int[] {2, 1, 8}, 10)); } @Test public void test2() { - assertEquals(-1, solution1.minimumSubarrayLength(new int[]{1, 12, 2, 5}, 43)); + assertEquals(-1, solution1.minimumSubarrayLength(new int[] {1, 12, 2, 5}, 43)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3112Test.java b/src/test/java/com/fishercoder/fourththousand/_3112Test.java index fa820b68de..972f379417 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3112Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3112Test.java @@ -1,12 +1,12 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.fourththousand._3112; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _3112Test { private _3112.Solution1 solution1; @@ -17,9 +17,12 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{0, -1, 4}, solution1 - .minimumTime(3, CommonUtils - .convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1,2],[1,2,1],[0,2,4]"), - new int[]{1, 1, 5})); + assertArrayEquals( + new int[] {0, -1, 4}, + solution1.minimumTime( + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1,2],[1,2,1],[0,2,4]"), + new int[] {1, 1, 5})); } } diff --git a/src/test/java/com/fishercoder/fourththousand/_3142Test.java b/src/test/java/com/fishercoder/fourththousand/_3142Test.java index cabd98ea74..a81afa7c77 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3142Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3142Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3142; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3142Test { private _3142.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(false, solution1.satisfiesConditions(new int[][]{{1}, {2}, {3}})); + assertEquals(false, solution1.satisfiesConditions(new int[][] {{1}, {2}, {3}})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3175Test.java b/src/test/java/com/fishercoder/fourththousand/_3175Test.java index 6c2bfc6f07..90d21243d2 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3175Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3175Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3175; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3175Test { private _3175.Solution1 solution1; private static int[] skills; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - skills = new int[]{16, 4, 7, 17}; + skills = new int[] {16, 4, 7, 17}; k = 562084119; assertEquals(3, solution1.findWinningPlayer(skills, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3178Test.java b/src/test/java/com/fishercoder/fourththousand/_3178Test.java index 1d0d472dbc..c394f9ebb0 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3178Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3178Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3178; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3178Test { private _3178.Solution1 solution1; private _3178.Solution2 solution2; @@ -31,5 +31,4 @@ public void test2() { public void test3() { assertEquals(2, solution1.numberOfChild(4, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3185Test.java b/src/test/java/com/fishercoder/fourththousand/_3185Test.java index 391af9e267..8f0954558c 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3185Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3185Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3185; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3185Test { private _3185.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.countCompleteDayPairs(new int[]{12, 12, 30, 24, 24})); + assertEquals(2, solution1.countCompleteDayPairs(new int[] {12, 12, 30, 24, 24})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3186Test.java b/src/test/java/com/fishercoder/fourththousand/_3186Test.java index 64e2f887ea..649d3c2211 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3186Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3186Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3186; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3186Test { private _3186.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.maximumTotalDamage(new int[]{1, 1, 3, 4})); + assertEquals(6, solution1.maximumTotalDamage(new int[] {1, 1, 3, 4})); } @Test public void test2() { - assertEquals(31, solution1.maximumTotalDamage(new int[]{5, 9, 2, 10, 2, 7, 10, 9, 3, 8})); + assertEquals(31, solution1.maximumTotalDamage(new int[] {5, 9, 2, 10, 2, 7, 10, 9, 3, 8})); } @Test public void test3() { - assertEquals(10, solution1.maximumTotalDamage(new int[]{7, 1, 6, 3})); + assertEquals(10, solution1.maximumTotalDamage(new int[] {7, 1, 6, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3189Test.java b/src/test/java/com/fishercoder/fourththousand/_3189Test.java index 8593286c7c..68cab6b9d9 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3189Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3189Test.java @@ -1,12 +1,12 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.fourththousand._3189; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3189Test { private _3189.Solution1 solution1; @@ -17,15 +17,15 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minMoves(new int[][]{ - {0, 0}, {1, 0}, {1, 1} - })); + assertEquals(3, solution1.minMoves(new int[][] {{0, 0}, {1, 0}, {1, 1}})); } @Test public void test2() { - assertEquals(6, solution1.minMoves(CommonUtils - .convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0],[0,1],[0,2],[0,3]"))); + assertEquals( + 6, + solution1.minMoves( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0],[0,1],[0,2],[0,3]"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3191Test.java b/src/test/java/com/fishercoder/fourththousand/_3191Test.java index 9e97747ee2..1f876db9da 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3191Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3191Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3191; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3191Test { private _3191.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minOperations(new int[]{0, 1, 1, 1, 0, 0})); + assertEquals(3, solution1.minOperations(new int[] {0, 1, 1, 1, 0, 0})); } @Test public void test2() { - assertEquals(-1, solution1.minOperations(new int[]{0, 1, 1, 1})); + assertEquals(-1, solution1.minOperations(new int[] {0, 1, 1, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3192Test.java b/src/test/java/com/fishercoder/fourththousand/_3192Test.java index 421382f4ce..e6d3ac43c2 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3192Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3192Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3192; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3192Test { private _3192.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.minOperations(new int[]{0, 1, 1, 0, 1})); + assertEquals(4, solution1.minOperations(new int[] {0, 1, 1, 0, 1})); } @Test public void test2() { - assertEquals(1, solution1.minOperations(new int[]{1, 0, 0, 0})); + assertEquals(1, solution1.minOperations(new int[] {1, 0, 0, 0})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3196Test.java b/src/test/java/com/fishercoder/fourththousand/_3196Test.java index 98e33d7b89..852ec9f0bb 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3196Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3196Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3196; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3196Test { private _3196.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(10, solution1.maximumTotalCost(new int[]{1, -2, 3, 4})); + assertEquals(10, solution1.maximumTotalCost(new int[] {1, -2, 3, 4})); } @Test public void test2() { - assertEquals(-7, solution1.maximumTotalCost(new int[]{-14, -13, -20})); + assertEquals(-7, solution1.maximumTotalCost(new int[] {-14, -13, -20})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3199Test.java b/src/test/java/com/fishercoder/fourththousand/_3199Test.java index 041905b694..8d5a768215 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3199Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3199Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3199; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3199Test { private _3199.Solution1 solution1; @@ -16,17 +16,20 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.tripletCount(new int[]{1}, new int[]{2}, new int[]{3})); + assertEquals(1, solution1.tripletCount(new int[] {1}, new int[] {2}, new int[] {3})); } @Test public void test2() { - assertEquals(4, solution1.tripletCount(new int[]{1, 1}, new int[]{2, 3}, new int[]{1, 5})); + assertEquals( + 4, solution1.tripletCount(new int[] {1, 1}, new int[] {2, 3}, new int[] {1, 5})); } @Test public void test3() { - assertEquals(9, solution1.tripletCount(new int[]{0, 6, 0}, new int[]{8, 8, 4}, new int[]{6, 9, 2})); + assertEquals( + 9, + solution1.tripletCount( + new int[] {0, 6, 0}, new int[] {8, 8, 4}, new int[] {6, 9, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3208Test.java b/src/test/java/com/fishercoder/fourththousand/_3208Test.java index e7e6509d2f..db507e665a 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3208Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3208Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3208; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3208Test { private _3208.Solution1 solution1; @@ -16,22 +16,21 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numberOfAlternatingGroups(new int[]{0, 1, 0, 1, 0}, 3)); + assertEquals(3, solution1.numberOfAlternatingGroups(new int[] {0, 1, 0, 1, 0}, 3)); } @Test public void test2() { - assertEquals(2, solution1.numberOfAlternatingGroups(new int[]{0, 1, 0, 0, 1, 0, 1}, 6)); + assertEquals(2, solution1.numberOfAlternatingGroups(new int[] {0, 1, 0, 0, 1, 0, 1}, 6)); } @Test public void test3() { - assertEquals(0, solution1.numberOfAlternatingGroups(new int[]{1, 1, 0, 1}, 4)); + assertEquals(0, solution1.numberOfAlternatingGroups(new int[] {1, 1, 0, 1}, 4)); } @Test public void test4() { - assertEquals(4, solution1.numberOfAlternatingGroups(new int[]{0, 1, 0, 1}, 3)); + assertEquals(4, solution1.numberOfAlternatingGroups(new int[] {0, 1, 0, 1}, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3223Test.java b/src/test/java/com/fishercoder/fourththousand/_3223Test.java index fc070436b9..10998b2da1 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3223Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3223Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3223; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3223Test { private _3223.Solution1 solution1; @@ -16,6 +16,9 @@ public void setup() { @Test public void test1() { - assertEquals(38, solution1.minimumLength("ucvbutgkohgbcobqeyqwppbxqoynxeuuzouyvmydfhrprdbuzwqebwuiejoxsxdhbmuaiscalnteocghnlisxxawxgcjloevrdcj")); + assertEquals( + 38, + solution1.minimumLength( + "ucvbutgkohgbcobqeyqwppbxqoynxeuuzouyvmydfhrprdbuzwqebwuiejoxsxdhbmuaiscalnteocghnlisxxawxgcjloevrdcj")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3224Test.java b/src/test/java/com/fishercoder/fourththousand/_3224Test.java index 1e10cc4696..8207daa4da 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3224Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3224Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3224; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3224Test { private _3224.Solution1 solution1; @@ -14,24 +14,30 @@ public void setup() { solution1 = new _3224.Solution1(); } - @Test public void test1() { - assertEquals(2, solution1.minChanges(new int[]{1, 0, 1, 2, 4, 3}, 4)); + assertEquals(2, solution1.minChanges(new int[] {1, 0, 1, 2, 4, 3}, 4)); } @Test public void test2() { - assertEquals(2, solution1.minChanges(new int[]{18, 10, 14, 18, 17, 2, 11, 5}, 19)); + assertEquals(2, solution1.minChanges(new int[] {18, 10, 14, 18, 17, 2, 11, 5}, 19)); } @Test public void test3() { - assertEquals(4, solution1.minChanges(new int[]{9, 2, 7, 7, 8, 9, 1, 5, 1, 9, 4, 9, 4, 7}, 9)); + assertEquals( + 4, solution1.minChanges(new int[] {9, 2, 7, 7, 8, 9, 1, 5, 1, 9, 4, 9, 4, 7}, 9)); } @Test public void test4() { - assertEquals(7, solution1.minChanges(new int[]{1, 1, 1, 1, 0, 0, 0, 5, 4, 3, 19, 17, 16, 15, 15, 15, 19, 19, 19, 19}, 20)); + assertEquals( + 7, + solution1.minChanges( + new int[] { + 1, 1, 1, 1, 0, 0, 0, 5, 4, 3, 19, 17, 16, 15, 15, 15, 19, 19, 19, 19 + }, + 20)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3226Test.java b/src/test/java/com/fishercoder/fourththousand/_3226Test.java index c9ea13abca..c78f793e04 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3226Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3226Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3226; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3226Test { private _3226.Solution1 solution1; @@ -28,4 +28,4 @@ public void test2() { public void test3() { assertEquals(-1, solution1.minChanges(2, 47)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3228Test.java b/src/test/java/com/fishercoder/fourththousand/_3228Test.java index e28d83512b..f264774dfa 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3228Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3228Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3228; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3228Test { private _3228.Solution1 solution1; @@ -48,4 +48,4 @@ public void test6() { public void test7() { assertEquals(4, solution1.maxOperations("0101100000")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3233Test.java b/src/test/java/com/fishercoder/fourththousand/_3233Test.java index b1b7846bb0..326b27c05c 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3233Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3233Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3233; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3233Test { private _3233.Solution1 solution1; @@ -53,5 +53,4 @@ public void test7() { public void test8() { assertEquals(433, solution1.nonSpecialCount(1, 441)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3234Test.java b/src/test/java/com/fishercoder/fourththousand/_3234Test.java index a2501cbc76..f01b253965 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3234Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3234Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3234; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3234Test { private _3234.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(5, solution1.numberOfSubstrings("00011")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3237Test.java b/src/test/java/com/fishercoder/fourththousand/_3237Test.java index 6dcdbf6276..c4fdc7c7e1 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3237Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3237Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.fourththousand._3237; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _3237Test { private _3237.Solution1 solution1; @@ -16,11 +16,15 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 3, 1}, solution1.simulationResult(new int[]{1, 2, 3}, new int[]{3, 3, 2})); + assertArrayEquals( + new int[] {2, 3, 1}, + solution1.simulationResult(new int[] {1, 2, 3}, new int[] {3, 3, 2})); } @Test public void test2() { - assertArrayEquals(new int[]{3, 1, 4, 2}, solution1.simulationResult(new int[]{1, 4, 2, 3}, new int[]{4, 1, 3})); + assertArrayEquals( + new int[] {3, 1, 4, 2}, + solution1.simulationResult(new int[] {1, 4, 2, 3}, new int[] {4, 1, 3})); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3240Test.java b/src/test/java/com/fishercoder/fourththousand/_3240Test.java index 1debc23ad2..4b80ebfa93 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3240Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3240Test.java @@ -1,12 +1,12 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.fourththousand._3240; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3240Test { private _3240.Solution1 solution1; @@ -17,7 +17,10 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minFlips(CommonUtils - .convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,0,0],[0,1,0],[0,0,1]"))); + assertEquals( + 3, + solution1.minFlips( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,0,0],[0,1,0],[0,0,1]"))); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3241Test.java b/src/test/java/com/fishercoder/fourththousand/_3241Test.java index 31a6e82fef..fa47e54217 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3241Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3241Test.java @@ -1,12 +1,12 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.fourththousand._3241; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _3241Test { private _3241.Solution1 solution1; @@ -17,11 +17,59 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{4, 6, 3, 5, 5}, solution1.timeTaken(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,4],[0,1],[2,3],[0,2]"))); + assertArrayEquals( + new int[] {4, 6, 3, 5, 5}, + solution1.timeTaken( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,4],[0,1],[2,3],[0,2]"))); } @Test public void test2() { - assertArrayEquals(new int[]{21, 23, 21, 23, 24, 26, 24, 26, 26, 27, 23, 26, 25, 24, 27, 27, 25, 23, 24, 28, 23, 24, 25, 27, 23, 28, 26, 28, 26, 24, 27, 29, 28, 26, 28, 29, 26, 30, 29, 25, 23, 25, 27, 31, 25, 30, 30, 29, 23, 23, 25, 26, 23, 29, 32, 27, 30, 30, 28, 30, 31, 31, 27, 31, 24, 29, 30, 29, 24, 26, 25, 26, 28, 26, 27, 24, 32, 24, 27, 30, 27, 30, 23, 33, 25, 29, 27, 29, 27, 29, 27, 25, 34, 30, 27, 23, 24, 26, 26, 25, 30, 30, 27, 27, 26, 31, 30, 23, 25, 27, 26, 26, 29, 26, 31, 30, 33, 26, 25, 27, 30, 32, 32, 28, 29, 31, 34, 27, 27, 34, 30, 28, 25, 30, 32, 24, 34, 30, 29, 26, 31, 27, 28, 28, 26, 26, 25, 32, 29, 27, 25, 27, 28, 27, 31, 32, 34, 33, 26, 25, 33, 25, 29, 28, 29, 29, 27, 36, 31, 25, 24, 27, 28, 35, 34, 26, 33, 30, 25, 28, 31, 25, 32, 34, 35, 25, 36, 27, 28, 33, 27, 33, 24, 27, 25, 33, 28, 32, 29, 28, 35, 24, 33, 31, 27, 26, 25, 28, 33, 27, 37, 28, 32, 31, 31, 29, 28, 25, 29, 28, 36, 30, 31, 29, 29, 32, 29, 32, 26, 26, 34, 27, 24, 29, 28, 32, 25, 38, 33, 26, 38, 29, 29, 32, 33, 27, 27, 32, 28, 30, 27, 28, 32, 31, 27, 30, 27, 25, 31, 32, 31, 30, 31, 35, 26, 27, 27, 25, 31, 27, 30, 26, 28, 30, 26, 39, 33, 33, 26, 26, 33, 30, 31, 36, 27, 31, 33, 31, 26, 27, 31, 29, 27, 28, 31, 29, 34, 33, 34, 30, 31, 27, 39, 38, 29, 33, 24, 26, 28, 24, 32, 28, 31, 36, 27, 31, 29, 29, 30, 24, 31, 27, 29, 31, 30, 28, 34, 35, 31, 31, 37, 31, 32, 28, 27, 25, 24, 23, 28, 36, 24, 36, 33, 36, 32, 28, 27, 36, 29, 31, 33, 30, 31, 33, 33, 35, 31, 34, 28, 28, 34, 31, 33, 34, 28, 29, 27, 31, 29, 27, 33, 29, 25, 28, 29, 37, 34, 29, 31, 28, 30, 38, 35, 27, 26, 34, 37, 27, 33, 39, 29, 40, 30, 33, 29, 28, 29, 29, 30, 29, 31, 35, 30, 23, 35, 28, 28, 26, 25, 31, 30, 30, 26, 27, 33, 28, 28, 29, 30, 32, 28, 36, 31, 31, 26, 35, 32, 27, 29, 39, 32, 34, 36, 28, 27, 32, 29, 33, 36, 30, 25, 25, 27, 31, 31, 32, 34, 32, 36, 27, 26, 30, 28, 31, 27, 31, 35, 32, 33, 26, 32, 30, 25, 33, 31, 28, 35, 32, 27, 32, 27, 32, 37, 30, 28, 26, 28, 29, 31, 29, 34, 33, 26, 25, 29, 29, 27, 31, 28, 31, 35, 32, 28, 29, 26, 31, 30, 39, 23, 28, 30, 33, 30, 24, 32, 34, 34, 34, 27, 26, 31, 31, 25, 26, 30, 30, 36, 30, 34, 26, 29, 34, 28, 28, 32, 30, 28, 31, 31, 32, 26, 31, 26, 29, 29, 35, 32, 29, 26, 29, 34, 28, 24, 34, 29, 26, 30, 30, 35, 34, 28, 30, 25, 30, 31, 31, 33, 27, 30, 30, 33, 30, 36, 31, 31, 29, 29, 34, 32, 33, 28, 35, 32, 28, 28, 30, 29, 34, 36, 31, 38, 32, 35, 36, 30, 29, 30, 31, 30, 27, 28, 29, 27, 31, 27, 31, 25, 33, 33, 31, 27, 29, 32, 32, 29, 25, 30, 34, 35, 31, 33, 35, 33, 26, 25, 30, 26, 34, 40, 29, 25, 27, 32, 32, 36, 37, 32, 31, 31, 27, 37, 35, 35, 31, 30, 29, 34, 27, 31, 37, 29, 27, 31, 28, 34, 31, 28, 31, 30, 37, 34, 32, 38, 31, 30, 33, 29, 37, 30, 28, 32, 34, 35, 31, 29, 23, 28, 26, 32, 35, 31, 28, 32, 29, 30, 30, 35, 40, 35, 36, 32, 26, 36, 32, 30, 24, 30, 31, 27, 38, 30, 27, 29, 35, 36, 34, 32, 30, 28, 32, 27, 27, 26, 35, 35, 29, 33, 31, 28, 32, 32, 25, 27, 27, 31, 31, 28, 29, 36, 30, 28, 30, 29, 32, 32, 33, 30, 33, 37, 38, 28, 30, 32, 34, 29, 30, 27, 26, 25, 36, 27, 31, 29, 30, 28, 32, 30, 34, 37, 25, 28, 30, 27, 37, 27, 29, 24, 33, 31, 27, 35, 29, 40, 32}, solution1.timeTaken(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[159,24],[446,195],[38,14],[36,6],[222,93],[427,50],[604,292],[667,181],[197,66],[247,43],[175,91],[738,503],[251,15],[639,184],[262,79],[535,176],[162,94],[310,106],[445,398],[55,11],[318,65],[516,174],[223,74],[539,74],[624,326],[151,22],[509,39],[383,117],[363,297],[690,590],[452,28],[694,92],[188,28],[41,24],[579,575],[620,24],[725,140],[474,383],[5,4],[471,61],[365,25],[331,177],[640,508],[368,334],[469,423],[467,213],[68,3],[246,205],[214,112],[585,415],[100,34],[403,2],[633,37],[1,0],[629,50],[221,152],[695,54],[238,60],[512,40],[727,114],[420,289],[317,42],[37,31],[282,221],[686,89],[391,275],[105,37],[379,36],[174,122],[244,180],[502,397],[43,38],[500,172],[266,239],[352,57],[426,315],[572,398],[191,121],[483,319],[411,67],[461,31],[429,303],[423,162],[614,319],[437,214],[649,339],[270,89],[264,96],[361,112],[711,21],[739,703],[581,270],[556,155],[290,221],[612,147],[200,129],[393,114],[346,145],[115,32],[677,240],[71,4],[593,37],[325,26],[636,501],[179,15],[335,20],[601,284],[170,49],[204,69],[268,177],[651,410],[141,69],[717,211],[17,0],[249,89],[372,135],[510,461],[97,91],[599,517],[546,533],[133,53],[64,17],[360,134],[261,165],[652,375],[185,21],[643,321],[80,73],[733,626],[436,128],[202,147],[501,147],[330,184],[410,188],[327,244],[497,330],[656,434],[621,279],[158,6],[448,355],[631,612],[626,105],[257,13],[136,76],[718,174],[728,343],[54,43],[607,54],[395,8],[24,2],[373,209],[466,276],[333,151],[753,343],[178,24],[699,495],[648,585],[580,516],[91,48],[301,205],[550,127],[28,6],[83,60],[171,139],[529,487],[82,0],[465,321],[606,493],[687,124],[58,26],[544,433],[329,218],[72,26],[569,180],[737,68],[441,48],[534,292],[697,479],[413,117],[647,575],[710,584],[573,450],[577,460],[416,321],[732,687],[109,5],[189,121],[10,2],[48,2],[145,91],[504,63],[565,379],[491,418],[487,396],[16,13],[519,336],[683,329],[706,247],[531,93],[594,118],[459,161],[463,258],[618,275],[29,1],[563,261],[554,101],[653,561],[750,424],[207,55],[193,146],[138,74],[762,389],[315,101],[560,378],[381,186],[34,23],[507,54],[700,513],[302,237],[680,318],[722,594],[392,317],[488,28],[405,171],[272,158],[78,33],[67,19],[46,32],[583,446],[713,667],[47,14],[730,109],[576,94],[708,701],[693,617],[275,237],[107,0],[553,234],[157,114],[86,73],[271,267],[324,223],[482,185],[755,465],[460,453],[98,68],[578,298],[305,227],[322,74],[745,367],[172,158],[468,108],[595,525],[477,251],[253,221],[338,228],[194,21],[239,41],[183,83],[337,0],[503,337],[49,2],[528,124],[688,681],[545,68],[674,406],[558,377],[417,395],[490,362],[232,17],[386,313],[525,338],[50,29],[359,144],[350,227],[298,122],[51,4],[340,107],[527,299],[18,17],[664,359],[137,32],[388,260],[645,544],[21,1],[440,10],[740,229],[209,97],[366,229],[377,254],[334,12],[14,7],[723,61],[358,26],[409,351],[513,267],[142,110],[407,306],[349,316],[106,87],[94,73],[470,111],[40,2],[240,220],[353,262],[613,161],[242,25],[705,465],[757,300],[684,416],[715,81],[224,74],[380,65],[227,106],[591,90],[149,12],[744,494],[99,40],[284,7],[27,15],[655,638],[35,14],[586,295],[123,98],[742,256],[85,42],[12,10],[165,143],[456,116],[716,171],[116,60],[139,96],[760,706],[627,390],[367,351],[518,463],[743,492],[203,38],[498,2],[313,136],[536,213],[729,639],[375,283],[387,12],[752,117],[273,47],[419,105],[296,122],[511,436],[720,127],[356,81],[508,459],[147,63],[70,29],[486,84],[540,134],[23,11],[124,25],[492,109],[213,148],[390,190],[679,174],[592,139],[431,252],[182,46],[76,61],[254,44],[754,408],[523,301],[364,321],[153,16],[198,123],[286,214],[551,522],[102,12],[736,614],[120,67],[644,195],[161,135],[45,31],[548,507],[241,131],[278,257],[280,154],[567,481],[332,270],[279,6],[543,344],[682,376],[297,258],[382,276],[160,155],[533,345],[252,46],[168,57],[33,18],[394,62],[600,175],[245,117],[291,123],[678,370],[537,207],[662,202],[630,582],[31,27],[538,18],[205,64],[596,48],[685,107],[92,54],[761,736],[668,511],[231,113],[354,60],[433,15],[587,112],[89,30],[439,87],[698,171],[464,451],[444,133],[84,82],[616,335],[559,477],[378,351],[473,58],[235,105],[265,11],[228,169],[57,47],[721,34],[113,6],[114,93],[605,82],[166,11],[236,20],[692,334],[476,98],[432,156],[362,225],[495,115],[2,0],[568,318],[300,148],[707,224],[263,208],[701,175],[385,212],[564,368],[135,3],[619,256],[347,156],[637,146],[402,377],[530,257],[401,357],[293,269],[132,52],[499,28],[449,97],[526,15],[494,64],[309,107],[140,45],[196,9],[52,0],[260,45],[74,7],[304,246],[422,221],[541,384],[622,586],[326,157],[177,65],[164,88],[515,152],[44,40],[169,52],[125,112],[428,102],[646,9],[756,1],[443,322],[675,492],[371,204],[167,156],[13,3],[20,0],[308,231],[749,24],[597,447],[670,281],[243,130],[478,177],[7,6],[584,215],[234,23],[602,253],[219,104],[62,11],[4,3],[303,220],[735,570],[9,7],[186,156],[126,122],[19,9],[220,174],[634,291],[173,129],[520,94],[30,12],[557,407],[588,479],[299,31],[128,71],[480,252],[598,400],[672,546],[726,223],[22,20],[425,370],[342,243],[574,269],[181,13],[625,167],[481,444],[95,2],[289,51],[215,128],[104,68],[281,272],[127,71],[343,230],[163,55],[505,54],[638,322],[681,161],[712,97],[201,107],[561,142],[575,308],[39,20],[562,174],[724,46],[384,306],[657,343],[190,150],[493,345],[517,420],[719,34],[665,0],[152,151],[661,252],[134,105],[285,162],[288,6],[287,261],[450,96],[748,347],[187,132],[746,295],[348,74],[341,298],[714,664],[77,17],[216,119],[294,112],[611,342],[399,74],[184,116],[110,18],[63,45],[255,223],[571,244],[642,517],[111,99],[60,38],[650,344],[319,3],[430,120],[206,77],[454,146],[659,28],[357,305],[6,1],[320,81],[370,214],[566,90],[704,342],[696,361],[555,461],[458,457],[457,213],[61,59],[462,29],[609,198],[376,122],[259,105],[344,105],[156,54],[90,84],[485,284],[122,105],[666,530],[218,62],[230,195],[119,33],[11,4],[731,666],[603,527],[88,5],[339,230],[691,73],[396,293],[734,600],[484,251],[702,6],[42,5],[237,220],[69,4],[208,121],[336,3],[521,54],[8,6],[129,54],[121,100],[763,66],[398,34],[3,2],[408,29],[703,176],[277,225],[112,30],[146,20],[532,18],[590,109],[87,74],[397,88],[154,124],[195,154],[522,289],[199,119],[226,86],[15,5],[211,110],[496,241],[658,493],[258,242],[758,575],[210,200],[628,553],[615,377],[225,56],[323,304],[73,64],[56,34],[673,334],[314,5],[144,4],[438,296],[248,187],[617,536],[274,39],[267,75],[311,289],[747,310],[96,95],[751,705],[689,186],[180,59],[176,154],[475,232],[316,293],[447,253],[65,30],[623,558],[81,72],[307,306],[75,1],[489,115],[66,31],[229,169],[663,374],[117,39],[547,291],[424,170],[150,77],[256,11],[524,489],[269,22],[741,281],[654,591],[118,77],[283,126],[276,168],[295,211],[131,15],[418,142],[25,9],[669,342],[412,181],[570,269],[155,100],[514,364],[292,16],[451,215],[321,145],[93,87],[355,202],[709,527],[130,47],[506,426],[415,8],[59,32],[389,210],[250,44],[328,148],[143,36],[312,304],[404,238],[552,498],[435,409],[103,44],[759,139],[212,106],[53,25],[148,131],[192,17],[660,558],[400,81],[610,528],[217,40],[635,334],[479,325],[306,107],[582,521],[589,113],[542,49],[608,276],[406,321],[641,118],[108,77],[79,47],[101,31],[26,6],[549,305],[632,607],[421,298],[32,15],[472,456],[453,59],[345,187],[374,284],[233,166],[414,225],[671,629],[351,165],[676,431],[455,218],[434,97],[442,69],[369,175]"))); + assertArrayEquals( + new int[] { + 21, 23, 21, 23, 24, 26, 24, 26, 26, 27, 23, 26, 25, 24, 27, 27, 25, 23, 24, 28, + 23, 24, 25, 27, 23, 28, 26, 28, 26, 24, 27, 29, 28, 26, 28, 29, 26, 30, 29, 25, + 23, 25, 27, 31, 25, 30, 30, 29, 23, 23, 25, 26, 23, 29, 32, 27, 30, 30, 28, 30, + 31, 31, 27, 31, 24, 29, 30, 29, 24, 26, 25, 26, 28, 26, 27, 24, 32, 24, 27, 30, + 27, 30, 23, 33, 25, 29, 27, 29, 27, 29, 27, 25, 34, 30, 27, 23, 24, 26, 26, 25, + 30, 30, 27, 27, 26, 31, 30, 23, 25, 27, 26, 26, 29, 26, 31, 30, 33, 26, 25, 27, + 30, 32, 32, 28, 29, 31, 34, 27, 27, 34, 30, 28, 25, 30, 32, 24, 34, 30, 29, 26, + 31, 27, 28, 28, 26, 26, 25, 32, 29, 27, 25, 27, 28, 27, 31, 32, 34, 33, 26, 25, + 33, 25, 29, 28, 29, 29, 27, 36, 31, 25, 24, 27, 28, 35, 34, 26, 33, 30, 25, 28, + 31, 25, 32, 34, 35, 25, 36, 27, 28, 33, 27, 33, 24, 27, 25, 33, 28, 32, 29, 28, + 35, 24, 33, 31, 27, 26, 25, 28, 33, 27, 37, 28, 32, 31, 31, 29, 28, 25, 29, 28, + 36, 30, 31, 29, 29, 32, 29, 32, 26, 26, 34, 27, 24, 29, 28, 32, 25, 38, 33, 26, + 38, 29, 29, 32, 33, 27, 27, 32, 28, 30, 27, 28, 32, 31, 27, 30, 27, 25, 31, 32, + 31, 30, 31, 35, 26, 27, 27, 25, 31, 27, 30, 26, 28, 30, 26, 39, 33, 33, 26, 26, + 33, 30, 31, 36, 27, 31, 33, 31, 26, 27, 31, 29, 27, 28, 31, 29, 34, 33, 34, 30, + 31, 27, 39, 38, 29, 33, 24, 26, 28, 24, 32, 28, 31, 36, 27, 31, 29, 29, 30, 24, + 31, 27, 29, 31, 30, 28, 34, 35, 31, 31, 37, 31, 32, 28, 27, 25, 24, 23, 28, 36, + 24, 36, 33, 36, 32, 28, 27, 36, 29, 31, 33, 30, 31, 33, 33, 35, 31, 34, 28, 28, + 34, 31, 33, 34, 28, 29, 27, 31, 29, 27, 33, 29, 25, 28, 29, 37, 34, 29, 31, 28, + 30, 38, 35, 27, 26, 34, 37, 27, 33, 39, 29, 40, 30, 33, 29, 28, 29, 29, 30, 29, + 31, 35, 30, 23, 35, 28, 28, 26, 25, 31, 30, 30, 26, 27, 33, 28, 28, 29, 30, 32, + 28, 36, 31, 31, 26, 35, 32, 27, 29, 39, 32, 34, 36, 28, 27, 32, 29, 33, 36, 30, + 25, 25, 27, 31, 31, 32, 34, 32, 36, 27, 26, 30, 28, 31, 27, 31, 35, 32, 33, 26, + 32, 30, 25, 33, 31, 28, 35, 32, 27, 32, 27, 32, 37, 30, 28, 26, 28, 29, 31, 29, + 34, 33, 26, 25, 29, 29, 27, 31, 28, 31, 35, 32, 28, 29, 26, 31, 30, 39, 23, 28, + 30, 33, 30, 24, 32, 34, 34, 34, 27, 26, 31, 31, 25, 26, 30, 30, 36, 30, 34, 26, + 29, 34, 28, 28, 32, 30, 28, 31, 31, 32, 26, 31, 26, 29, 29, 35, 32, 29, 26, 29, + 34, 28, 24, 34, 29, 26, 30, 30, 35, 34, 28, 30, 25, 30, 31, 31, 33, 27, 30, 30, + 33, 30, 36, 31, 31, 29, 29, 34, 32, 33, 28, 35, 32, 28, 28, 30, 29, 34, 36, 31, + 38, 32, 35, 36, 30, 29, 30, 31, 30, 27, 28, 29, 27, 31, 27, 31, 25, 33, 33, 31, + 27, 29, 32, 32, 29, 25, 30, 34, 35, 31, 33, 35, 33, 26, 25, 30, 26, 34, 40, 29, + 25, 27, 32, 32, 36, 37, 32, 31, 31, 27, 37, 35, 35, 31, 30, 29, 34, 27, 31, 37, + 29, 27, 31, 28, 34, 31, 28, 31, 30, 37, 34, 32, 38, 31, 30, 33, 29, 37, 30, 28, + 32, 34, 35, 31, 29, 23, 28, 26, 32, 35, 31, 28, 32, 29, 30, 30, 35, 40, 35, 36, + 32, 26, 36, 32, 30, 24, 30, 31, 27, 38, 30, 27, 29, 35, 36, 34, 32, 30, 28, 32, + 27, 27, 26, 35, 35, 29, 33, 31, 28, 32, 32, 25, 27, 27, 31, 31, 28, 29, 36, 30, + 28, 30, 29, 32, 32, 33, 30, 33, 37, 38, 28, 30, 32, 34, 29, 30, 27, 26, 25, 36, + 27, 31, 29, 30, 28, 32, 30, 34, 37, 25, 28, 30, 27, 37, 27, 29, 24, 33, 31, 27, + 35, 29, 40, 32 + }, + solution1.timeTaken( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[159,24],[446,195],[38,14],[36,6],[222,93],[427,50],[604,292],[667,181],[197,66],[247,43],[175,91],[738,503],[251,15],[639,184],[262,79],[535,176],[162,94],[310,106],[445,398],[55,11],[318,65],[516,174],[223,74],[539,74],[624,326],[151,22],[509,39],[383,117],[363,297],[690,590],[452,28],[694,92],[188,28],[41,24],[579,575],[620,24],[725,140],[474,383],[5,4],[471,61],[365,25],[331,177],[640,508],[368,334],[469,423],[467,213],[68,3],[246,205],[214,112],[585,415],[100,34],[403,2],[633,37],[1,0],[629,50],[221,152],[695,54],[238,60],[512,40],[727,114],[420,289],[317,42],[37,31],[282,221],[686,89],[391,275],[105,37],[379,36],[174,122],[244,180],[502,397],[43,38],[500,172],[266,239],[352,57],[426,315],[572,398],[191,121],[483,319],[411,67],[461,31],[429,303],[423,162],[614,319],[437,214],[649,339],[270,89],[264,96],[361,112],[711,21],[739,703],[581,270],[556,155],[290,221],[612,147],[200,129],[393,114],[346,145],[115,32],[677,240],[71,4],[593,37],[325,26],[636,501],[179,15],[335,20],[601,284],[170,49],[204,69],[268,177],[651,410],[141,69],[717,211],[17,0],[249,89],[372,135],[510,461],[97,91],[599,517],[546,533],[133,53],[64,17],[360,134],[261,165],[652,375],[185,21],[643,321],[80,73],[733,626],[436,128],[202,147],[501,147],[330,184],[410,188],[327,244],[497,330],[656,434],[621,279],[158,6],[448,355],[631,612],[626,105],[257,13],[136,76],[718,174],[728,343],[54,43],[607,54],[395,8],[24,2],[373,209],[466,276],[333,151],[753,343],[178,24],[699,495],[648,585],[580,516],[91,48],[301,205],[550,127],[28,6],[83,60],[171,139],[529,487],[82,0],[465,321],[606,493],[687,124],[58,26],[544,433],[329,218],[72,26],[569,180],[737,68],[441,48],[534,292],[697,479],[413,117],[647,575],[710,584],[573,450],[577,460],[416,321],[732,687],[109,5],[189,121],[10,2],[48,2],[145,91],[504,63],[565,379],[491,418],[487,396],[16,13],[519,336],[683,329],[706,247],[531,93],[594,118],[459,161],[463,258],[618,275],[29,1],[563,261],[554,101],[653,561],[750,424],[207,55],[193,146],[138,74],[762,389],[315,101],[560,378],[381,186],[34,23],[507,54],[700,513],[302,237],[680,318],[722,594],[392,317],[488,28],[405,171],[272,158],[78,33],[67,19],[46,32],[583,446],[713,667],[47,14],[730,109],[576,94],[708,701],[693,617],[275,237],[107,0],[553,234],[157,114],[86,73],[271,267],[324,223],[482,185],[755,465],[460,453],[98,68],[578,298],[305,227],[322,74],[745,367],[172,158],[468,108],[595,525],[477,251],[253,221],[338,228],[194,21],[239,41],[183,83],[337,0],[503,337],[49,2],[528,124],[688,681],[545,68],[674,406],[558,377],[417,395],[490,362],[232,17],[386,313],[525,338],[50,29],[359,144],[350,227],[298,122],[51,4],[340,107],[527,299],[18,17],[664,359],[137,32],[388,260],[645,544],[21,1],[440,10],[740,229],[209,97],[366,229],[377,254],[334,12],[14,7],[723,61],[358,26],[409,351],[513,267],[142,110],[407,306],[349,316],[106,87],[94,73],[470,111],[40,2],[240,220],[353,262],[613,161],[242,25],[705,465],[757,300],[684,416],[715,81],[224,74],[380,65],[227,106],[591,90],[149,12],[744,494],[99,40],[284,7],[27,15],[655,638],[35,14],[586,295],[123,98],[742,256],[85,42],[12,10],[165,143],[456,116],[716,171],[116,60],[139,96],[760,706],[627,390],[367,351],[518,463],[743,492],[203,38],[498,2],[313,136],[536,213],[729,639],[375,283],[387,12],[752,117],[273,47],[419,105],[296,122],[511,436],[720,127],[356,81],[508,459],[147,63],[70,29],[486,84],[540,134],[23,11],[124,25],[492,109],[213,148],[390,190],[679,174],[592,139],[431,252],[182,46],[76,61],[254,44],[754,408],[523,301],[364,321],[153,16],[198,123],[286,214],[551,522],[102,12],[736,614],[120,67],[644,195],[161,135],[45,31],[548,507],[241,131],[278,257],[280,154],[567,481],[332,270],[279,6],[543,344],[682,376],[297,258],[382,276],[160,155],[533,345],[252,46],[168,57],[33,18],[394,62],[600,175],[245,117],[291,123],[678,370],[537,207],[662,202],[630,582],[31,27],[538,18],[205,64],[596,48],[685,107],[92,54],[761,736],[668,511],[231,113],[354,60],[433,15],[587,112],[89,30],[439,87],[698,171],[464,451],[444,133],[84,82],[616,335],[559,477],[378,351],[473,58],[235,105],[265,11],[228,169],[57,47],[721,34],[113,6],[114,93],[605,82],[166,11],[236,20],[692,334],[476,98],[432,156],[362,225],[495,115],[2,0],[568,318],[300,148],[707,224],[263,208],[701,175],[385,212],[564,368],[135,3],[619,256],[347,156],[637,146],[402,377],[530,257],[401,357],[293,269],[132,52],[499,28],[449,97],[526,15],[494,64],[309,107],[140,45],[196,9],[52,0],[260,45],[74,7],[304,246],[422,221],[541,384],[622,586],[326,157],[177,65],[164,88],[515,152],[44,40],[169,52],[125,112],[428,102],[646,9],[756,1],[443,322],[675,492],[371,204],[167,156],[13,3],[20,0],[308,231],[749,24],[597,447],[670,281],[243,130],[478,177],[7,6],[584,215],[234,23],[602,253],[219,104],[62,11],[4,3],[303,220],[735,570],[9,7],[186,156],[126,122],[19,9],[220,174],[634,291],[173,129],[520,94],[30,12],[557,407],[588,479],[299,31],[128,71],[480,252],[598,400],[672,546],[726,223],[22,20],[425,370],[342,243],[574,269],[181,13],[625,167],[481,444],[95,2],[289,51],[215,128],[104,68],[281,272],[127,71],[343,230],[163,55],[505,54],[638,322],[681,161],[712,97],[201,107],[561,142],[575,308],[39,20],[562,174],[724,46],[384,306],[657,343],[190,150],[493,345],[517,420],[719,34],[665,0],[152,151],[661,252],[134,105],[285,162],[288,6],[287,261],[450,96],[748,347],[187,132],[746,295],[348,74],[341,298],[714,664],[77,17],[216,119],[294,112],[611,342],[399,74],[184,116],[110,18],[63,45],[255,223],[571,244],[642,517],[111,99],[60,38],[650,344],[319,3],[430,120],[206,77],[454,146],[659,28],[357,305],[6,1],[320,81],[370,214],[566,90],[704,342],[696,361],[555,461],[458,457],[457,213],[61,59],[462,29],[609,198],[376,122],[259,105],[344,105],[156,54],[90,84],[485,284],[122,105],[666,530],[218,62],[230,195],[119,33],[11,4],[731,666],[603,527],[88,5],[339,230],[691,73],[396,293],[734,600],[484,251],[702,6],[42,5],[237,220],[69,4],[208,121],[336,3],[521,54],[8,6],[129,54],[121,100],[763,66],[398,34],[3,2],[408,29],[703,176],[277,225],[112,30],[146,20],[532,18],[590,109],[87,74],[397,88],[154,124],[195,154],[522,289],[199,119],[226,86],[15,5],[211,110],[496,241],[658,493],[258,242],[758,575],[210,200],[628,553],[615,377],[225,56],[323,304],[73,64],[56,34],[673,334],[314,5],[144,4],[438,296],[248,187],[617,536],[274,39],[267,75],[311,289],[747,310],[96,95],[751,705],[689,186],[180,59],[176,154],[475,232],[316,293],[447,253],[65,30],[623,558],[81,72],[307,306],[75,1],[489,115],[66,31],[229,169],[663,374],[117,39],[547,291],[424,170],[150,77],[256,11],[524,489],[269,22],[741,281],[654,591],[118,77],[283,126],[276,168],[295,211],[131,15],[418,142],[25,9],[669,342],[412,181],[570,269],[155,100],[514,364],[292,16],[451,215],[321,145],[93,87],[355,202],[709,527],[130,47],[506,426],[415,8],[59,32],[389,210],[250,44],[328,148],[143,36],[312,304],[404,238],[552,498],[435,409],[103,44],[759,139],[212,106],[53,25],[148,131],[192,17],[660,558],[400,81],[610,528],[217,40],[635,334],[479,325],[306,107],[582,521],[589,113],[542,49],[608,276],[406,321],[641,118],[108,77],[79,47],[101,31],[26,6],[549,305],[632,607],[421,298],[32,15],[472,456],[453,59],[345,187],[374,284],[233,166],[414,225],[671,629],[351,165],[676,431],[455,218],[434,97],[442,69],[369,175]"))); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3243Test.java b/src/test/java/com/fishercoder/fourththousand/_3243Test.java index c85ffcf516..e579faf676 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3243Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3243Test.java @@ -1,12 +1,12 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.fourththousand._3243; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _3243Test { private _3243.Solution1 solution1; @@ -17,7 +17,11 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{3, 2, 1}, solution1.shortestDistanceAfterQueries(5, - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,4],[0,2],[0,4]"))); + assertArrayEquals( + new int[] {3, 2, 1}, + solution1.shortestDistanceAfterQueries( + 5, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,4],[0,2],[0,4]"))); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/fourththousand/_3258Test.java b/src/test/java/com/fishercoder/fourththousand/_3258Test.java index 1b6bb771f7..456bd3a729 100644 --- a/src/test/java/com/fishercoder/fourththousand/_3258Test.java +++ b/src/test/java/com/fishercoder/fourththousand/_3258Test.java @@ -1,11 +1,11 @@ package com.fishercoder.fourththousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.fourththousand._3258; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _3258Test { private _3258.Solution1 solution1; @@ -23,4 +23,4 @@ public void test1() { public void test2() { assertEquals(25, solution1.countKConstraintSubstrings("1010101", 2)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1002Test.java b/src/test/java/com/fishercoder/secondthousand/_1002Test.java index f03bf2779f..8c97da80e1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1002Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1002Test.java @@ -16,13 +16,13 @@ public void setup() { @Test public void test1() { - A = new String[]{"bella", "label", "roller"}; + A = new String[] {"bella", "label", "roller"}; CommonUtils.print(solution1.commonChars(A)); } @Test public void test2() { - A = new String[]{"cool", "lock", "cook"}; + A = new String[] {"cool", "lock", "cook"}; CommonUtils.print(solution1.commonChars(A)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1003Test.java b/src/test/java/com/fishercoder/secondthousand/_1003Test.java index be5feb7eae..38aadeef3c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1003Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1003Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.secondthousand._1003; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _1003Test { private _1003.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1004Test.java b/src/test/java/com/fishercoder/secondthousand/_1004Test.java index 4d4d82e161..1f1908ba29 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1004Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1004Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1004; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1004Test { private _1004.Solution1 solution1; private static int[] A; @@ -17,7 +17,7 @@ public void setup() { @Test public void test1() { - A = new int[]{1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0}; + A = new int[] {1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0}; assertEquals(6, solution1.longestOnes(A, 2)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1005Test.java b/src/test/java/com/fishercoder/secondthousand/_1005Test.java index 157c54c770..c0a58c7af6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1005Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1005Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1005; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1005Test { private _1005.Solution1 solution1; private _1005.Solution2 solution2; @@ -18,25 +18,25 @@ public void setup() { @Test public void test1() { - assertEquals(5, solution1.largestSumAfterKNegations(new int[]{4, 2, 3}, 1)); - assertEquals(5, solution2.largestSumAfterKNegations(new int[]{4, 2, 3}, 1)); + assertEquals(5, solution1.largestSumAfterKNegations(new int[] {4, 2, 3}, 1)); + assertEquals(5, solution2.largestSumAfterKNegations(new int[] {4, 2, 3}, 1)); } @Test public void test2() { - assertEquals(6, solution1.largestSumAfterKNegations(new int[]{3, -1, 0, 2}, 3)); - assertEquals(6, solution2.largestSumAfterKNegations(new int[]{3, -1, 0, 2}, 3)); + assertEquals(6, solution1.largestSumAfterKNegations(new int[] {3, -1, 0, 2}, 3)); + assertEquals(6, solution2.largestSumAfterKNegations(new int[] {3, -1, 0, 2}, 3)); } @Test public void test3() { - assertEquals(13, solution1.largestSumAfterKNegations(new int[]{2, -3, -1, 5, -4}, 2)); - assertEquals(13, solution2.largestSumAfterKNegations(new int[]{2, -3, -1, 5, -4}, 2)); + assertEquals(13, solution1.largestSumAfterKNegations(new int[] {2, -3, -1, 5, -4}, 2)); + assertEquals(13, solution2.largestSumAfterKNegations(new int[] {2, -3, -1, 5, -4}, 2)); } @Test public void test4() { - assertEquals(22, solution1.largestSumAfterKNegations(new int[]{-8, 3, -5, -3, -5, -2}, 6)); - assertEquals(22, solution2.largestSumAfterKNegations(new int[]{-8, 3, -5, -3, -5, -2}, 6)); + assertEquals(22, solution1.largestSumAfterKNegations(new int[] {-8, 3, -5, -3, -5, -2}, 6)); + assertEquals(22, solution2.largestSumAfterKNegations(new int[] {-8, 3, -5, -3, -5, -2}, 6)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1008Test.java b/src/test/java/com/fishercoder/secondthousand/_1008Test.java index 377a152c87..706b05901e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1008Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1008Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1008; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1008Test { private _1008.Solution1 solution1; @@ -20,7 +19,7 @@ public class _1008Test { public void test1() { solution1 = new _1008.Solution1(); solution2 = new _1008.Solution2(); - preorder = new int[]{8, 5, 1, 7, 10, 12}; + preorder = new int[] {8, 5, 1, 7, 10, 12}; expected = TreeUtils.constructBinaryTree(Arrays.asList(8, 5, 10, 1, 7, null, 12)); TreeUtils.printBinaryTree(expected); actual = solution1.bstFromPreorder(preorder); @@ -30,5 +29,4 @@ public void test1() { TreeUtils.printBinaryTree(actual); assertEquals(expected, actual); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1009Test.java b/src/test/java/com/fishercoder/secondthousand/_1009Test.java index 89b9c6d2c3..31c93ec4db 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1009Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1009Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1009; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1009Test { private _1009.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(1, solution1.bitwiseComplement(0)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1010Test.java b/src/test/java/com/fishercoder/secondthousand/_1010Test.java index f630eb29d3..bdc6b6201b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1010Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1010Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1010; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1010Test { private _1010.Solution1 solution1; private _1010.Solution2 solution2; @@ -19,16 +19,15 @@ public void setup() { @Test public void test1() { - time = new int[]{30, 20, 150, 100, 40}; + time = new int[] {30, 20, 150, 100, 40}; assertEquals(3, solution1.numPairsDivisibleBy60(time)); assertEquals(3, solution2.numPairsDivisibleBy60(time)); } @Test public void test2() { - time = new int[]{60, 60, 60}; + time = new int[] {60, 60, 60}; assertEquals(3, solution1.numPairsDivisibleBy60(time)); assertEquals(3, solution2.numPairsDivisibleBy60(time)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1011Test.java b/src/test/java/com/fishercoder/secondthousand/_1011Test.java index ec0b1922a1..2bd00253cd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1011Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1011Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1011; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1011Test { private _1011.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1013Test.java b/src/test/java/com/fishercoder/secondthousand/_1013Test.java index 96189ff3d7..3a85d798db 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1013Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1013Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1013; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1013Test { private _1013.Solution1 solution1; @@ -16,17 +16,21 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.canThreePartsEqualSum(new int[]{0, 2, 1, -6, 6, -7, 9, 1, 2, 0, 1})); + assertEquals( + true, + solution1.canThreePartsEqualSum(new int[] {0, 2, 1, -6, 6, -7, 9, 1, 2, 0, 1})); } @Test public void test2() { - assertEquals(false, solution1.canThreePartsEqualSum(new int[]{0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1})); + assertEquals( + false, + solution1.canThreePartsEqualSum(new int[] {0, 2, 1, -6, 6, 7, 9, -1, 2, 0, 1})); } @Test public void test3() { - assertEquals(true, solution1.canThreePartsEqualSum(new int[]{3, 3, 6, 5, -2, 2, 5, 1, -9, 4})); + assertEquals( + true, solution1.canThreePartsEqualSum(new int[] {3, 3, 6, 5, -2, 2, 5, 1, -9, 4})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1014Test.java b/src/test/java/com/fishercoder/secondthousand/_1014Test.java index 7e497a73a9..93b27c09b3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1014Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1014Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1014; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1014Test { private _1014.Solution1 solution1; @@ -16,11 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(solution1.maxScoreSightseeingPair(new int[]{1, 3, 5}), 7); + assertEquals(solution1.maxScoreSightseeingPair(new int[] {1, 3, 5}), 7); } @Test public void test2() { - assertEquals(solution1.maxScoreSightseeingPair(new int[]{8, 1, 5, 2, 6}), 11); + assertEquals(solution1.maxScoreSightseeingPair(new int[] {8, 1, 5, 2, 6}), 11); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1018Test.java b/src/test/java/com/fishercoder/secondthousand/_1018Test.java index 1ebcc9599a..2b2fe86d82 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1018Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1018Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1018; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1018Test { private _1018.Solution1 solution1; private static int[] A; @@ -19,32 +18,42 @@ public void setup() { @Test public void test1() { - A = new int[]{0, 1, 1}; + A = new int[] {0, 1, 1}; assertEquals(Arrays.asList(true, false, false), solution1.prefixesDivBy5(A)); } @Test public void test2() { - A = new int[]{1, 1, 1}; + A = new int[] {1, 1, 1}; assertEquals(Arrays.asList(false, false, false), solution1.prefixesDivBy5(A)); } @Test public void test3() { - A = new int[]{0, 1, 1, 1, 1, 1}; - assertEquals(Arrays.asList(true, false, false, false, true, false), solution1.prefixesDivBy5(A)); + A = new int[] {0, 1, 1, 1, 1, 1}; + assertEquals( + Arrays.asList(true, false, false, false, true, false), solution1.prefixesDivBy5(A)); } @Test public void test4() { - A = new int[]{1, 1, 1, 0, 1}; + A = new int[] {1, 1, 1, 0, 1}; assertEquals(Arrays.asList(false, false, false, false, false), solution1.prefixesDivBy5(A)); } @Test public void test5() { - A = new int[]{1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1}; - assertEquals(Arrays.asList(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, true, true, true, true, false), solution1.prefixesDivBy5(A)); + A = + new int[] { + 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, + 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1 + }; + assertEquals( + Arrays.asList( + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, true, false, + false, true, true, true, true, false), + solution1.prefixesDivBy5(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1019Test.java b/src/test/java/com/fishercoder/secondthousand/_1019Test.java index fb17ec81d8..1f66955246 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1019Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1019Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1019; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1019Test { private _1019.Solution1 solution1; @@ -18,20 +18,19 @@ public void setup() { @Test public void test1() { - ListNode head = LinkedListUtils.contructLinkedList(new int[]{2, 1, 5}); - assertArrayEquals(new int[]{5, 5, 0}, solution1.nextLargerNodes(head)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {2, 1, 5}); + assertArrayEquals(new int[] {5, 5, 0}, solution1.nextLargerNodes(head)); } @Test public void test2() { - ListNode head = LinkedListUtils.contructLinkedList(new int[]{2, 7, 4, 3, 5}); - assertArrayEquals(new int[]{7, 0, 5, 5, 0}, solution1.nextLargerNodes(head)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {2, 7, 4, 3, 5}); + assertArrayEquals(new int[] {7, 0, 5, 5, 0}, solution1.nextLargerNodes(head)); } @Test public void test3() { - ListNode head = LinkedListUtils.contructLinkedList(new int[]{1, 7, 5, 1, 9, 2, 5, 1}); - assertArrayEquals(new int[]{7, 9, 9, 9, 0, 5, 0, 0}, solution1.nextLargerNodes(head)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {1, 7, 5, 1, 9, 2, 5, 1}); + assertArrayEquals(new int[] {7, 9, 9, 9, 0, 5, 0, 0}, solution1.nextLargerNodes(head)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1020Test.java b/src/test/java/com/fishercoder/secondthousand/_1020Test.java index 32940c8ce1..d168079e37 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1020Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1020Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1020; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1020Test { private _1020.Solution1 solution1; @@ -17,10 +17,10 @@ public void setup() { @Test public void test1() { int[][] map = { - {0, 0, 0, 0}, - {1, 0, 1, 0}, - {0, 1, 1, 0}, - {0, 0, 0, 0} + {0, 0, 0, 0}, + {1, 0, 1, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 0} }; assertEquals(solution1.numEnclaves(map), 3); @@ -29,10 +29,10 @@ public void test1() { @Test public void test2() { int[][] map = { - {0, 1, 1, 0}, - {0, 0, 1, 0}, - {0, 0, 1, 0}, - {0, 0, 0, 0} + {0, 1, 1, 0}, + {0, 0, 1, 0}, + {0, 0, 1, 0}, + {0, 0, 0, 0} }; assertEquals(solution1.numEnclaves(map), 0); @@ -41,12 +41,12 @@ public void test2() { @Test public void test3() { int[][] map = { - {0, 1, 1, 0}, - {0, 0, 0, 0}, - {1, 0, 1, 0}, - {1, 0, 0, 0}, - {0, 1, 1, 0}, - {0, 0, 0, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 0}, + {1, 0, 1, 0}, + {1, 0, 0, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 0}, }; assertEquals(solution1.numEnclaves(map), 3); diff --git a/src/test/java/com/fishercoder/secondthousand/_1021Test.java b/src/test/java/com/fishercoder/secondthousand/_1021Test.java index f232340e0f..0cdfdb0e45 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1021Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1021Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1021; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1021Test { private _1021.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals("", solution1.removeOuterParentheses("()()")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1022Test.java b/src/test/java/com/fishercoder/secondthousand/_1022Test.java index 41f4dbd2cc..2c085fe14a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1022Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1022Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1022; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1022Test { private _1022.Solution1 solution1; private static TreeNode root; @@ -25,5 +24,4 @@ public void test1() { TreeUtils.printBinaryTree(root); assertEquals(22, solution1.sumRootToLeaf(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1024Test.java b/src/test/java/com/fishercoder/secondthousand/_1024Test.java index 9ff428cbdb..e6958ebf01 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1024Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1024Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1024; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1024Test { private _1024.Solution1 solution1; @@ -17,17 +17,31 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.videoStitching(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]"), 10)); + assertEquals( + 3, + solution1.videoStitching( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]"), + 10)); } @Test public void test2() { - assertEquals(-1, solution1.videoStitching(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2]"), 5)); + assertEquals( + -1, + solution1.videoStitching( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1],[1,2]"), + 5)); } @Test public void test3() { - assertEquals(-1, solution1.videoStitching(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,2],[4,8]"), 5)); + assertEquals( + -1, + solution1.videoStitching( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,2],[4,8]"), + 5)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1025Test.java b/src/test/java/com/fishercoder/secondthousand/_1025Test.java index ed35777239..cb88c5d17f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1025Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1025Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1025; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - @Disabled public class _1025Test { private _1025.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1026Test.java b/src/test/java/com/fishercoder/secondthousand/_1026Test.java index 701cd29eaf..c659bf55d7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1026Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1026Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1026; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1026Test { private _1026.Solution1 solution1; @@ -16,7 +15,9 @@ public class _1026Test { @Test public void test1() { solution1 = new _1026.Solution1(); - root = TreeUtils.constructBinaryTree(Arrays.asList(8, 3, 10, 1, 6, null, 14, null, null, 4, 7, 13)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(8, 3, 10, 1, 6, null, 14, null, null, 4, 7, 13)); assertEquals(7, solution1.maxAncestorDiff(root)); } @@ -26,5 +27,4 @@ public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 2, null, 0, 3)); assertEquals(3, solution1.maxAncestorDiff(root)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1029Test.java b/src/test/java/com/fishercoder/secondthousand/_1029Test.java index 6b74190dcf..eb1fbaf719 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1029Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1029Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1029; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1029Test { private _1029.Solution1 solution1; private static int[][] costs; @@ -17,26 +17,27 @@ public void setup() { @Test public void test1() { - costs = new int[][]{ - {10, 20}, - {30, 200}, - {400, 50}, - {30, 20} - }; + costs = + new int[][] { + {10, 20}, + {30, 200}, + {400, 50}, + {30, 20} + }; assertEquals(110, solution1.twoCitySchedCost(costs)); } @Test public void test2() { - costs = new int[][]{ - {259, 770}, - {448, 54}, - {926, 667}, - {184, 139}, - {840, 118}, - {577, 469} - }; + costs = + new int[][] { + {259, 770}, + {448, 54}, + {926, 667}, + {184, 139}, + {840, 118}, + {577, 469} + }; assertEquals(1859, solution1.twoCitySchedCost(costs)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1030Test.java b/src/test/java/com/fishercoder/secondthousand/_1030Test.java index 34884f7dbb..d309a49d44 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1030Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1030Test.java @@ -27,5 +27,4 @@ public void test2() { public void test3() { CommonUtils.print2DIntArray(solution1.allCellsDistOrder(2, 3, 1, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1033Test.java b/src/test/java/com/fishercoder/secondthousand/_1033Test.java index 3b167e6eef..a7c0393962 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1033Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1033Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1033; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1033Test { private _1033.Solution1 solution1; @@ -31,4 +31,4 @@ public void test3() { int[] expected = {1, 2}; assertArrayEquals(expected, solution1.numMovesStones(3, 5, 1)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1034Test.java b/src/test/java/com/fishercoder/secondthousand/_1034Test.java index fc9f40884c..9c59a217c2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1034Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1034Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1034; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1034Test { private _1034.Solution1 solution1; @@ -17,20 +17,39 @@ public void setup() { @Test public void test1() { - assertArrayEquals(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[3,3],[3,2]"), - solution1.colorBorder(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,1],[1,2]"), 0, 0, 3)); + assertArrayEquals( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[3,3],[3,2]"), + solution1.colorBorder( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,1],[1,2]"), + 0, + 0, + 3)); } @Test public void test2() { - assertArrayEquals(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,2,1],[1,2,2],[2,2,1]"), - solution1.colorBorder(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,2,1],[1,2,2],[2,2,1]"), 1, 1, 2)); + assertArrayEquals( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,2,1],[1,2,2],[2,2,1]"), + solution1.colorBorder( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,2,1],[1,2,2],[2,2,1]"), + 1, + 1, + 2)); } @Test public void test3() { - assertArrayEquals(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,1,1,1,1,2],[1,2,1,1,1,2],[1,1,1,1,1,2]"), - solution1.colorBorder(CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,2,1,2,1,2],[2,2,2,2,1,2],[1,2,2,2,1,2]"), 1, 3, 1)); + assertArrayEquals( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,1,1,1,1,2],[1,2,1,1,1,2],[1,1,1,1,1,2]"), + solution1.colorBorder( + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,2,1,2,1,2],[2,2,2,2,1,2],[1,2,2,2,1,2]"), + 1, + 3, + 1)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1037Test.java b/src/test/java/com/fishercoder/secondthousand/_1037Test.java index d39b2ef230..90d2bd14a9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1037Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1037Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1037; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1037Test { private _1037.Solution1 solution1; @@ -16,22 +16,33 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.isBoomerang(new int[][]{new int[]{1, 1}, new int[]{2, 3}, new int[]{3, 2}})); + assertEquals( + true, + solution1.isBoomerang( + new int[][] {new int[] {1, 1}, new int[] {2, 3}, new int[] {3, 2}})); } @Test public void test2() { - assertEquals(false, solution1.isBoomerang(new int[][]{new int[]{1, 1}, new int[]{2, 2}, new int[]{3, 3}})); + assertEquals( + false, + solution1.isBoomerang( + new int[][] {new int[] {1, 1}, new int[] {2, 2}, new int[] {3, 3}})); } @Test public void test3() { - assertEquals(true, solution1.isBoomerang(new int[][]{new int[]{0, 0}, new int[]{0, 2}, new int[]{2, 1}})); + assertEquals( + true, + solution1.isBoomerang( + new int[][] {new int[] {0, 0}, new int[] {0, 2}, new int[] {2, 1}})); } @Test public void test4() { - assertEquals(false, solution1.isBoomerang(new int[][]{new int[]{0, 0}, new int[]{1, 1}, new int[]{1, 1}})); + assertEquals( + false, + solution1.isBoomerang( + new int[][] {new int[] {0, 0}, new int[] {1, 1}, new int[] {1, 1}})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1038Test.java b/src/test/java/com/fishercoder/secondthousand/_1038Test.java index 65b4a2ca1e..56c9fa9ccd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1038Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1038Test.java @@ -1,17 +1,16 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1038; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1038Test { - + private _1038.Solution1 solution1; private static TreeNode root; private static TreeNode expected; @@ -24,13 +23,19 @@ public void setup() { @Test public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(4, 1, 6, 0, 2, 5, 7, null, null, null, 3, null, null, null, 8)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 4, 1, 6, 0, 2, 5, 7, null, null, null, 3, null, null, null, 8)); TreeUtils.printBinaryTree(root); - expected = TreeUtils.constructBinaryTree(Arrays.asList(30, 36, 21, 36, 35, 26, 15, null, null, null, 33, null, null, null, 8)); + expected = + TreeUtils.constructBinaryTree( + Arrays.asList( + 30, 36, 21, 36, 35, 26, 15, null, null, null, 33, null, null, null, + 8)); TreeUtils.printBinaryTree(expected); actual = solution1.bstToGst(root); TreeUtils.printBinaryTree(actual); assertEquals(expected, actual); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1043Test.java b/src/test/java/com/fishercoder/secondthousand/_1043Test.java index e63d43d9fb..f4f43d15ee 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1043Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1043Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1043; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1043Test { private _1043.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(84, solution1.maxSumAfterPartitioning(new int[]{1, 15, 7, 9, 2, 5, 10}, 3)); + assertEquals(84, solution1.maxSumAfterPartitioning(new int[] {1, 15, 7, 9, 2, 5, 10}, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1046Test.java b/src/test/java/com/fishercoder/secondthousand/_1046Test.java index 2a57b75be4..acc6d78161 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1046Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1046Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1046; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1046Test { private _1046.Solution1 solution1; @@ -16,6 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.lastStoneWeight(new int[]{2, 7, 4, 1, 8, 1})); + assertEquals(1, solution1.lastStoneWeight(new int[] {2, 7, 4, 1, 8, 1})); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1047Test.java b/src/test/java/com/fishercoder/secondthousand/_1047Test.java index 5afb48ea83..8b7935c669 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1047Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1047Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1047; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1047Test { private _1047.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("ca", solution1.removeDuplicates("abbaca")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1049Test.java b/src/test/java/com/fishercoder/secondthousand/_1049Test.java index ff99f779a1..f327ac1996 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1049Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1049Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1049; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1049Test { private _1049.Solution1 solution1; private static int[] stones; @@ -17,9 +17,7 @@ public void setup() { @Test public void test1() { - stones = new int[]{2, 7, 4, 1, 8, 1}; + stones = new int[] {2, 7, 4, 1, 8, 1}; assertEquals(1, solution1.lastStoneWeightII(stones)); } - - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1051Test.java b/src/test/java/com/fishercoder/secondthousand/_1051Test.java index 0cb7b55bf7..7270dbfc5f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1051Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1051Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1051; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1051Test { private _1051.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.heightChecker(new int[]{1, 1, 4, 2, 1, 3})); + assertEquals(3, solution1.heightChecker(new int[] {1, 1, 4, 2, 1, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1055Test.java b/src/test/java/com/fishercoder/secondthousand/_1055Test.java index a71276c996..39432fdd31 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1055Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1055Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1055; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1055Test { private _1055.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.fixedPoint(new int[]{-10, -5, 0, 3, 7})); + assertEquals(3, solution1.fixedPoint(new int[] {-10, -5, 0, 3, 7})); } @Test public void test2() { - assertEquals(0, solution1.fixedPoint(new int[]{0, 2, 5, 8, 17})); + assertEquals(0, solution1.fixedPoint(new int[] {0, 2, 5, 8, 17})); } @Test public void test3() { - assertEquals(-1, solution1.fixedPoint(new int[]{-10, -5, 3, 4, 7, 9})); + assertEquals(-1, solution1.fixedPoint(new int[] {-10, -5, 3, 4, 7, 9})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1056Test.java b/src/test/java/com/fishercoder/secondthousand/_1056Test.java index 92df0fd4a2..570eed43e5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1056Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1056Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1056; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1056Test { private _1056.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(false, solution1.confusingNumber(25)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1057Test.java b/src/test/java/com/fishercoder/secondthousand/_1057Test.java index ca7586e404..8a627a392e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1057Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1057Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1057; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1057Test { private _1057.Solution1 solution1; private static int[][] workers; @@ -18,30 +18,33 @@ public void setup() { @Test public void test1() { - workers = new int[][]{ - {0, 0}, - {2, 1}, - }; - bikes = new int[][]{ - {1, 2}, - {3, 3}, - }; - assertArrayEquals(new int[]{1, 0}, solution1.assignBikes(workers, bikes)); + workers = + new int[][] { + {0, 0}, + {2, 1}, + }; + bikes = + new int[][] { + {1, 2}, + {3, 3}, + }; + assertArrayEquals(new int[] {1, 0}, solution1.assignBikes(workers, bikes)); } @Test public void test2() { - workers = new int[][]{ - {0, 0}, - {1, 1}, - {2, 0}, - }; - bikes = new int[][]{ - {1, 0}, - {2, 2}, - {2, 1}, - }; - assertArrayEquals(new int[]{0, 2, 1}, solution1.assignBikes(workers, bikes)); + workers = + new int[][] { + {0, 0}, + {1, 1}, + {2, 0}, + }; + bikes = + new int[][] { + {1, 0}, + {2, 2}, + {2, 1}, + }; + assertArrayEquals(new int[] {0, 2, 1}, solution1.assignBikes(workers, bikes)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1059Test.java b/src/test/java/com/fishercoder/secondthousand/_1059Test.java index 5c40493564..cc71d9caf2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1059Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1059Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1059; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _1059Test { private _1059.Solution1 solution1; @@ -18,45 +18,66 @@ public void setup() { @Test public void test1() { - assertFalse(solution1.leadsToDestination(3, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[0,1],[0,2]"), 0, 2)); + assertFalse( + solution1.leadsToDestination( + 3, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[0,2]"), + 0, + 2)); } @Test public void test2() { - assertFalse(solution1.leadsToDestination(4, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[0,1],[0,3],[1,2],[2,1]"), 0, 3)); + assertFalse( + solution1.leadsToDestination( + 4, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[0,3],[1,2],[2,1]"), + 0, + 3)); } @Test public void test3() { - assertTrue(solution1.leadsToDestination(4, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[0,1],[0,2],[1,3],[2,3]"), 0, 3)); + assertTrue( + solution1.leadsToDestination( + 4, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[0,2],[1,3],[2,3]"), + 0, + 3)); } @Test public void test4() { - assertFalse(solution1.leadsToDestination(2, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[0,1],[1,1]"), 0, 1)); + assertFalse( + solution1.leadsToDestination( + 2, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[1,1]"), + 0, + 1)); } @Test public void test5() { - assertFalse(solution1.leadsToDestination(2, new int[][]{}, 0, 1)); + assertFalse(solution1.leadsToDestination(2, new int[][] {}, 0, 1)); } @Test public void test6() { - assertTrue(solution1.leadsToDestination(1, new int[][]{}, 0, 0)); + assertTrue(solution1.leadsToDestination(1, new int[][] {}, 0, 0)); } @Test public void test7() { - assertTrue(solution1.leadsToDestination(100, CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[0,12],[0,13],[0,14],[0,15],[0,16],[0,17],[0,18],[0,19],[0,20],[0,21],[0,22],[0,23],[0,24],[0,25],[0,26],[0,27],[0,28],[0,29],[0,30],[0,31],[0,32],[0,33],[0,34],[0,35],[0,36],[0,37],[0,38],[0,39],[0,40],[0,41],[0,42],[0,43],[0,44],[0,45],[0,46],[0,47],[0,48],[0,49],[0,50],[0,51],[0,52],[0,53],[0,54],[0,55],[0,56],[0,57],[0,58],[0,59],[0,60],[0,61],[0,62],[0,63],[0,64],[0,65],[0,66],[0,67],[0,68],[0,69],[0,70],[0,71],[0,72],[0,73],[0,74],[0,75],[0,76],[0,77],[0,78],[0,79],[0,80],[0,81],[0,82],[0,83],[0,84],[0,85],[0,86],[0,87],[0,88],[0,89],[0,90],[0,91],[0,92],[0,93],[0,94],[0,95],[0,96],[0,97],[0,98],[0,99],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10],[1,11],[1,12],[1,13],[1,14],[1,15],[1,16],[1,17],[1,18],[1,19],[1,20],[1,21],[1,22],[1,23],[1,24],[1,25],[1,26],[1,27],[1,28],[1,29],[1,30],[1,31],[1,32],[1,33],[1,34],[1,35],[1,36],[1,37],[1,38],[1,39],[1,40],[1,41],[1,42],[1,43],[1,44],[1,45],[1,46],[1,47],[1,48],[1,49],[1,50],[1,51],[1,52],[1,53],[1,54],[1,55],[1,56],[1,57],[1,58],[1,59],[1,60],[1,61],[1,62],[1,63],[1,64],[1,65],[1,66],[1,67],[1,68],[1,69],[1,70],[1,71],[1,72],[1,73],[1,74],[1,75],[1,76],[1,77],[1,78],[1,79],[1,80],[1,81],[1,82],[1,83],[1,84],[1,85],[1,86],[1,87],[1,88],[1,89],[1,90],[1,91],[1,92],[1,93],[1,94],[1,95],[1,96],[1,97],[1,98],[1,99],[2,3],[2,4],[2,5],[2,6],[2,7],[2,8],[2,9],[2,10],[2,11],[2,12],[2,13],[2,14],[2,15],[2,16],[2,17],[2,18],[2,19],[2,20],[2,21],[2,22],[2,23],[2,24],[2,25],[2,26],[2,27],[2,28],[2,29],[2,30],[2,31],[2,32],[2,33],[2,34],[2,35],[2,36],[2,37],[2,38],[2,39],[2,40],[2,41],[2,42],[2,43],[2,44],[2,45],[2,46],[2,47],[2,48],[2,49],[2,50],[2,51],[2,52],[2,53],[2,54],[2,55],[2,56],[2,57],[2,58],[2,59],[2,60],[2,61],[2,62],[2,63],[2,64],[2,65],[2,66],[2,67],[2,68],[2,69],[2,70],[2,71],[2,72],[2,73],[2,74],[2,75],[2,76],[2,77],[2,78],[2,79],[2,80],[2,81],[2,82],[2,83],[2,84],[2,85],[2,86],[2,87],[2,88],[2,89],[2,90],[2,91],[2,92],[2,93],[2,94],[2,95],[2,96],[2,97],[2,98],[2,99],[3,4],[3,5],[3,6],[3,7],[3,8],[3,9],[3,10],[3,11],[3,12],[3,13],[3,14],[3,15],[3,16],[3,17],[3,18],[3,19],[3,20],[3,21],[3,22],[3,23],[3,24],[3,25],[3,26],[3,27],[3,28],[3,29],[3,30],[3,31],[3,32],[3,33],[3,34],[3,35],[3,36],[3,37],[3,38],[3,39],[3,40],[3,41],[3,42],[3,43],[3,44],[3,45],[3,46],[3,47],[3,48],[3,49],[3,50],[3,51],[3,52],[3,53],[3,54],[3,55],[3,56],[3,57],[3,58],[3,59],[3,60],[3,61],[3,62],[3,63],[3,64],[3,65],[3,66],[3,67],[3,68],[3,69],[3,70],[3,71],[3,72],[3,73],[3,74],[3,75],[3,76],[3,77],[3,78],[3,79],[3,80],[3,81],[3,82],[3,83],[3,84],[3,85],[3,86],[3,87],[3,88],[3,89],[3,90],[3,91],[3,92],[3,93],[3,94],[3,95],[3,96],[3,97],[3,98],[3,99],[4,5],[4,6],[4,7],[4,8],[4,9],[4,10],[4,11],[4,12],[4,13],[4,14],[4,15],[4,16],[4,17],[4,18],[4,19],[4,20],[4,21],[4,22],[4,23],[4,24],[4,25],[4,26],[4,27],[4,28],[4,29],[4,30],[4,31],[4,32],[4,33],[4,34],[4,35],[4,36],[4,37],[4,38],[4,39],[4,40],[4,41],[4,42],[4,43],[4,44],[4,45],[4,46],[4,47],[4,48],[4,49],[4,50],[4,51],[4,52],[4,53],[4,54],[4,55],[4,56],[4,57],[4,58],[4,59],[4,60],[4,61],[4,62],[4,63],[4,64],[4,65],[4,66],[4,67],[4,68],[4,69],[4,70],[4,71],[4,72],[4,73],[4,74],[4,75],[4,76],[4,77],[4,78],[4,79],[4,80],[4,81],[4,82],[4,83],[4,84],[4,85],[4,86],[4,87],[4,88],[4,89],[4,90],[4,91],[4,92],[4,93],[4,94],[4,95],[4,96],[4,97],[4,98],[4,99],[5,6],[5,7],[5,8],[5,9],[5,10],[5,11],[5,12],[5,13],[5,14],[5,15],[5,16],[5,17],[5,18],[5,19],[5,20],[5,21],[5,22],[5,23],[5,24],[5,25],[5,26],[5,27],[5,28],[5,29],[5,30],[5,31],[5,32],[5,33],[5,34],[5,35],[5,36],[5,37],[5,38],[5,39],[5,40],[5,41],[5,42],[5,43],[5,44],[5,45],[5,46],[5,47],[5,48],[5,49],[5,50],[5,51],[5,52],[5,53],[5,54],[5,55],[5,56],[5,57],[5,58],[5,59],[5,60],[5,61],[5,62],[5,63],[5,64],[5,65],[5,66],[5,67],[5,68],[5,69],[5,70],[5,71],[5,72],[5,73],[5,74],[5,75],[5,76],[5,77],[5,78],[5,79],[5,80],[5,81],[5,82],[5,83],[5,84],[5,85],[5,86],[5,87],[5,88],[5,89],[5,90],[5,91],[5,92],[5,93],[5,94],[5,95],[5,96],[5,97],[5,98],[5,99],[6,7],[6,8],[6,9],[6,10],[6,11],[6,12],[6,13],[6,14],[6,15],[6,16],[6,17],[6,18],[6,19],[6,20],[6,21],[6,22],[6,23],[6,24],[6,25],[6,26],[6,27],[6,28],[6,29],[6,30],[6,31],[6,32],[6,33],[6,34],[6,35],[6,36],[6,37],[6,38],[6,39],[6,40],[6,41],[6,42],[6,43],[6,44],[6,45],[6,46],[6,47],[6,48],[6,49],[6,50],[6,51],[6,52],[6,53],[6,54],[6,55],[6,56],[6,57],[6,58],[6,59],[6,60],[6,61],[6,62],[6,63],[6,64],[6,65],[6,66],[6,67],[6,68],[6,69],[6,70],[6,71],[6,72],[6,73],[6,74],[6,75],[6,76],[6,77],[6,78],[6,79],[6,80],[6,81],[6,82],[6,83],[6,84],[6,85],[6,86],[6,87],[6,88],[6,89],[6,90],[6,91],[6,92],[6,93],[6,94],[6,95],[6,96],[6,97],[6,98],[6,99],[7,8],[7,9],[7,10],[7,11],[7,12],[7,13],[7,14],[7,15],[7,16],[7,17],[7,18],[7,19],[7,20],[7,21],[7,22],[7,23],[7,24],[7,25],[7,26],[7,27],[7,28],[7,29],[7,30],[7,31],[7,32],[7,33],[7,34],[7,35],[7,36],[7,37],[7,38],[7,39],[7,40],[7,41],[7,42],[7,43],[7,44],[7,45],[7,46],[7,47],[7,48],[7,49],[7,50],[7,51],[7,52],[7,53],[7,54],[7,55],[7,56],[7,57],[7,58],[7,59],[7,60],[7,61],[7,62],[7,63],[7,64],[7,65],[7,66],[7,67],[7,68],[7,69],[7,70],[7,71],[7,72],[7,73],[7,74],[7,75],[7,76],[7,77],[7,78],[7,79],[7,80],[7,81],[7,82],[7,83],[7,84],[7,85],[7,86],[7,87],[7,88],[7,89],[7,90],[7,91],[7,92],[7,93],[7,94],[7,95],[7,96],[7,97],[7,98],[7,99],[8,9],[8,10],[8,11],[8,12],[8,13],[8,14],[8,15],[8,16],[8,17],[8,18],[8,19],[8,20],[8,21],[8,22],[8,23],[8,24],[8,25],[8,26],[8,27],[8,28],[8,29],[8,30],[8,31],[8,32],[8,33],[8,34],[8,35],[8,36],[8,37],[8,38],[8,39],[8,40],[8,41],[8,42],[8,43],[8,44],[8,45],[8,46],[8,47],[8,48],[8,49],[8,50],[8,51],[8,52],[8,53],[8,54],[8,55],[8,56],[8,57],[8,58],[8,59],[8,60],[8,61],[8,62],[8,63],[8,64],[8,65],[8,66],[8,67],[8,68],[8,69],[8,70],[8,71],[8,72],[8,73],[8,74],[8,75],[8,76],[8,77],[8,78],[8,79],[8,80],[8,81],[8,82],[8,83],[8,84],[8,85],[8,86],[8,87],[8,88],[8,89],[8,90],[8,91],[8,92],[8,93],[8,94],[8,95],[8,96],[8,97],[8,98],[8,99],[9,10],[9,11],[9,12],[9,13],[9,14],[9,15],[9,16],[9,17],[9,18],[9,19],[9,20],[9,21],[9,22],[9,23],[9,24],[9,25],[9,26],[9,27],[9,28],[9,29],[9,30],[9,31],[9,32],[9,33],[9,34],[9,35],[9,36],[9,37],[9,38],[9,39],[9,40],[9,41],[9,42],[9,43],[9,44],[9,45],[9,46],[9,47],[9,48],[9,49],[9,50],[9,51],[9,52],[9,53],[9,54],[9,55],[9,56],[9,57],[9,58],[9,59],[9,60],[9,61],[9,62],[9,63],[9,64],[9,65],[9,66],[9,67],[9,68],[9,69],[9,70],[9,71],[9,72],[9,73],[9,74],[9,75],[9,76],[9,77],[9,78],[9,79],[9,80],[9,81],[9,82],[9,83],[9,84],[9,85],[9,86],[9,87],[9,88],[9,89],[9,90],[9,91],[9,92],[9,93],[9,94],[9,95],[9,96],[9,97],[9,98],[9,99],[10,11],[10,12],[10,13],[10,14],[10,15],[10,16],[10,17],[10,18],[10,19],[10,20],[10,21],[10,22],[10,23],[10,24],[10,25],[10,26],[10,27],[10,28],[10,29],[10,30],[10,31],[10,32],[10,33],[10,34],[10,35],[10,36],[10,37],[10,38],[10,39],[10,40],[10,41],[10,42],[10,43],[10,44],[10,45],[10,46],[10,47],[10,48],[10,49],[10,50],[10,51],[10,52],[10,53],[10,54],[10,55],[10,56],[10,57],[10,58],[10,59],[10,60],[10,61],[10,62],[10,63],[10,64],[10,65],[10,66],[10,67],[10,68],[10,69],[10,70],[10,71],[10,72],[10,73],[10,74],[10,75],[10,76],[10,77],[10,78],[10,79],[10,80],[10,81],[10,82],[10,83],[10,84],[10,85],[10,86],[10,87],[10,88],[10,89],[10,90],[10,91],[10,92],[10,93],[10,94],[10,95],[10,96],[10,97],[10,98],[10,99],[11,12],[11,13],[11,14],[11,15],[11,16],[11,17],[11,18],[11,19],[11,20],[11,21],[11,22],[11,23],[11,24],[11,25],[11,26],[11,27],[11,28],[11,29],[11,30],[11,31],[11,32],[11,33],[11,34],[11,35],[11,36],[11,37],[11,38],[11,39],[11,40],[11,41],[11,42],[11,43],[11,44],[11,45],[11,46],[11,47],[11,48],[11,49],[11,50],[11,51],[11,52],[11,53],[11,54],[11,55],[11,56],[11,57],[11,58],[11,59],[11,60],[11,61],[11,62],[11,63],[11,64],[11,65],[11,66],[11,67],[11,68],[11,69],[11,70],[11,71],[11,72],[11,73],[11,74],[11,75],[11,76],[11,77],[11,78],[11,79],[11,80],[11,81],[11,82],[11,83],[11,84],[11,85],[11,86],[11,87],[11,88],[11,89],[11,90],[11,91],[11,92],[11,93],[11,94],[11,95],[11,96],[11,97],[11,98],[11,99],[12,13],[12,14],[12,15],[12,16],[12,17],[12,18],[12,19],[12,20],[12,21],[12,22],[12,23],[12,24],[12,25],[12,26],[12,27],[12,28],[12,29],[12,30],[12,31],[12,32],[12,33],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[12,40],[12,41],[12,42],[12,43],[12,44],[12,45],[12,46],[12,47],[12,48],[12,49],[12,50],[12,51],[12,52],[12,53],[12,54],[12,55],[12,56],[12,57],[12,58],[12,59],[12,60],[12,61],[12,62],[12,63],[12,64],[12,65],[12,66],[12,67],[12,68],[12,69],[12,70],[12,71],[12,72],[12,73],[12,74],[12,75],[12,76],[12,77],[12,78],[12,79],[12,80],[12,81],[12,82],[12,83],[12,84],[12,85],[12,86],[12,87],[12,88],[12,89],[12,90],[12,91],[12,92],[12,93],[12,94],[12,95],[12,96],[12,97],[12,98],[12,99],[13,14],[13,15],[13,16],[13,17],[13,18],[13,19],[13,20],[13,21],[13,22],[13,23],[13,24],[13,25],[13,26],[13,27],[13,28],[13,29],[13,30],[13,31],[13,32],[13,33],[13,34],[13,35],[13,36],[13,37],[13,38],[13,39],[13,40],[13,41],[13,42],[13,43],[13,44],[13,45],[13,46],[13,47],[13,48],[13,49],[13,50],[13,51],[13,52],[13,53],[13,54],[13,55],[13,56],[13,57],[13,58],[13,59],[13,60],[13,61],[13,62],[13,63],[13,64],[13,65],[13,66],[13,67],[13,68],[13,69],[13,70],[13,71],[13,72],[13,73],[13,74],[13,75],[13,76],[13,77],[13,78],[13,79],[13,80],[13,81],[13,82],[13,83],[13,84],[13,85],[13,86],[13,87],[13,88],[13,89],[13,90],[13,91],[13,92],[13,93],[13,94],[13,95],[13,96],[13,97],[13,98],[13,99],[14,15],[14,16],[14,17],[14,18],[14,19],[14,20],[14,21],[14,22],[14,23],[14,24],[14,25],[14,26],[14,27],[14,28],[14,29],[14,30],[14,31],[14,32],[14,33],[14,34],[14,35],[14,36],[14,37],[14,38],[14,39],[14,40],[14,41],[14,42],[14,43],[14,44],[14,45],[14,46],[14,47],[14,48],[14,49],[14,50],[14,51],[14,52],[14,53],[14,54],[14,55],[14,56],[14,57],[14,58],[14,59],[14,60],[14,61],[14,62],[14,63],[14,64],[14,65],[14,66],[14,67],[14,68],[14,69],[14,70],[14,71],[14,72],[14,73],[14,74],[14,75],[14,76],[14,77],[14,78],[14,79],[14,80],[14,81],[14,82],[14,83],[14,84],[14,85],[14,86],[14,87],[14,88],[14,89],[14,90],[14,91],[14,92],[14,93],[14,94],[14,95],[14,96],[14,97],[14,98],[14,99],[15,16],[15,17],[15,18],[15,19],[15,20],[15,21],[15,22],[15,23],[15,24],[15,25],[15,26],[15,27],[15,28],[15,29],[15,30],[15,31],[15,32],[15,33],[15,34],[15,35],[15,36],[15,37],[15,38],[15,39],[15,40],[15,41],[15,42],[15,43],[15,44],[15,45],[15,46],[15,47],[15,48],[15,49],[15,50],[15,51],[15,52],[15,53],[15,54],[15,55],[15,56],[15,57],[15,58],[15,59],[15,60],[15,61],[15,62],[15,63],[15,64],[15,65],[15,66],[15,67],[15,68],[15,69],[15,70],[15,71],[15,72],[15,73],[15,74],[15,75],[15,76],[15,77],[15,78],[15,79],[15,80],[15,81],[15,82],[15,83],[15,84],[15,85],[15,86],[15,87],[15,88],[15,89],[15,90],[15,91],[15,92],[15,93],[15,94],[15,95],[15,96],[15,97],[15,98],[15,99],[16,17],[16,18],[16,19],[16,20],[16,21],[16,22],[16,23],[16,24],[16,25],[16,26],[16,27],[16,28],[16,29],[16,30],[16,31],[16,32],[16,33],[16,34],[16,35],[16,36],[16,37],[16,38],[16,39],[16,40],[16,41],[16,42],[16,43],[16,44],[16,45],[16,46],[16,47],[16,48],[16,49],[16,50],[16,51],[16,52],[16,53],[16,54],[16,55],[16,56],[16,57],[16,58],[16,59],[16,60],[16,61],[16,62],[16,63],[16,64],[16,65],[16,66],[16,67],[16,68],[16,69],[16,70],[16,71],[16,72],[16,73],[16,74],[16,75],[16,76],[16,77],[16,78],[16,79],[16,80],[16,81],[16,82],[16,83],[16,84],[16,85],[16,86],[16,87],[16,88],[16,89],[16,90],[16,91],[16,92],[16,93],[16,94],[16,95],[16,96],[16,97],[16,98],[16,99],[17,18],[17,19],[17,20],[17,21],[17,22],[17,23],[17,24],[17,25],[17,26],[17,27],[17,28],[17,29],[17,30],[17,31],[17,32],[17,33],[17,34],[17,35],[17,36],[17,37],[17,38],[17,39],[17,40],[17,41],[17,42],[17,43],[17,44],[17,45],[17,46],[17,47],[17,48],[17,49],[17,50],[17,51],[17,52],[17,53],[17,54],[17,55],[17,56],[17,57],[17,58],[17,59],[17,60],[17,61],[17,62],[17,63],[17,64],[17,65],[17,66],[17,67],[17,68],[17,69],[17,70],[17,71],[17,72],[17,73],[17,74],[17,75],[17,76],[17,77],[17,78],[17,79],[17,80],[17,81],[17,82],[17,83],[17,84],[17,85],[17,86],[17,87],[17,88],[17,89],[17,90],[17,91],[17,92],[17,93],[17,94],[17,95],[17,96],[17,97],[17,98],[17,99],[18,19],[18,20],[18,21],[18,22],[18,23],[18,24],[18,25],[18,26],[18,27],[18,28],[18,29],[18,30],[18,31],[18,32],[18,33],[18,34],[18,35],[18,36],[18,37],[18,38],[18,39],[18,40],[18,41],[18,42],[18,43],[18,44],[18,45],[18,46],[18,47],[18,48],[18,49],[18,50],[18,51],[18,52],[18,53],[18,54],[18,55],[18,56],[18,57],[18,58],[18,59],[18,60],[18,61],[18,62],[18,63],[18,64],[18,65],[18,66],[18,67],[18,68],[18,69],[18,70],[18,71],[18,72],[18,73],[18,74],[18,75],[18,76],[18,77],[18,78],[18,79],[18,80],[18,81],[18,82],[18,83],[18,84],[18,85],[18,86],[18,87],[18,88],[18,89],[18,90],[18,91],[18,92],[18,93],[18,94],[18,95],[18,96],[18,97],[18,98],[18,99],[19,20],[19,21],[19,22],[19,23],[19,24],[19,25],[19,26],[19,27],[19,28],[19,29],[19,30],[19,31],[19,32],[19,33],[19,34],[19,35],[19,36],[19,37],[19,38],[19,39],[19,40],[19,41],[19,42],[19,43],[19,44],[19,45],[19,46],[19,47],[19,48],[19,49],[19,50],[19,51],[19,52],[19,53],[19,54],[19,55],[19,56],[19,57],[19,58],[19,59],[19,60],[19,61],[19,62],[19,63],[19,64],[19,65],[19,66],[19,67],[19,68],[19,69],[19,70],[19,71],[19,72],[19,73],[19,74],[19,75],[19,76],[19,77],[19,78],[19,79],[19,80],[19,81],[19,82],[19,83],[19,84],[19,85],[19,86],[19,87],[19,88],[19,89],[19,90],[19,91],[19,92],[19,93],[19,94],[19,95],[19,96],[19,97],[19,98],[19,99],[20,21],[20,22],[20,23],[20,24],[20,25],[20,26],[20,27],[20,28],[20,29],[20,30],[20,31],[20,32],[20,33],[20,34],[20,35],[20,36],[20,37],[20,38],[20,39],[20,40],[20,41],[20,42],[20,43],[20,44],[20,45],[20,46],[20,47],[20,48],[20,49],[20,50],[20,51],[20,52],[20,53],[20,54],[20,55],[20,56],[20,57],[20,58],[20,59],[20,60],[20,61],[20,62],[20,63],[20,64],[20,65],[20,66],[20,67],[20,68],[20,69],[20,70],[20,71],[20,72],[20,73],[20,74],[20,75],[20,76],[20,77],[20,78],[20,79],[20,80],[20,81],[20,82],[20,83],[20,84],[20,85],[20,86],[20,87],[20,88],[20,89],[20,90],[20,91],[20,92],[20,93],[20,94],[20,95],[20,96],[20,97],[20,98],[20,99],[21,22],[21,23],[21,24],[21,25],[21,26],[21,27],[21,28],[21,29],[21,30],[21,31],[21,32],[21,33],[21,34],[21,35],[21,36],[21,37],[21,38],[21,39],[21,40],[21,41],[21,42],[21,43],[21,44],[21,45],[21,46],[21,47],[21,48],[21,49],[21,50],[21,51],[21,52],[21,53],[21,54],[21,55],[21,56],[21,57],[21,58],[21,59],[21,60],[21,61],[21,62],[21,63],[21,64],[21,65],[21,66],[21,67],[21,68],[21,69],[21,70],[21,71],[21,72],[21,73],[21,74],[21,75],[21,76],[21,77],[21,78],[21,79],[21,80],[21,81],[21,82],[21,83],[21,84],[21,85],[21,86],[21,87],[21,88],[21,89],[21,90],[21,91],[21,92],[21,93],[21,94],[21,95],[21,96],[21,97],[21,98],[21,99],[22,23],[22,24],[22,25],[22,26],[22,27],[22,28],[22,29],[22,30],[22,31],[22,32],[22,33],[22,34],[22,35],[22,36],[22,37],[22,38],[22,39],[22,40],[22,41],[22,42],[22,43],[22,44],[22,45],[22,46],[22,47],[22,48],[22,49],[22,50],[22,51],[22,52],[22,53],[22,54],[22,55],[22,56],[22,57],[22,58],[22,59],[22,60],[22,61],[22,62],[22,63],[22,64],[22,65],[22,66],[22,67],[22,68],[22,69],[22,70],[22,71],[22,72],[22,73],[22,74],[22,75],[22,76],[22,77],[22,78],[22,79],[22,80],[22,81],[22,82],[22,83],[22,84],[22,85],[22,86],[22,87],[22,88],[22,89],[22,90],[22,91],[22,92],[22,93],[22,94],[22,95],[22,96],[22,97],[22,98],[22,99],[23,24],[23,25],[23,26],[23,27],[23,28],[23,29],[23,30],[23,31],[23,32],[23,33],[23,34],[23,35],[23,36],[23,37],[23,38],[23,39],[23,40],[23,41],[23,42],[23,43],[23,44],[23,45],[23,46],[23,47],[23,48],[23,49],[23,50],[23,51],[23,52],[23,53],[23,54],[23,55],[23,56],[23,57],[23,58],[23,59],[23,60],[23,61],[23,62],[23,63],[23,64],[23,65],[23,66],[23,67],[23,68],[23,69],[23,70],[23,71],[23,72],[23,73],[23,74],[23,75],[23,76],[23,77],[23,78],[23,79],[23,80],[23,81],[23,82],[23,83],[23,84],[23,85],[23,86],[23,87],[23,88],[23,89],[23,90],[23,91],[23,92],[23,93],[23,94],[23,95],[23,96],[23,97],[23,98],[23,99],[24,25],[24,26],[24,27],[24,28],[24,29],[24,30],[24,31],[24,32],[24,33],[24,34],[24,35],[24,36],[24,37],[24,38],[24,39],[24,40],[24,41],[24,42],[24,43],[24,44],[24,45],[24,46],[24,47],[24,48],[24,49],[24,50],[24,51],[24,52],[24,53],[24,54],[24,55],[24,56],[24,57],[24,58],[24,59],[24,60],[24,61],[24,62],[24,63],[24,64],[24,65],[24,66],[24,67],[24,68],[24,69],[24,70],[24,71],[24,72],[24,73],[24,74],[24,75],[24,76],[24,77],[24,78],[24,79],[24,80],[24,81],[24,82],[24,83],[24,84],[24,85],[24,86],[24,87],[24,88],[24,89],[24,90],[24,91],[24,92],[24,93],[24,94],[24,95],[24,96],[24,97],[24,98],[24,99],[25,26],[25,27],[25,28],[25,29],[25,30],[25,31],[25,32],[25,33],[25,34],[25,35],[25,36],[25,37],[25,38],[25,39],[25,40],[25,41],[25,42],[25,43],[25,44],[25,45],[25,46],[25,47],[25,48],[25,49],[25,50],[25,51],[25,52],[25,53],[25,54],[25,55],[25,56],[25,57],[25,58],[25,59],[25,60],[25,61],[25,62],[25,63],[25,64],[25,65],[25,66],[25,67],[25,68],[25,69],[25,70],[25,71],[25,72],[25,73],[25,74],[25,75],[25,76],[25,77],[25,78],[25,79],[25,80],[25,81],[25,82],[25,83],[25,84],[25,85],[25,86],[25,87],[25,88],[25,89],[25,90],[25,91],[25,92],[25,93],[25,94],[25,95],[25,96],[25,97],[25,98],[25,99],[26,27],[26,28],[26,29],[26,30],[26,31],[26,32],[26,33],[26,34],[26,35],[26,36],[26,37],[26,38],[26,39],[26,40],[26,41],[26,42],[26,43],[26,44],[26,45],[26,46],[26,47],[26,48],[26,49],[26,50],[26,51],[26,52],[26,53],[26,54],[26,55],[26,56],[26,57],[26,58],[26,59],[26,60],[26,61],[26,62],[26,63],[26,64],[26,65],[26,66],[26,67],[26,68],[26,69],[26,70],[26,71],[26,72],[26,73],[26,74],[26,75],[26,76],[26,77],[26,78],[26,79],[26,80],[26,81],[26,82],[26,83],[26,84],[26,85],[26,86],[26,87],[26,88],[26,89],[26,90],[26,91],[26,92],[26,93],[26,94],[26,95],[26,96],[26,97],[26,98],[26,99],[27,28],[27,29],[27,30],[27,31],[27,32],[27,33],[27,34],[27,35],[27,36],[27,37],[27,38],[27,39],[27,40],[27,41],[27,42],[27,43],[27,44],[27,45],[27,46],[27,47],[27,48],[27,49],[27,50],[27,51],[27,52],[27,53],[27,54],[27,55],[27,56],[27,57],[27,58],[27,59],[27,60],[27,61],[27,62],[27,63],[27,64],[27,65],[27,66],[27,67],[27,68],[27,69],[27,70],[27,71],[27,72],[27,73],[27,74],[27,75],[27,76],[27,77],[27,78],[27,79],[27,80],[27,81],[27,82],[27,83],[27,84],[27,85],[27,86],[27,87],[27,88],[27,89],[27,90],[27,91],[27,92],[27,93],[27,94],[27,95],[27,96],[27,97],[27,98],[27,99],[28,29],[28,30],[28,31],[28,32],[28,33],[28,34],[28,35],[28,36],[28,37],[28,38],[28,39],[28,40],[28,41],[28,42],[28,43],[28,44],[28,45],[28,46],[28,47],[28,48],[28,49],[28,50],[28,51],[28,52],[28,53],[28,54],[28,55],[28,56],[28,57],[28,58],[28,59],[28,60],[28,61],[28,62],[28,63],[28,64],[28,65],[28,66],[28,67],[28,68],[28,69],[28,70],[28,71],[28,72],[28,73],[28,74],[28,75],[28,76],[28,77],[28,78],[28,79],[28,80],[28,81],[28,82],[28,83],[28,84],[28,85],[28,86],[28,87],[28,88],[28,89],[28,90],[28,91],[28,92],[28,93],[28,94],[28,95],[28,96],[28,97],[28,98],[28,99],[29,30],[29,31],[29,32],[29,33],[29,34],[29,35],[29,36],[29,37],[29,38],[29,39],[29,40],[29,41],[29,42],[29,43],[29,44],[29,45],[29,46],[29,47],[29,48],[29,49],[29,50],[29,51],[29,52],[29,53],[29,54],[29,55],[29,56],[29,57],[29,58],[29,59],[29,60],[29,61],[29,62],[29,63],[29,64],[29,65],[29,66],[29,67],[29,68],[29,69],[29,70],[29,71],[29,72],[29,73],[29,74],[29,75],[29,76],[29,77],[29,78],[29,79],[29,80],[29,81],[29,82],[29,83],[29,84],[29,85],[29,86],[29,87],[29,88],[29,89],[29,90],[29,91],[29,92],[29,93],[29,94],[29,95],[29,96],[29,97],[29,98],[29,99],[30,31],[30,32],[30,33],[30,34],[30,35],[30,36],[30,37],[30,38],[30,39],[30,40],[30,41],[30,42],[30,43],[30,44],[30,45],[30,46],[30,47],[30,48],[30,49],[30,50],[30,51],[30,52],[30,53],[30,54],[30,55],[30,56],[30,57],[30,58],[30,59],[30,60],[30,61],[30,62],[30,63],[30,64],[30,65],[30,66],[30,67],[30,68],[30,69],[30,70],[30,71],[30,72],[30,73],[30,74],[30,75],[30,76],[30,77],[30,78],[30,79],[30,80],[30,81],[30,82],[30,83],[30,84],[30,85],[30,86],[30,87],[30,88],[30,89],[30,90],[30,91],[30,92],[30,93],[30,94],[30,95],[30,96],[30,97],[30,98],[30,99],[31,32],[31,33],[31,34],[31,35],[31,36],[31,37],[31,38],[31,39],[31,40],[31,41],[31,42],[31,43],[31,44],[31,45],[31,46],[31,47],[31,48],[31,49],[31,50],[31,51],[31,52],[31,53],[31,54],[31,55],[31,56],[31,57],[31,58],[31,59],[31,60],[31,61],[31,62],[31,63],[31,64],[31,65],[31,66],[31,67],[31,68],[31,69],[31,70],[31,71],[31,72],[31,73],[31,74],[31,75],[31,76],[31,77],[31,78],[31,79],[31,80],[31,81],[31,82],[31,83],[31,84],[31,85],[31,86],[31,87],[31,88],[31,89],[31,90],[31,91],[31,92],[31,93],[31,94],[31,95],[31,96],[31,97],[31,98],[31,99],[32,33],[32,34],[32,35],[32,36],[32,37],[32,38],[32,39],[32,40],[32,41],[32,42],[32,43],[32,44],[32,45],[32,46],[32,47],[32,48],[32,49],[32,50],[32,51],[32,52],[32,53],[32,54],[32,55],[32,56],[32,57],[32,58],[32,59],[32,60],[32,61],[32,62],[32,63],[32,64],[32,65],[32,66],[32,67],[32,68],[32,69],[32,70],[32,71],[32,72],[32,73],[32,74],[32,75],[32,76],[32,77],[32,78],[32,79],[32,80],[32,81],[32,82],[32,83],[32,84],[32,85],[32,86],[32,87],[32,88],[32,89],[32,90],[32,91],[32,92],[32,93],[32,94],[32,95],[32,96],[32,97],[32,98],[32,99],[33,34],[33,35],[33,36],[33,37],[33,38],[33,39],[33,40],[33,41],[33,42],[33,43],[33,44],[33,45],[33,46],[33,47],[33,48],[33,49],[33,50],[33,51],[33,52],[33,53],[33,54],[33,55],[33,56],[33,57],[33,58],[33,59],[33,60],[33,61],[33,62],[33,63],[33,64],[33,65],[33,66],[33,67],[33,68],[33,69],[33,70],[33,71],[33,72],[33,73],[33,74],[33,75],[33,76],[33,77],[33,78],[33,79],[33,80],[33,81],[33,82],[33,83],[33,84],[33,85],[33,86],[33,87],[33,88],[33,89],[33,90],[33,91],[33,92],[33,93],[33,94],[33,95],[33,96],[33,97],[33,98],[33,99],[34,35],[34,36],[34,37],[34,38],[34,39],[34,40],[34,41],[34,42],[34,43],[34,44],[34,45],[34,46],[34,47],[34,48],[34,49],[34,50],[34,51],[34,52],[34,53],[34,54],[34,55],[34,56],[34,57],[34,58],[34,59],[34,60],[34,61],[34,62],[34,63],[34,64],[34,65],[34,66],[34,67],[34,68],[34,69],[34,70],[34,71],[34,72],[34,73],[34,74],[34,75],[34,76],[34,77],[34,78],[34,79],[34,80],[34,81],[34,82],[34,83],[34,84],[34,85],[34,86],[34,87],[34,88],[34,89],[34,90],[34,91],[34,92],[34,93],[34,94],[34,95],[34,96],[34,97],[34,98],[34,99],[35,36],[35,37],[35,38],[35,39],[35,40],[35,41],[35,42],[35,43],[35,44],[35,45],[35,46],[35,47],[35,48],[35,49],[35,50],[35,51],[35,52],[35,53],[35,54],[35,55],[35,56],[35,57],[35,58],[35,59],[35,60],[35,61],[35,62],[35,63],[35,64],[35,65],[35,66],[35,67],[35,68],[35,69],[35,70],[35,71],[35,72],[35,73],[35,74],[35,75],[35,76],[35,77],[35,78],[35,79],[35,80],[35,81],[35,82],[35,83],[35,84],[35,85],[35,86],[35,87],[35,88],[35,89],[35,90],[35,91],[35,92],[35,93],[35,94],[35,95],[35,96],[35,97],[35,98],[35,99],[36,37],[36,38],[36,39],[36,40],[36,41],[36,42],[36,43],[36,44],[36,45],[36,46],[36,47],[36,48],[36,49],[36,50],[36,51],[36,52],[36,53],[36,54],[36,55],[36,56],[36,57],[36,58],[36,59],[36,60],[36,61],[36,62],[36,63],[36,64],[36,65],[36,66],[36,67],[36,68],[36,69],[36,70],[36,71],[36,72],[36,73],[36,74],[36,75],[36,76],[36,77],[36,78],[36,79],[36,80],[36,81],[36,82],[36,83],[36,84],[36,85],[36,86],[36,87],[36,88],[36,89],[36,90],[36,91],[36,92],[36,93],[36,94],[36,95],[36,96],[36,97],[36,98],[36,99],[37,38],[37,39],[37,40],[37,41],[37,42],[37,43],[37,44],[37,45],[37,46],[37,47],[37,48],[37,49],[37,50],[37,51],[37,52],[37,53],[37,54],[37,55],[37,56],[37,57],[37,58],[37,59],[37,60],[37,61],[37,62],[37,63],[37,64],[37,65],[37,66],[37,67],[37,68],[37,69],[37,70],[37,71],[37,72],[37,73],[37,74],[37,75],[37,76],[37,77],[37,78],[37,79],[37,80],[37,81],[37,82],[37,83],[37,84],[37,85],[37,86],[37,87],[37,88],[37,89],[37,90],[37,91],[37,92],[37,93],[37,94],[37,95],[37,96],[37,97],[37,98],[37,99],[38,39],[38,40],[38,41],[38,42],[38,43],[38,44],[38,45],[38,46],[38,47],[38,48],[38,49],[38,50],[38,51],[38,52],[38,53],[38,54],[38,55],[38,56],[38,57],[38,58],[38,59],[38,60],[38,61],[38,62],[38,63],[38,64],[38,65],[38,66],[38,67],[38,68],[38,69],[38,70],[38,71],[38,72],[38,73],[38,74],[38,75],[38,76],[38,77],[38,78],[38,79],[38,80],[38,81],[38,82],[38,83],[38,84],[38,85],[38,86],[38,87],[38,88],[38,89],[38,90],[38,91],[38,92],[38,93],[38,94],[38,95],[38,96],[38,97],[38,98],[38,99],[39,40],[39,41],[39,42],[39,43],[39,44],[39,45],[39,46],[39,47],[39,48],[39,49],[39,50],[39,51],[39,52],[39,53],[39,54],[39,55],[39,56],[39,57],[39,58],[39,59],[39,60],[39,61],[39,62],[39,63],[39,64],[39,65],[39,66],[39,67],[39,68],[39,69],[39,70],[39,71],[39,72],[39,73],[39,74],[39,75],[39,76],[39,77],[39,78],[39,79],[39,80],[39,81],[39,82],[39,83],[39,84],[39,85],[39,86],[39,87],[39,88],[39,89],[39,90],[39,91],[39,92],[39,93],[39,94],[39,95],[39,96],[39,97],[39,98],[39,99],[40,41],[40,42],[40,43],[40,44],[40,45],[40,46],[40,47],[40,48],[40,49],[40,50],[40,51],[40,52],[40,53],[40,54],[40,55],[40,56],[40,57],[40,58],[40,59],[40,60],[40,61],[40,62],[40,63],[40,64],[40,65],[40,66],[40,67],[40,68],[40,69],[40,70],[40,71],[40,72],[40,73],[40,74],[40,75],[40,76],[40,77],[40,78],[40,79],[40,80],[40,81],[40,82],[40,83],[40,84],[40,85],[40,86],[40,87],[40,88],[40,89],[40,90],[40,91],[40,92],[40,93],[40,94],[40,95],[40,96],[40,97],[40,98],[40,99],[41,42],[41,43],[41,44],[41,45],[41,46],[41,47],[41,48],[41,49],[41,50],[41,51],[41,52],[41,53],[41,54],[41,55],[41,56],[41,57],[41,58],[41,59],[41,60],[41,61],[41,62],[41,63],[41,64],[41,65],[41,66],[41,67],[41,68],[41,69],[41,70],[41,71],[41,72],[41,73],[41,74],[41,75],[41,76],[41,77],[41,78],[41,79],[41,80],[41,81],[41,82],[41,83],[41,84],[41,85],[41,86],[41,87],[41,88],[41,89],[41,90],[41,91],[41,92],[41,93],[41,94],[41,95],[41,96],[41,97],[41,98],[41,99],[42,43],[42,44],[42,45],[42,46],[42,47],[42,48],[42,49],[42,50],[42,51],[42,52],[42,53],[42,54],[42,55],[42,56],[42,57],[42,58],[42,59],[42,60],[42,61],[42,62],[42,63],[42,64],[42,65],[42,66],[42,67],[42,68],[42,69],[42,70],[42,71],[42,72],[42,73],[42,74],[42,75],[42,76],[42,77],[42,78],[42,79],[42,80],[42,81],[42,82],[42,83],[42,84],[42,85],[42,86],[42,87],[42,88],[42,89],[42,90],[42,91],[42,92],[42,93],[42,94],[42,95],[42,96],[42,97],[42,98],[42,99],[43,44],[43,45],[43,46],[43,47],[43,48],[43,49],[43,50],[43,51],[43,52],[43,53],[43,54],[43,55],[43,56],[43,57],[43,58],[43,59],[43,60],[43,61],[43,62],[43,63],[43,64],[43,65],[43,66],[43,67],[43,68],[43,69],[43,70],[43,71],[43,72],[43,73],[43,74],[43,75],[43,76],[43,77],[43,78],[43,79],[43,80],[43,81],[43,82],[43,83],[43,84],[43,85],[43,86],[43,87],[43,88],[43,89],[43,90],[43,91],[43,92],[43,93],[43,94],[43,95],[43,96],[43,97],[43,98],[43,99],[44,45],[44,46],[44,47],[44,48],[44,49],[44,50],[44,51],[44,52],[44,53],[44,54],[44,55],[44,56],[44,57],[44,58],[44,59],[44,60],[44,61],[44,62],[44,63],[44,64],[44,65],[44,66],[44,67],[44,68],[44,69],[44,70],[44,71],[44,72],[44,73],[44,74],[44,75],[44,76],[44,77],[44,78],[44,79],[44,80],[44,81],[44,82],[44,83],[44,84],[44,85],[44,86],[44,87],[44,88],[44,89],[44,90],[44,91],[44,92],[44,93],[44,94],[44,95],[44,96],[44,97],[44,98],[44,99],[45,46],[45,47],[45,48],[45,49],[45,50],[45,51],[45,52],[45,53],[45,54],[45,55],[45,56],[45,57],[45,58],[45,59],[45,60],[45,61],[45,62],[45,63],[45,64],[45,65],[45,66],[45,67],[45,68],[45,69],[45,70],[45,71],[45,72],[45,73],[45,74],[45,75],[45,76],[45,77],[45,78],[45,79],[45,80],[45,81],[45,82],[45,83],[45,84],[45,85],[45,86],[45,87],[45,88],[45,89],[45,90],[45,91],[45,92],[45,93],[45,94],[45,95],[45,96],[45,97],[45,98],[45,99],[46,47],[46,48],[46,49],[46,50],[46,51],[46,52],[46,53],[46,54],[46,55],[46,56],[46,57],[46,58],[46,59],[46,60],[46,61],[46,62],[46,63],[46,64],[46,65],[46,66],[46,67],[46,68],[46,69],[46,70],[46,71],[46,72],[46,73],[46,74],[46,75],[46,76],[46,77],[46,78],[46,79],[46,80],[46,81],[46,82],[46,83],[46,84],[46,85],[46,86],[46,87],[46,88],[46,89],[46,90],[46,91],[46,92],[46,93],[46,94],[46,95],[46,96],[46,97],[46,98],[46,99],[47,48],[47,49],[47,50],[47,51],[47,52],[47,53],[47,54],[47,55],[47,56],[47,57],[47,58],[47,59],[47,60],[47,61],[47,62],[47,63],[47,64],[47,65],[47,66],[47,67],[47,68],[47,69],[47,70],[47,71],[47,72],[47,73],[47,74],[47,75],[47,76],[47,77],[47,78],[47,79],[47,80],[47,81],[47,82],[47,83],[47,84],[47,85],[47,86],[47,87],[47,88],[47,89],[47,90],[47,91],[47,92],[47,93],[47,94],[47,95],[47,96],[47,97],[47,98],[47,99],[48,49],[48,50],[48,51],[48,52],[48,53],[48,54],[48,55],[48,56],[48,57],[48,58],[48,59],[48,60],[48,61],[48,62],[48,63],[48,64],[48,65],[48,66],[48,67],[48,68],[48,69],[48,70],[48,71],[48,72],[48,73],[48,74],[48,75],[48,76],[48,77],[48,78],[48,79],[48,80],[48,81],[48,82],[48,83],[48,84],[48,85],[48,86],[48,87],[48,88],[48,89],[48,90],[48,91],[48,92],[48,93],[48,94],[48,95],[48,96],[48,97],[48,98],[48,99],[49,50],[49,51],[49,52],[49,53],[49,54],[49,55],[49,56],[49,57],[49,58],[49,59],[49,60],[49,61],[49,62],[49,63],[49,64],[49,65],[49,66],[49,67],[49,68],[49,69],[49,70],[49,71],[49,72],[49,73],[49,74],[49,75],[49,76],[49,77],[49,78],[49,79],[49,80],[49,81],[49,82],[49,83],[49,84],[49,85],[49,86],[49,87],[49,88],[49,89],[49,90],[49,91],[49,92],[49,93],[49,94],[49,95],[49,96],[49,97],[49,98],[49,99],[50,51],[50,52],[50,53],[50,54],[50,55],[50,56],[50,57],[50,58],[50,59],[50,60],[50,61],[50,62],[50,63],[50,64],[50,65],[50,66],[50,67],[50,68],[50,69],[50,70],[50,71],[50,72],[50,73],[50,74],[50,75],[50,76],[50,77],[50,78],[50,79],[50,80],[50,81],[50,82],[50,83],[50,84],[50,85],[50,86],[50,87],[50,88],[50,89],[50,90],[50,91],[50,92],[50,93],[50,94],[50,95],[50,96],[50,97],[50,98],[50,99],[51,52],[51,53],[51,54],[51,55],[51,56],[51,57],[51,58],[51,59],[51,60],[51,61],[51,62],[51,63],[51,64],[51,65],[51,66],[51,67],[51,68],[51,69],[51,70],[51,71],[51,72],[51,73],[51,74],[51,75],[51,76],[51,77],[51,78],[51,79],[51,80],[51,81],[51,82],[51,83],[51,84],[51,85],[51,86],[51,87],[51,88],[51,89],[51,90],[51,91],[51,92],[51,93],[51,94],[51,95],[51,96],[51,97],[51,98],[51,99],[52,53],[52,54],[52,55],[52,56],[52,57],[52,58],[52,59],[52,60],[52,61],[52,62],[52,63],[52,64],[52,65],[52,66],[52,67],[52,68],[52,69],[52,70],[52,71],[52,72],[52,73],[52,74],[52,75],[52,76],[52,77],[52,78],[52,79],[52,80],[52,81],[52,82],[52,83],[52,84],[52,85],[52,86],[52,87],[52,88],[52,89],[52,90],[52,91],[52,92],[52,93],[52,94],[52,95],[52,96],[52,97],[52,98],[52,99],[53,54],[53,55],[53,56],[53,57],[53,58],[53,59],[53,60],[53,61],[53,62],[53,63],[53,64],[53,65],[53,66],[53,67],[53,68],[53,69],[53,70],[53,71],[53,72],[53,73],[53,74],[53,75],[53,76],[53,77],[53,78],[53,79],[53,80],[53,81],[53,82],[53,83],[53,84],[53,85],[53,86],[53,87],[53,88],[53,89],[53,90],[53,91],[53,92],[53,93],[53,94],[53,95],[53,96],[53,97],[53,98],[53,99],[54,55],[54,56],[54,57],[54,58],[54,59],[54,60],[54,61],[54,62],[54,63],[54,64],[54,65],[54,66],[54,67],[54,68],[54,69],[54,70],[54,71],[54,72],[54,73],[54,74],[54,75],[54,76],[54,77],[54,78],[54,79],[54,80],[54,81],[54,82],[54,83],[54,84],[54,85],[54,86],[54,87],[54,88],[54,89],[54,90],[54,91],[54,92],[54,93],[54,94],[54,95],[54,96],[54,97],[54,98],[54,99],[55,56],[55,57],[55,58],[55,59],[55,60],[55,61],[55,62],[55,63],[55,64],[55,65],[55,66],[55,67],[55,68],[55,69],[55,70],[55,71],[55,72],[55,73],[55,74],[55,75],[55,76],[55,77],[55,78],[55,79],[55,80],[55,81],[55,82],[55,83],[55,84],[55,85],[55,86],[55,87],[55,88],[55,89],[55,90],[55,91],[55,92],[55,93],[55,94],[55,95],[55,96],[55,97],[55,98],[55,99],[56,57],[56,58],[56,59],[56,60],[56,61],[56,62],[56,63],[56,64],[56,65],[56,66],[56,67],[56,68],[56,69],[56,70],[56,71],[56,72],[56,73],[56,74],[56,75],[56,76],[56,77],[56,78],[56,79],[56,80],[56,81],[56,82],[56,83],[56,84],[56,85],[56,86],[56,87],[56,88],[56,89],[56,90],[56,91],[56,92],[56,93],[56,94],[56,95],[56,96],[56,97],[56,98],[56,99],[57,58],[57,59],[57,60],[57,61],[57,62],[57,63],[57,64],[57,65],[57,66],[57,67],[57,68],[57,69],[57,70],[57,71],[57,72],[57,73],[57,74],[57,75],[57,76],[57,77],[57,78],[57,79],[57,80],[57,81],[57,82],[57,83],[57,84],[57,85],[57,86],[57,87],[57,88],[57,89],[57,90],[57,91],[57,92],[57,93],[57,94],[57,95],[57,96],[57,97],[57,98],[57,99],[58,59],[58,60],[58,61],[58,62],[58,63],[58,64],[58,65],[58,66],[58,67],[58,68],[58,69],[58,70],[58,71],[58,72],[58,73],[58,74],[58,75],[58,76],[58,77],[58,78],[58,79],[58,80],[58,81],[58,82],[58,83],[58,84],[58,85],[58,86],[58,87],[58,88],[58,89],[58,90],[58,91],[58,92],[58,93],[58,94],[58,95],[58,96],[58,97],[58,98],[58,99],[59,60],[59,61],[59,62],[59,63],[59,64],[59,65],[59,66],[59,67],[59,68],[59,69],[59,70],[59,71],[59,72],[59,73],[59,74],[59,75],[59,76],[59,77],[59,78],[59,79],[59,80],[59,81],[59,82],[59,83],[59,84],[59,85],[59,86],[59,87],[59,88],[59,89],[59,90],[59,91],[59,92],[59,93],[59,94],[59,95],[59,96],[59,97],[59,98],[59,99],[60,61],[60,62],[60,63],[60,64],[60,65],[60,66],[60,67],[60,68],[60,69],[60,70],[60,71],[60,72],[60,73],[60,74],[60,75],[60,76],[60,77],[60,78],[60,79],[60,80],[60,81],[60,82],[60,83],[60,84],[60,85],[60,86],[60,87],[60,88],[60,89],[60,90],[60,91],[60,92],[60,93],[60,94],[60,95],[60,96],[60,97],[60,98],[60,99],[61,62],[61,63],[61,64],[61,65],[61,66],[61,67],[61,68],[61,69],[61,70],[61,71],[61,72],[61,73],[61,74],[61,75],[61,76],[61,77],[61,78],[61,79],[61,80],[61,81],[61,82],[61,83],[61,84],[61,85],[61,86],[61,87],[61,88],[61,89],[61,90],[61,91],[61,92],[61,93],[61,94],[61,95],[61,96],[61,97],[61,98],[61,99],[62,63],[62,64],[62,65],[62,66],[62,67],[62,68],[62,69],[62,70],[62,71],[62,72],[62,73],[62,74],[62,75],[62,76],[62,77],[62,78],[62,79],[62,80],[62,81],[62,82],[62,83],[62,84],[62,85],[62,86],[62,87],[62,88],[62,89],[62,90],[62,91],[62,92],[62,93],[62,94],[62,95],[62,96],[62,97],[62,98],[62,99],[63,64],[63,65],[63,66],[63,67],[63,68],[63,69],[63,70],[63,71],[63,72],[63,73],[63,74],[63,75],[63,76],[63,77],[63,78],[63,79],[63,80],[63,81],[63,82],[63,83],[63,84],[63,85],[63,86],[63,87],[63,88],[63,89],[63,90],[63,91],[63,92],[63,93],[63,94],[63,95],[63,96],[63,97],[63,98],[63,99],[64,65],[64,66],[64,67],[64,68],[64,69],[64,70],[64,71],[64,72],[64,73],[64,74],[64,75],[64,76],[64,77],[64,78],[64,79],[64,80],[64,81],[64,82],[64,83],[64,84],[64,85],[64,86],[64,87],[64,88],[64,89],[64,90],[64,91],[64,92],[64,93],[64,94],[64,95],[64,96],[64,97],[64,98],[64,99],[65,66],[65,67],[65,68],[65,69],[65,70],[65,71],[65,72],[65,73],[65,74],[65,75],[65,76],[65,77],[65,78],[65,79],[65,80],[65,81],[65,82],[65,83],[65,84],[65,85],[65,86],[65,87],[65,88],[65,89],[65,90],[65,91],[65,92],[65,93],[65,94],[65,95],[65,96],[65,97],[65,98],[65,99],[66,67],[66,68],[66,69],[66,70],[66,71],[66,72],[66,73],[66,74],[66,75],[66,76],[66,77],[66,78],[66,79],[66,80],[66,81],[66,82],[66,83],[66,84],[66,85],[66,86],[66,87],[66,88],[66,89],[66,90],[66,91],[66,92],[66,93],[66,94],[66,95],[66,96],[66,97],[66,98],[66,99],[67,68],[67,69],[67,70],[67,71],[67,72],[67,73],[67,74],[67,75],[67,76],[67,77],[67,78],[67,79],[67,80],[67,81],[67,82],[67,83],[67,84],[67,85],[67,86],[67,87],[67,88],[67,89],[67,90],[67,91],[67,92],[67,93],[67,94],[67,95],[67,96],[67,97],[67,98],[67,99],[68,69],[68,70],[68,71],[68,72],[68,73],[68,74],[68,75],[68,76],[68,77],[68,78],[68,79],[68,80],[68,81],[68,82],[68,83],[68,84],[68,85],[68,86],[68,87],[68,88],[68,89],[68,90],[68,91],[68,92],[68,93],[68,94],[68,95],[68,96],[68,97],[68,98],[68,99],[69,70],[69,71],[69,72],[69,73],[69,74],[69,75],[69,76],[69,77],[69,78],[69,79],[69,80],[69,81],[69,82],[69,83],[69,84],[69,85],[69,86],[69,87],[69,88],[69,89],[69,90],[69,91],[69,92],[69,93],[69,94],[69,95],[69,96],[69,97],[69,98],[69,99],[70,71],[70,72],[70,73],[70,74],[70,75],[70,76],[70,77],[70,78],[70,79],[70,80],[70,81],[70,82],[70,83],[70,84],[70,85],[70,86],[70,87],[70,88],[70,89],[70,90],[70,91],[70,92],[70,93],[70,94],[70,95],[70,96],[70,97],[70,98],[70,99],[71,72],[71,73],[71,74],[71,75],[71,76],[71,77],[71,78],[71,79],[71,80],[71,81],[71,82],[71,83],[71,84],[71,85],[71,86],[71,87],[71,88],[71,89],[71,90],[71,91],[71,92],[71,93],[71,94],[71,95],[71,96],[71,97],[71,98],[71,99],[72,73],[72,74],[72,75],[72,76],[72,77],[72,78],[72,79],[72,80],[72,81],[72,82],[72,83],[72,84],[72,85],[72,86],[72,87],[72,88],[72,89],[72,90],[72,91],[72,92],[72,93],[72,94],[72,95],[72,96],[72,97],[72,98],[72,99],[73,74],[73,75],[73,76],[73,77],[73,78],[73,79],[73,80],[73,81],[73,82],[73,83],[73,84],[73,85],[73,86],[73,87],[73,88],[73,89],[73,90],[73,91],[73,92],[73,93],[73,94],[73,95],[73,96],[73,97],[73,98],[73,99],[74,75],[74,76],[74,77],[74,78],[74,79],[74,80],[74,81],[74,82],[74,83],[74,84],[74,85],[74,86],[74,87],[74,88],[74,89],[74,90],[74,91],[74,92],[74,93],[74,94],[74,95],[74,96],[74,97],[74,98],[74,99],[75,76],[75,77],[75,78],[75,79],[75,80],[75,81],[75,82],[75,83],[75,84],[75,85],[75,86],[75,87],[75,88],[75,89],[75,90],[75,91],[75,92],[75,93],[75,94],[75,95],[75,96],[75,97],[75,98],[75,99],[76,77],[76,78],[76,79],[76,80],[76,81],[76,82],[76,83],[76,84],[76,85],[76,86],[76,87],[76,88],[76,89],[76,90],[76,91],[76,92],[76,93],[76,94],[76,95],[76,96],[76,97],[76,98],[76,99],[77,78],[77,79],[77,80],[77,81],[77,82],[77,83],[77,84],[77,85],[77,86],[77,87],[77,88],[77,89],[77,90],[77,91],[77,92],[77,93],[77,94],[77,95],[77,96],[77,97],[77,98],[77,99],[78,79],[78,80],[78,81],[78,82],[78,83],[78,84],[78,85],[78,86],[78,87],[78,88],[78,89],[78,90],[78,91],[78,92],[78,93],[78,94],[78,95],[78,96],[78,97],[78,98],[78,99],[79,80],[79,81],[79,82],[79,83],[79,84],[79,85],[79,86],[79,87],[79,88],[79,89],[79,90],[79,91],[79,92],[79,93],[79,94],[79,95],[79,96],[79,97],[79,98],[79,99],[80,81],[80,82],[80,83],[80,84],[80,85],[80,86],[80,87],[80,88],[80,89],[80,90],[80,91],[80,92],[80,93],[80,94],[80,95],[80,96],[80,97],[80,98],[80,99],[81,82],[81,83],[81,84],[81,85],[81,86],[81,87],[81,88],[81,89],[81,90],[81,91],[81,92],[81,93],[81,94],[81,95],[81,96],[81,97],[81,98],[81,99],[82,83],[82,84],[82,85],[82,86],[82,87],[82,88],[82,89],[82,90],[82,91],[82,92],[82,93],[82,94],[82,95],[82,96],[82,97],[82,98],[82,99],[83,84],[83,85],[83,86],[83,87],[83,88],[83,89],[83,90],[83,91],[83,92],[83,93],[83,94],[83,95],[83,96],[83,97],[83,98],[83,99],[84,85],[84,86],[84,87],[84,88],[84,89],[84,90],[84,91],[84,92],[84,93],[84,94],[84,95],[84,96],[84,97],[84,98],[84,99],[85,86],[85,87],[85,88],[85,89],[85,90],[85,91],[85,92],[85,93],[85,94],[85,95],[85,96],[85,97],[85,98],[85,99],[86,87],[86,88],[86,89],[86,90],[86,91],[86,92],[86,93],[86,94],[86,95],[86,96],[86,97],[86,98],[86,99],[87,88],[87,89],[87,90],[87,91],[87,92],[87,93],[87,94],[87,95],[87,96],[87,97],[87,98],[87,99],[88,89],[88,90],[88,91],[88,92],[88,93],[88,94],[88,95],[88,96],[88,97],[88,98],[88,99],[89,90],[89,91],[89,92],[89,93],[89,94],[89,95],[89,96],[89,97],[89,98],[89,99],[90,91],[90,92],[90,93],[90,94],[90,95],[90,96],[90,97],[90,98],[90,99],[91,92],[91,93],[91,94],[91,95],[91,96],[91,97],[91,98],[91,99],[92,93],[92,94],[92,95],[92,96],[92,97],[92,98],[92,99],[93,94],[93,95],[93,96],[93,97],[93,98],[93,99],[94,95],[94,96],[94,97],[94,98],[94,99],[95,96],[95,97],[95,98],[95,99],[96,97],[96,98],[96,99],[97,98],[97,99],[98,99]"), 0, 99)); + assertTrue( + solution1.leadsToDestination( + 100, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[0,12],[0,13],[0,14],[0,15],[0,16],[0,17],[0,18],[0,19],[0,20],[0,21],[0,22],[0,23],[0,24],[0,25],[0,26],[0,27],[0,28],[0,29],[0,30],[0,31],[0,32],[0,33],[0,34],[0,35],[0,36],[0,37],[0,38],[0,39],[0,40],[0,41],[0,42],[0,43],[0,44],[0,45],[0,46],[0,47],[0,48],[0,49],[0,50],[0,51],[0,52],[0,53],[0,54],[0,55],[0,56],[0,57],[0,58],[0,59],[0,60],[0,61],[0,62],[0,63],[0,64],[0,65],[0,66],[0,67],[0,68],[0,69],[0,70],[0,71],[0,72],[0,73],[0,74],[0,75],[0,76],[0,77],[0,78],[0,79],[0,80],[0,81],[0,82],[0,83],[0,84],[0,85],[0,86],[0,87],[0,88],[0,89],[0,90],[0,91],[0,92],[0,93],[0,94],[0,95],[0,96],[0,97],[0,98],[0,99],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10],[1,11],[1,12],[1,13],[1,14],[1,15],[1,16],[1,17],[1,18],[1,19],[1,20],[1,21],[1,22],[1,23],[1,24],[1,25],[1,26],[1,27],[1,28],[1,29],[1,30],[1,31],[1,32],[1,33],[1,34],[1,35],[1,36],[1,37],[1,38],[1,39],[1,40],[1,41],[1,42],[1,43],[1,44],[1,45],[1,46],[1,47],[1,48],[1,49],[1,50],[1,51],[1,52],[1,53],[1,54],[1,55],[1,56],[1,57],[1,58],[1,59],[1,60],[1,61],[1,62],[1,63],[1,64],[1,65],[1,66],[1,67],[1,68],[1,69],[1,70],[1,71],[1,72],[1,73],[1,74],[1,75],[1,76],[1,77],[1,78],[1,79],[1,80],[1,81],[1,82],[1,83],[1,84],[1,85],[1,86],[1,87],[1,88],[1,89],[1,90],[1,91],[1,92],[1,93],[1,94],[1,95],[1,96],[1,97],[1,98],[1,99],[2,3],[2,4],[2,5],[2,6],[2,7],[2,8],[2,9],[2,10],[2,11],[2,12],[2,13],[2,14],[2,15],[2,16],[2,17],[2,18],[2,19],[2,20],[2,21],[2,22],[2,23],[2,24],[2,25],[2,26],[2,27],[2,28],[2,29],[2,30],[2,31],[2,32],[2,33],[2,34],[2,35],[2,36],[2,37],[2,38],[2,39],[2,40],[2,41],[2,42],[2,43],[2,44],[2,45],[2,46],[2,47],[2,48],[2,49],[2,50],[2,51],[2,52],[2,53],[2,54],[2,55],[2,56],[2,57],[2,58],[2,59],[2,60],[2,61],[2,62],[2,63],[2,64],[2,65],[2,66],[2,67],[2,68],[2,69],[2,70],[2,71],[2,72],[2,73],[2,74],[2,75],[2,76],[2,77],[2,78],[2,79],[2,80],[2,81],[2,82],[2,83],[2,84],[2,85],[2,86],[2,87],[2,88],[2,89],[2,90],[2,91],[2,92],[2,93],[2,94],[2,95],[2,96],[2,97],[2,98],[2,99],[3,4],[3,5],[3,6],[3,7],[3,8],[3,9],[3,10],[3,11],[3,12],[3,13],[3,14],[3,15],[3,16],[3,17],[3,18],[3,19],[3,20],[3,21],[3,22],[3,23],[3,24],[3,25],[3,26],[3,27],[3,28],[3,29],[3,30],[3,31],[3,32],[3,33],[3,34],[3,35],[3,36],[3,37],[3,38],[3,39],[3,40],[3,41],[3,42],[3,43],[3,44],[3,45],[3,46],[3,47],[3,48],[3,49],[3,50],[3,51],[3,52],[3,53],[3,54],[3,55],[3,56],[3,57],[3,58],[3,59],[3,60],[3,61],[3,62],[3,63],[3,64],[3,65],[3,66],[3,67],[3,68],[3,69],[3,70],[3,71],[3,72],[3,73],[3,74],[3,75],[3,76],[3,77],[3,78],[3,79],[3,80],[3,81],[3,82],[3,83],[3,84],[3,85],[3,86],[3,87],[3,88],[3,89],[3,90],[3,91],[3,92],[3,93],[3,94],[3,95],[3,96],[3,97],[3,98],[3,99],[4,5],[4,6],[4,7],[4,8],[4,9],[4,10],[4,11],[4,12],[4,13],[4,14],[4,15],[4,16],[4,17],[4,18],[4,19],[4,20],[4,21],[4,22],[4,23],[4,24],[4,25],[4,26],[4,27],[4,28],[4,29],[4,30],[4,31],[4,32],[4,33],[4,34],[4,35],[4,36],[4,37],[4,38],[4,39],[4,40],[4,41],[4,42],[4,43],[4,44],[4,45],[4,46],[4,47],[4,48],[4,49],[4,50],[4,51],[4,52],[4,53],[4,54],[4,55],[4,56],[4,57],[4,58],[4,59],[4,60],[4,61],[4,62],[4,63],[4,64],[4,65],[4,66],[4,67],[4,68],[4,69],[4,70],[4,71],[4,72],[4,73],[4,74],[4,75],[4,76],[4,77],[4,78],[4,79],[4,80],[4,81],[4,82],[4,83],[4,84],[4,85],[4,86],[4,87],[4,88],[4,89],[4,90],[4,91],[4,92],[4,93],[4,94],[4,95],[4,96],[4,97],[4,98],[4,99],[5,6],[5,7],[5,8],[5,9],[5,10],[5,11],[5,12],[5,13],[5,14],[5,15],[5,16],[5,17],[5,18],[5,19],[5,20],[5,21],[5,22],[5,23],[5,24],[5,25],[5,26],[5,27],[5,28],[5,29],[5,30],[5,31],[5,32],[5,33],[5,34],[5,35],[5,36],[5,37],[5,38],[5,39],[5,40],[5,41],[5,42],[5,43],[5,44],[5,45],[5,46],[5,47],[5,48],[5,49],[5,50],[5,51],[5,52],[5,53],[5,54],[5,55],[5,56],[5,57],[5,58],[5,59],[5,60],[5,61],[5,62],[5,63],[5,64],[5,65],[5,66],[5,67],[5,68],[5,69],[5,70],[5,71],[5,72],[5,73],[5,74],[5,75],[5,76],[5,77],[5,78],[5,79],[5,80],[5,81],[5,82],[5,83],[5,84],[5,85],[5,86],[5,87],[5,88],[5,89],[5,90],[5,91],[5,92],[5,93],[5,94],[5,95],[5,96],[5,97],[5,98],[5,99],[6,7],[6,8],[6,9],[6,10],[6,11],[6,12],[6,13],[6,14],[6,15],[6,16],[6,17],[6,18],[6,19],[6,20],[6,21],[6,22],[6,23],[6,24],[6,25],[6,26],[6,27],[6,28],[6,29],[6,30],[6,31],[6,32],[6,33],[6,34],[6,35],[6,36],[6,37],[6,38],[6,39],[6,40],[6,41],[6,42],[6,43],[6,44],[6,45],[6,46],[6,47],[6,48],[6,49],[6,50],[6,51],[6,52],[6,53],[6,54],[6,55],[6,56],[6,57],[6,58],[6,59],[6,60],[6,61],[6,62],[6,63],[6,64],[6,65],[6,66],[6,67],[6,68],[6,69],[6,70],[6,71],[6,72],[6,73],[6,74],[6,75],[6,76],[6,77],[6,78],[6,79],[6,80],[6,81],[6,82],[6,83],[6,84],[6,85],[6,86],[6,87],[6,88],[6,89],[6,90],[6,91],[6,92],[6,93],[6,94],[6,95],[6,96],[6,97],[6,98],[6,99],[7,8],[7,9],[7,10],[7,11],[7,12],[7,13],[7,14],[7,15],[7,16],[7,17],[7,18],[7,19],[7,20],[7,21],[7,22],[7,23],[7,24],[7,25],[7,26],[7,27],[7,28],[7,29],[7,30],[7,31],[7,32],[7,33],[7,34],[7,35],[7,36],[7,37],[7,38],[7,39],[7,40],[7,41],[7,42],[7,43],[7,44],[7,45],[7,46],[7,47],[7,48],[7,49],[7,50],[7,51],[7,52],[7,53],[7,54],[7,55],[7,56],[7,57],[7,58],[7,59],[7,60],[7,61],[7,62],[7,63],[7,64],[7,65],[7,66],[7,67],[7,68],[7,69],[7,70],[7,71],[7,72],[7,73],[7,74],[7,75],[7,76],[7,77],[7,78],[7,79],[7,80],[7,81],[7,82],[7,83],[7,84],[7,85],[7,86],[7,87],[7,88],[7,89],[7,90],[7,91],[7,92],[7,93],[7,94],[7,95],[7,96],[7,97],[7,98],[7,99],[8,9],[8,10],[8,11],[8,12],[8,13],[8,14],[8,15],[8,16],[8,17],[8,18],[8,19],[8,20],[8,21],[8,22],[8,23],[8,24],[8,25],[8,26],[8,27],[8,28],[8,29],[8,30],[8,31],[8,32],[8,33],[8,34],[8,35],[8,36],[8,37],[8,38],[8,39],[8,40],[8,41],[8,42],[8,43],[8,44],[8,45],[8,46],[8,47],[8,48],[8,49],[8,50],[8,51],[8,52],[8,53],[8,54],[8,55],[8,56],[8,57],[8,58],[8,59],[8,60],[8,61],[8,62],[8,63],[8,64],[8,65],[8,66],[8,67],[8,68],[8,69],[8,70],[8,71],[8,72],[8,73],[8,74],[8,75],[8,76],[8,77],[8,78],[8,79],[8,80],[8,81],[8,82],[8,83],[8,84],[8,85],[8,86],[8,87],[8,88],[8,89],[8,90],[8,91],[8,92],[8,93],[8,94],[8,95],[8,96],[8,97],[8,98],[8,99],[9,10],[9,11],[9,12],[9,13],[9,14],[9,15],[9,16],[9,17],[9,18],[9,19],[9,20],[9,21],[9,22],[9,23],[9,24],[9,25],[9,26],[9,27],[9,28],[9,29],[9,30],[9,31],[9,32],[9,33],[9,34],[9,35],[9,36],[9,37],[9,38],[9,39],[9,40],[9,41],[9,42],[9,43],[9,44],[9,45],[9,46],[9,47],[9,48],[9,49],[9,50],[9,51],[9,52],[9,53],[9,54],[9,55],[9,56],[9,57],[9,58],[9,59],[9,60],[9,61],[9,62],[9,63],[9,64],[9,65],[9,66],[9,67],[9,68],[9,69],[9,70],[9,71],[9,72],[9,73],[9,74],[9,75],[9,76],[9,77],[9,78],[9,79],[9,80],[9,81],[9,82],[9,83],[9,84],[9,85],[9,86],[9,87],[9,88],[9,89],[9,90],[9,91],[9,92],[9,93],[9,94],[9,95],[9,96],[9,97],[9,98],[9,99],[10,11],[10,12],[10,13],[10,14],[10,15],[10,16],[10,17],[10,18],[10,19],[10,20],[10,21],[10,22],[10,23],[10,24],[10,25],[10,26],[10,27],[10,28],[10,29],[10,30],[10,31],[10,32],[10,33],[10,34],[10,35],[10,36],[10,37],[10,38],[10,39],[10,40],[10,41],[10,42],[10,43],[10,44],[10,45],[10,46],[10,47],[10,48],[10,49],[10,50],[10,51],[10,52],[10,53],[10,54],[10,55],[10,56],[10,57],[10,58],[10,59],[10,60],[10,61],[10,62],[10,63],[10,64],[10,65],[10,66],[10,67],[10,68],[10,69],[10,70],[10,71],[10,72],[10,73],[10,74],[10,75],[10,76],[10,77],[10,78],[10,79],[10,80],[10,81],[10,82],[10,83],[10,84],[10,85],[10,86],[10,87],[10,88],[10,89],[10,90],[10,91],[10,92],[10,93],[10,94],[10,95],[10,96],[10,97],[10,98],[10,99],[11,12],[11,13],[11,14],[11,15],[11,16],[11,17],[11,18],[11,19],[11,20],[11,21],[11,22],[11,23],[11,24],[11,25],[11,26],[11,27],[11,28],[11,29],[11,30],[11,31],[11,32],[11,33],[11,34],[11,35],[11,36],[11,37],[11,38],[11,39],[11,40],[11,41],[11,42],[11,43],[11,44],[11,45],[11,46],[11,47],[11,48],[11,49],[11,50],[11,51],[11,52],[11,53],[11,54],[11,55],[11,56],[11,57],[11,58],[11,59],[11,60],[11,61],[11,62],[11,63],[11,64],[11,65],[11,66],[11,67],[11,68],[11,69],[11,70],[11,71],[11,72],[11,73],[11,74],[11,75],[11,76],[11,77],[11,78],[11,79],[11,80],[11,81],[11,82],[11,83],[11,84],[11,85],[11,86],[11,87],[11,88],[11,89],[11,90],[11,91],[11,92],[11,93],[11,94],[11,95],[11,96],[11,97],[11,98],[11,99],[12,13],[12,14],[12,15],[12,16],[12,17],[12,18],[12,19],[12,20],[12,21],[12,22],[12,23],[12,24],[12,25],[12,26],[12,27],[12,28],[12,29],[12,30],[12,31],[12,32],[12,33],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[12,40],[12,41],[12,42],[12,43],[12,44],[12,45],[12,46],[12,47],[12,48],[12,49],[12,50],[12,51],[12,52],[12,53],[12,54],[12,55],[12,56],[12,57],[12,58],[12,59],[12,60],[12,61],[12,62],[12,63],[12,64],[12,65],[12,66],[12,67],[12,68],[12,69],[12,70],[12,71],[12,72],[12,73],[12,74],[12,75],[12,76],[12,77],[12,78],[12,79],[12,80],[12,81],[12,82],[12,83],[12,84],[12,85],[12,86],[12,87],[12,88],[12,89],[12,90],[12,91],[12,92],[12,93],[12,94],[12,95],[12,96],[12,97],[12,98],[12,99],[13,14],[13,15],[13,16],[13,17],[13,18],[13,19],[13,20],[13,21],[13,22],[13,23],[13,24],[13,25],[13,26],[13,27],[13,28],[13,29],[13,30],[13,31],[13,32],[13,33],[13,34],[13,35],[13,36],[13,37],[13,38],[13,39],[13,40],[13,41],[13,42],[13,43],[13,44],[13,45],[13,46],[13,47],[13,48],[13,49],[13,50],[13,51],[13,52],[13,53],[13,54],[13,55],[13,56],[13,57],[13,58],[13,59],[13,60],[13,61],[13,62],[13,63],[13,64],[13,65],[13,66],[13,67],[13,68],[13,69],[13,70],[13,71],[13,72],[13,73],[13,74],[13,75],[13,76],[13,77],[13,78],[13,79],[13,80],[13,81],[13,82],[13,83],[13,84],[13,85],[13,86],[13,87],[13,88],[13,89],[13,90],[13,91],[13,92],[13,93],[13,94],[13,95],[13,96],[13,97],[13,98],[13,99],[14,15],[14,16],[14,17],[14,18],[14,19],[14,20],[14,21],[14,22],[14,23],[14,24],[14,25],[14,26],[14,27],[14,28],[14,29],[14,30],[14,31],[14,32],[14,33],[14,34],[14,35],[14,36],[14,37],[14,38],[14,39],[14,40],[14,41],[14,42],[14,43],[14,44],[14,45],[14,46],[14,47],[14,48],[14,49],[14,50],[14,51],[14,52],[14,53],[14,54],[14,55],[14,56],[14,57],[14,58],[14,59],[14,60],[14,61],[14,62],[14,63],[14,64],[14,65],[14,66],[14,67],[14,68],[14,69],[14,70],[14,71],[14,72],[14,73],[14,74],[14,75],[14,76],[14,77],[14,78],[14,79],[14,80],[14,81],[14,82],[14,83],[14,84],[14,85],[14,86],[14,87],[14,88],[14,89],[14,90],[14,91],[14,92],[14,93],[14,94],[14,95],[14,96],[14,97],[14,98],[14,99],[15,16],[15,17],[15,18],[15,19],[15,20],[15,21],[15,22],[15,23],[15,24],[15,25],[15,26],[15,27],[15,28],[15,29],[15,30],[15,31],[15,32],[15,33],[15,34],[15,35],[15,36],[15,37],[15,38],[15,39],[15,40],[15,41],[15,42],[15,43],[15,44],[15,45],[15,46],[15,47],[15,48],[15,49],[15,50],[15,51],[15,52],[15,53],[15,54],[15,55],[15,56],[15,57],[15,58],[15,59],[15,60],[15,61],[15,62],[15,63],[15,64],[15,65],[15,66],[15,67],[15,68],[15,69],[15,70],[15,71],[15,72],[15,73],[15,74],[15,75],[15,76],[15,77],[15,78],[15,79],[15,80],[15,81],[15,82],[15,83],[15,84],[15,85],[15,86],[15,87],[15,88],[15,89],[15,90],[15,91],[15,92],[15,93],[15,94],[15,95],[15,96],[15,97],[15,98],[15,99],[16,17],[16,18],[16,19],[16,20],[16,21],[16,22],[16,23],[16,24],[16,25],[16,26],[16,27],[16,28],[16,29],[16,30],[16,31],[16,32],[16,33],[16,34],[16,35],[16,36],[16,37],[16,38],[16,39],[16,40],[16,41],[16,42],[16,43],[16,44],[16,45],[16,46],[16,47],[16,48],[16,49],[16,50],[16,51],[16,52],[16,53],[16,54],[16,55],[16,56],[16,57],[16,58],[16,59],[16,60],[16,61],[16,62],[16,63],[16,64],[16,65],[16,66],[16,67],[16,68],[16,69],[16,70],[16,71],[16,72],[16,73],[16,74],[16,75],[16,76],[16,77],[16,78],[16,79],[16,80],[16,81],[16,82],[16,83],[16,84],[16,85],[16,86],[16,87],[16,88],[16,89],[16,90],[16,91],[16,92],[16,93],[16,94],[16,95],[16,96],[16,97],[16,98],[16,99],[17,18],[17,19],[17,20],[17,21],[17,22],[17,23],[17,24],[17,25],[17,26],[17,27],[17,28],[17,29],[17,30],[17,31],[17,32],[17,33],[17,34],[17,35],[17,36],[17,37],[17,38],[17,39],[17,40],[17,41],[17,42],[17,43],[17,44],[17,45],[17,46],[17,47],[17,48],[17,49],[17,50],[17,51],[17,52],[17,53],[17,54],[17,55],[17,56],[17,57],[17,58],[17,59],[17,60],[17,61],[17,62],[17,63],[17,64],[17,65],[17,66],[17,67],[17,68],[17,69],[17,70],[17,71],[17,72],[17,73],[17,74],[17,75],[17,76],[17,77],[17,78],[17,79],[17,80],[17,81],[17,82],[17,83],[17,84],[17,85],[17,86],[17,87],[17,88],[17,89],[17,90],[17,91],[17,92],[17,93],[17,94],[17,95],[17,96],[17,97],[17,98],[17,99],[18,19],[18,20],[18,21],[18,22],[18,23],[18,24],[18,25],[18,26],[18,27],[18,28],[18,29],[18,30],[18,31],[18,32],[18,33],[18,34],[18,35],[18,36],[18,37],[18,38],[18,39],[18,40],[18,41],[18,42],[18,43],[18,44],[18,45],[18,46],[18,47],[18,48],[18,49],[18,50],[18,51],[18,52],[18,53],[18,54],[18,55],[18,56],[18,57],[18,58],[18,59],[18,60],[18,61],[18,62],[18,63],[18,64],[18,65],[18,66],[18,67],[18,68],[18,69],[18,70],[18,71],[18,72],[18,73],[18,74],[18,75],[18,76],[18,77],[18,78],[18,79],[18,80],[18,81],[18,82],[18,83],[18,84],[18,85],[18,86],[18,87],[18,88],[18,89],[18,90],[18,91],[18,92],[18,93],[18,94],[18,95],[18,96],[18,97],[18,98],[18,99],[19,20],[19,21],[19,22],[19,23],[19,24],[19,25],[19,26],[19,27],[19,28],[19,29],[19,30],[19,31],[19,32],[19,33],[19,34],[19,35],[19,36],[19,37],[19,38],[19,39],[19,40],[19,41],[19,42],[19,43],[19,44],[19,45],[19,46],[19,47],[19,48],[19,49],[19,50],[19,51],[19,52],[19,53],[19,54],[19,55],[19,56],[19,57],[19,58],[19,59],[19,60],[19,61],[19,62],[19,63],[19,64],[19,65],[19,66],[19,67],[19,68],[19,69],[19,70],[19,71],[19,72],[19,73],[19,74],[19,75],[19,76],[19,77],[19,78],[19,79],[19,80],[19,81],[19,82],[19,83],[19,84],[19,85],[19,86],[19,87],[19,88],[19,89],[19,90],[19,91],[19,92],[19,93],[19,94],[19,95],[19,96],[19,97],[19,98],[19,99],[20,21],[20,22],[20,23],[20,24],[20,25],[20,26],[20,27],[20,28],[20,29],[20,30],[20,31],[20,32],[20,33],[20,34],[20,35],[20,36],[20,37],[20,38],[20,39],[20,40],[20,41],[20,42],[20,43],[20,44],[20,45],[20,46],[20,47],[20,48],[20,49],[20,50],[20,51],[20,52],[20,53],[20,54],[20,55],[20,56],[20,57],[20,58],[20,59],[20,60],[20,61],[20,62],[20,63],[20,64],[20,65],[20,66],[20,67],[20,68],[20,69],[20,70],[20,71],[20,72],[20,73],[20,74],[20,75],[20,76],[20,77],[20,78],[20,79],[20,80],[20,81],[20,82],[20,83],[20,84],[20,85],[20,86],[20,87],[20,88],[20,89],[20,90],[20,91],[20,92],[20,93],[20,94],[20,95],[20,96],[20,97],[20,98],[20,99],[21,22],[21,23],[21,24],[21,25],[21,26],[21,27],[21,28],[21,29],[21,30],[21,31],[21,32],[21,33],[21,34],[21,35],[21,36],[21,37],[21,38],[21,39],[21,40],[21,41],[21,42],[21,43],[21,44],[21,45],[21,46],[21,47],[21,48],[21,49],[21,50],[21,51],[21,52],[21,53],[21,54],[21,55],[21,56],[21,57],[21,58],[21,59],[21,60],[21,61],[21,62],[21,63],[21,64],[21,65],[21,66],[21,67],[21,68],[21,69],[21,70],[21,71],[21,72],[21,73],[21,74],[21,75],[21,76],[21,77],[21,78],[21,79],[21,80],[21,81],[21,82],[21,83],[21,84],[21,85],[21,86],[21,87],[21,88],[21,89],[21,90],[21,91],[21,92],[21,93],[21,94],[21,95],[21,96],[21,97],[21,98],[21,99],[22,23],[22,24],[22,25],[22,26],[22,27],[22,28],[22,29],[22,30],[22,31],[22,32],[22,33],[22,34],[22,35],[22,36],[22,37],[22,38],[22,39],[22,40],[22,41],[22,42],[22,43],[22,44],[22,45],[22,46],[22,47],[22,48],[22,49],[22,50],[22,51],[22,52],[22,53],[22,54],[22,55],[22,56],[22,57],[22,58],[22,59],[22,60],[22,61],[22,62],[22,63],[22,64],[22,65],[22,66],[22,67],[22,68],[22,69],[22,70],[22,71],[22,72],[22,73],[22,74],[22,75],[22,76],[22,77],[22,78],[22,79],[22,80],[22,81],[22,82],[22,83],[22,84],[22,85],[22,86],[22,87],[22,88],[22,89],[22,90],[22,91],[22,92],[22,93],[22,94],[22,95],[22,96],[22,97],[22,98],[22,99],[23,24],[23,25],[23,26],[23,27],[23,28],[23,29],[23,30],[23,31],[23,32],[23,33],[23,34],[23,35],[23,36],[23,37],[23,38],[23,39],[23,40],[23,41],[23,42],[23,43],[23,44],[23,45],[23,46],[23,47],[23,48],[23,49],[23,50],[23,51],[23,52],[23,53],[23,54],[23,55],[23,56],[23,57],[23,58],[23,59],[23,60],[23,61],[23,62],[23,63],[23,64],[23,65],[23,66],[23,67],[23,68],[23,69],[23,70],[23,71],[23,72],[23,73],[23,74],[23,75],[23,76],[23,77],[23,78],[23,79],[23,80],[23,81],[23,82],[23,83],[23,84],[23,85],[23,86],[23,87],[23,88],[23,89],[23,90],[23,91],[23,92],[23,93],[23,94],[23,95],[23,96],[23,97],[23,98],[23,99],[24,25],[24,26],[24,27],[24,28],[24,29],[24,30],[24,31],[24,32],[24,33],[24,34],[24,35],[24,36],[24,37],[24,38],[24,39],[24,40],[24,41],[24,42],[24,43],[24,44],[24,45],[24,46],[24,47],[24,48],[24,49],[24,50],[24,51],[24,52],[24,53],[24,54],[24,55],[24,56],[24,57],[24,58],[24,59],[24,60],[24,61],[24,62],[24,63],[24,64],[24,65],[24,66],[24,67],[24,68],[24,69],[24,70],[24,71],[24,72],[24,73],[24,74],[24,75],[24,76],[24,77],[24,78],[24,79],[24,80],[24,81],[24,82],[24,83],[24,84],[24,85],[24,86],[24,87],[24,88],[24,89],[24,90],[24,91],[24,92],[24,93],[24,94],[24,95],[24,96],[24,97],[24,98],[24,99],[25,26],[25,27],[25,28],[25,29],[25,30],[25,31],[25,32],[25,33],[25,34],[25,35],[25,36],[25,37],[25,38],[25,39],[25,40],[25,41],[25,42],[25,43],[25,44],[25,45],[25,46],[25,47],[25,48],[25,49],[25,50],[25,51],[25,52],[25,53],[25,54],[25,55],[25,56],[25,57],[25,58],[25,59],[25,60],[25,61],[25,62],[25,63],[25,64],[25,65],[25,66],[25,67],[25,68],[25,69],[25,70],[25,71],[25,72],[25,73],[25,74],[25,75],[25,76],[25,77],[25,78],[25,79],[25,80],[25,81],[25,82],[25,83],[25,84],[25,85],[25,86],[25,87],[25,88],[25,89],[25,90],[25,91],[25,92],[25,93],[25,94],[25,95],[25,96],[25,97],[25,98],[25,99],[26,27],[26,28],[26,29],[26,30],[26,31],[26,32],[26,33],[26,34],[26,35],[26,36],[26,37],[26,38],[26,39],[26,40],[26,41],[26,42],[26,43],[26,44],[26,45],[26,46],[26,47],[26,48],[26,49],[26,50],[26,51],[26,52],[26,53],[26,54],[26,55],[26,56],[26,57],[26,58],[26,59],[26,60],[26,61],[26,62],[26,63],[26,64],[26,65],[26,66],[26,67],[26,68],[26,69],[26,70],[26,71],[26,72],[26,73],[26,74],[26,75],[26,76],[26,77],[26,78],[26,79],[26,80],[26,81],[26,82],[26,83],[26,84],[26,85],[26,86],[26,87],[26,88],[26,89],[26,90],[26,91],[26,92],[26,93],[26,94],[26,95],[26,96],[26,97],[26,98],[26,99],[27,28],[27,29],[27,30],[27,31],[27,32],[27,33],[27,34],[27,35],[27,36],[27,37],[27,38],[27,39],[27,40],[27,41],[27,42],[27,43],[27,44],[27,45],[27,46],[27,47],[27,48],[27,49],[27,50],[27,51],[27,52],[27,53],[27,54],[27,55],[27,56],[27,57],[27,58],[27,59],[27,60],[27,61],[27,62],[27,63],[27,64],[27,65],[27,66],[27,67],[27,68],[27,69],[27,70],[27,71],[27,72],[27,73],[27,74],[27,75],[27,76],[27,77],[27,78],[27,79],[27,80],[27,81],[27,82],[27,83],[27,84],[27,85],[27,86],[27,87],[27,88],[27,89],[27,90],[27,91],[27,92],[27,93],[27,94],[27,95],[27,96],[27,97],[27,98],[27,99],[28,29],[28,30],[28,31],[28,32],[28,33],[28,34],[28,35],[28,36],[28,37],[28,38],[28,39],[28,40],[28,41],[28,42],[28,43],[28,44],[28,45],[28,46],[28,47],[28,48],[28,49],[28,50],[28,51],[28,52],[28,53],[28,54],[28,55],[28,56],[28,57],[28,58],[28,59],[28,60],[28,61],[28,62],[28,63],[28,64],[28,65],[28,66],[28,67],[28,68],[28,69],[28,70],[28,71],[28,72],[28,73],[28,74],[28,75],[28,76],[28,77],[28,78],[28,79],[28,80],[28,81],[28,82],[28,83],[28,84],[28,85],[28,86],[28,87],[28,88],[28,89],[28,90],[28,91],[28,92],[28,93],[28,94],[28,95],[28,96],[28,97],[28,98],[28,99],[29,30],[29,31],[29,32],[29,33],[29,34],[29,35],[29,36],[29,37],[29,38],[29,39],[29,40],[29,41],[29,42],[29,43],[29,44],[29,45],[29,46],[29,47],[29,48],[29,49],[29,50],[29,51],[29,52],[29,53],[29,54],[29,55],[29,56],[29,57],[29,58],[29,59],[29,60],[29,61],[29,62],[29,63],[29,64],[29,65],[29,66],[29,67],[29,68],[29,69],[29,70],[29,71],[29,72],[29,73],[29,74],[29,75],[29,76],[29,77],[29,78],[29,79],[29,80],[29,81],[29,82],[29,83],[29,84],[29,85],[29,86],[29,87],[29,88],[29,89],[29,90],[29,91],[29,92],[29,93],[29,94],[29,95],[29,96],[29,97],[29,98],[29,99],[30,31],[30,32],[30,33],[30,34],[30,35],[30,36],[30,37],[30,38],[30,39],[30,40],[30,41],[30,42],[30,43],[30,44],[30,45],[30,46],[30,47],[30,48],[30,49],[30,50],[30,51],[30,52],[30,53],[30,54],[30,55],[30,56],[30,57],[30,58],[30,59],[30,60],[30,61],[30,62],[30,63],[30,64],[30,65],[30,66],[30,67],[30,68],[30,69],[30,70],[30,71],[30,72],[30,73],[30,74],[30,75],[30,76],[30,77],[30,78],[30,79],[30,80],[30,81],[30,82],[30,83],[30,84],[30,85],[30,86],[30,87],[30,88],[30,89],[30,90],[30,91],[30,92],[30,93],[30,94],[30,95],[30,96],[30,97],[30,98],[30,99],[31,32],[31,33],[31,34],[31,35],[31,36],[31,37],[31,38],[31,39],[31,40],[31,41],[31,42],[31,43],[31,44],[31,45],[31,46],[31,47],[31,48],[31,49],[31,50],[31,51],[31,52],[31,53],[31,54],[31,55],[31,56],[31,57],[31,58],[31,59],[31,60],[31,61],[31,62],[31,63],[31,64],[31,65],[31,66],[31,67],[31,68],[31,69],[31,70],[31,71],[31,72],[31,73],[31,74],[31,75],[31,76],[31,77],[31,78],[31,79],[31,80],[31,81],[31,82],[31,83],[31,84],[31,85],[31,86],[31,87],[31,88],[31,89],[31,90],[31,91],[31,92],[31,93],[31,94],[31,95],[31,96],[31,97],[31,98],[31,99],[32,33],[32,34],[32,35],[32,36],[32,37],[32,38],[32,39],[32,40],[32,41],[32,42],[32,43],[32,44],[32,45],[32,46],[32,47],[32,48],[32,49],[32,50],[32,51],[32,52],[32,53],[32,54],[32,55],[32,56],[32,57],[32,58],[32,59],[32,60],[32,61],[32,62],[32,63],[32,64],[32,65],[32,66],[32,67],[32,68],[32,69],[32,70],[32,71],[32,72],[32,73],[32,74],[32,75],[32,76],[32,77],[32,78],[32,79],[32,80],[32,81],[32,82],[32,83],[32,84],[32,85],[32,86],[32,87],[32,88],[32,89],[32,90],[32,91],[32,92],[32,93],[32,94],[32,95],[32,96],[32,97],[32,98],[32,99],[33,34],[33,35],[33,36],[33,37],[33,38],[33,39],[33,40],[33,41],[33,42],[33,43],[33,44],[33,45],[33,46],[33,47],[33,48],[33,49],[33,50],[33,51],[33,52],[33,53],[33,54],[33,55],[33,56],[33,57],[33,58],[33,59],[33,60],[33,61],[33,62],[33,63],[33,64],[33,65],[33,66],[33,67],[33,68],[33,69],[33,70],[33,71],[33,72],[33,73],[33,74],[33,75],[33,76],[33,77],[33,78],[33,79],[33,80],[33,81],[33,82],[33,83],[33,84],[33,85],[33,86],[33,87],[33,88],[33,89],[33,90],[33,91],[33,92],[33,93],[33,94],[33,95],[33,96],[33,97],[33,98],[33,99],[34,35],[34,36],[34,37],[34,38],[34,39],[34,40],[34,41],[34,42],[34,43],[34,44],[34,45],[34,46],[34,47],[34,48],[34,49],[34,50],[34,51],[34,52],[34,53],[34,54],[34,55],[34,56],[34,57],[34,58],[34,59],[34,60],[34,61],[34,62],[34,63],[34,64],[34,65],[34,66],[34,67],[34,68],[34,69],[34,70],[34,71],[34,72],[34,73],[34,74],[34,75],[34,76],[34,77],[34,78],[34,79],[34,80],[34,81],[34,82],[34,83],[34,84],[34,85],[34,86],[34,87],[34,88],[34,89],[34,90],[34,91],[34,92],[34,93],[34,94],[34,95],[34,96],[34,97],[34,98],[34,99],[35,36],[35,37],[35,38],[35,39],[35,40],[35,41],[35,42],[35,43],[35,44],[35,45],[35,46],[35,47],[35,48],[35,49],[35,50],[35,51],[35,52],[35,53],[35,54],[35,55],[35,56],[35,57],[35,58],[35,59],[35,60],[35,61],[35,62],[35,63],[35,64],[35,65],[35,66],[35,67],[35,68],[35,69],[35,70],[35,71],[35,72],[35,73],[35,74],[35,75],[35,76],[35,77],[35,78],[35,79],[35,80],[35,81],[35,82],[35,83],[35,84],[35,85],[35,86],[35,87],[35,88],[35,89],[35,90],[35,91],[35,92],[35,93],[35,94],[35,95],[35,96],[35,97],[35,98],[35,99],[36,37],[36,38],[36,39],[36,40],[36,41],[36,42],[36,43],[36,44],[36,45],[36,46],[36,47],[36,48],[36,49],[36,50],[36,51],[36,52],[36,53],[36,54],[36,55],[36,56],[36,57],[36,58],[36,59],[36,60],[36,61],[36,62],[36,63],[36,64],[36,65],[36,66],[36,67],[36,68],[36,69],[36,70],[36,71],[36,72],[36,73],[36,74],[36,75],[36,76],[36,77],[36,78],[36,79],[36,80],[36,81],[36,82],[36,83],[36,84],[36,85],[36,86],[36,87],[36,88],[36,89],[36,90],[36,91],[36,92],[36,93],[36,94],[36,95],[36,96],[36,97],[36,98],[36,99],[37,38],[37,39],[37,40],[37,41],[37,42],[37,43],[37,44],[37,45],[37,46],[37,47],[37,48],[37,49],[37,50],[37,51],[37,52],[37,53],[37,54],[37,55],[37,56],[37,57],[37,58],[37,59],[37,60],[37,61],[37,62],[37,63],[37,64],[37,65],[37,66],[37,67],[37,68],[37,69],[37,70],[37,71],[37,72],[37,73],[37,74],[37,75],[37,76],[37,77],[37,78],[37,79],[37,80],[37,81],[37,82],[37,83],[37,84],[37,85],[37,86],[37,87],[37,88],[37,89],[37,90],[37,91],[37,92],[37,93],[37,94],[37,95],[37,96],[37,97],[37,98],[37,99],[38,39],[38,40],[38,41],[38,42],[38,43],[38,44],[38,45],[38,46],[38,47],[38,48],[38,49],[38,50],[38,51],[38,52],[38,53],[38,54],[38,55],[38,56],[38,57],[38,58],[38,59],[38,60],[38,61],[38,62],[38,63],[38,64],[38,65],[38,66],[38,67],[38,68],[38,69],[38,70],[38,71],[38,72],[38,73],[38,74],[38,75],[38,76],[38,77],[38,78],[38,79],[38,80],[38,81],[38,82],[38,83],[38,84],[38,85],[38,86],[38,87],[38,88],[38,89],[38,90],[38,91],[38,92],[38,93],[38,94],[38,95],[38,96],[38,97],[38,98],[38,99],[39,40],[39,41],[39,42],[39,43],[39,44],[39,45],[39,46],[39,47],[39,48],[39,49],[39,50],[39,51],[39,52],[39,53],[39,54],[39,55],[39,56],[39,57],[39,58],[39,59],[39,60],[39,61],[39,62],[39,63],[39,64],[39,65],[39,66],[39,67],[39,68],[39,69],[39,70],[39,71],[39,72],[39,73],[39,74],[39,75],[39,76],[39,77],[39,78],[39,79],[39,80],[39,81],[39,82],[39,83],[39,84],[39,85],[39,86],[39,87],[39,88],[39,89],[39,90],[39,91],[39,92],[39,93],[39,94],[39,95],[39,96],[39,97],[39,98],[39,99],[40,41],[40,42],[40,43],[40,44],[40,45],[40,46],[40,47],[40,48],[40,49],[40,50],[40,51],[40,52],[40,53],[40,54],[40,55],[40,56],[40,57],[40,58],[40,59],[40,60],[40,61],[40,62],[40,63],[40,64],[40,65],[40,66],[40,67],[40,68],[40,69],[40,70],[40,71],[40,72],[40,73],[40,74],[40,75],[40,76],[40,77],[40,78],[40,79],[40,80],[40,81],[40,82],[40,83],[40,84],[40,85],[40,86],[40,87],[40,88],[40,89],[40,90],[40,91],[40,92],[40,93],[40,94],[40,95],[40,96],[40,97],[40,98],[40,99],[41,42],[41,43],[41,44],[41,45],[41,46],[41,47],[41,48],[41,49],[41,50],[41,51],[41,52],[41,53],[41,54],[41,55],[41,56],[41,57],[41,58],[41,59],[41,60],[41,61],[41,62],[41,63],[41,64],[41,65],[41,66],[41,67],[41,68],[41,69],[41,70],[41,71],[41,72],[41,73],[41,74],[41,75],[41,76],[41,77],[41,78],[41,79],[41,80],[41,81],[41,82],[41,83],[41,84],[41,85],[41,86],[41,87],[41,88],[41,89],[41,90],[41,91],[41,92],[41,93],[41,94],[41,95],[41,96],[41,97],[41,98],[41,99],[42,43],[42,44],[42,45],[42,46],[42,47],[42,48],[42,49],[42,50],[42,51],[42,52],[42,53],[42,54],[42,55],[42,56],[42,57],[42,58],[42,59],[42,60],[42,61],[42,62],[42,63],[42,64],[42,65],[42,66],[42,67],[42,68],[42,69],[42,70],[42,71],[42,72],[42,73],[42,74],[42,75],[42,76],[42,77],[42,78],[42,79],[42,80],[42,81],[42,82],[42,83],[42,84],[42,85],[42,86],[42,87],[42,88],[42,89],[42,90],[42,91],[42,92],[42,93],[42,94],[42,95],[42,96],[42,97],[42,98],[42,99],[43,44],[43,45],[43,46],[43,47],[43,48],[43,49],[43,50],[43,51],[43,52],[43,53],[43,54],[43,55],[43,56],[43,57],[43,58],[43,59],[43,60],[43,61],[43,62],[43,63],[43,64],[43,65],[43,66],[43,67],[43,68],[43,69],[43,70],[43,71],[43,72],[43,73],[43,74],[43,75],[43,76],[43,77],[43,78],[43,79],[43,80],[43,81],[43,82],[43,83],[43,84],[43,85],[43,86],[43,87],[43,88],[43,89],[43,90],[43,91],[43,92],[43,93],[43,94],[43,95],[43,96],[43,97],[43,98],[43,99],[44,45],[44,46],[44,47],[44,48],[44,49],[44,50],[44,51],[44,52],[44,53],[44,54],[44,55],[44,56],[44,57],[44,58],[44,59],[44,60],[44,61],[44,62],[44,63],[44,64],[44,65],[44,66],[44,67],[44,68],[44,69],[44,70],[44,71],[44,72],[44,73],[44,74],[44,75],[44,76],[44,77],[44,78],[44,79],[44,80],[44,81],[44,82],[44,83],[44,84],[44,85],[44,86],[44,87],[44,88],[44,89],[44,90],[44,91],[44,92],[44,93],[44,94],[44,95],[44,96],[44,97],[44,98],[44,99],[45,46],[45,47],[45,48],[45,49],[45,50],[45,51],[45,52],[45,53],[45,54],[45,55],[45,56],[45,57],[45,58],[45,59],[45,60],[45,61],[45,62],[45,63],[45,64],[45,65],[45,66],[45,67],[45,68],[45,69],[45,70],[45,71],[45,72],[45,73],[45,74],[45,75],[45,76],[45,77],[45,78],[45,79],[45,80],[45,81],[45,82],[45,83],[45,84],[45,85],[45,86],[45,87],[45,88],[45,89],[45,90],[45,91],[45,92],[45,93],[45,94],[45,95],[45,96],[45,97],[45,98],[45,99],[46,47],[46,48],[46,49],[46,50],[46,51],[46,52],[46,53],[46,54],[46,55],[46,56],[46,57],[46,58],[46,59],[46,60],[46,61],[46,62],[46,63],[46,64],[46,65],[46,66],[46,67],[46,68],[46,69],[46,70],[46,71],[46,72],[46,73],[46,74],[46,75],[46,76],[46,77],[46,78],[46,79],[46,80],[46,81],[46,82],[46,83],[46,84],[46,85],[46,86],[46,87],[46,88],[46,89],[46,90],[46,91],[46,92],[46,93],[46,94],[46,95],[46,96],[46,97],[46,98],[46,99],[47,48],[47,49],[47,50],[47,51],[47,52],[47,53],[47,54],[47,55],[47,56],[47,57],[47,58],[47,59],[47,60],[47,61],[47,62],[47,63],[47,64],[47,65],[47,66],[47,67],[47,68],[47,69],[47,70],[47,71],[47,72],[47,73],[47,74],[47,75],[47,76],[47,77],[47,78],[47,79],[47,80],[47,81],[47,82],[47,83],[47,84],[47,85],[47,86],[47,87],[47,88],[47,89],[47,90],[47,91],[47,92],[47,93],[47,94],[47,95],[47,96],[47,97],[47,98],[47,99],[48,49],[48,50],[48,51],[48,52],[48,53],[48,54],[48,55],[48,56],[48,57],[48,58],[48,59],[48,60],[48,61],[48,62],[48,63],[48,64],[48,65],[48,66],[48,67],[48,68],[48,69],[48,70],[48,71],[48,72],[48,73],[48,74],[48,75],[48,76],[48,77],[48,78],[48,79],[48,80],[48,81],[48,82],[48,83],[48,84],[48,85],[48,86],[48,87],[48,88],[48,89],[48,90],[48,91],[48,92],[48,93],[48,94],[48,95],[48,96],[48,97],[48,98],[48,99],[49,50],[49,51],[49,52],[49,53],[49,54],[49,55],[49,56],[49,57],[49,58],[49,59],[49,60],[49,61],[49,62],[49,63],[49,64],[49,65],[49,66],[49,67],[49,68],[49,69],[49,70],[49,71],[49,72],[49,73],[49,74],[49,75],[49,76],[49,77],[49,78],[49,79],[49,80],[49,81],[49,82],[49,83],[49,84],[49,85],[49,86],[49,87],[49,88],[49,89],[49,90],[49,91],[49,92],[49,93],[49,94],[49,95],[49,96],[49,97],[49,98],[49,99],[50,51],[50,52],[50,53],[50,54],[50,55],[50,56],[50,57],[50,58],[50,59],[50,60],[50,61],[50,62],[50,63],[50,64],[50,65],[50,66],[50,67],[50,68],[50,69],[50,70],[50,71],[50,72],[50,73],[50,74],[50,75],[50,76],[50,77],[50,78],[50,79],[50,80],[50,81],[50,82],[50,83],[50,84],[50,85],[50,86],[50,87],[50,88],[50,89],[50,90],[50,91],[50,92],[50,93],[50,94],[50,95],[50,96],[50,97],[50,98],[50,99],[51,52],[51,53],[51,54],[51,55],[51,56],[51,57],[51,58],[51,59],[51,60],[51,61],[51,62],[51,63],[51,64],[51,65],[51,66],[51,67],[51,68],[51,69],[51,70],[51,71],[51,72],[51,73],[51,74],[51,75],[51,76],[51,77],[51,78],[51,79],[51,80],[51,81],[51,82],[51,83],[51,84],[51,85],[51,86],[51,87],[51,88],[51,89],[51,90],[51,91],[51,92],[51,93],[51,94],[51,95],[51,96],[51,97],[51,98],[51,99],[52,53],[52,54],[52,55],[52,56],[52,57],[52,58],[52,59],[52,60],[52,61],[52,62],[52,63],[52,64],[52,65],[52,66],[52,67],[52,68],[52,69],[52,70],[52,71],[52,72],[52,73],[52,74],[52,75],[52,76],[52,77],[52,78],[52,79],[52,80],[52,81],[52,82],[52,83],[52,84],[52,85],[52,86],[52,87],[52,88],[52,89],[52,90],[52,91],[52,92],[52,93],[52,94],[52,95],[52,96],[52,97],[52,98],[52,99],[53,54],[53,55],[53,56],[53,57],[53,58],[53,59],[53,60],[53,61],[53,62],[53,63],[53,64],[53,65],[53,66],[53,67],[53,68],[53,69],[53,70],[53,71],[53,72],[53,73],[53,74],[53,75],[53,76],[53,77],[53,78],[53,79],[53,80],[53,81],[53,82],[53,83],[53,84],[53,85],[53,86],[53,87],[53,88],[53,89],[53,90],[53,91],[53,92],[53,93],[53,94],[53,95],[53,96],[53,97],[53,98],[53,99],[54,55],[54,56],[54,57],[54,58],[54,59],[54,60],[54,61],[54,62],[54,63],[54,64],[54,65],[54,66],[54,67],[54,68],[54,69],[54,70],[54,71],[54,72],[54,73],[54,74],[54,75],[54,76],[54,77],[54,78],[54,79],[54,80],[54,81],[54,82],[54,83],[54,84],[54,85],[54,86],[54,87],[54,88],[54,89],[54,90],[54,91],[54,92],[54,93],[54,94],[54,95],[54,96],[54,97],[54,98],[54,99],[55,56],[55,57],[55,58],[55,59],[55,60],[55,61],[55,62],[55,63],[55,64],[55,65],[55,66],[55,67],[55,68],[55,69],[55,70],[55,71],[55,72],[55,73],[55,74],[55,75],[55,76],[55,77],[55,78],[55,79],[55,80],[55,81],[55,82],[55,83],[55,84],[55,85],[55,86],[55,87],[55,88],[55,89],[55,90],[55,91],[55,92],[55,93],[55,94],[55,95],[55,96],[55,97],[55,98],[55,99],[56,57],[56,58],[56,59],[56,60],[56,61],[56,62],[56,63],[56,64],[56,65],[56,66],[56,67],[56,68],[56,69],[56,70],[56,71],[56,72],[56,73],[56,74],[56,75],[56,76],[56,77],[56,78],[56,79],[56,80],[56,81],[56,82],[56,83],[56,84],[56,85],[56,86],[56,87],[56,88],[56,89],[56,90],[56,91],[56,92],[56,93],[56,94],[56,95],[56,96],[56,97],[56,98],[56,99],[57,58],[57,59],[57,60],[57,61],[57,62],[57,63],[57,64],[57,65],[57,66],[57,67],[57,68],[57,69],[57,70],[57,71],[57,72],[57,73],[57,74],[57,75],[57,76],[57,77],[57,78],[57,79],[57,80],[57,81],[57,82],[57,83],[57,84],[57,85],[57,86],[57,87],[57,88],[57,89],[57,90],[57,91],[57,92],[57,93],[57,94],[57,95],[57,96],[57,97],[57,98],[57,99],[58,59],[58,60],[58,61],[58,62],[58,63],[58,64],[58,65],[58,66],[58,67],[58,68],[58,69],[58,70],[58,71],[58,72],[58,73],[58,74],[58,75],[58,76],[58,77],[58,78],[58,79],[58,80],[58,81],[58,82],[58,83],[58,84],[58,85],[58,86],[58,87],[58,88],[58,89],[58,90],[58,91],[58,92],[58,93],[58,94],[58,95],[58,96],[58,97],[58,98],[58,99],[59,60],[59,61],[59,62],[59,63],[59,64],[59,65],[59,66],[59,67],[59,68],[59,69],[59,70],[59,71],[59,72],[59,73],[59,74],[59,75],[59,76],[59,77],[59,78],[59,79],[59,80],[59,81],[59,82],[59,83],[59,84],[59,85],[59,86],[59,87],[59,88],[59,89],[59,90],[59,91],[59,92],[59,93],[59,94],[59,95],[59,96],[59,97],[59,98],[59,99],[60,61],[60,62],[60,63],[60,64],[60,65],[60,66],[60,67],[60,68],[60,69],[60,70],[60,71],[60,72],[60,73],[60,74],[60,75],[60,76],[60,77],[60,78],[60,79],[60,80],[60,81],[60,82],[60,83],[60,84],[60,85],[60,86],[60,87],[60,88],[60,89],[60,90],[60,91],[60,92],[60,93],[60,94],[60,95],[60,96],[60,97],[60,98],[60,99],[61,62],[61,63],[61,64],[61,65],[61,66],[61,67],[61,68],[61,69],[61,70],[61,71],[61,72],[61,73],[61,74],[61,75],[61,76],[61,77],[61,78],[61,79],[61,80],[61,81],[61,82],[61,83],[61,84],[61,85],[61,86],[61,87],[61,88],[61,89],[61,90],[61,91],[61,92],[61,93],[61,94],[61,95],[61,96],[61,97],[61,98],[61,99],[62,63],[62,64],[62,65],[62,66],[62,67],[62,68],[62,69],[62,70],[62,71],[62,72],[62,73],[62,74],[62,75],[62,76],[62,77],[62,78],[62,79],[62,80],[62,81],[62,82],[62,83],[62,84],[62,85],[62,86],[62,87],[62,88],[62,89],[62,90],[62,91],[62,92],[62,93],[62,94],[62,95],[62,96],[62,97],[62,98],[62,99],[63,64],[63,65],[63,66],[63,67],[63,68],[63,69],[63,70],[63,71],[63,72],[63,73],[63,74],[63,75],[63,76],[63,77],[63,78],[63,79],[63,80],[63,81],[63,82],[63,83],[63,84],[63,85],[63,86],[63,87],[63,88],[63,89],[63,90],[63,91],[63,92],[63,93],[63,94],[63,95],[63,96],[63,97],[63,98],[63,99],[64,65],[64,66],[64,67],[64,68],[64,69],[64,70],[64,71],[64,72],[64,73],[64,74],[64,75],[64,76],[64,77],[64,78],[64,79],[64,80],[64,81],[64,82],[64,83],[64,84],[64,85],[64,86],[64,87],[64,88],[64,89],[64,90],[64,91],[64,92],[64,93],[64,94],[64,95],[64,96],[64,97],[64,98],[64,99],[65,66],[65,67],[65,68],[65,69],[65,70],[65,71],[65,72],[65,73],[65,74],[65,75],[65,76],[65,77],[65,78],[65,79],[65,80],[65,81],[65,82],[65,83],[65,84],[65,85],[65,86],[65,87],[65,88],[65,89],[65,90],[65,91],[65,92],[65,93],[65,94],[65,95],[65,96],[65,97],[65,98],[65,99],[66,67],[66,68],[66,69],[66,70],[66,71],[66,72],[66,73],[66,74],[66,75],[66,76],[66,77],[66,78],[66,79],[66,80],[66,81],[66,82],[66,83],[66,84],[66,85],[66,86],[66,87],[66,88],[66,89],[66,90],[66,91],[66,92],[66,93],[66,94],[66,95],[66,96],[66,97],[66,98],[66,99],[67,68],[67,69],[67,70],[67,71],[67,72],[67,73],[67,74],[67,75],[67,76],[67,77],[67,78],[67,79],[67,80],[67,81],[67,82],[67,83],[67,84],[67,85],[67,86],[67,87],[67,88],[67,89],[67,90],[67,91],[67,92],[67,93],[67,94],[67,95],[67,96],[67,97],[67,98],[67,99],[68,69],[68,70],[68,71],[68,72],[68,73],[68,74],[68,75],[68,76],[68,77],[68,78],[68,79],[68,80],[68,81],[68,82],[68,83],[68,84],[68,85],[68,86],[68,87],[68,88],[68,89],[68,90],[68,91],[68,92],[68,93],[68,94],[68,95],[68,96],[68,97],[68,98],[68,99],[69,70],[69,71],[69,72],[69,73],[69,74],[69,75],[69,76],[69,77],[69,78],[69,79],[69,80],[69,81],[69,82],[69,83],[69,84],[69,85],[69,86],[69,87],[69,88],[69,89],[69,90],[69,91],[69,92],[69,93],[69,94],[69,95],[69,96],[69,97],[69,98],[69,99],[70,71],[70,72],[70,73],[70,74],[70,75],[70,76],[70,77],[70,78],[70,79],[70,80],[70,81],[70,82],[70,83],[70,84],[70,85],[70,86],[70,87],[70,88],[70,89],[70,90],[70,91],[70,92],[70,93],[70,94],[70,95],[70,96],[70,97],[70,98],[70,99],[71,72],[71,73],[71,74],[71,75],[71,76],[71,77],[71,78],[71,79],[71,80],[71,81],[71,82],[71,83],[71,84],[71,85],[71,86],[71,87],[71,88],[71,89],[71,90],[71,91],[71,92],[71,93],[71,94],[71,95],[71,96],[71,97],[71,98],[71,99],[72,73],[72,74],[72,75],[72,76],[72,77],[72,78],[72,79],[72,80],[72,81],[72,82],[72,83],[72,84],[72,85],[72,86],[72,87],[72,88],[72,89],[72,90],[72,91],[72,92],[72,93],[72,94],[72,95],[72,96],[72,97],[72,98],[72,99],[73,74],[73,75],[73,76],[73,77],[73,78],[73,79],[73,80],[73,81],[73,82],[73,83],[73,84],[73,85],[73,86],[73,87],[73,88],[73,89],[73,90],[73,91],[73,92],[73,93],[73,94],[73,95],[73,96],[73,97],[73,98],[73,99],[74,75],[74,76],[74,77],[74,78],[74,79],[74,80],[74,81],[74,82],[74,83],[74,84],[74,85],[74,86],[74,87],[74,88],[74,89],[74,90],[74,91],[74,92],[74,93],[74,94],[74,95],[74,96],[74,97],[74,98],[74,99],[75,76],[75,77],[75,78],[75,79],[75,80],[75,81],[75,82],[75,83],[75,84],[75,85],[75,86],[75,87],[75,88],[75,89],[75,90],[75,91],[75,92],[75,93],[75,94],[75,95],[75,96],[75,97],[75,98],[75,99],[76,77],[76,78],[76,79],[76,80],[76,81],[76,82],[76,83],[76,84],[76,85],[76,86],[76,87],[76,88],[76,89],[76,90],[76,91],[76,92],[76,93],[76,94],[76,95],[76,96],[76,97],[76,98],[76,99],[77,78],[77,79],[77,80],[77,81],[77,82],[77,83],[77,84],[77,85],[77,86],[77,87],[77,88],[77,89],[77,90],[77,91],[77,92],[77,93],[77,94],[77,95],[77,96],[77,97],[77,98],[77,99],[78,79],[78,80],[78,81],[78,82],[78,83],[78,84],[78,85],[78,86],[78,87],[78,88],[78,89],[78,90],[78,91],[78,92],[78,93],[78,94],[78,95],[78,96],[78,97],[78,98],[78,99],[79,80],[79,81],[79,82],[79,83],[79,84],[79,85],[79,86],[79,87],[79,88],[79,89],[79,90],[79,91],[79,92],[79,93],[79,94],[79,95],[79,96],[79,97],[79,98],[79,99],[80,81],[80,82],[80,83],[80,84],[80,85],[80,86],[80,87],[80,88],[80,89],[80,90],[80,91],[80,92],[80,93],[80,94],[80,95],[80,96],[80,97],[80,98],[80,99],[81,82],[81,83],[81,84],[81,85],[81,86],[81,87],[81,88],[81,89],[81,90],[81,91],[81,92],[81,93],[81,94],[81,95],[81,96],[81,97],[81,98],[81,99],[82,83],[82,84],[82,85],[82,86],[82,87],[82,88],[82,89],[82,90],[82,91],[82,92],[82,93],[82,94],[82,95],[82,96],[82,97],[82,98],[82,99],[83,84],[83,85],[83,86],[83,87],[83,88],[83,89],[83,90],[83,91],[83,92],[83,93],[83,94],[83,95],[83,96],[83,97],[83,98],[83,99],[84,85],[84,86],[84,87],[84,88],[84,89],[84,90],[84,91],[84,92],[84,93],[84,94],[84,95],[84,96],[84,97],[84,98],[84,99],[85,86],[85,87],[85,88],[85,89],[85,90],[85,91],[85,92],[85,93],[85,94],[85,95],[85,96],[85,97],[85,98],[85,99],[86,87],[86,88],[86,89],[86,90],[86,91],[86,92],[86,93],[86,94],[86,95],[86,96],[86,97],[86,98],[86,99],[87,88],[87,89],[87,90],[87,91],[87,92],[87,93],[87,94],[87,95],[87,96],[87,97],[87,98],[87,99],[88,89],[88,90],[88,91],[88,92],[88,93],[88,94],[88,95],[88,96],[88,97],[88,98],[88,99],[89,90],[89,91],[89,92],[89,93],[89,94],[89,95],[89,96],[89,97],[89,98],[89,99],[90,91],[90,92],[90,93],[90,94],[90,95],[90,96],[90,97],[90,98],[90,99],[91,92],[91,93],[91,94],[91,95],[91,96],[91,97],[91,98],[91,99],[92,93],[92,94],[92,95],[92,96],[92,97],[92,98],[92,99],[93,94],[93,95],[93,96],[93,97],[93,98],[93,99],[94,95],[94,96],[94,97],[94,98],[94,99],[95,96],[95,97],[95,98],[95,99],[96,97],[96,98],[96,99],[97,98],[97,99],[98,99]"), + 0, + 99)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1060Test.java b/src/test/java/com/fishercoder/secondthousand/_1060Test.java index f6ceab1cb7..a2f11f8b26 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1060Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1060Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1060; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1060Test { private _1060.Solution1 solution1; private _1060.Solution2 solution2; @@ -18,19 +18,19 @@ public void setup() { @Test public void test1() { - assertEquals(5, solution1.missingElement(new int[]{4, 7, 9, 10}, 1)); - assertEquals(5, solution2.missingElement(new int[]{4, 7, 9, 10}, 1)); + assertEquals(5, solution1.missingElement(new int[] {4, 7, 9, 10}, 1)); + assertEquals(5, solution2.missingElement(new int[] {4, 7, 9, 10}, 1)); } @Test public void test2() { - assertEquals(8, solution1.missingElement(new int[]{4, 7, 9, 10}, 3)); - assertEquals(8, solution2.missingElement(new int[]{4, 7, 9, 10}, 3)); + assertEquals(8, solution1.missingElement(new int[] {4, 7, 9, 10}, 3)); + assertEquals(8, solution2.missingElement(new int[] {4, 7, 9, 10}, 3)); } @Test public void test3() { - assertEquals(6, solution1.missingElement(new int[]{1, 2, 4}, 3)); - assertEquals(6, solution2.missingElement(new int[]{1, 2, 4}, 3)); + assertEquals(6, solution1.missingElement(new int[] {1, 2, 4}, 3)); + assertEquals(6, solution2.missingElement(new int[] {1, 2, 4}, 3)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1061Test.java b/src/test/java/com/fishercoder/secondthousand/_1061Test.java index 5614098177..6a5f598191 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1061Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1061Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1061; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1061Test { private _1061.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("makkek", solution1.smallestEquivalentString("parker", "morris", "parser")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1062Test.java b/src/test/java/com/fishercoder/secondthousand/_1062Test.java index 9b36496a78..a4df3491c2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1062Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1062Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1062; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1062Test { private _1062.Solution1 solution1; @@ -36,6 +36,9 @@ public void test4() { @Test public void test5() { - assertEquals(10, (solution1.longestRepeatingSubstring("aaabaabbbaaabaabbaabbbabbbaaaabbaaaaaabbbaabbbbbbbbbaaaabbabbaba"))); + assertEquals( + 10, + (solution1.longestRepeatingSubstring( + "aaabaabbbaaabaabbaabbbabbbaaaabbaaaaaabbbaabbbbbbbbbaaaabbabbaba"))); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1065Test.java b/src/test/java/com/fishercoder/secondthousand/_1065Test.java index e741345a9c..4e70dd8fbd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1065Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1065Test.java @@ -15,22 +15,46 @@ public void setup() { @Test public void test1() { - CommonUtils.print2DIntArray(solution1.indexPairs("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", new String[]{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"})); + CommonUtils.print2DIntArray( + solution1.indexPairs( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + new String[] { + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + })); } @Test public void test2() { - CommonUtils.print2DIntArray(solution1.indexPairs("thestoryofleetcodeandme", new String[]{"story", "fleet", "leetcode"})); + CommonUtils.print2DIntArray( + solution1.indexPairs( + "thestoryofleetcodeandme", new String[] {"story", "fleet", "leetcode"})); } @Test public void test3() { - CommonUtils.print2DIntArray(solution1.indexPairs("ababa", new String[]{"aba", "ab"})); + CommonUtils.print2DIntArray(solution1.indexPairs("ababa", new String[] {"aba", "ab"})); } @Test public void test4() { - CommonUtils.print2DIntArray(solution1.indexPairs("aabaabbaabbaababaaaaaababaabaabaabaababbaabbbbaabbaaababbbbaabbabbabbababbabaabaaaabaabbbb", new String[]{"aabaaabbaba", "bbabbbaaabaaaab", "ababaabaababb", "bbbaaabababbba", "baaaabbaa"})); + CommonUtils.print2DIntArray( + solution1.indexPairs( + "aabaabbaabbaababaaaaaababaabaabaabaababbaabbbbaabbaaababbbbaabbabbabbababbabaabaaaabaabbbb", + new String[] { + "aabaaabbaba", + "bbabbbaaabaaaab", + "ababaabaababb", + "bbbaaabababbba", + "baaaabbaa" + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1066Test.java b/src/test/java/com/fishercoder/secondthousand/_1066Test.java index 255475061e..25e6514be1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1066Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1066Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1066; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1066Test { private _1066.Solution1 solution1; private static int[][] workers; @@ -13,74 +13,82 @@ public class _1066Test { @Test public void test1() { solution1 = new _1066.Solution1(); - workers = new int[][]{ - {0, 0}, - {2, 1}, - }; - bikes = new int[][]{ - {1, 2}, - {3, 3}, - }; + workers = + new int[][] { + {0, 0}, + {2, 1}, + }; + bikes = + new int[][] { + {1, 2}, + {3, 3}, + }; assertEquals(6, solution1.assignBikes(workers, bikes)); } @Test public void test2() { solution1 = new _1066.Solution1(); - workers = new int[][]{ - {0, 0}, - {1, 1}, - {2, 0}, - }; - bikes = new int[][]{ - {1, 0}, - {2, 2}, - {2, 1}, - }; + workers = + new int[][] { + {0, 0}, + {1, 1}, + {2, 0}, + }; + bikes = + new int[][] { + {1, 0}, + {2, 2}, + {2, 1}, + }; assertEquals(4, solution1.assignBikes(workers, bikes)); } @Test public void test3() { solution1 = new _1066.Solution1(); - workers = new int[][]{ - {0, 0}, - {1, 0}, - {2, 0}, - {3, 0}, - {4, 0}, - {5, 0}, - }; - bikes = new int[][]{ - {0, 999}, - {1, 999}, - {2, 999}, - {3, 999}, - {4, 999}, - {5, 999}, - {6, 999}, - {7, 999}, - }; + workers = + new int[][] { + {0, 0}, + {1, 0}, + {2, 0}, + {3, 0}, + {4, 0}, + {5, 0}, + }; + bikes = + new int[][] { + {0, 999}, + {1, 999}, + {2, 999}, + {3, 999}, + {4, 999}, + {5, 999}, + {6, 999}, + {7, 999}, + }; assertEquals(5994, solution1.assignBikes(workers, bikes)); } @Test public void test4() { solution1 = new _1066.Solution1(); - workers = new int[][]{ - {815, 60}, - {638, 626}, - {6, 44}, - {103, 90}, - {591, 880}, - }; - bikes = new int[][]{ - {709, 161}, - {341, 339}, - {755, 955}, - {172, 27}, - {433, 489}, - }; + workers = + new int[][] { + {815, 60}, + {638, 626}, + {6, 44}, + {103, 90}, + {591, 880}, + }; + bikes = + new int[][] { + {709, 161}, + {341, 339}, + {755, 955}, + {172, 27}, + {433, 489}, + }; assertEquals(1458, solution1.assignBikes(workers, bikes)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1071Test.java b/src/test/java/com/fishercoder/secondthousand/_1071Test.java index 742fe38c1d..b6b1591a5b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1071Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1071Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1071; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1071Test { private _1071.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals("", solution1.gcdOfStrings("ABCABCD", "ABC")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1078Test.java b/src/test/java/com/fishercoder/secondthousand/_1078Test.java index 9fc104cea6..94f519d131 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1078Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1078Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1078; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1078Test { private _1078.Solution1 solution1; @@ -16,12 +16,16 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new String[]{"girl", "student"}, solution1.findOcurrences("alice is a good girl she is a good student", "a", "good")); + assertArrayEquals( + new String[] {"girl", "student"}, + solution1.findOcurrences( + "alice is a good girl she is a good student", "a", "good")); } @Test public void test2() { - assertArrayEquals(new String[]{"we", "rock"}, solution1.findOcurrences("we will we will rock you", "we", "will")); + assertArrayEquals( + new String[] {"we", "rock"}, + solution1.findOcurrences("we will we will rock you", "we", "will")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1079Test.java b/src/test/java/com/fishercoder/secondthousand/_1079Test.java index 0360b619d5..6c956ad471 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1079Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1079Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1079; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1079Test { private _1079.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(188, solution1.numTilePossibilities("AAABBC")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1080Test.java b/src/test/java/com/fishercoder/secondthousand/_1080Test.java index 0e3f0bf544..36dd6d7106 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1080Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1080Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1080; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1080Test { private _1080.Solution1 solution1; @@ -29,18 +28,24 @@ public void test1() { @Test public void test2() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, -3, -5, 3, null, 4, null)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(1, 2, -3, -5, 3, null, 4, null)); TreeUtils.printBinaryTree(root); - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, -3, null, 3, null, 4)); + TreeNode expected = + TreeUtils.constructBinaryTree(Arrays.asList(1, 2, -3, null, 3, null, 4)); TreeUtils.printBinaryTree(expected); assertEquals(expected, solution1.sufficientSubset(root, -1)); } @Test public void test3() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(5, 4, 8, 11, null, 17, 4, 7, 1, null, null, 5, 3)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(5, 4, 8, 11, null, 17, 4, 7, 1, null, null, 5, 3)); TreeUtils.printBinaryTree(root); - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(5, 4, 8, 11, null, 17, 4, 7, null, null, null, 5)); + TreeNode expected = + TreeUtils.constructBinaryTree( + Arrays.asList(5, 4, 8, 11, null, 17, 4, 7, null, null, null, 5)); TreeUtils.printBinaryTree(expected); assertEquals(expected, solution1.sufficientSubset(root, 22)); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1085Test.java b/src/test/java/com/fishercoder/secondthousand/_1085Test.java index 8554e24a8b..9b35fb17b2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1085Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1085Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1085; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1085Test { private _1085.Solution1 solution1; @@ -16,11 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.sumOfDigits(new int[]{34, 23, 1, 24, 75, 33, 54, 8})); + assertEquals(0, solution1.sumOfDigits(new int[] {34, 23, 1, 24, 75, 33, 54, 8})); } @Test public void test2() { - assertEquals(1, solution1.sumOfDigits(new int[]{99, 77, 33, 66, 55})); + assertEquals(1, solution1.sumOfDigits(new int[] {99, 77, 33, 66, 55})); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1086Test.java b/src/test/java/com/fishercoder/secondthousand/_1086Test.java index 9a167a3e6f..68b509f557 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1086Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1086Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1086; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1086Test { private _1086.Solution1 solution1; private _1086.Solution2 solution2; @@ -19,44 +19,49 @@ public void setup() { @Test public void test1() { - items = new int[][]{ - {1, 91}, - {1, 92}, - {2, 93}, - {2, 97}, - {1, 60}, - {2, 77}, - {1, 65}, - {1, 87}, - {1, 100}, - {2, 100}, - {2, 76} - }; - assertArrayEquals(new int[][]{ - {1, 87}, - {2, 88} - }, solution1.highFive(items)); + items = + new int[][] { + {1, 91}, + {1, 92}, + {2, 93}, + {2, 97}, + {1, 60}, + {2, 77}, + {1, 65}, + {1, 87}, + {1, 100}, + {2, 100}, + {2, 76} + }; + assertArrayEquals( + new int[][] { + {1, 87}, + {2, 88} + }, + solution1.highFive(items)); } @Test public void test2() { - items = new int[][]{ - {1, 91}, - {1, 92}, - {2, 93}, - {2, 97}, - {1, 60}, - {2, 77}, - {1, 65}, - {1, 87}, - {1, 100}, - {2, 100}, - {2, 76} - }; - assertArrayEquals(new int[][]{ - {1, 87}, - {2, 88} - }, solution2.highFive(items)); + items = + new int[][] { + {1, 91}, + {1, 92}, + {2, 93}, + {2, 97}, + {1, 60}, + {2, 77}, + {1, 65}, + {1, 87}, + {1, 100}, + {2, 100}, + {2, 76} + }; + assertArrayEquals( + new int[][] { + {1, 87}, + {2, 88} + }, + solution2.highFive(items)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1087Test.java b/src/test/java/com/fishercoder/secondthousand/_1087Test.java index cdb37d9419..8861216e94 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1087Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1087Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1087; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1087Test { private _1087.Solution1 solution1; private _1087.Solution2 solution2; @@ -18,20 +18,25 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new String[]{"ade", "adf", "bde", "bdf", "cde", "cdf"}, solution1.expand("{a,b,c}d{e,f}")); - assertArrayEquals(new String[]{"ade", "adf", "bde", "bdf", "cde", "cdf"}, solution2.expand("{a,b,c}d{e,f}")); + assertArrayEquals( + new String[] {"ade", "adf", "bde", "bdf", "cde", "cdf"}, + solution1.expand("{a,b,c}d{e,f}")); + assertArrayEquals( + new String[] {"ade", "adf", "bde", "bdf", "cde", "cdf"}, + solution2.expand("{a,b,c}d{e,f}")); } @Test public void test2() { - assertArrayEquals(new String[]{"abcd"}, solution1.expand("abcd")); - assertArrayEquals(new String[]{"abcd"}, solution2.expand("abcd")); + assertArrayEquals(new String[] {"abcd"}, solution1.expand("abcd")); + assertArrayEquals(new String[] {"abcd"}, solution2.expand("abcd")); } @Test public void test3() { - assertArrayEquals(new String[]{"acdf", "acef", "bcdf", "bcef"}, solution1.expand("{a,b}c{d,e}f")); - assertArrayEquals(new String[]{"acdf", "acef", "bcdf", "bcef"}, solution2.expand("{a,b}c{d,e}f")); + assertArrayEquals( + new String[] {"acdf", "acef", "bcdf", "bcef"}, solution1.expand("{a,b}c{d,e}f")); + assertArrayEquals( + new String[] {"acdf", "acef", "bcdf", "bcef"}, solution2.expand("{a,b}c{d,e}f")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1089Test.java b/src/test/java/com/fishercoder/secondthousand/_1089Test.java index 3271faef3a..9f06603538 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1089Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1089Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1089; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1089Test { private _1089.Solution1 solution1; private static int[] arr; @@ -17,16 +17,15 @@ public void setup() { @Test public void test1() { - arr = new int[]{1, 0, 2, 3, 0, 4, 5, 0}; + arr = new int[] {1, 0, 2, 3, 0, 4, 5, 0}; solution1.duplicateZeros(arr); - assertArrayEquals(new int[]{1, 0, 0, 2, 3, 0, 0, 4}, arr); + assertArrayEquals(new int[] {1, 0, 0, 2, 3, 0, 0, 4}, arr); } @Test public void test2() { - arr = new int[]{1, 2, 3}; + arr = new int[] {1, 2, 3}; solution1.duplicateZeros(arr); - assertArrayEquals(new int[]{1, 2, 3}, arr); + assertArrayEquals(new int[] {1, 2, 3}, arr); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1090Test.java b/src/test/java/com/fishercoder/secondthousand/_1090Test.java index f52f93b3d9..e1cf75e677 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1090Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1090Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1090; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1090Test { private _1090.Solution1 solution1; @@ -16,7 +16,9 @@ public void setupForEachTest() { @Test public void test1() { - assertEquals(9, solution1.largestValsFromLabels(new int[]{5, 4, 3, 2, 1}, new int[]{1, 1, 2, 2, 3}, 3, 1)); + assertEquals( + 9, + solution1.largestValsFromLabels( + new int[] {5, 4, 3, 2, 1}, new int[] {1, 1, 2, 2, 3}, 3, 1)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1091Test.java b/src/test/java/com/fishercoder/secondthousand/_1091Test.java index 9c7c62dde1..32fd31cb94 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1091Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1091Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1091; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1091Test { private _1091.Solution1 solution1; @@ -17,40 +17,60 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.shortestPathBinaryMatrix(new int[][]{ - {0, 1}, - {1, 0} - })); + assertEquals( + 2, + solution1.shortestPathBinaryMatrix( + new int[][] { + {0, 1}, + {1, 0} + })); } @Test public void test2() { - assertEquals(4, solution1.shortestPathBinaryMatrix(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0,0],[1,1,0],[1,1,0]"))); + assertEquals( + 4, + solution1.shortestPathBinaryMatrix( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0,0],[1,1,0],[1,1,0]"))); } @Test public void test3() { - assertEquals(-1, solution1.shortestPathBinaryMatrix(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,0,0],[1,1,0],[1,1,0]"))); + assertEquals( + -1, + solution1.shortestPathBinaryMatrix( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,0,0],[1,1,0],[1,1,0]"))); } @Test public void test4() { - assertEquals(-1, solution1.shortestPathBinaryMatrix(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,0,0],[1,1,0],[1,1,1]"))); + assertEquals( + -1, + solution1.shortestPathBinaryMatrix( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,0,0],[1,1,0],[1,1,1]"))); } @Test public void test5() { - assertEquals(1, solution1.shortestPathBinaryMatrix(new int[][]{ - {0} - })); + assertEquals(1, solution1.shortestPathBinaryMatrix(new int[][] {{0}})); } @Test public void test6() { - assertEquals(7, solution1.shortestPathBinaryMatrix(new int[][]{ - {0, 1, 0, 0, 1, 1, 0}, {1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 1, 1, 1}, {0, 1, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 0, 0}, {1, 0, 1, 0, 0, 1, 0} - })) - ; + assertEquals( + 7, + solution1.shortestPathBinaryMatrix( + new int[][] { + {0, 1, 0, 0, 1, 1, 0}, + {1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 1, 1}, + {0, 1, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0}, + {1, 0, 1, 0, 0, 1, 0} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1094Test.java b/src/test/java/com/fishercoder/secondthousand/_1094Test.java index 80e55e654b..57ccb95c1c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1094Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1094Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1094; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1094Test { private _1094.Solution1 solution1; private static int[][] trips; @@ -19,21 +19,27 @@ public void setup() { @Test public void test1() { - trips = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,1,5],[3,3,7]"); + trips = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,1,5],[3,3,7]"); capacity = 4; assertEquals(false, solution1.carPooling(trips, capacity)); } @Test public void test2() { - trips = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,1,5],[3,3,7]"); + trips = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,1,5],[3,3,7]"); capacity = 5; assertEquals(true, solution1.carPooling(trips, capacity)); } @Test public void test3() { - trips = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[7,5,6],[6,7,8],[10,1,6]"); + trips = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[7,5,6],[6,7,8],[10,1,6]"); capacity = 16; assertEquals(false, solution1.carPooling(trips, capacity)); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1099Test.java b/src/test/java/com/fishercoder/secondthousand/_1099Test.java index 3dac98fb52..a35a4155da 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1099Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1099Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1099; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1099Test { private _1099.Solution1 solution1; private _1099.Solution2 solution2; @@ -18,22 +18,21 @@ public void setup() { @Test public void test1() { - assertEquals(58, solution1.twoSumLessThanK(new int[]{34, 23, 1, 24, 75, 33, 54, 8}, 60)); + assertEquals(58, solution1.twoSumLessThanK(new int[] {34, 23, 1, 24, 75, 33, 54, 8}, 60)); } @Test public void test2() { - assertEquals(-1, solution1.twoSumLessThanK(new int[]{10, 20, 30}, 15)); + assertEquals(-1, solution1.twoSumLessThanK(new int[] {10, 20, 30}, 15)); } @Test public void test3() { - assertEquals(58, solution2.twoSumLessThanK(new int[]{34, 23, 1, 24, 75, 33, 54, 8}, 60)); + assertEquals(58, solution2.twoSumLessThanK(new int[] {34, 23, 1, 24, 75, 33, 54, 8}, 60)); } @Test public void test4() { - assertEquals(-1, solution2.twoSumLessThanK(new int[]{10, 20, 30}, 15)); + assertEquals(-1, solution2.twoSumLessThanK(new int[] {10, 20, 30}, 15)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1100Test.java b/src/test/java/com/fishercoder/secondthousand/_1100Test.java index efa69bf59e..812fb57979 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1100Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1100Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1100; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1100Test { private _1100.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1103Test.java b/src/test/java/com/fishercoder/secondthousand/_1103Test.java index 9b59d9f9b4..3b44136dc0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1103Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1103Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1103; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1103Test { private _1103.Solution1 solution1; @@ -16,17 +16,21 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{1, 2, 3, 1}, solution1.distributeCandies(7, 4)); + assertArrayEquals(new int[] {1, 2, 3, 1}, solution1.distributeCandies(7, 4)); } @Test public void test2() { - assertArrayEquals(new int[]{5, 2, 3}, solution1.distributeCandies(10, 3)); + assertArrayEquals(new int[] {5, 2, 3}, solution1.distributeCandies(10, 3)); } @Test public void test3() { - assertArrayEquals(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 5, 0, 0, 0, 0, 0}, solution1.distributeCandies(600, 40)); + assertArrayEquals( + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 5, 0, 0, 0, 0, 0 + }, + solution1.distributeCandies(600, 40)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1104Test.java b/src/test/java/com/fishercoder/secondthousand/_1104Test.java index 58246bb2fc..fc51c2b998 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1104Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1104Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1104; +import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1104Test { private _1104.Solution1 solution1; private _1104.Solution2 solution2; @@ -54,32 +53,44 @@ public void test5() { @Test @Disabled public void test6() { - //takes too long to finish, ignore to let build pass - expected = Arrays.asList(1, 2, 6, 11, 24, 47, 97, 188, 390, 754, 1562, 3018, 6250, 12075, 25000, 48303, 100000); + // takes too long to finish, ignore to let build pass + expected = + Arrays.asList( + 1, 2, 6, 11, 24, 47, 97, 188, 390, 754, 1562, 3018, 6250, 12075, 25000, + 48303, 100000); assertEquals(expected, solution1.pathInZigZagTree(100000)); } @Test @Disabled public void test7() { - //takes too long to finish, ignore to let build pass - expected = Arrays.asList(1, 3, 5, 12, 23, 48, 94, 195, 377, 781, 1509, 3125, 6037, 12500, 24151, 50000, 96607, 200000); + // takes too long to finish, ignore to let build pass + expected = + Arrays.asList( + 1, 3, 5, 12, 23, 48, 94, 195, 377, 781, 1509, 3125, 6037, 12500, 24151, + 50000, 96607, 200000); assertEquals(expected, solution1.pathInZigZagTree(200000)); } @Test @Disabled public void test8() { - //takes too long to finish, ignore to let build pass - expected = Arrays.asList(1, 2, 6, 11, 24, 47, 97, 188, 390, 754, 1562, 3018, 6250, 12075, 25000, 48303, 100000, 193215, 400000); + // takes too long to finish, ignore to let build pass + expected = + Arrays.asList( + 1, 2, 6, 11, 24, 47, 97, 188, 390, 754, 1562, 3018, 6250, 12075, 25000, + 48303, 100000, 193215, 400000); assertEquals(expected, solution1.pathInZigZagTree(400000)); } @Test @Disabled public void test9() { - //takes too long to finish, ignore to let build pass - expected = Arrays.asList(1, 2, 7, 8, 30, 34, 122, 139, 488, 559, 1953, 2237, 7812, 8950, 31250, 35803, 125000, 143215, 500000); + // takes too long to finish, ignore to let build pass + expected = + Arrays.asList( + 1, 2, 7, 8, 30, 34, 122, 139, 488, 559, 1953, 2237, 7812, 8950, 31250, + 35803, 125000, 143215, 500000); assertEquals(expected, solution1.pathInZigZagTree(500000)); } @@ -100,5 +111,4 @@ public void test12() { expected = Arrays.asList(1); assertEquals(expected, solution2.pathInZigZagTree(1)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1105Test.java b/src/test/java/com/fishercoder/secondthousand/_1105Test.java index 4264f29578..748f80db80 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1105Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1105Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1105; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1105Test { private _1105.Solution1 solution1; @@ -17,11 +17,11 @@ public void setup() { @Test public void test1() { - assertEquals(6, + assertEquals( + 6, solution1.minHeightShelves( - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,1],[2,3],[2,3],[1,1],[1,1],[1,1],[1,2]"), - 4 - )); + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1],[2,3],[2,3],[1,1],[1,1],[1,1],[1,2]"), + 4)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1108Test.java b/src/test/java/com/fishercoder/secondthousand/_1108Test.java index 23f8caf9dc..8af1f717df 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1108Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1108Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1108; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1108Test { private _1108.Solution1 solution1; private _1108.Solution2 solution2; diff --git a/src/test/java/com/fishercoder/secondthousand/_1110Test.java b/src/test/java/com/fishercoder/secondthousand/_1110Test.java index d0665ed19f..607fd0d528 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1110Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1110Test.java @@ -3,12 +3,10 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1110; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.Arrays; import java.util.List; - +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1110Test { private _1110.Solution1 solution1; @@ -27,21 +25,21 @@ public void setup() { public void test1() { root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); TreeUtils.printBinaryTree(root); - List actual = solution1.delNodes(root, new int[]{3, 5}); + List actual = solution1.delNodes(root, new int[] {3, 5}); for (TreeNode node : actual) { TreeUtils.printBinaryTree(node); } actual.clear(); root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); - actual = solution2.delNodes(root, new int[]{3, 5}); + actual = solution2.delNodes(root, new int[] {3, 5}); for (TreeNode node : actual) { TreeUtils.printBinaryTree(node); } actual.clear(); root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6, 7)); - actual = solution3.delNodes(root, new int[]{3, 5}); + actual = solution3.delNodes(root, new int[] {3, 5}); for (TreeNode node : actual) { TreeUtils.printBinaryTree(node); } @@ -51,13 +49,13 @@ public void test1() { public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, null, 4, 3)); TreeUtils.printBinaryTree(root); - List actual = solution1.delNodes(root, new int[]{2, 3}); + List actual = solution1.delNodes(root, new int[] {2, 3}); for (TreeNode node : actual) { TreeUtils.printBinaryTree(node); } actual.clear(); root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, null, 4, 3)); - actual = solution2.delNodes(root, new int[]{2, 3}); + actual = solution2.delNodes(root, new int[] {2, 3}); for (TreeNode node : actual) { TreeUtils.printBinaryTree(node); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1118Test.java b/src/test/java/com/fishercoder/secondthousand/_1118Test.java index 1bca1f551a..4cf7a15d55 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1118Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1118Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1118; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1118Test { private _1118.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(29, solution1.numberOfDays(1836, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1119Test.java b/src/test/java/com/fishercoder/secondthousand/_1119Test.java index 26574ab978..afa2581e5c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1119Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1119Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1119; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1119Test { private _1119.Solution1 solution1; private _1119.Solution2 solution2; @@ -30,5 +30,4 @@ public void test2() { assertEquals("", solution1.removeVowels(S)); assertEquals("", solution2.removeVowels(S)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1122Test.java b/src/test/java/com/fishercoder/secondthousand/_1122Test.java index 08769b0767..9bbeaa113d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1122Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1122Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1122; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1122Test { private _1122.Solution1 solution1; @@ -16,7 +16,10 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19}, solution1.relativeSortArray(new int[]{2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19}, new int[]{2, 1, 4, 3, 9, 6})); + assertArrayEquals( + new int[] {2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19}, + solution1.relativeSortArray( + new int[] {2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19}, + new int[] {2, 1, 4, 3, 9, 6})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1128Test.java b/src/test/java/com/fishercoder/secondthousand/_1128Test.java index fa43ec56c7..a0ab447a90 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1128Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1128Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1128; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1128Test { private _1128.Solution1 solution1; private static int[][] dominoes; @@ -17,12 +17,13 @@ public void setup() { @Test public void test1() { - dominoes = new int[][]{ - {1, 2}, - {2, 1}, - {3, 4}, - {5, 6} - }; + dominoes = + new int[][] { + {1, 2}, + {2, 1}, + {3, 4}, + {5, 6} + }; assertEquals(1, solution1.numEquivDominoPairs(dominoes)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1133Test.java b/src/test/java/com/fishercoder/secondthousand/_1133Test.java index f64d1cc430..801eaf3c1f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1133Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1133Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1133; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1133Test { private _1133.Solution1 solution1; private _1133.Solution2 solution2; @@ -19,16 +19,15 @@ public void setup() { @Test public void test1() { - A = new int[]{5, 7, 3, 9, 4, 9, 8, 3, 1}; + A = new int[] {5, 7, 3, 9, 4, 9, 8, 3, 1}; assertEquals(8, solution1.largestUniqueNumber(A)); assertEquals(8, solution2.largestUniqueNumber(A)); } @Test public void test2() { - A = new int[]{9, 9, 8, 8}; + A = new int[] {9, 9, 8, 8}; assertEquals(-1, solution1.largestUniqueNumber(A)); assertEquals(-1, solution2.largestUniqueNumber(A)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1134Test.java b/src/test/java/com/fishercoder/secondthousand/_1134Test.java index 9948a6b1f8..56c1b3fa88 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1134Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1134Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1134; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1134Test { private _1134.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1136Test.java b/src/test/java/com/fishercoder/secondthousand/_1136Test.java index 99c3c7e605..5e932cc19b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1136Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1136Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1136; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1136Test { private _1136.Solution1 solution1; private _1136.Solution2 solution2; @@ -19,79 +19,108 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.minimumSemesters(3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3],[2,3]"))); - assertEquals(2, solution2.minimumSemesters(3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3],[2,3]"))); + assertEquals( + 2, + solution1.minimumSemesters( + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3],[2,3]"))); + assertEquals( + 2, + solution2.minimumSemesters( + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3],[2,3]"))); } @Test public void test2() { - assertEquals(-1, solution1.minimumSemesters(3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[2,3],[3,1]"))); - assertEquals(-1, solution2.minimumSemesters(3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[2,3],[3,1]"))); + assertEquals( + -1, + solution1.minimumSemesters( + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[2,3],[3,1]"))); + assertEquals( + -1, + solution2.minimumSemesters( + 3, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[2,3],[3,1]"))); } @Test public void test3() { - assertEquals(25, solution1.minimumSemesters(25, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("" - + "[5,10],[11,14],[21,22],[16,19],[21,25],[6,18],[1,9],[4,7]," - + "[10,23],[5,14],[9,18],[18,21],[11,22],[1,15],[1,2],[5,18],[7,20],[2,23]," - + "[12,13],[9,14],[10,16],[11,21],[5,12],[2,24],[8,17],[15,17],[10,13],[11,16]," - + "[20,22],[7,11],[9,15],[16,22],[18,20],[19,22],[10,18],[3,20],[16,25],[10,15]," - + "[1,23],[13,16],[23,25],[1,8],[4,10],[19,24],[11,20],[3,18],[6,25],[11,13]," - + "[13,15],[22,24],[6,24],[17,20],[2,25],[15,24],[8,21],[14,16],[5,16],[19,23]," - + "[1,5],[4,22],[19,20],[12,15],[16,18],[9,13],[13,22],[14,22],[2,8],[3,13]," - + "[9,23],[14,15],[14,17],[8,20],[9,17],[3,19],[8,25],[2,12],[7,24],[19,25]," - + "[1,13],[6,11],[14,21],[7,15],[3,14],[15,23],[10,17],[4,20],[6,14],[10,21]," - + "[2,13],[3,21],[8,11],[5,21],[6,23],[17,25],[16,21],[12,22],[1,16]," - + "[6,19],[7,25],[3,23],[11,25],[3,10],[6,7],[2,3],[5,25],[1,6],[4,17]," - + "[2,16],[13,17],[17,22],[6,13],[5,6],[4,11],[4,23],[4,8],[12,23],[7,21]," - + "[5,20],[3,24],[2,10],[13,14],[11,24],[1,3],[2,7],[7,23],[6,17],[5,17]," - + "[16,17],[8,15],[8,23],[7,17],[14,18],[16,23],[23,24],[4,12],[17,19],[5,9]," - + "[10,11],[5,23],[2,9],[1,19],[2,19],[12,20],[2,14],[11,12],[1,12],[13,23],[4,9]," - + "[7,13],[15,20],[21,24],[8,18],[9,11],[8,19],[6,22],[16,20],[22,25],[20,21],[6,16]," - + "[3,17],[1,22],[9,22],[20,24],[2,6],[9,16],[2,4],[2,20],[20,25],[9,10],[3,11],[15,18]," - + "[1,20],[3,6],[8,14],[10,22],[12,21],[7,8],[8,16],[9,20],[3,8],[15,21],[17,21],[11,18]," - + "[13,24],[17,24],[6,20],[4,15],[6,15],[3,22],[13,21],[2,22],[13,25],[9,12],[4,19],[1,24]," - + "[12,19],[5,8],[1,7],[3,16],[3,5],[12,24],[3,12],[2,17],[18,22],[4,25],[8,24]," - + "[15,19],[18,23],[1,4],[1,21],[10,24],[20,23],[4,14],[16,24],[10,20],[18,24]," - + "[1,14],[12,14],[10,12],[4,16],[5,19],[4,5],[19,21],[15,25],[1,18],[2,21],[4,24]," - + "[7,14],[4,6],[15,16],[3,7],[21,23],[1,17],[12,16],[13,18],[5,7],[9,19],[2,15],[22,23]," - + "[7,19],[17,23],[8,22],[11,17],[7,16],[8,9],[6,21],[4,21],[4,13],[14,24],[3,4],[7,18]," - + "[11,15],[5,11],[12,17],[6,9],[1,25],[12,18],[6,12],[8,10],[6,8],[11,23],[7,10],[14,25]," - + "[14,23],[12,25],[5,24],[10,19],[3,25],[7,9],[8,12],[5,22],[24,25],[13,19],[3,15],[5,15]," - + "[15,22],[10,14],[3,9],[13,20],[1,10],[9,21],[10,25],[9,24],[14,20],[9,25],[8,13],[7,12]," - + "[5,13],[6,10],[2,5],[2,18],[14,19],[1,11],[7,22],[18,25],[11,19]," - + "[18,19],[4,18],[17,18],[2,11]"))); + assertEquals( + 25, + solution1.minimumSemesters( + 25, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "" + + "[5,10],[11,14],[21,22],[16,19],[21,25],[6,18],[1,9],[4,7]," + + "[10,23],[5,14],[9,18],[18,21],[11,22],[1,15],[1,2],[5,18],[7,20],[2,23]," + + "[12,13],[9,14],[10,16],[11,21],[5,12],[2,24],[8,17],[15,17],[10,13],[11,16]," + + "[20,22],[7,11],[9,15],[16,22],[18,20],[19,22],[10,18],[3,20],[16,25],[10,15]," + + "[1,23],[13,16],[23,25],[1,8],[4,10],[19,24],[11,20],[3,18],[6,25],[11,13]," + + "[13,15],[22,24],[6,24],[17,20],[2,25],[15,24],[8,21],[14,16],[5,16],[19,23]," + + "[1,5],[4,22],[19,20],[12,15],[16,18],[9,13],[13,22],[14,22],[2,8],[3,13]," + + "[9,23],[14,15],[14,17],[8,20],[9,17],[3,19],[8,25],[2,12],[7,24],[19,25]," + + "[1,13],[6,11],[14,21],[7,15],[3,14],[15,23],[10,17],[4,20],[6,14],[10,21]," + + "[2,13],[3,21],[8,11],[5,21],[6,23],[17,25],[16,21],[12,22],[1,16]," + + "[6,19],[7,25],[3,23],[11,25],[3,10],[6,7],[2,3],[5,25],[1,6],[4,17]," + + "[2,16],[13,17],[17,22],[6,13],[5,6],[4,11],[4,23],[4,8],[12,23],[7,21]," + + "[5,20],[3,24],[2,10],[13,14],[11,24],[1,3],[2,7],[7,23],[6,17],[5,17]," + + "[16,17],[8,15],[8,23],[7,17],[14,18],[16,23],[23,24],[4,12],[17,19],[5,9]," + + "[10,11],[5,23],[2,9],[1,19],[2,19],[12,20],[2,14],[11,12],[1,12],[13,23],[4,9]," + + "[7,13],[15,20],[21,24],[8,18],[9,11],[8,19],[6,22],[16,20],[22,25],[20,21],[6,16]," + + "[3,17],[1,22],[9,22],[20,24],[2,6],[9,16],[2,4],[2,20],[20,25],[9,10],[3,11],[15,18]," + + "[1,20],[3,6],[8,14],[10,22],[12,21],[7,8],[8,16],[9,20],[3,8],[15,21],[17,21],[11,18]," + + "[13,24],[17,24],[6,20],[4,15],[6,15],[3,22],[13,21],[2,22],[13,25],[9,12],[4,19],[1,24]," + + "[12,19],[5,8],[1,7],[3,16],[3,5],[12,24],[3,12],[2,17],[18,22],[4,25],[8,24]," + + "[15,19],[18,23],[1,4],[1,21],[10,24],[20,23],[4,14],[16,24],[10,20],[18,24]," + + "[1,14],[12,14],[10,12],[4,16],[5,19],[4,5],[19,21],[15,25],[1,18],[2,21],[4,24]," + + "[7,14],[4,6],[15,16],[3,7],[21,23],[1,17],[12,16],[13,18],[5,7],[9,19],[2,15],[22,23]," + + "[7,19],[17,23],[8,22],[11,17],[7,16],[8,9],[6,21],[4,21],[4,13],[14,24],[3,4],[7,18]," + + "[11,15],[5,11],[12,17],[6,9],[1,25],[12,18],[6,12],[8,10],[6,8],[11,23],[7,10],[14,25]," + + "[14,23],[12,25],[5,24],[10,19],[3,25],[7,9],[8,12],[5,22],[24,25],[13,19],[3,15],[5,15]," + + "[15,22],[10,14],[3,9],[13,20],[1,10],[9,21],[10,25],[9,24],[14,20],[9,25],[8,13],[7,12]," + + "[5,13],[6,10],[2,5],[2,18],[14,19],[1,11],[7,22],[18,25],[11,19]," + + "[18,19],[4,18],[17,18],[2,11]"))); - assertEquals(25, solution2.minimumSemesters(25, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("" - + "[5,10],[11,14],[21,22],[16,19],[21,25],[6,18],[1,9],[4,7]," - + "[10,23],[5,14],[9,18],[18,21],[11,22],[1,15],[1,2],[5,18],[7,20],[2,23]," - + "[12,13],[9,14],[10,16],[11,21],[5,12],[2,24],[8,17],[15,17],[10,13],[11,16]," - + "[20,22],[7,11],[9,15],[16,22],[18,20],[19,22],[10,18],[3,20],[16,25],[10,15]," - + "[1,23],[13,16],[23,25],[1,8],[4,10],[19,24],[11,20],[3,18],[6,25],[11,13]," - + "[13,15],[22,24],[6,24],[17,20],[2,25],[15,24],[8,21],[14,16],[5,16],[19,23]," - + "[1,5],[4,22],[19,20],[12,15],[16,18],[9,13],[13,22],[14,22],[2,8],[3,13]," - + "[9,23],[14,15],[14,17],[8,20],[9,17],[3,19],[8,25],[2,12],[7,24],[19,25]," - + "[1,13],[6,11],[14,21],[7,15],[3,14],[15,23],[10,17],[4,20],[6,14],[10,21]," - + "[2,13],[3,21],[8,11],[5,21],[6,23],[17,25],[16,21],[12,22],[1,16]," - + "[6,19],[7,25],[3,23],[11,25],[3,10],[6,7],[2,3],[5,25],[1,6],[4,17]," - + "[2,16],[13,17],[17,22],[6,13],[5,6],[4,11],[4,23],[4,8],[12,23],[7,21]," - + "[5,20],[3,24],[2,10],[13,14],[11,24],[1,3],[2,7],[7,23],[6,17],[5,17]," - + "[16,17],[8,15],[8,23],[7,17],[14,18],[16,23],[23,24],[4,12],[17,19],[5,9]," - + "[10,11],[5,23],[2,9],[1,19],[2,19],[12,20],[2,14],[11,12],[1,12],[13,23],[4,9]," - + "[7,13],[15,20],[21,24],[8,18],[9,11],[8,19],[6,22],[16,20],[22,25],[20,21],[6,16]," - + "[3,17],[1,22],[9,22],[20,24],[2,6],[9,16],[2,4],[2,20],[20,25],[9,10],[3,11],[15,18]," - + "[1,20],[3,6],[8,14],[10,22],[12,21],[7,8],[8,16],[9,20],[3,8],[15,21],[17,21],[11,18]," - + "[13,24],[17,24],[6,20],[4,15],[6,15],[3,22],[13,21],[2,22],[13,25],[9,12],[4,19],[1,24]," - + "[12,19],[5,8],[1,7],[3,16],[3,5],[12,24],[3,12],[2,17],[18,22],[4,25],[8,24]," - + "[15,19],[18,23],[1,4],[1,21],[10,24],[20,23],[4,14],[16,24],[10,20],[18,24]," - + "[1,14],[12,14],[10,12],[4,16],[5,19],[4,5],[19,21],[15,25],[1,18],[2,21],[4,24]," - + "[7,14],[4,6],[15,16],[3,7],[21,23],[1,17],[12,16],[13,18],[5,7],[9,19],[2,15],[22,23]," - + "[7,19],[17,23],[8,22],[11,17],[7,16],[8,9],[6,21],[4,21],[4,13],[14,24],[3,4],[7,18]," - + "[11,15],[5,11],[12,17],[6,9],[1,25],[12,18],[6,12],[8,10],[6,8],[11,23],[7,10],[14,25]," - + "[14,23],[12,25],[5,24],[10,19],[3,25],[7,9],[8,12],[5,22],[24,25],[13,19],[3,15],[5,15]," - + "[15,22],[10,14],[3,9],[13,20],[1,10],[9,21],[10,25],[9,24],[14,20],[9,25],[8,13],[7,12]," - + "[5,13],[6,10],[2,5],[2,18],[14,19],[1,11],[7,22],[18,25],[11,19]," - + "[18,19],[4,18],[17,18],[2,11]"))); + assertEquals( + 25, + solution2.minimumSemesters( + 25, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "" + + "[5,10],[11,14],[21,22],[16,19],[21,25],[6,18],[1,9],[4,7]," + + "[10,23],[5,14],[9,18],[18,21],[11,22],[1,15],[1,2],[5,18],[7,20],[2,23]," + + "[12,13],[9,14],[10,16],[11,21],[5,12],[2,24],[8,17],[15,17],[10,13],[11,16]," + + "[20,22],[7,11],[9,15],[16,22],[18,20],[19,22],[10,18],[3,20],[16,25],[10,15]," + + "[1,23],[13,16],[23,25],[1,8],[4,10],[19,24],[11,20],[3,18],[6,25],[11,13]," + + "[13,15],[22,24],[6,24],[17,20],[2,25],[15,24],[8,21],[14,16],[5,16],[19,23]," + + "[1,5],[4,22],[19,20],[12,15],[16,18],[9,13],[13,22],[14,22],[2,8],[3,13]," + + "[9,23],[14,15],[14,17],[8,20],[9,17],[3,19],[8,25],[2,12],[7,24],[19,25]," + + "[1,13],[6,11],[14,21],[7,15],[3,14],[15,23],[10,17],[4,20],[6,14],[10,21]," + + "[2,13],[3,21],[8,11],[5,21],[6,23],[17,25],[16,21],[12,22],[1,16]," + + "[6,19],[7,25],[3,23],[11,25],[3,10],[6,7],[2,3],[5,25],[1,6],[4,17]," + + "[2,16],[13,17],[17,22],[6,13],[5,6],[4,11],[4,23],[4,8],[12,23],[7,21]," + + "[5,20],[3,24],[2,10],[13,14],[11,24],[1,3],[2,7],[7,23],[6,17],[5,17]," + + "[16,17],[8,15],[8,23],[7,17],[14,18],[16,23],[23,24],[4,12],[17,19],[5,9]," + + "[10,11],[5,23],[2,9],[1,19],[2,19],[12,20],[2,14],[11,12],[1,12],[13,23],[4,9]," + + "[7,13],[15,20],[21,24],[8,18],[9,11],[8,19],[6,22],[16,20],[22,25],[20,21],[6,16]," + + "[3,17],[1,22],[9,22],[20,24],[2,6],[9,16],[2,4],[2,20],[20,25],[9,10],[3,11],[15,18]," + + "[1,20],[3,6],[8,14],[10,22],[12,21],[7,8],[8,16],[9,20],[3,8],[15,21],[17,21],[11,18]," + + "[13,24],[17,24],[6,20],[4,15],[6,15],[3,22],[13,21],[2,22],[13,25],[9,12],[4,19],[1,24]," + + "[12,19],[5,8],[1,7],[3,16],[3,5],[12,24],[3,12],[2,17],[18,22],[4,25],[8,24]," + + "[15,19],[18,23],[1,4],[1,21],[10,24],[20,23],[4,14],[16,24],[10,20],[18,24]," + + "[1,14],[12,14],[10,12],[4,16],[5,19],[4,5],[19,21],[15,25],[1,18],[2,21],[4,24]," + + "[7,14],[4,6],[15,16],[3,7],[21,23],[1,17],[12,16],[13,18],[5,7],[9,19],[2,15],[22,23]," + + "[7,19],[17,23],[8,22],[11,17],[7,16],[8,9],[6,21],[4,21],[4,13],[14,24],[3,4],[7,18]," + + "[11,15],[5,11],[12,17],[6,9],[1,25],[12,18],[6,12],[8,10],[6,8],[11,23],[7,10],[14,25]," + + "[14,23],[12,25],[5,24],[10,19],[3,25],[7,9],[8,12],[5,22],[24,25],[13,19],[3,15],[5,15]," + + "[15,22],[10,14],[3,9],[13,20],[1,10],[9,21],[10,25],[9,24],[14,20],[9,25],[8,13],[7,12]," + + "[5,13],[6,10],[2,5],[2,18],[14,19],[1,11],[7,22],[18,25],[11,19]," + + "[18,19],[4,18],[17,18],[2,11]"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1137Test.java b/src/test/java/com/fishercoder/secondthousand/_1137Test.java index e39439038e..576fec0086 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1137Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1137Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1137; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1137Test { private _1137.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1138Test.java b/src/test/java/com/fishercoder/secondthousand/_1138Test.java index 8d579ad191..1b31fc42f8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1138Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1138Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1138; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1138Test { private _1138.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals("DDDDD!UUUUURRR!DDDDLLLD!", solution1.alphabetBoardPath("zdz")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1143Test.java b/src/test/java/com/fishercoder/secondthousand/_1143Test.java index d031592605..aeeab23514 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1143Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1143Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1143; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1143Test { private _1143.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(2, solution1.longestCommonSubsequence("ezupkr", "ubmrapg")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1145Test.java b/src/test/java/com/fishercoder/secondthousand/_1145Test.java index 476571ed77..7b8cbfebd5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1145Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1145Test.java @@ -3,14 +3,11 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1145; +import java.util.Arrays; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1145Test { private _1145.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1146Test.java b/src/test/java/com/fishercoder/secondthousand/_1146Test.java index 9e65e24e19..9a9e942806 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1146Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1146Test.java @@ -1,18 +1,16 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1146; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1146Test { private _1146.Solution1.SnapshotArray snapshotArray; @BeforeEach - public void setup() { - - } + public void setup() {} @Test public void test1() { @@ -33,5 +31,4 @@ public void test2() { snapshotArray.snap(); snapshotArray.snap(); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1150Test.java b/src/test/java/com/fishercoder/secondthousand/_1150Test.java index 86252dc0f4..31ab1d28be 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1150Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1150Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1150; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1150Test { private _1150.Solution1 solution1; private static int[] nums; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 4, 5, 5, 5, 5, 5, 6, 6}; + nums = new int[] {2, 4, 5, 5, 5, 5, 5, 6, 6}; assertEquals(true, solution1.isMajorityElement(nums, 5)); } @Test public void test2() { - nums = new int[]{10, 100, 101, 101}; + nums = new int[] {10, 100, 101, 101}; assertEquals(false, solution1.isMajorityElement(nums, 101)); } @Test public void test3() { - nums = new int[]{1, 1, 1, 2, 3, 3, 3}; + nums = new int[] {1, 1, 1, 2, 3, 3, 3}; assertEquals(false, solution1.isMajorityElement(nums, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1151Test.java b/src/test/java/com/fishercoder/secondthousand/_1151Test.java index 8af98839f3..6ff740accd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1151Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1151Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1151; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1151Test { private _1151.Solution1 solution1; private static int[] data; @@ -18,37 +18,40 @@ public void setup() { @Test public void test1() { - data = new int[]{1, 0, 1, 0, 1}; + data = new int[] {1, 0, 1, 0, 1}; expected = 1; assertEquals(expected, solution1.minSwaps(data)); } @Test public void test2() { - data = new int[]{0, 0, 0, 1, 0}; + data = new int[] {0, 0, 0, 1, 0}; expected = 0; assertEquals(expected, solution1.minSwaps(data)); } @Test public void test3() { - data = new int[]{1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1}; + data = new int[] {1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1}; expected = 3; assertEquals(expected, solution1.minSwaps(data)); } @Test public void test4() { - data = new int[]{1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1}; + data = + new int[] { + 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, + 0, 0, 1, 1, 1, 1, 0, 0, 1 + }; expected = 8; assertEquals(expected, solution1.minSwaps(data)); } @Test public void test5() { - data = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + data = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; expected = 0; assertEquals(expected, solution1.minSwaps(data)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1152Test.java b/src/test/java/com/fishercoder/secondthousand/_1152Test.java index 78f01861f3..a8735a8366 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1152Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1152Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1152; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1152Test { private _1152.Solution1 solution1; @@ -18,16 +17,64 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("home", "about", "career"), solution1.mostVisitedPattern(new String[]{"joe", "joe", "joe", "james", "james", "james", "james", "mary", "mary", "mary"}, new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, new String[]{"home", "about", "career", "home", "cart", "maps", "home", "home", "about", "career"})); + assertEquals( + Arrays.asList("home", "about", "career"), + solution1.mostVisitedPattern( + new String[] { + "joe", "joe", "joe", "james", "james", "james", "james", "mary", "mary", + "mary" + }, + new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + new String[] { + "home", "about", "career", "home", "cart", "maps", "home", "home", + "about", "career" + })); } @Test public void test2() { - assertEquals(Arrays.asList("oz", "mryxsjc", "wlarkzzqht"), solution1.mostVisitedPattern(new String[]{"zkiikgv", "zkiikgv", "zkiikgv", "zkiikgv"}, new int[]{436363475, 710406388, 386655081, 797150921}, new String[]{"wnaaxbfhxp", "mryxsjc", "oz", "wlarkzzqht"})); + assertEquals( + Arrays.asList("oz", "mryxsjc", "wlarkzzqht"), + solution1.mostVisitedPattern( + new String[] {"zkiikgv", "zkiikgv", "zkiikgv", "zkiikgv"}, + new int[] {436363475, 710406388, 386655081, 797150921}, + new String[] {"wnaaxbfhxp", "mryxsjc", "oz", "wlarkzzqht"})); } @Test public void test3() { - assertEquals(Arrays.asList("hibympufi", "hibympufi", "yljmntrclw"), solution1.mostVisitedPattern(new String[]{"h", "eiy", "cq", "h", "cq", "txldsscx", "cq", "txldsscx", "h", "cq", "cq"}, new int[]{527896567, 334462937, 517687281, 134127993, 859112386, 159548699, 51100299, 444082139, 926837079, 317455832, 411747930}, new String[]{"hibympufi", "hibympufi", "hibympufi", "hibympufi", "hibympufi", "hibympufi", "hibympufi", "hibympufi", "yljmntrclw", "hibympufi", "yljmntrclw"})); + assertEquals( + Arrays.asList("hibympufi", "hibympufi", "yljmntrclw"), + solution1.mostVisitedPattern( + new String[] { + "h", + "eiy", + "cq", + "h", + "cq", + "txldsscx", + "cq", + "txldsscx", + "h", + "cq", + "cq" + }, + new int[] { + 527896567, 334462937, 517687281, 134127993, 859112386, 159548699, + 51100299, 444082139, 926837079, 317455832, 411747930 + }, + new String[] { + "hibympufi", + "hibympufi", + "hibympufi", + "hibympufi", + "hibympufi", + "hibympufi", + "hibympufi", + "hibympufi", + "yljmntrclw", + "hibympufi", + "yljmntrclw" + })); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1154Test.java b/src/test/java/com/fishercoder/secondthousand/_1154Test.java index bf9f36a2a5..71b7285b65 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1154Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1154Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1154; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1154Test { private _1154.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(271, solution1.dayOfYear("1969-09-28")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1160Test.java b/src/test/java/com/fishercoder/secondthousand/_1160Test.java index d64bbc3f36..639bb1b7bc 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1160Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1160Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1160; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1160Test { private _1160.Solution1 solution1; private static String[] words; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - words = new String[]{"cat", "bt", "hat", "tree"}; + words = new String[] {"cat", "bt", "hat", "tree"}; assertEquals(6, solution1.countCharacters(words, "atach")); } @Test public void test2() { - words = new String[]{"hello", "world", "leetcode"}; + words = new String[] {"hello", "world", "leetcode"}; assertEquals(10, solution1.countCharacters(words, "welldonehoneyr")); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1161Test.java b/src/test/java/com/fishercoder/secondthousand/_1161Test.java index 2054e6d3fe..00e98fef2f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1161Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1161Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1161; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1161Test { private _1161.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1165Test.java b/src/test/java/com/fishercoder/secondthousand/_1165Test.java index 57a9a7e58e..54c5642d88 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1165Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1165Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1165; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1165Test { private _1165.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(73, solution1.calculateTime("pqrstuvwxyzabcdefghijklmno", "leetcode")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1170Test.java b/src/test/java/com/fishercoder/secondthousand/_1170Test.java index 25653583d5..76195ffed9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1170Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1170Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1170; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1170Test { private _1170.Solution1 solution1; private _1170.Solution2 solution2; @@ -20,30 +20,29 @@ public void setup() { @Test public void test1() { - queries = new String[]{"cbd"}; - words = new String[]{"zaaaz"}; - assertArrayEquals(new int[]{1}, solution1.numSmallerByFrequency(queries, words)); + queries = new String[] {"cbd"}; + words = new String[] {"zaaaz"}; + assertArrayEquals(new int[] {1}, solution1.numSmallerByFrequency(queries, words)); } @Test public void test2() { - queries = new String[]{"bbb", "cc"}; - words = new String[]{"a", "aa", "aaa", "aaaa"}; - assertArrayEquals(new int[]{1, 2}, solution1.numSmallerByFrequency(queries, words)); + queries = new String[] {"bbb", "cc"}; + words = new String[] {"a", "aa", "aaa", "aaaa"}; + assertArrayEquals(new int[] {1, 2}, solution1.numSmallerByFrequency(queries, words)); } @Test public void test3() { - queries = new String[]{"cbd"}; - words = new String[]{"zaaaz"}; - assertArrayEquals(new int[]{1}, solution2.numSmallerByFrequency(queries, words)); + queries = new String[] {"cbd"}; + words = new String[] {"zaaaz"}; + assertArrayEquals(new int[] {1}, solution2.numSmallerByFrequency(queries, words)); } @Test public void test4() { - queries = new String[]{"bbb", "cc"}; - words = new String[]{"a", "aa", "aaa", "aaaa"}; - assertArrayEquals(new int[]{1, 2}, solution2.numSmallerByFrequency(queries, words)); + queries = new String[] {"bbb", "cc"}; + words = new String[] {"a", "aa", "aaa", "aaaa"}; + assertArrayEquals(new int[] {1, 2}, solution2.numSmallerByFrequency(queries, words)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1171Test.java b/src/test/java/com/fishercoder/secondthousand/_1171Test.java index eac578ec60..95ba86032d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1171Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1171Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1171; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1171Test { private _1171.Solution1 solution1; private _1171.Solution2 solution2; @@ -19,43 +19,65 @@ public void setup() { @Test public void test1() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{3, 1}), solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 2, -3, 3, 1}))); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{3, 1}), solution2.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 2, -3, 3, 1}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {3, 1}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {1, 2, -3, 3, 1}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {3, 1}), + solution2.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {1, 2, -3, 3, 1}))); } @Test public void test2() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 2, 4}), solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, -3, 4}))); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 2, 4}), solution2.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, -3, 4}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 4}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, -3, 4}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 4}), + solution2.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, -3, 4}))); } @Test public void test3() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1}), solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, -3, -2}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, -3, -2}))); } @Test public void test4() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{5, -2, -5}), - solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{5, -3, -4, 1, 6, -2, -5}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {5, -2, -5}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {5, -3, -4, 1, 6, -2, -5}))); } @Test public void test5() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{}), - solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{0}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {}), + solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[] {0}))); } @Test public void test6() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{2}), - solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{2, 0}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {2}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList(new int[] {2, 0}))); } @Test public void test7() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 5, 1}), - solution1.removeZeroSumSublists(LinkedListUtils.contructLinkedList(new int[]{1, 3, 2, -3, -2, 5, 100, -100, 1}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 5, 1}), + solution1.removeZeroSumSublists( + LinkedListUtils.contructLinkedList( + new int[] {1, 3, 2, -3, -2, 5, 100, -100, 1}))); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1175Test.java b/src/test/java/com/fishercoder/secondthousand/_1175Test.java index 0422183f3a..e43dc6438f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1175Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1175Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1175; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - @Disabled public class _1175Test { private _1175.Solution1 solution1; @@ -20,5 +20,4 @@ public void setup() { public void test1() { assertEquals(12, solution1.numPrimeArrangements(5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1176Test.java b/src/test/java/com/fishercoder/secondthousand/_1176Test.java index 98271a5834..03e75bea68 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1176Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1176Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1176; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1176Test { private _1176.Solution1 solution1; @@ -16,16 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.dietPlanPerformance(new int[]{1, 2, 3, 4, 5}, 1, 3, 3)); + assertEquals(0, solution1.dietPlanPerformance(new int[] {1, 2, 3, 4, 5}, 1, 3, 3)); } @Test public void test2() { - assertEquals(1, solution1.dietPlanPerformance(new int[]{3, 2}, 2, 0, 1)); + assertEquals(1, solution1.dietPlanPerformance(new int[] {3, 2}, 2, 0, 1)); } @Test public void test3() { - assertEquals(0, solution1.dietPlanPerformance(new int[]{6, 5, 0, 0}, 2, 1, 5)); + assertEquals(0, solution1.dietPlanPerformance(new int[] {6, 5, 0, 0}, 2, 1, 5)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1180Test.java b/src/test/java/com/fishercoder/secondthousand/_1180Test.java index 578e0a6c16..570902e857 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1180Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1180Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1180; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1180Test { private _1180.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1182Test.java b/src/test/java/com/fishercoder/secondthousand/_1182Test.java index b31428d113..4c987f8d10 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1182Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1182Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1182; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1182Test { private _1182.Solution1 solution1; private static int[] colors; @@ -20,22 +19,20 @@ public void setup() { @Test public void test1() { - colors = new int[]{1, 1, 2, 1, 3, 2, 2, 3, 3}; - queries = new int[][]{ - {1, 3}, - {2, 2}, - {6, 1} - }; + colors = new int[] {1, 1, 2, 1, 3, 2, 2, 3, 3}; + queries = + new int[][] { + {1, 3}, + {2, 2}, + {6, 1} + }; assertEquals(Arrays.asList(3, 0, 3), solution1.shortestDistanceColor(colors, queries)); } @Test public void test2() { - colors = new int[]{1, 2}; - queries = new int[][]{ - {0, 3} - }; + colors = new int[] {1, 2}; + queries = new int[][] {{0, 3}}; assertEquals(Arrays.asList(-1), solution1.shortestDistanceColor(colors, queries)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1184Test.java b/src/test/java/com/fishercoder/secondthousand/_1184Test.java index 989f30b867..8a53ce3284 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1184Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1184Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1184; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1184Test { private _1184.Solution1 solution1; private static int[] distance; @@ -17,26 +17,25 @@ public void setup() { @Test public void test1() { - distance = new int[]{1, 2, 3, 4}; + distance = new int[] {1, 2, 3, 4}; assertEquals(1, solution1.distanceBetweenBusStops(distance, 0, 1)); } @Test public void test2() { - distance = new int[]{1, 2, 3, 4}; + distance = new int[] {1, 2, 3, 4}; assertEquals(4, solution1.distanceBetweenBusStops(distance, 0, 3)); } @Test public void test3() { - distance = new int[]{1, 2, 3, 4}; + distance = new int[] {1, 2, 3, 4}; assertEquals(3, solution1.distanceBetweenBusStops(distance, 0, 2)); } @Test public void test4() { - distance = new int[]{7,10,1,12,11,14,5,0}; + distance = new int[] {7, 10, 1, 12, 11, 14, 5, 0}; assertEquals(17, solution1.distanceBetweenBusStops(distance, 7, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1185Test.java b/src/test/java/com/fishercoder/secondthousand/_1185Test.java index 60dc07f99e..a8d1436ece 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1185Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1185Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1185; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1185Test { private _1185.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals("Sunday", solution1.dayOfTheWeek(15, 8, 1993)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1189Test.java b/src/test/java/com/fishercoder/secondthousand/_1189Test.java index 6ef6bd076f..31a62c9441 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1189Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1189Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1189; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1189Test { private _1189.Solution1 solution1; @@ -31,7 +31,9 @@ public void test3() { @Test public void test4() { - assertEquals(10, solution1.maxNumberOfBalloons("krhizmmgmcrecekgyljqkldocicziihtgpqwbticmvuyznragqoyrukzopfmjhjjxemsxmrsxuqmnkrzhgvtgdgtykhcglurvppvcwhrhrjoislonvvglhdciilduvuiebmffaagxerjeewmtcwmhmtwlxtvlbocczlrppmpjbpnifqtlninyzjtmazxdbzwxthpvrfulvrspycqcghuopjirzoeuqhetnbrcdakilzmklxwudxxhwilasbjjhhfgghogqoofsufysmcqeilaivtmfziumjloewbkjvaahsaaggteppqyuoylgpbdwqubaalfwcqrjeycjbbpifjbpigjdnnswocusuprydgrtxuaojeriigwumlovafxnpibjopjfqzrwemoinmptxddgcszmfprdrichjeqcvikynzigleaajcysusqasqadjemgnyvmzmbcfrttrzonwafrnedglhpudovigwvpimttiketopkvqw")); + assertEquals( + 10, + solution1.maxNumberOfBalloons( + "krhizmmgmcrecekgyljqkldocicziihtgpqwbticmvuyznragqoyrukzopfmjhjjxemsxmrsxuqmnkrzhgvtgdgtykhcglurvppvcwhrhrjoislonvvglhdciilduvuiebmffaagxerjeewmtcwmhmtwlxtvlbocczlrppmpjbpnifqtlninyzjtmazxdbzwxthpvrfulvrspycqcghuopjirzoeuqhetnbrcdakilzmklxwudxxhwilasbjjhhfgghogqoofsufysmcqeilaivtmfziumjloewbkjvaahsaaggteppqyuoylgpbdwqubaalfwcqrjeycjbbpifjbpigjdnnswocusuprydgrtxuaojeriigwumlovafxnpibjopjfqzrwemoinmptxddgcszmfprdrichjeqcvikynzigleaajcysusqasqadjemgnyvmzmbcfrttrzonwafrnedglhpudovigwvpimttiketopkvqw")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1190Test.java b/src/test/java/com/fishercoder/secondthousand/_1190Test.java index f60dc44388..9a3efbb715 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1190Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1190Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1190; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1190Test { private _1190.Solution1 solution1; private _1190.Solution2 solution2; @@ -36,5 +36,4 @@ public void test3() { public void test4() { assertEquals("apmnolkjihgfedcbq", solution1.reverseParentheses("a(bcdefghijkl(mno)p)q")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1196Test.java b/src/test/java/com/fishercoder/secondthousand/_1196Test.java index d1c9e10d91..2d2a6b2fc7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1196Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1196Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1196; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1196Test { private _1196.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.maxNumberOfApples(new int[]{100, 200, 150, 1000})); + assertEquals(4, solution1.maxNumberOfApples(new int[] {100, 200, 150, 1000})); } @Test public void test2() { - assertEquals(5, solution1.maxNumberOfApples(new int[]{900, 950, 800, 1000, 700, 800})); + assertEquals(5, solution1.maxNumberOfApples(new int[] {900, 950, 800, 1000, 700, 800})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1197Test.java b/src/test/java/com/fishercoder/secondthousand/_1197Test.java index fbd85da64d..020e40680a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1197Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1197Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1197; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1197Test { private _1197.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(56, solution1.minKnightMoves(2, 112)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1198Test.java b/src/test/java/com/fishercoder/secondthousand/_1198Test.java index 829363c520..46cf677d35 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1198Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1198Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1198; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1198Test { private _1198.Solution1 solution1; private static int[][] mat; @@ -17,13 +17,13 @@ public void setup() { @Test public void test1() { - mat = new int[][]{ - {1, 2, 3, 4, 5}, - {2, 4, 5, 8, 10}, - {3, 5, 7, 9, 11}, - {1, 3, 5, 7, 9} - }; + mat = + new int[][] { + {1, 2, 3, 4, 5}, + {2, 4, 5, 8, 10}, + {3, 5, 7, 9, 11}, + {1, 3, 5, 7, 9} + }; assertEquals(5, solution1.smallestCommonElement(mat)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1200Test.java b/src/test/java/com/fishercoder/secondthousand/_1200Test.java index 694aa60453..53839a0851 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1200Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1200Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1200; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1200; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1200Test { private _1200.Solution1 solution1; @@ -22,7 +21,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{4, 2, 1, 3}; + arr = new int[] {4, 2, 1, 3}; expected = new ArrayList<>(); expected.add(Arrays.asList(1, 2)); expected.add(Arrays.asList(2, 3)); @@ -32,10 +31,9 @@ public void test1() { @Test public void test2() { - arr = new int[]{40, 11, 26, 27, -20}; + arr = new int[] {40, 11, 26, 27, -20}; expected = new ArrayList<>(); expected.add(Arrays.asList(26, 27)); assertEquals(expected, solution1.minimumAbsDifference(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1207Test.java b/src/test/java/com/fishercoder/secondthousand/_1207Test.java index 482cd1b3bd..e61f564d9e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1207Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1207Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1207; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1207Test { private _1207.Solution1 solution1; private static int[] arr; @@ -17,19 +17,19 @@ public void setup() { @Test public void test1() { - arr = new int[]{1, 2, 2, 1, 1, 3}; + arr = new int[] {1, 2, 2, 1, 1, 3}; assertEquals(true, solution1.uniqueOccurrences(arr)); } @Test public void test2() { - arr = new int[]{1, 2}; + arr = new int[] {1, 2}; assertEquals(false, solution1.uniqueOccurrences(arr)); } @Test public void test3() { - arr = new int[]{-3, 0, 1, -3, 1, 1, 1, -3, 10, 0}; + arr = new int[] {-3, 0, 1, -3, 1, 1, 1, -3, 10, 0}; assertEquals(true, solution1.uniqueOccurrences(arr)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1209Test.java b/src/test/java/com/fishercoder/secondthousand/_1209Test.java index 80e843741d..815a4e700a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1209Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1209Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1209; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1209Test { private _1209.Solution1 solution1; @@ -45,9 +45,20 @@ public void test3() { @Test public void test4() { - assertEquals("ghayqgq", solution1.removeDuplicates("ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", 7)); - assertEquals("ghayqgq", solution2.removeDuplicates("ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", 7)); - assertEquals("ghayqgq", solution3.removeDuplicates("ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", 7)); + assertEquals( + "ghayqgq", + solution1.removeDuplicates( + "ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", + 7)); + assertEquals( + "ghayqgq", + solution2.removeDuplicates( + "ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", + 7)); + assertEquals( + "ghayqgq", + solution3.removeDuplicates( + "ghanyhhhhhttttttthhyyyyyynnnnnnyqkkkkkkkrrrrrrjjjjjjjryyyyyyfffffffygq", + 7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1213Test.java b/src/test/java/com/fishercoder/secondthousand/_1213Test.java index a6e92cfb66..f7532abc1f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1213Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1213Test.java @@ -15,7 +15,10 @@ public void setup() { @Test public void test1() { - CommonUtils.printList(solution1.arraysIntersection(new int[]{1, 2, 3, 4, 5}, new int[]{1, 2, 5, 7, 9}, new int[]{1, 3, 4, 5, 8})); + CommonUtils.printList( + solution1.arraysIntersection( + new int[] {1, 2, 3, 4, 5}, + new int[] {1, 2, 5, 7, 9}, + new int[] {1, 3, 4, 5, 8})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1214Test.java b/src/test/java/com/fishercoder/secondthousand/_1214Test.java index 57c8b40aa0..fdfe8063a5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1214Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1214Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1214; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1214Test { private _1214.Solution1 solution1; private static TreeNode root1; @@ -40,5 +39,4 @@ public void test3() { root2 = TreeUtils.constructBinaryTree(Arrays.asList(5, 1, 7, 0, 2)); assertEquals(true, solution1.twoSumBSTs(root1, root2, 17)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1217Test.java b/src/test/java/com/fishercoder/secondthousand/_1217Test.java index 6167612f3d..f3d4eca3eb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1217Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1217Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1217; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1217Test { private _1217.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.minCostToMoveChips(new int[]{1, 2, 3})); + assertEquals(1, solution1.minCostToMoveChips(new int[] {1, 2, 3})); } @Test public void test2() { - assertEquals(2, solution1.minCostToMoveChips(new int[]{2, 2, 2, 3, 3})); + assertEquals(2, solution1.minCostToMoveChips(new int[] {2, 2, 2, 3, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1219Test.java b/src/test/java/com/fishercoder/secondthousand/_1219Test.java index 5eb04ed450..76df79b16c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1219Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1219Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1219; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1219Test { private _1219.Solution1 solution1; private static int[][] grid; @@ -17,34 +17,37 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {0, 6, 0}, - {5, 8, 7}, - {0, 9, 0}, - }; + grid = + new int[][] { + {0, 6, 0}, + {5, 8, 7}, + {0, 9, 0}, + }; assertEquals(24, solution1.getMaximumGold(grid)); } @Test public void test2() { - grid = new int[][]{ - {1, 0, 7}, - {2, 0, 6}, - {3, 4, 5}, - {0, 3, 0}, - {9, 0, 20}, - }; + grid = + new int[][] { + {1, 0, 7}, + {2, 0, 6}, + {3, 4, 5}, + {0, 3, 0}, + {9, 0, 20}, + }; assertEquals(28, solution1.getMaximumGold(grid)); } @Test public void test3() { - grid = new int[][]{ - {0, 0, 19, 5, 8}, - {11, 20, 14, 1, 0}, - {0, 0, 1, 1, 1}, - {0, 2, 0, 2, 0}, - }; + grid = + new int[][] { + {0, 0, 19, 5, 8}, + {11, 20, 14, 1, 0}, + {0, 0, 1, 1, 1}, + {0, 2, 0, 2, 0}, + }; assertEquals(77, solution1.getMaximumGold(grid)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1221Test.java b/src/test/java/com/fishercoder/secondthousand/_1221Test.java index d30219729f..cd1f46bebb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1221Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1221Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1221; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1221Test { private _1221.Solution1 solution1; private _1221.Solution2 solution2; @@ -39,5 +39,4 @@ public void test4() { assertEquals(2, solution1.balancedStringSplit("RLRRRLLRLL")); assertEquals(2, solution2.balancedStringSplit("RLRRRLLRLL")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1228Test.java b/src/test/java/com/fishercoder/secondthousand/_1228Test.java index 5a290f06b9..a15c1554f4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1228Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1228Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1228; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1228Test { private _1228.Solution1 solution1; private _1228.Solution2 solution2; @@ -18,14 +18,13 @@ public void setup() { @Test public void test1() { - assertEquals(9, solution1.missingNumber(new int[]{5, 7, 11, 13})); - assertEquals(9, solution2.missingNumber(new int[]{5, 7, 11, 13})); + assertEquals(9, solution1.missingNumber(new int[] {5, 7, 11, 13})); + assertEquals(9, solution2.missingNumber(new int[] {5, 7, 11, 13})); } @Test public void test2() { - assertEquals(14, solution1.missingNumber(new int[]{15, 13, 12})); - assertEquals(14, solution2.missingNumber(new int[]{15, 13, 12})); + assertEquals(14, solution1.missingNumber(new int[] {15, 13, 12})); + assertEquals(14, solution2.missingNumber(new int[] {15, 13, 12})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1230Test.java b/src/test/java/com/fishercoder/secondthousand/_1230Test.java index 29368c705f..2b99db6f6f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1230Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1230Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1230; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1230Test { private _1230.Solution1 solution1; @@ -16,32 +16,34 @@ public void setup() { @Test public void test1() { - assertEquals(0.4, solution1.probabilityOfHeads(new double[]{0.4}, 1)); + assertEquals(0.4, solution1.probabilityOfHeads(new double[] {0.4}, 1)); } @Test public void test2() { - assertEquals(0.03125, solution1.probabilityOfHeads(new double[]{0.5, 0.5, 0.5, 0.5, 0.5}, 0)); + assertEquals( + 0.03125, solution1.probabilityOfHeads(new double[] {0.5, 0.5, 0.5, 0.5, 0.5}, 0)); } @Test public void test3() { - assertEquals(0.125, solution1.probabilityOfHeads(new double[]{0.5, 0.25}, 2)); + assertEquals(0.125, solution1.probabilityOfHeads(new double[] {0.5, 0.25}, 2)); } @Test public void test4() { - assertEquals(0.21875, solution1.probabilityOfHeads(new double[]{0.5, 0.25, 0.25}, 2)); + assertEquals(0.21875, solution1.probabilityOfHeads(new double[] {0.5, 0.25, 0.25}, 2)); } @Test public void test5() { - assertEquals(0.375, solution1.probabilityOfHeads(new double[]{0.5, 0.5, 0.5, 0.5}, 2)); + assertEquals(0.375, solution1.probabilityOfHeads(new double[] {0.5, 0.5, 0.5, 0.5}, 2)); } @Test public void test6() { - assertEquals(0.31250, solution1.probabilityOfHeads(new double[]{0.5, 0.5, 0.5, 0.5, 0.5, 0.5}, 3)); + assertEquals( + 0.31250, + solution1.probabilityOfHeads(new double[] {0.5, 0.5, 0.5, 0.5, 0.5, 0.5}, 3)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1232Test.java b/src/test/java/com/fishercoder/secondthousand/_1232Test.java index 51c08f73a4..04166d01bd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1232Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1232Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1232; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1232Test { private _1232.Solution1 solution1; private static int[][] coordinates; @@ -17,51 +17,54 @@ public void setup() { @Test public void test1() { - coordinates = new int[][]{ - {1, 2}, - {2, 3}, - {3, 4}, - {4, 5}, - {5, 6}, - {6, 7} - }; + coordinates = + new int[][] { + {1, 2}, + {2, 3}, + {3, 4}, + {4, 5}, + {5, 6}, + {6, 7} + }; assertEquals(true, solution1.checkStraightLine(coordinates)); } @Test public void test2() { - coordinates = new int[][]{ - {1, 1}, - {2, 2}, - {3, 4}, - {4, 5}, - {5, 6}, - {7, 7} - }; + coordinates = + new int[][] { + {1, 1}, + {2, 2}, + {3, 4}, + {4, 5}, + {5, 6}, + {7, 7} + }; assertEquals(false, solution1.checkStraightLine(coordinates)); } @Test public void test3() { - coordinates = new int[][]{ - {-3, -2}, - {-1, -2}, - {2, -2}, - {-2, -2}, - {0, -2} - }; + coordinates = + new int[][] { + {-3, -2}, + {-1, -2}, + {2, -2}, + {-2, -2}, + {0, -2} + }; assertEquals(true, solution1.checkStraightLine(coordinates)); } @Test public void test4() { - coordinates = new int[][]{ - {0, 1}, - {1, 3}, - {-4, -7}, - {5, 11} - }; + coordinates = + new int[][] { + {0, 1}, + {1, 3}, + {-4, -7}, + {5, 11} + }; assertEquals(true, solution1.checkStraightLine(coordinates)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1243Test.java b/src/test/java/com/fishercoder/secondthousand/_1243Test.java index eeb6d9e95c..2ed88079f1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1243Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1243Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.secondthousand._1243; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _1243Test { private _1243.Solution1 solution1; private static int[] arr; @@ -19,14 +18,13 @@ public void setup() { @Test public void test1() { - arr = new int[]{6, 2, 3, 4}; + arr = new int[] {6, 2, 3, 4}; assertTrue(solution1.transformArray(arr).equals(Arrays.asList(6, 3, 3, 4))); } @Test public void test2() { - arr = new int[]{1, 6, 3, 4, 3, 5}; + arr = new int[] {1, 6, 3, 4, 3, 5}; assertTrue(solution1.transformArray(arr).equals(Arrays.asList(1, 4, 4, 4, 4, 5))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1249Test.java b/src/test/java/com/fishercoder/secondthousand/_1249Test.java index 9b229ee45e..c4f9a57aac 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1249Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1249Test.java @@ -37,7 +37,6 @@ public void test4() { @Test public void test5() { - System.out.println(solution1.minRemoveToMakeValid("())()((("));//should be "()()" + System.out.println(solution1.minRemoveToMakeValid("())()(((")); // should be "()()" } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1252Test.java b/src/test/java/com/fishercoder/secondthousand/_1252Test.java index 4d49bb377b..8999db5390 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1252Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1252Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1252; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1252Test { private _1252.Solution1 solution1; private _1252.Solution2 solution2; @@ -19,38 +19,41 @@ public void setup() { @Test public void test1() { - indices = new int[][]{ - {0, 1}, - {1, 1} - }; + indices = + new int[][] { + {0, 1}, + {1, 1} + }; assertEquals(6, solution1.oddCells(2, 3, indices)); } @Test public void test2() { - indices = new int[][]{ - {1, 1}, - {0, 0} - }; + indices = + new int[][] { + {1, 1}, + {0, 0} + }; assertEquals(0, solution1.oddCells(2, 2, indices)); } @Test public void test3() { - indices = new int[][]{ - {0, 1}, - {1, 1} - }; + indices = + new int[][] { + {0, 1}, + {1, 1} + }; assertEquals(6, solution2.oddCells(2, 3, indices)); } @Test public void test4() { - indices = new int[][]{ - {1, 1}, - {0, 0} - }; + indices = + new int[][] { + {1, 1}, + {0, 0} + }; assertEquals(0, solution2.oddCells(2, 2, indices)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1257Test.java b/src/test/java/com/fishercoder/secondthousand/_1257Test.java index 010d11be82..3335d49477 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1257Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1257Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1257; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1257Test { private _1257.Solution1 solution1; @@ -18,86 +17,101 @@ public void setup() { @Test public void test1() { - assertEquals("North America", solution1.findSmallestRegion( - Arrays.asList(Arrays.asList("Earth", "North America", "South America"), - Arrays.asList("North America", "United States", "Canada"), - Arrays.asList("United States", "New York", "Boston"), - Arrays.asList("Canada", "Ontario", "Quebec"), - Arrays.asList("South America", "Brazil")), "Quebec", "New York")); + assertEquals( + "North America", + solution1.findSmallestRegion( + Arrays.asList( + Arrays.asList("Earth", "North America", "South America"), + Arrays.asList("North America", "United States", "Canada"), + Arrays.asList("United States", "New York", "Boston"), + Arrays.asList("Canada", "Ontario", "Quebec"), + Arrays.asList("South America", "Brazil")), + "Quebec", + "New York")); } @Test public void test2() { - assertEquals("Canada", solution1.findSmallestRegion( - Arrays.asList(Arrays.asList("Earth", "North America", "South America"), - Arrays.asList("North America", "United States", "Canada"), - Arrays.asList("United States", "New York", "Boston"), - Arrays.asList("Canada", "Ontario", "Quebec"), - Arrays.asList("South America", "Brazil")), - "Canada", "Quebec")); + assertEquals( + "Canada", + solution1.findSmallestRegion( + Arrays.asList( + Arrays.asList("Earth", "North America", "South America"), + Arrays.asList("North America", "United States", "Canada"), + Arrays.asList("United States", "New York", "Boston"), + Arrays.asList("Canada", "Ontario", "Quebec"), + Arrays.asList("South America", "Brazil")), + "Canada", + "Quebec")); } @Test public void test3() { - assertEquals("Earth", solution1.findSmallestRegion( - Arrays.asList(Arrays.asList("Earth", "North America", "South America"), - Arrays.asList("North America", "United States", "Canada"), - Arrays.asList("United States", "New York", "Boston"), - Arrays.asList("Canada", "Ontario", "Quebec"), - Arrays.asList("South America", "Brazil")), - "Canada", "South America")); + assertEquals( + "Earth", + solution1.findSmallestRegion( + Arrays.asList( + Arrays.asList("Earth", "North America", "South America"), + Arrays.asList("North America", "United States", "Canada"), + Arrays.asList("United States", "New York", "Boston"), + Arrays.asList("Canada", "Ontario", "Quebec"), + Arrays.asList("South America", "Brazil")), + "Canada", + "South America")); } @Test public void test4() { - assertEquals("GfAj", solution1.findSmallestRegion( - Arrays.asList(Arrays.asList("zDkA", "GfAj", "lt"), - Arrays.asList("GfAj", "rtupD", "og", "l"), - Arrays.asList("rtupD", "IT", "jGcew", "ZwFqF"), - Arrays.asList("og", "yVobt", "EjA", "piUyQ"), - Arrays.asList("IT", "XFlc", "W", "rB"), - Arrays.asList("l", "GwQg", "shco", "Dub", "KwgZq"), - Arrays.asList("jGcew", "KH", "lbW"), - Arrays.asList("KH", "BZ", "sauG"), - Arrays.asList("sNyV", "WbrP"), - Arrays.asList("oXMG", "uqe"), - Arrays.asList("ALlyw", "jguyA", "Mi"), - Arrays.asList("PnGPY", "Ev", "lI"), - Arrays.asList("wmYF", "xreBK"), - Arrays.asList("x", "dclJ"), - Arrays.asList("JyOSt", "i"), - Arrays.asList("yEH", "UY", "GIwLp"), - Arrays.asList("lbW", "M"), - Arrays.asList("th", "JyOSt", "ALlyw"), - Arrays.asList("ZwFqF", "GDl"), - Arrays.asList("Zqk", "th"), - Arrays.asList("Aa", "wmYF"), - Arrays.asList("nQ", "IOw"), - Arrays.asList("oGg", "x"), - Arrays.asList("pLGYN", "ldb"), - Arrays.asList("XjpeC", "vK", "aaO", "D"), - Arrays.asList("a", "TekG", "zp"), - Arrays.asList("Dub", "PnGPY"), - Arrays.asList("SOvB", "iD", "pLGYN", "Zqk"), - Arrays.asList("bmFhM", "SOvB", "RWsEM", "z"), - Arrays.asList("SAH", "bmFhM"), - Arrays.asList("GEs", "oXMG", "tNJYJ"), - Arrays.asList("zh", "PWeEf"), - Arrays.asList("Mfb", "GEs", "XjpeC", "p"), - Arrays.asList("Sn", "rVIh", "twv", "pYA", "Ywm"), - Arrays.asList("piUyQ", "G", "aTi"), - Arrays.asList("If", "e", "y", "quEA", "sNyV"), - Arrays.asList("XFlc", "Sn", "ftXOZ"), - Arrays.asList("lt", "Q", "fWB", "a", "Wk", "zpqU"), - Arrays.asList("xsUkW", "Cssa", "TgPi", "qx"), - Arrays.asList("sauG", "If", "nK", "HHOr", "yEH", "YWMgF"), - Arrays.asList("shco", "xsUkW"), - Arrays.asList("GwQg", "Mfb", "gr", "S", "nQ"), - Arrays.asList("v", "SAH", "Rjr"), - Arrays.asList("BZ", "v", "zh", "oGg", "WP"), - Arrays.asList("yVobt", "Aa", "lJRmv") - ), - "RWsEM", "GfAj")); + assertEquals( + "GfAj", + solution1.findSmallestRegion( + Arrays.asList( + Arrays.asList("zDkA", "GfAj", "lt"), + Arrays.asList("GfAj", "rtupD", "og", "l"), + Arrays.asList("rtupD", "IT", "jGcew", "ZwFqF"), + Arrays.asList("og", "yVobt", "EjA", "piUyQ"), + Arrays.asList("IT", "XFlc", "W", "rB"), + Arrays.asList("l", "GwQg", "shco", "Dub", "KwgZq"), + Arrays.asList("jGcew", "KH", "lbW"), + Arrays.asList("KH", "BZ", "sauG"), + Arrays.asList("sNyV", "WbrP"), + Arrays.asList("oXMG", "uqe"), + Arrays.asList("ALlyw", "jguyA", "Mi"), + Arrays.asList("PnGPY", "Ev", "lI"), + Arrays.asList("wmYF", "xreBK"), + Arrays.asList("x", "dclJ"), + Arrays.asList("JyOSt", "i"), + Arrays.asList("yEH", "UY", "GIwLp"), + Arrays.asList("lbW", "M"), + Arrays.asList("th", "JyOSt", "ALlyw"), + Arrays.asList("ZwFqF", "GDl"), + Arrays.asList("Zqk", "th"), + Arrays.asList("Aa", "wmYF"), + Arrays.asList("nQ", "IOw"), + Arrays.asList("oGg", "x"), + Arrays.asList("pLGYN", "ldb"), + Arrays.asList("XjpeC", "vK", "aaO", "D"), + Arrays.asList("a", "TekG", "zp"), + Arrays.asList("Dub", "PnGPY"), + Arrays.asList("SOvB", "iD", "pLGYN", "Zqk"), + Arrays.asList("bmFhM", "SOvB", "RWsEM", "z"), + Arrays.asList("SAH", "bmFhM"), + Arrays.asList("GEs", "oXMG", "tNJYJ"), + Arrays.asList("zh", "PWeEf"), + Arrays.asList("Mfb", "GEs", "XjpeC", "p"), + Arrays.asList("Sn", "rVIh", "twv", "pYA", "Ywm"), + Arrays.asList("piUyQ", "G", "aTi"), + Arrays.asList("If", "e", "y", "quEA", "sNyV"), + Arrays.asList("XFlc", "Sn", "ftXOZ"), + Arrays.asList("lt", "Q", "fWB", "a", "Wk", "zpqU"), + Arrays.asList("xsUkW", "Cssa", "TgPi", "qx"), + Arrays.asList("sauG", "If", "nK", "HHOr", "yEH", "YWMgF"), + Arrays.asList("shco", "xsUkW"), + Arrays.asList("GwQg", "Mfb", "gr", "S", "nQ"), + Arrays.asList("v", "SAH", "Rjr"), + Arrays.asList("BZ", "v", "zh", "oGg", "WP"), + Arrays.asList("yVobt", "Aa", "lJRmv")), + "RWsEM", + "GfAj")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1258Test.java b/src/test/java/com/fishercoder/secondthousand/_1258Test.java index baca135788..4cffb0163b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1258Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1258Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1258; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1258; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1258Test { @@ -21,10 +20,21 @@ public void setup() { @Test public void test1() { - synonyms = Arrays.asList(Arrays.asList("happy", "joy"), Arrays.asList("sad", "sorrow"), Arrays.asList("joy", "cheerful")); - List expected = Arrays.asList("I am cheerful today but was sad yesterday", "I am cheerful today but was sorrow yesterday", "I am happy today but was sad yesterday", "I am happy today but was sorrow yesterday", - "I am joy today but was sad yesterday", "I am joy today but was sorrow yesterday"); - assertEquals(expected, solution1.generateSentences(synonyms, "I am happy today but was sad yesterday")); + synonyms = + Arrays.asList( + Arrays.asList("happy", "joy"), + Arrays.asList("sad", "sorrow"), + Arrays.asList("joy", "cheerful")); + List expected = + Arrays.asList( + "I am cheerful today but was sad yesterday", + "I am cheerful today but was sorrow yesterday", + "I am happy today but was sad yesterday", + "I am happy today but was sorrow yesterday", + "I am joy today but was sad yesterday", + "I am joy today but was sorrow yesterday"); + assertEquals( + expected, + solution1.generateSentences(synonyms, "I am happy today but was sad yesterday")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1260Test.java b/src/test/java/com/fishercoder/secondthousand/_1260Test.java index b297e9886f..fae81acc36 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1260Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1260Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1260; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1260; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1260Test { private _1260.Solution1 solution1; @@ -21,57 +20,48 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; - expected = Arrays.asList( - Arrays.asList(9, 1, 2), - Arrays.asList(3, 4, 5), - Arrays.asList(6, 7, 8) - ); + grid = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; + expected = + Arrays.asList( + Arrays.asList(9, 1, 2), Arrays.asList(3, 4, 5), Arrays.asList(6, 7, 8)); assertEquals(expected, solution1.shiftGrid(grid, 1)); } @Test public void test2() { - grid = new int[][]{ - {1}, - {2}, - {3}, - {4}, - {7}, - {6}, - {5} - }; - expected = Arrays.asList( - Arrays.asList(6), - Arrays.asList(5), - Arrays.asList(1), - Arrays.asList(2), - Arrays.asList(3), - Arrays.asList(4), - Arrays.asList(7) - ); + grid = new int[][] {{1}, {2}, {3}, {4}, {7}, {6}, {5}}; + expected = + Arrays.asList( + Arrays.asList(6), + Arrays.asList(5), + Arrays.asList(1), + Arrays.asList(2), + Arrays.asList(3), + Arrays.asList(4), + Arrays.asList(7)); assertEquals(expected, solution1.shiftGrid(grid, 23)); } @Test public void test3() { - grid = new int[][]{ - {3, 8, 1, 9}, - {19, 7, 2, 5}, - {4, 6, 11, 10}, - {12, 0, 21, 13} - }; - expected = Arrays.asList( - Arrays.asList(12, 0, 21, 13), - Arrays.asList(3, 8, 1, 9), - Arrays.asList(19, 7, 2, 5), - Arrays.asList(4, 6, 11, 10) - ); + grid = + new int[][] { + {3, 8, 1, 9}, + {19, 7, 2, 5}, + {4, 6, 11, 10}, + {12, 0, 21, 13} + }; + expected = + Arrays.asList( + Arrays.asList(12, 0, 21, 13), + Arrays.asList(3, 8, 1, 9), + Arrays.asList(19, 7, 2, 5), + Arrays.asList(4, 6, 11, 10)); assertEquals(expected, solution1.shiftGrid(grid, 4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1266Test.java b/src/test/java/com/fishercoder/secondthousand/_1266Test.java index 6387017bd1..ce34e9b30f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1266Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1266Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1266; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1266Test { private _1266.Solution1 solution1; private static int[][] points; @@ -17,21 +17,22 @@ public void setup() { @Test public void test1() { - points = new int[][]{ - {1, 1}, - {3, 4}, - {-1, 0} - }; + points = + new int[][] { + {1, 1}, + {3, 4}, + {-1, 0} + }; assertEquals(7, solution1.minTimeToVisitAllPoints(points)); } @Test public void test2() { - points = new int[][]{ - {3, 2}, - {-2, 2} - }; + points = + new int[][] { + {3, 2}, + {-2, 2} + }; assertEquals(5, solution1.minTimeToVisitAllPoints(points)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1267Test.java b/src/test/java/com/fishercoder/secondthousand/_1267Test.java index 806455438f..f5cdafb111 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1267Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1267Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1267; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1267Test { private _1267.Solution1 solution1; private static int[][] grid; @@ -17,42 +17,45 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {1, 0}, - {0, 1} - }; + grid = + new int[][] { + {1, 0}, + {0, 1} + }; assertEquals(0, solution1.countServers(grid)); } @Test public void test2() { - grid = new int[][]{ - {1, 0}, - {1, 1} - }; + grid = + new int[][] { + {1, 0}, + {1, 1} + }; assertEquals(3, solution1.countServers(grid)); } @Test public void test3() { - grid = new int[][]{ - {1, 1, 0, 0}, - {0, 0, 1, 0}, - {0, 0, 1, 0}, - {0, 0, 0, 1} - }; + grid = + new int[][] { + {1, 1, 0, 0}, + {0, 0, 1, 0}, + {0, 0, 1, 0}, + {0, 0, 0, 1} + }; assertEquals(4, solution1.countServers(grid)); } @Test public void test4() { - grid = new int[][]{ - {1, 1, 0, 0}, - {1, 1, 1, 0}, - {0, 0, 1, 0}, - {0, 0, 0, 1} - }; + grid = + new int[][] { + {1, 1, 0, 0}, + {1, 1, 1, 0}, + {0, 0, 1, 0}, + {0, 0, 0, 1} + }; assertEquals(6, solution1.countServers(grid)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1268Test.java b/src/test/java/com/fishercoder/secondthousand/_1268Test.java index 93b095f8e0..5cbb1dbdf4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1268Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1268Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1268; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1268; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1268Test { private _1268.Solution1 solution1; @@ -21,8 +20,14 @@ public void setup() { @Test public void test1() { - products = new String[]{"mobile", "mouse", "moneypot", "monitor", "mousepad"}; - expected = Arrays.asList(Arrays.asList("mobile", "moneypot", "monitor"), Arrays.asList("mobile", "moneypot", "monitor"), Arrays.asList("mouse", "mousepad"), Arrays.asList("mouse", "mousepad"), Arrays.asList("mouse", "mousepad")); + products = new String[] {"mobile", "mouse", "moneypot", "monitor", "mousepad"}; + expected = + Arrays.asList( + Arrays.asList("mobile", "moneypot", "monitor"), + Arrays.asList("mobile", "moneypot", "monitor"), + Arrays.asList("mouse", "mousepad"), + Arrays.asList("mouse", "mousepad"), + Arrays.asList("mouse", "mousepad")); assertEquals(expected, solution1.suggestedProducts(products, "mouse")); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1271Test.java b/src/test/java/com/fishercoder/secondthousand/_1271Test.java index 714b119d38..e379ff34d5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1271Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1271Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1271; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1271Test { private _1271.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals("AEIDBCDIBC", solution1.toHexspeak("747823223228")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1273Test.java b/src/test/java/com/fishercoder/secondthousand/_1273Test.java index 1c69a9f43b..32a7c8ba5c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1273Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1273Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1273; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1273Test { private _1273.Solution1 solution1; private static int[] parent; @@ -18,30 +18,29 @@ public void setup() { @Test public void test1() { - parent = new int[]{-1, 0, 0, 1, 2, 2, 2}; - value = new int[]{1, -2, 4, 0, -2, -1, -1}; + parent = new int[] {-1, 0, 0, 1, 2, 2, 2}; + value = new int[] {1, -2, 4, 0, -2, -1, -1}; assertEquals(2, solution1.deleteTreeNodes(7, parent, value)); } @Test public void test2() { - parent = new int[]{-1, 0, 0, 1, 2, 2, 2}; - value = new int[]{1, -2, 3, 0, -2, -1, 0}; + parent = new int[] {-1, 0, 0, 1, 2, 2, 2}; + value = new int[] {1, -2, 3, 0, -2, -1, 0}; assertEquals(2, solution1.deleteTreeNodes(7, parent, value)); } @Test public void test3() { - parent = new int[]{-1, 0, 0, 1, 2, 2, 2}; - value = new int[]{1, -2, 4, 0, -2, -1, -2}; + parent = new int[] {-1, 0, 0, 1, 2, 2, 2}; + value = new int[] {1, -2, 4, 0, -2, -1, -2}; assertEquals(6, solution1.deleteTreeNodes(7, parent, value)); } @Test public void test4() { - parent = new int[]{-1, 0, 0, 1, 2, 2, 2}; - value = new int[]{3, -2, 4, 0, -2, -1, -2}; + parent = new int[] {-1, 0, 0, 1, 2, 2, 2}; + value = new int[] {3, -2, 4, 0, -2, -1, -2}; assertEquals(0, solution1.deleteTreeNodes(7, parent, value)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1275Test.java b/src/test/java/com/fishercoder/secondthousand/_1275Test.java index c4426d0477..0d9de9f4e9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1275Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1275Test.java @@ -1,12 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1275; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1275Test { private _1275.Solution1 solution1; private static int[][] moves; @@ -23,51 +22,55 @@ public void clear() { @Test public void test1() { - moves = new int[][]{ - {0, 0}, - {2, 0}, - {1, 1}, - {2, 1}, - {2, 2}, - }; + moves = + new int[][] { + {0, 0}, + {2, 0}, + {1, 1}, + {2, 1}, + {2, 2}, + }; assertEquals("A", solution1.tictactoe(moves)); } @Test public void test2() { - moves = new int[][]{ - {0, 0}, - {1, 1}, - {0, 1}, - {0, 2}, - {1, 0}, - {2, 0}, - }; + moves = + new int[][] { + {0, 0}, + {1, 1}, + {0, 1}, + {0, 2}, + {1, 0}, + {2, 0}, + }; assertEquals("B", solution1.tictactoe(moves)); } @Test public void test3() { - moves = new int[][]{ - {0, 0}, - {1, 1}, - {2, 0}, - {1, 0}, - {1, 2}, - {2, 1}, - {0, 1}, - {0, 2}, - {2, 2}, - }; + moves = + new int[][] { + {0, 0}, + {1, 1}, + {2, 0}, + {1, 0}, + {1, 2}, + {2, 1}, + {0, 1}, + {0, 2}, + {2, 2}, + }; assertEquals("Draw", solution1.tictactoe(moves)); } @Test public void test4() { - moves = new int[][]{ - {0, 0}, - {1, 1}, - }; + moves = + new int[][] { + {0, 0}, + {1, 1}, + }; assertEquals("Pending", solution1.tictactoe(moves)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1277Test.java b/src/test/java/com/fishercoder/secondthousand/_1277Test.java index b29a08dbb1..38105fe0d8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1277Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1277Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1277; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1277Test { private _1277.Solution1 solution1; private _1277.Solution2 solution2; @@ -19,22 +19,23 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {0, 1, 1, 1}, - {1, 1, 1, 1}, - {0, 1, 1, 1} - }; + matrix = + new int[][] { + {0, 1, 1, 1}, + {1, 1, 1, 1}, + {0, 1, 1, 1} + }; assertEquals(15, solution1.countSquares(matrix)); } @Test public void test2() { - matrix = new int[][]{ - {0, 1, 1, 1}, - {1, 1, 1, 1}, - {0, 1, 1, 1} - }; + matrix = + new int[][] { + {0, 1, 1, 1}, + {1, 1, 1, 1}, + {0, 1, 1, 1} + }; assertEquals(15, solution2.countSquares(matrix)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1281Test.java b/src/test/java/com/fishercoder/secondthousand/_1281Test.java index 735a1f931b..297889396d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1281Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1281Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1281; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1281Test { private _1281.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(15, solution1.subtractProductAndSum(234)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1282Test.java b/src/test/java/com/fishercoder/secondthousand/_1282Test.java index 7134ab30fb..cfa0866113 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1282Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1282Test.java @@ -16,14 +16,13 @@ public void setup() { @Test public void test1() { - groupSizes = new int[]{3, 3, 3, 3, 3, 1, 3}; + groupSizes = new int[] {3, 3, 3, 3, 3, 1, 3}; CommonUtils.printListList(solution1.groupThePeople(groupSizes)); } @Test public void test2() { - groupSizes = new int[]{2, 1, 3, 3, 3, 2}; + groupSizes = new int[] {2, 1, 3, 3, 3, 2}; CommonUtils.printListList(solution1.groupThePeople(groupSizes)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1283Test.java b/src/test/java/com/fishercoder/secondthousand/_1283Test.java index 45044c421f..8ae6031468 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1283Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1283Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1283; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1283Test { private _1283.Solution solution; private static int[] nums; @@ -18,14 +18,14 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 5, 9}; + nums = new int[] {1, 2, 5, 9}; threshold = 6; assertEquals(5, solution.smallestDivisor(nums, threshold)); } @Test public void test2() { - nums = new int[]{2, 3, 5, 7, 11}; + nums = new int[] {2, 3, 5, 7, 11}; threshold = 11; assertEquals(3, solution.smallestDivisor(nums, threshold)); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1286Test.java b/src/test/java/com/fishercoder/secondthousand/_1286Test.java index 7a8749c3ff..4527838c45 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1286Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1286Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1286; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1286Test { private _1286.Solution1.CombinationIterator combinationIterator; @@ -38,5 +38,4 @@ public void test3() { assertEquals("bcd", combinationIterator.next()); assertEquals(false, combinationIterator.hasNext()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1287Test.java b/src/test/java/com/fishercoder/secondthousand/_1287Test.java index 617be47917..cf46eb9067 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1287Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1287Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1287; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1287Test { private _1287.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.findSpecialInteger(new int[]{1, 2, 2, 6, 6, 6, 6, 7, 10})); + assertEquals(6, solution1.findSpecialInteger(new int[] {1, 2, 2, 6, 6, 6, 6, 7, 10})); } @Test public void test2() { - assertEquals(1, solution1.findSpecialInteger(new int[]{1})); + assertEquals(1, solution1.findSpecialInteger(new int[] {1})); } @Test public void test3() { - assertEquals(3, solution1.findSpecialInteger(new int[]{1, 2, 3, 3})); + assertEquals(3, solution1.findSpecialInteger(new int[] {1, 2, 3, 3})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1289Test.java b/src/test/java/com/fishercoder/secondthousand/_1289Test.java index 8e3817c288..6f3afecebe 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1289Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1289Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1289; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1289Test { private _1289.Solution1 solution1; private static int[][] arr; @@ -17,12 +17,12 @@ public void setup() { @Test public void test1() { - arr = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; + arr = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; assertEquals(13, solution1.minFallingPathSum(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1290Test.java b/src/test/java/com/fishercoder/secondthousand/_1290Test.java index 9c4ddce583..9d4fd86f4c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1290Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1290Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1290; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1290Test { private _1290.Solution1 solution1; private _1290.Solution2 solution2; @@ -32,4 +31,4 @@ public void test2() { head = LinkedListUtils.createSinglyLinkedList(Arrays.asList(1, 1, 1)); assertEquals(7, solution2.getDecimalValue(head)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1291Test.java b/src/test/java/com/fishercoder/secondthousand/_1291Test.java index 223d30fe2f..4abc6900e7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1291Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1291Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1291; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - @Disabled public class _1291Test { private _1291.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1295Test.java b/src/test/java/com/fishercoder/secondthousand/_1295Test.java index ba2369d64f..3c55dfba3d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1295Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1295Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1295; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1295Test { private _1295.Solution1 solution1; private _1295.Solution2 solution2; @@ -18,14 +18,13 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.findNumbers(new int[]{12, 345, 2, 6, 7896})); - assertEquals(2, solution2.findNumbers(new int[]{12, 345, 2, 6, 7896})); + assertEquals(2, solution1.findNumbers(new int[] {12, 345, 2, 6, 7896})); + assertEquals(2, solution2.findNumbers(new int[] {12, 345, 2, 6, 7896})); } @Test public void test2() { - assertEquals(1, solution1.findNumbers(new int[]{555, 901, 482, 1771})); - assertEquals(1, solution2.findNumbers(new int[]{555, 901, 482, 1771})); + assertEquals(1, solution1.findNumbers(new int[] {555, 901, 482, 1771})); + assertEquals(1, solution2.findNumbers(new int[] {555, 901, 482, 1771})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1296Test.java b/src/test/java/com/fishercoder/secondthousand/_1296Test.java index 706de2fb16..17b1435357 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1296Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1296Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1296; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1296Test { private _1296.Solution1 solution1; @@ -16,22 +16,23 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.isPossibleDivide(new int[]{1, 2, 3, 3, 4, 4, 5, 6}, 4)); + assertEquals(true, solution1.isPossibleDivide(new int[] {1, 2, 3, 3, 4, 4, 5, 6}, 4)); } @Test public void test2() { - assertEquals(true, solution1.isPossibleDivide(new int[]{3, 2, 1, 2, 3, 4, 3, 4, 5, 9, 10, 11}, 3)); + assertEquals( + true, + solution1.isPossibleDivide(new int[] {3, 2, 1, 2, 3, 4, 3, 4, 5, 9, 10, 11}, 3)); } @Test public void test3() { - assertEquals(true, solution1.isPossibleDivide(new int[]{3, 3, 2, 2, 1, 1}, 3)); + assertEquals(true, solution1.isPossibleDivide(new int[] {3, 3, 2, 2, 1, 1}, 3)); } @Test public void test4() { - assertEquals(false, solution1.isPossibleDivide(new int[]{1, 2, 3, 4}, 3)); + assertEquals(false, solution1.isPossibleDivide(new int[] {1, 2, 3, 4}, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1297Test.java b/src/test/java/com/fishercoder/secondthousand/_1297Test.java index 662d311ec5..d84ca4e41c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1297Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1297Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1297; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1297Test { private _1297.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(0, solution1.maxFreq("abcde", 2, 3, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1299Test.java b/src/test/java/com/fishercoder/secondthousand/_1299Test.java index 9f300b9261..edfd4256a6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1299Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1299Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1299; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1299Test { private _1299.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{17, 18, 5, 4, 6, 1}; - assertArrayEquals(new int[]{18, 6, 6, 6, 1, -1}, solution1.replaceElements(arr)); + arr = new int[] {17, 18, 5, 4, 6, 1}; + assertArrayEquals(new int[] {18, 6, 6, 6, 1, -1}, solution1.replaceElements(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1300Test.java b/src/test/java/com/fishercoder/secondthousand/_1300Test.java index b8fd60e6b1..0602e8294e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1300Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1300Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1300; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1300Test { private _1300.Solution1 solution1; private static int[] arr; @@ -17,56 +17,55 @@ public void setup() { @Test public void test1() { - arr = new int[]{4, 9, 3}; + arr = new int[] {4, 9, 3}; assertEquals(3, solution1.findBestValue(arr, 10)); } @Test public void test2() { - arr = new int[]{2, 3, 5}; + arr = new int[] {2, 3, 5}; assertEquals(5, solution1.findBestValue(arr, 10)); } @Test public void test3() { - arr = new int[]{60864, 25176, 27249, 21296, 20204}; + arr = new int[] {60864, 25176, 27249, 21296, 20204}; assertEquals(11361, solution1.findBestValue(arr, 56803)); } @Test public void test4() { - arr = new int[]{2, 3, 5}; + arr = new int[] {2, 3, 5}; assertEquals(5, solution1.findBestValue(arr, 11)); } @Test public void test5() { - arr = new int[]{60864, 25176, 27249, 21296, 20204}; + arr = new int[] {60864, 25176, 27249, 21296, 20204}; assertEquals(11361, solution1.findBestValue(arr, 56803)); } @Test public void test6() { - arr = new int[]{48772, 52931, 14253, 32289, 75263}; + arr = new int[] {48772, 52931, 14253, 32289, 75263}; assertEquals(8175, solution1.findBestValue(arr, 40876)); } @Test public void test7() { - arr = new int[]{1547, 83230, 57084, 93444, 70879}; + arr = new int[] {1547, 83230, 57084, 93444, 70879}; assertEquals(17422, solution1.findBestValue(arr, 71237)); } @Test public void test8() { - arr = new int[]{1, 1, 2}; + arr = new int[] {1, 1, 2}; assertEquals(2, solution1.findBestValue(arr, 10)); } @Test public void test9() { - arr = new int[]{1, 1, 1}; + arr = new int[] {1, 1, 1}; assertEquals(1, solution1.findBestValue(arr, 10)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1302Test.java b/src/test/java/com/fishercoder/secondthousand/_1302Test.java index 08bb83b470..e94bde8f0f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1302Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1302Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1302; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1302Test { private _1302.Solution1 solution1; @@ -19,7 +18,11 @@ public void setup() { @Test public void test1() { - assertEquals(15, solution1.deepestLeavesSum(TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, null, 6, 7, null, null, null, null, 8)))); + assertEquals( + 15, + solution1.deepestLeavesSum( + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 2, 3, 4, 5, null, 6, 7, null, null, null, null, 8)))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1304Test.java b/src/test/java/com/fishercoder/secondthousand/_1304Test.java index d9f4c235f2..d3db0f4129 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1304Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1304Test.java @@ -17,5 +17,4 @@ public void setup() { public void test1() { CommonUtils.printArray(solution1.sumZero(5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1305Test.java b/src/test/java/com/fishercoder/secondthousand/_1305Test.java index df86d05209..ec76c104fb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1305Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1305Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1305; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1305Test { private _1305.Solution1 solution1; private static TreeNode root1; @@ -26,5 +25,4 @@ public void test1() { root2 = TreeUtils.constructBinaryTree(Arrays.asList(1, 0, 3)); assertEquals(Arrays.asList(0, 1, 1, 2, 3, 4), solution1.getAllElements(root1, root2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1309Test.java b/src/test/java/com/fishercoder/secondthousand/_1309Test.java index cb826770db..da824cbdf4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1309Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1309Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1309; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1309Test { private _1309.Solution1 solution1; @@ -31,6 +31,9 @@ public void test3() { @Test public void test4() { - assertEquals("abcdefghijklmnopqrstuvwxyz", solution1.freqAlphabets("12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#")); + assertEquals( + "abcdefghijklmnopqrstuvwxyz", + solution1.freqAlphabets( + "12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#")); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1313Test.java b/src/test/java/com/fishercoder/secondthousand/_1313Test.java index f1a585559a..0f62f8833d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1313Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1313Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1313; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1313Test { private _1313.Solution1 solution1; @@ -16,7 +16,7 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 4, 4, 4}, solution1.decompressRLElist(new int[]{1, 2, 3, 4})); + assertArrayEquals( + new int[] {2, 4, 4, 4}, solution1.decompressRLElist(new int[] {1, 2, 3, 4})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1314Test.java b/src/test/java/com/fishercoder/secondthousand/_1314Test.java index 8aee1b4066..1cbe1b5865 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1314Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1314Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1314; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1314Test { private _1314.Solution1 solution1; private _1314.Solution2 solution2; @@ -20,32 +20,36 @@ public void setup() { @Test public void test1() { - mat = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; - expected = new int[][]{ - {12, 21, 16}, - {27, 45, 33}, - {24, 39, 28} - }; + mat = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; + expected = + new int[][] { + {12, 21, 16}, + {27, 45, 33}, + {24, 39, 28} + }; assertArrayEquals(expected, solution1.matrixBlockSum(mat, 1)); assertArrayEquals(expected, solution2.matrixBlockSum(mat, 1)); } @Test public void test2() { - mat = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; - expected = new int[][]{ - {45, 45, 45}, - {45, 45, 45}, - {45, 45, 45} - }; + mat = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; + expected = + new int[][] { + {45, 45, 45}, + {45, 45, 45}, + {45, 45, 45} + }; assertArrayEquals(expected, solution1.matrixBlockSum(mat, 2)); assertArrayEquals(expected, solution2.matrixBlockSum(mat, 2)); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1315Test.java b/src/test/java/com/fishercoder/secondthousand/_1315Test.java index 6d492ba6da..298e1bc73b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1315Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1315Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1315; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1315Test { private _1315.Solution1 solution1; private static TreeNode root; @@ -21,7 +20,9 @@ public void setup() { @Test public void test1() { - root = TreeUtils.constructBinaryTree(Arrays.asList(6, 7, 8, 2, 7, 1, 3, 9, null, 1, 4, null, null, null, 5)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(6, 7, 8, 2, 7, 1, 3, 9, null, 1, 4, null, null, null, 5)); TreeUtils.printBinaryTree(root); assertEquals(18, solution1.sumEvenGrandparent(root)); } diff --git a/src/test/java/com/fishercoder/secondthousand/_1317Test.java b/src/test/java/com/fishercoder/secondthousand/_1317Test.java index 7e836d80ad..15c8e25182 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1317Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1317Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1317; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1317Test { private _1317.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{11, 999}, solution1.getNoZeroIntegers(1010)); + assertArrayEquals(new int[] {11, 999}, solution1.getNoZeroIntegers(1010)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1323Test.java b/src/test/java/com/fishercoder/secondthousand/_1323Test.java index e3a9a17c16..40fad27517 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1323Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1323Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1323; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1323Test { private _1323.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(9969, solution1.maximum69Number(9669)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1324Test.java b/src/test/java/com/fishercoder/secondthousand/_1324Test.java index 0329e0ede6..c105205baf 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1324Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1324Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1324; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1324Test { private _1324.Solution1 solution1; @@ -23,12 +22,15 @@ public void test1() { @Test public void test2() { - assertEquals(Arrays.asList("TBONTB", "OEROOE", " T"), solution1.printVertically("TO BE OR NOT TO BE")); + assertEquals( + Arrays.asList("TBONTB", "OEROOE", " T"), + solution1.printVertically("TO BE OR NOT TO BE")); } @Test public void test3() { - assertEquals(Arrays.asList("CIC", "OSO", "N M", "T I", "E N", "S G", "T"), solution1.printVertically("CONTEST IS COMING")); + assertEquals( + Arrays.asList("CIC", "OSO", "N M", "T I", "E N", "S G", "T"), + solution1.printVertically("CONTEST IS COMING")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1325Test.java b/src/test/java/com/fishercoder/secondthousand/_1325Test.java index d21f474d39..208fa87e67 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1325Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1325Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1325; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1325Test { private _1325.Solution1 solution1; private _1325.Solution2 solution2; @@ -111,5 +110,4 @@ public void test10() { TreeUtils.printBinaryTree(expected); assertEquals(expected, solution2.removeLeafNodes(root, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1331Test.java b/src/test/java/com/fishercoder/secondthousand/_1331Test.java index 0956b9edf8..b65ecd0550 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1331Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1331Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1331; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1331Test { private _1331.Solution1 solution1; private static int[] arr; @@ -17,19 +17,19 @@ public void setup() { @Test public void test1() { - arr = new int[]{40, 10, 20, 30}; - assertArrayEquals(new int[]{4, 1, 2, 3}, solution1.arrayRankTransform(arr)); + arr = new int[] {40, 10, 20, 30}; + assertArrayEquals(new int[] {4, 1, 2, 3}, solution1.arrayRankTransform(arr)); } @Test public void test2() { - arr = new int[]{100, 100, 100}; - assertArrayEquals(new int[]{1, 1, 1}, solution1.arrayRankTransform(arr)); + arr = new int[] {100, 100, 100}; + assertArrayEquals(new int[] {1, 1, 1}, solution1.arrayRankTransform(arr)); } @Test public void test3() { - arr = new int[]{-1, -3, 100}; - assertArrayEquals(new int[]{2, 1, 3}, solution1.arrayRankTransform(arr)); + arr = new int[] {-1, -3, 100}; + assertArrayEquals(new int[] {2, 1, 3}, solution1.arrayRankTransform(arr)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1333Test.java b/src/test/java/com/fishercoder/secondthousand/_1333Test.java index 2ddd4b8b38..f2e5d4bbaf 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1333Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1333Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1333; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1333Test { private _1333.Solution1 solution1; private static int[][] restaurants; @@ -19,38 +18,41 @@ public void setup() { @Test public void test1() { - restaurants = new int[][]{ - {1, 4, 1, 40, 10}, - {2, 8, 0, 50, 5}, - {3, 8, 1, 30, 4}, - {4, 10, 0, 10, 3}, - {5, 1, 1, 15, 1} - }; + restaurants = + new int[][] { + {1, 4, 1, 40, 10}, + {2, 8, 0, 50, 5}, + {3, 8, 1, 30, 4}, + {4, 10, 0, 10, 3}, + {5, 1, 1, 15, 1} + }; assertEquals(Arrays.asList(3, 1, 5), solution1.filterRestaurants(restaurants, 1, 50, 10)); } @Test public void test2() { - restaurants = new int[][]{ - {1, 4, 1, 40, 10}, - {2, 8, 0, 50, 5}, - {3, 8, 1, 30, 4}, - {4, 10, 0, 10, 3}, - {5, 1, 1, 15, 1} - }; - assertEquals(Arrays.asList(4, 3, 2, 1, 5), solution1.filterRestaurants(restaurants, 0, 50, 10)); + restaurants = + new int[][] { + {1, 4, 1, 40, 10}, + {2, 8, 0, 50, 5}, + {3, 8, 1, 30, 4}, + {4, 10, 0, 10, 3}, + {5, 1, 1, 15, 1} + }; + assertEquals( + Arrays.asList(4, 3, 2, 1, 5), solution1.filterRestaurants(restaurants, 0, 50, 10)); } @Test public void test3() { - restaurants = new int[][]{ - {1, 4, 1, 40, 10}, - {2, 8, 0, 50, 5}, - {3, 8, 1, 30, 4}, - {4, 10, 0, 10, 3}, - {5, 1, 1, 15, 1} - }; + restaurants = + new int[][] { + {1, 4, 1, 40, 10}, + {2, 8, 0, 50, 5}, + {3, 8, 1, 30, 4}, + {4, 10, 0, 10, 3}, + {5, 1, 1, 15, 1} + }; assertEquals(Arrays.asList(4, 5), solution1.filterRestaurants(restaurants, 0, 30, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1334Test.java b/src/test/java/com/fishercoder/secondthousand/_1334Test.java index 0deea387ed..6b890d3bdb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1334Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1334Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1334; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - - public class _1334Test { private _1334.Solution1 solution1; @@ -18,17 +17,23 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.findTheCity(4, - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1,3],[1,2,1],[1,3,4],[2,3,1]"), - 4)); + assertEquals( + 3, + solution1.findTheCity( + 4, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1,3],[1,2,1],[1,3,4],[2,3,1]"), + 4)); } @Test public void test2() { - assertEquals(5, solution1.findTheCity(6, - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1,10],[0,2,1],[2,3,1],[1,3,1],[1,4,1],[4,5,10]"), - 20)); + assertEquals( + 5, + solution1.findTheCity( + 6, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1,10],[0,2,1],[2,3,1],[1,3,1],[1,4,1],[4,5,10]"), + 20)); } - - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1337Test.java b/src/test/java/com/fishercoder/secondthousand/_1337Test.java index 843c7add39..1ad8b83b86 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1337Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1337Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1337; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1337Test { private _1337.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(0, solution1.removePalindromeSub("")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1338Test.java b/src/test/java/com/fishercoder/secondthousand/_1338Test.java index ffc33194a1..ec850f659b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1338Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1338Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1338; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1338Test { private _1338.Solution1 solution1; private static int[] arr; @@ -17,32 +17,31 @@ public void setup() { @Test public void test1() { - arr = new int[]{3, 3, 3, 3, 5, 5, 5, 2, 2, 7}; + arr = new int[] {3, 3, 3, 3, 5, 5, 5, 2, 2, 7}; assertEquals(2, solution1.minSetSize(arr)); } @Test public void test2() { - arr = new int[]{7, 7, 7, 7, 7, 7}; + arr = new int[] {7, 7, 7, 7, 7, 7}; assertEquals(1, solution1.minSetSize(arr)); } @Test public void test3() { - arr = new int[]{1, 9}; + arr = new int[] {1, 9}; assertEquals(1, solution1.minSetSize(arr)); } @Test public void test4() { - arr = new int[]{1000, 1000, 3, 7}; + arr = new int[] {1000, 1000, 3, 7}; assertEquals(1, solution1.minSetSize(arr)); } @Test public void test5() { - arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + arr = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; assertEquals(5, solution1.minSetSize(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1339Test.java b/src/test/java/com/fishercoder/secondthousand/_1339Test.java index 368aebbac6..76808dcf35 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1339Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1339Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1339; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1339Test { private _1339.Solution1 solution1; private _1339.Solution2 solution2; @@ -32,5 +31,4 @@ public void test2() { root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, 5, 6)); assertEquals(110, solution2.maxProduct(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1341Test.java b/src/test/java/com/fishercoder/secondthousand/_1341Test.java index 90ebd04b78..5722126102 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1341Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1341Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1341; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1341Test { private _1341.Solution1 solution1; private static int[][] mat; @@ -17,25 +17,26 @@ public void setup() { @Test public void test1() { - mat = new int[][]{ - {1, 1, 0, 0, 0}, - {1, 1, 1, 1, 0}, - {1, 0, 0, 0, 0}, - {1, 1, 0, 0, 0}, - {1, 1, 1, 1, 1} - }; - assertArrayEquals(new int[]{2, 0}, solution1.kWeakestRows(mat, 2)); + mat = + new int[][] { + {1, 1, 0, 0, 0}, + {1, 1, 1, 1, 0}, + {1, 0, 0, 0, 0}, + {1, 1, 0, 0, 0}, + {1, 1, 1, 1, 1} + }; + assertArrayEquals(new int[] {2, 0}, solution1.kWeakestRows(mat, 2)); } @Test public void test2() { - mat = new int[][]{ - {1, 0, 0, 0}, - {1, 1, 1, 1}, - {1, 0, 0, 0}, - {1, 0, 0, 0} - }; - assertArrayEquals(new int[]{0, 2}, solution1.kWeakestRows(mat, 2)); + mat = + new int[][] { + {1, 0, 0, 0}, + {1, 1, 1, 1}, + {1, 0, 0, 0}, + {1, 0, 0, 0} + }; + assertArrayEquals(new int[] {0, 2}, solution1.kWeakestRows(mat, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1342Test.java b/src/test/java/com/fishercoder/secondthousand/_1342Test.java index 872fe23334..37c021cf71 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1342Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1342Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1342; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1342Test { private _1342.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(4, solution1.numberOfSteps(8)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1343Test.java b/src/test/java/com/fishercoder/secondthousand/_1343Test.java index e74fef4996..790bd4a23d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1343Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1343Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1343; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1343Test { private _1343.Solution1 solution1; @@ -16,22 +16,22 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numOfSubarrays(new int[]{2, 2, 2, 2, 5, 5, 5, 8}, 3, 4)); + assertEquals(3, solution1.numOfSubarrays(new int[] {2, 2, 2, 2, 5, 5, 5, 8}, 3, 4)); } @Test public void test2() { - assertEquals(5, solution1.numOfSubarrays(new int[]{1, 1, 1, 1, 1}, 1, 0)); + assertEquals(5, solution1.numOfSubarrays(new int[] {1, 1, 1, 1, 1}, 1, 0)); } @Test public void test3() { - assertEquals(6, solution1.numOfSubarrays(new int[]{11, 13, 17, 23, 29, 31, 7, 5, 2, 3}, 3, 5)); + assertEquals( + 6, solution1.numOfSubarrays(new int[] {11, 13, 17, 23, 29, 31, 7, 5, 2, 3}, 3, 5)); } @Test public void test4() { - assertEquals(1, solution1.numOfSubarrays(new int[]{7, 7, 7, 7, 7, 7, 7}, 7, 7)); + assertEquals(1, solution1.numOfSubarrays(new int[] {7, 7, 7, 7, 7, 7, 7}, 7, 7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1344Test.java b/src/test/java/com/fishercoder/secondthousand/_1344Test.java index e2c1a87136..9161305cc4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1344Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1344Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1344; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1344Test { private _1344.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(76.5, solution1.angleClock(1, 57), 0); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1345Test.java b/src/test/java/com/fishercoder/secondthousand/_1345Test.java index b83fc09b40..73e9e658a3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1345Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1345Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1345; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1345Test { private _1345.Solution1 solution1; private static int[] arr; @@ -17,38 +17,41 @@ public void setup() { @Test public void test1() { - arr = new int[]{100, -23, -23, 404, 100, 23, 23, 23, 3, 404}; + arr = new int[] {100, -23, -23, 404, 100, 23, 23, 23, 3, 404}; assertEquals(3, solution1.minJumps(arr)); } @Test public void test2() { - arr = new int[]{7}; + arr = new int[] {7}; assertEquals(0, solution1.minJumps(arr)); } @Test public void test3() { - arr = new int[]{7, 6, 9, 6, 9, 6, 9, 7}; + arr = new int[] {7, 6, 9, 6, 9, 6, 9, 7}; assertEquals(1, solution1.minJumps(arr)); } @Test public void test4() { - arr = new int[]{6, 1, 9}; + arr = new int[] {6, 1, 9}; assertEquals(2, solution1.minJumps(arr)); } @Test public void test5() { - arr = new int[]{11, 22, 7, 7, 7, 7, 7, 7, 7, 22, 13}; + arr = new int[] {11, 22, 7, 7, 7, 7, 7, 7, 7, 22, 13}; assertEquals(3, solution1.minJumps(arr)); } @Test public void test6() { - arr = new int[]{7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 11}; + arr = + new int[] { + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 11 + }; assertEquals(2, solution1.minJumps(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1346Test.java b/src/test/java/com/fishercoder/secondthousand/_1346Test.java index 93f63a47a1..73ed14b2e9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1346Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1346Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1346; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1346Test { private _1346.Solution1 solution1; private static int[] arr; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - arr = new int[]{10, 2, 5, 3}; + arr = new int[] {10, 2, 5, 3}; assertEquals(true, solution1.checkIfExist(arr)); } @Test public void test2() { - arr = new int[]{7, 1, 14, 11}; + arr = new int[] {7, 1, 14, 11}; assertEquals(true, solution1.checkIfExist(arr)); } @Test public void test3() { - arr = new int[]{3, 1, 7, 11}; + arr = new int[] {3, 1, 7, 11}; assertEquals(false, solution1.checkIfExist(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1347Test.java b/src/test/java/com/fishercoder/secondthousand/_1347Test.java index 3b66036c49..7b3c1abd94 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1347Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1347Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1347; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1347Test { private _1347.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(4, solution1.minSteps("friend", "family")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1348Test.java b/src/test/java/com/fishercoder/secondthousand/_1348Test.java index c9af7d2bc3..435aee45ba 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1348Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1348Test.java @@ -1,11 +1,10 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1348; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1348; import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1348Test { private _1348.Solution1.TweetCounts tweetCounts; @@ -17,10 +16,15 @@ public void test1() { tweetCounts.recordTweet("tweet3", 0); tweetCounts.recordTweet("tweet3", 60); tweetCounts.recordTweet("tweet3", 10); - assertEquals(Arrays.asList(2), tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 59)); - assertEquals(Arrays.asList(2, 1), tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 60)); + assertEquals( + Arrays.asList(2), + tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 59)); + assertEquals( + Arrays.asList(2, 1), + tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 60)); tweetCounts.recordTweet("tweet3", 120); - assertEquals(Arrays.asList(4), tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 0, 210)); + assertEquals( + Arrays.asList(4), tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 0, 210)); } @Test @@ -32,7 +36,9 @@ public void test2() { tweetCounts.recordTweet("tweet2", 99); tweetCounts.recordTweet("tweet3", 53); tweetCounts.recordTweet("tweet4", 3); - assertEquals(Arrays.asList(0), tweetCounts.getTweetCountsPerFrequency("hour", "tweet0", 89, 3045)); + assertEquals( + Arrays.asList(0), + tweetCounts.getTweetCountsPerFrequency("hour", "tweet0", 89, 3045)); tweetCounts.recordTweet("tweet0", 28); tweetCounts.recordTweet("tweet0", 91); tweetCounts.recordTweet("tweet0", 9); @@ -49,7 +55,11 @@ public void test3() { tweetCounts.recordTweet("tweet3", 18); tweetCounts.recordTweet("tweet4", 82); tweetCounts.recordTweet("tweet3", 89); - assertEquals(Arrays.asList(0), tweetCounts.getTweetCountsPerFrequency("day", "tweet0", 89, 9471)); - assertEquals(Arrays.asList(2, 0), tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 13, 4024)); + assertEquals( + Arrays.asList(0), + tweetCounts.getTweetCountsPerFrequency("day", "tweet0", 89, 9471)); + assertEquals( + Arrays.asList(2, 0), + tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 13, 4024)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1349Test.java b/src/test/java/com/fishercoder/secondthousand/_1349Test.java index 3c16c5db6a..cf3ab2ca04 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1349Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1349Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1349; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1349Test { private _1349.Solution1 solution1; private static char[][] seats; @@ -17,12 +17,12 @@ public void setup() { @Test public void test1() { - seats = new char[][]{ - {'#', '.', '#', '#', '.', '#'}, - {'.', '#', '#', '#', '#', '.'}, - {'#', '.', '#', '#', '.', '#'} - }; + seats = + new char[][] { + {'#', '.', '#', '#', '.', '#'}, + {'.', '#', '#', '#', '#', '.'}, + {'#', '.', '#', '#', '.', '#'} + }; assertEquals(4, solution1.maxStudents(seats)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1352Test.java b/src/test/java/com/fishercoder/secondthousand/_1352Test.java index 3db0f766ab..a5f156fc32 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1352Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1352Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1352; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1352Test { private _1352.Solution1.ProductOfNumbers productOfNumbers; @@ -22,5 +22,4 @@ public void test1() { productOfNumbers.add(8); assertEquals(32, productOfNumbers.getProduct(2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1353Test.java b/src/test/java/com/fishercoder/secondthousand/_1353Test.java index ff28439edf..8d330e3f28 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1353Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1353Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1353; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1353Test { private _1353.Solution1 solution1; private static int[][] events; @@ -17,57 +17,58 @@ public void setup() { @Test public void test1() { - events = new int[][]{ - {1, 2}, - {2, 3}, - {3, 4} - }; + events = + new int[][] { + {1, 2}, + {2, 3}, + {3, 4} + }; assertEquals(3, solution1.maxEvents(events)); } @Test public void test2() { - events = new int[][]{ - {1, 2}, - {2, 3}, - {3, 4}, - {1, 2} - }; + events = + new int[][] { + {1, 2}, + {2, 3}, + {3, 4}, + {1, 2} + }; assertEquals(4, solution1.maxEvents(events)); } @Test public void test3() { - events = new int[][]{ - {1, 4}, - {4, 4}, - {2, 2}, - {3, 4}, - {1, 1} - }; + events = + new int[][] { + {1, 4}, + {4, 4}, + {2, 2}, + {3, 4}, + {1, 1} + }; assertEquals(4, solution1.maxEvents(events)); } @Test public void test4() { - events = new int[][]{ - {1, 100000} - }; + events = new int[][] {{1, 100000}}; assertEquals(1, solution1.maxEvents(events)); } @Test public void test5() { - events = new int[][]{ - {1, 1}, - {1, 2}, - {1, 3}, - {1, 4}, - {1, 5}, - {1, 6}, - {1, 7}, - }; + events = + new int[][] { + {1, 1}, + {1, 2}, + {1, 3}, + {1, 4}, + {1, 5}, + {1, 6}, + {1, 7}, + }; assertEquals(7, solution1.maxEvents(events)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1354Test.java b/src/test/java/com/fishercoder/secondthousand/_1354Test.java index 984d6e9812..b1ba27621a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1354Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1354Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1354; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1354Test { private _1354.Solution1 solution1; private static int[] target; @@ -17,50 +17,158 @@ public void setup() { @Test public void test1() { - target = new int[]{9, 3, 5}; + target = new int[] {9, 3, 5}; assertEquals(true, solution1.isPossible(target)); } @Test public void test2() { - target = new int[]{1, 1, 1, 2}; + target = new int[] {1, 1, 1, 2}; assertEquals(false, solution1.isPossible(target)); } @Test public void test3() { - target = new int[]{8, 5}; + target = new int[] {8, 5}; assertEquals(true, solution1.isPossible(target)); } @Test public void test9() { - target = new int[]{9, 9, 9}; + target = new int[] {9, 9, 9}; assertEquals(false, solution1.isPossible(target)); } @Test public void test11() { - target = new int[]{1, 1, 2}; + target = new int[] {1, 1, 2}; assertEquals(false, solution1.isPossible(target)); } @Test public void test12() { - target = new int[]{1, 1000000000}; + target = new int[] {1, 1000000000}; assertEquals(true, solution1.isPossible(target)); } @Test public void test13() { - target = new int[]{5, 50}; + target = new int[] {5, 50}; assertEquals(false, solution1.isPossible(target)); } @Test public void test10() { - target = new int[]{835647834, 503037935, 773002076, 731298404, 903645595, 488189634, 319785391, 111546683, 609144970, 415205491, 685900245, 878508756, 236413773, 991053691, 947595808, 913014938, 533038855, 88376603, 436545178, 983496954, 122530918, 346542007, 55893465, 472984628, 347337093, 322587100, 552866643, 609759356, 288893937, 471774337, 465491640, 783022406, 699817530, 340584553, 663909719, 651419106, 846593366, 952609573, 912379694, 661318302, 538633771, 745093202, 753577352, 60741272, 800245613, 228718955, 314289253, 384902244, 834091366, 330486268, 832528567, 405339553, 667374764, 477631332, 458512135, 281436435, 301856749, 331522322, 439316110, 65782135, 313620054, 377064760, 689776101, 453352404, 739524725, 113039032, 403624252, 864855957, 816177580, 472331359, 702356269, 634580725, 79566086, 723272803, 484129094, 785382934, 519691527, 303358848, 673141033, 900376058, 640090231, 332948759, 3578533, 603932450, 300252459, 455172786, 398327644, 667611961, 579527425, 847780358, 251487657, 239105566, 949519075, 816672375, 569680210, 522034786, 433488047, 339341869, 323607606, 695508020, 671840506, 403376732, 437224135, 704526427, 733331510, 566004060, 190603334, 401309800, 135615700, 480920888, 880495868, 394755529, 754131300, 980354442, 940475050, 455976643, 26150213, 620704469, 305714399, 452126616, 331922227, 285017717, 547688077, 571029451, 580099665, 888037179, 116069830, 492086251, 460673303, 652403652, 529457074, 959765712, 884239314, 707976976, 421820667, 102910899, 850649035, 332557694, 156833539, 193014693, 712889809, 65402492, 81873875, 205826928, 906576787, 536580780, 98764481, 614216242, 724741649, 926963940, 415525579, 707467586, 670685849, 645316339, 663012408, 451540628, 190074574, 100279961, 373676876, 108645392, 439186589, 289025528, 317751557, 696247292, 252536329, 524764647, 664019135, 681731166, 697044386, 721419536, 89117662, 386734310, 933623270, 18288756, 858592177, 843786785, 267433641, 104266328, 816027769, 103604036, 874219314, 626912072, 643973051, 138646542, 930635468, 638385362, 666376936, 75446650, 725532251, 558802301, 898021675, 602462415, 287100257, 103256759, 241469306, 418203100, 359820338, 439745508, 711532895, 913171524, 828285226, 490697952, 94810193, 272869408, 26560972, 979834901, 5721504, 185048349, 42545696, 396115122, 904051513, 220906107, 738993493, 588839845, 742987869, 641939237, 20134580, 613427664, 760712842, 725934923, 233138479, 694808775, 504699750, 45306699, 928921991, 348537469, 341584856, 314823473, 323200569, 5906520, 590908812, 7058731, 612527161, 95929757, 923027538, 504340570, 108267579, 981049825, 3621484, 268758794, 155138552, 967177696, 154587439, 226488698, 435889878, 282062129, 837804113, 874696398, 704916352, 672370979, 429701338, 699214790, 311303195, 947796876, 50395096, 943382310, 264134145, 110060599, 662341190, 707099896, 778109433, 209892183, 129970328, 614555781, 65561327, 723924768, 308208692, 907464540, 511861513, 664166961, 278299804, 383189150, 305144703, 399367644, 745158781, 611505481, 788035592, 958094209, 4691422, 982804694, 182195783, 644444281, 888532003, 913888496, 781449985, 252740240, 661510236, 998487245, 284318090, 646237565, 822471400, 371153017, 988783, 234143485, 906623027, 265667900, 88762375, 654203306, 124205686, 724165887, 715879556, 778678123, 201533689, 241172717, 220243793, 300732194, 834092268, 546274723, 978426161, 544966162, 860580567, 833904274, 408002579, 683573852, 414196298, 567536223, 401758309, 449922489, 264257881, 552000887, 313883439, 121158141, 816111867, 426696045, 166578559, 869183250, 677763442, 449243505, 446613544, 618933881, 765618361, 782239559, 139564825, 17361518, 375149549, 752695711, 170774896, 24223979, 929368291, 714737788, 968883177, 418171397, 28938451, 530535587, 831491933, 388232832, 375471966, 501547932, 42057135, 105907929, 319325198, 866969758, 883623220, 636639049, 98250237, 119670840, 810521959, 994818843, 979182684, 698619283, 306787611, 79779236, 316097105, 20407838, 246365554, 405157606, 746584313, 338447287, 956653822, 157277229, 382734547, 919850823, 17698838, 400783732, 846595424, 820236688, 844188244, 592045378, 664969413, 199985888, 986952695, 924241714, 545487784, 487539172, 147186879, 945151212, 958877753, 669099388, 403471548, 499546716, 915071435, 897865485, 892380510, 328284017, 649646782, 564916899, 126507447, 341928577, 916918420, 335542645, 562151880, 341948589, 153658487, 915169176, 189949851, 956608598, 92763236, 671268832, 829439855, 198464213, 96704707, 504412819, 126161975, 935193455, 513168023, 134286447, 385405295, 615567547, 17991890, 790707341, 991003956, 917307082, 145826213, 725182412, 707571456, 193431873, 694550855, 988821536, 296476226, 166333863, 595537769, 579249117, 788071113, 445822525, 312987370, 690589050, 707167073, 734770753, 836025747, 398024391, 614034356, 19892950, 177961692, 901857208, 570179250, 880745468, 628351955, 471663624, 537067058, 620422588, 801133337, 443608528, 655426152, 630822673, 323931531, 616054005, 715419230, 344542774, 569479396, 46182177, 115731968, 615621055, 927437470, 415304055, 613134814, 593402338, 555887984, 424883671, 737555229, 580850096, 206291958, 408415618, 568495923, 383046806, 331153888, 630013482, 639299672, 932192570, 426968629, 665396997, 377560684, 425576288, 499413833, 304016029, 435936610, 890997684, 37462641, 308478314, 648743689, 968679592, 6563304, 528867706, 815369648, 699526086, 854594514, 77461257, 912978080, 437849059, 584065006, 448033159, 851418436, 275202511, 933127854, 57918210, 936121297, 728315416, 493270959, 635640085, 751603865, 815510463, 322128401, 817518864, 113319096, 719706704, 151675058, 579563270, 817496583, 331259914, 304828788, 832758432, 514693374, 628452536, 859015740, 54698207, 502378937, 925823748, 468799569, 912430738, 503849861, 155092332, 42145830, 16914543, 954818713, 944191613, 753948564, 101131208, 628620169, 514926770, 674609079, 477754503, 226746575, 399775590, 317837974, 685000591, 380154246, 862619940, 156768091, 907663822, 640534228, 509892852, 140342102, 997418526, 552535460, 430179820, 454222315, 646598713, 14409817, 280310343, 324342456, 625965172, 814280682, 974660429, 122025967, 697839974, 290110820, 878936393, 874327021, 252896959, 368474189, 596100537, 759459589, 74112139, 496075772, 660681195, 476919942, 732314798, 881551587, 600771213, 916355905, 62502174, 722694262, 846208181, 235701369, 377851030, 444635218, 905821472, 6007590, 14543647, 806494416, 995077069, 714758118, 844053358, 554781732, 772216007, 970855797, 411569324, 513182664, 137085083, 204095216, 632442670, 843815967, 289982568, 631746100, 825138049, 349162102, 5326115, 207201935, 835205999, 161469959, 312314799, 644367317, 122663749, 602404965, 763996480, 974548439, 732304994, 808596406, 180421152, 975264158, 122323736, 966123769, 50110342, 744171007, 561228509, 513803739, 631885254, 848740278, 38362310, 334317889, 407483295, 704719903, 793514069, 3850010, 47429717, 332085264, 296925009, 179969654, 285965854, 188329006, 353044452, 907132439, 173498729, 971005353, 886796300, 374137584, 167007939, 257311427, 69578518, 986207933, 820577598, 762893591, 855603877, 154159499, 81230719, 988672413, 560039653, 187206037, 124634358, 756546188, 562543979, 382863463, 791317508, 638677331, 472652962, 704857946, 755439531, 209470628, 413904724, 236402946, 980178476, 925780627, 624361832, 986373739, 865597279, 733945791, 40519093, 346073968, 531933636, 452742332, 388931131, 509971886, 203046081, 86591499, 107265603, 170834917, 222658017, 931432329, 545903464, 244840320, 750824817, 665373361, 418717528, 723513553, 572491457, 458224851, 688126547, 872604574, 477404041, 810687226, 902428227, 809180291, 181691685, 593946617, 443990866, 886931195, 671951824, 117916938, 88508493, 101987861, 998221579, 302729532, 637782794, 713816070, 909221425, 478649015, 947515758, 588376423, 102208139, 387839447, 126033549, 266213171, 286274226, 201637730, 911783168, 261943681, 622500013, 456472374, 708804967, 489562877, 836248357, 622073857, 432626926, 157337505, 416320771, 436152162, 592575425, 42633820, 518316330, 29165774, 254298082, 747662083, 309417930, 635421959, 306846172}; + target = + new int[] { + 835647834, 503037935, 773002076, 731298404, 903645595, 488189634, 319785391, + 111546683, 609144970, 415205491, 685900245, 878508756, 236413773, 991053691, + 947595808, 913014938, 533038855, 88376603, 436545178, 983496954, 122530918, + 346542007, 55893465, 472984628, 347337093, 322587100, 552866643, 609759356, + 288893937, 471774337, 465491640, 783022406, 699817530, 340584553, 663909719, + 651419106, 846593366, 952609573, 912379694, 661318302, 538633771, 745093202, + 753577352, 60741272, 800245613, 228718955, 314289253, 384902244, 834091366, + 330486268, 832528567, 405339553, 667374764, 477631332, 458512135, 281436435, + 301856749, 331522322, 439316110, 65782135, 313620054, 377064760, 689776101, + 453352404, 739524725, 113039032, 403624252, 864855957, 816177580, 472331359, + 702356269, 634580725, 79566086, 723272803, 484129094, 785382934, 519691527, + 303358848, 673141033, 900376058, 640090231, 332948759, 3578533, 603932450, + 300252459, 455172786, 398327644, 667611961, 579527425, 847780358, 251487657, + 239105566, 949519075, 816672375, 569680210, 522034786, 433488047, 339341869, + 323607606, 695508020, 671840506, 403376732, 437224135, 704526427, 733331510, + 566004060, 190603334, 401309800, 135615700, 480920888, 880495868, 394755529, + 754131300, 980354442, 940475050, 455976643, 26150213, 620704469, 305714399, + 452126616, 331922227, 285017717, 547688077, 571029451, 580099665, 888037179, + 116069830, 492086251, 460673303, 652403652, 529457074, 959765712, 884239314, + 707976976, 421820667, 102910899, 850649035, 332557694, 156833539, 193014693, + 712889809, 65402492, 81873875, 205826928, 906576787, 536580780, 98764481, + 614216242, 724741649, 926963940, 415525579, 707467586, 670685849, 645316339, + 663012408, 451540628, 190074574, 100279961, 373676876, 108645392, 439186589, + 289025528, 317751557, 696247292, 252536329, 524764647, 664019135, 681731166, + 697044386, 721419536, 89117662, 386734310, 933623270, 18288756, 858592177, + 843786785, 267433641, 104266328, 816027769, 103604036, 874219314, 626912072, + 643973051, 138646542, 930635468, 638385362, 666376936, 75446650, 725532251, + 558802301, 898021675, 602462415, 287100257, 103256759, 241469306, 418203100, + 359820338, 439745508, 711532895, 913171524, 828285226, 490697952, 94810193, + 272869408, 26560972, 979834901, 5721504, 185048349, 42545696, 396115122, + 904051513, 220906107, 738993493, 588839845, 742987869, 641939237, 20134580, + 613427664, 760712842, 725934923, 233138479, 694808775, 504699750, 45306699, + 928921991, 348537469, 341584856, 314823473, 323200569, 5906520, 590908812, + 7058731, 612527161, 95929757, 923027538, 504340570, 108267579, 981049825, + 3621484, 268758794, 155138552, 967177696, 154587439, 226488698, 435889878, + 282062129, 837804113, 874696398, 704916352, 672370979, 429701338, 699214790, + 311303195, 947796876, 50395096, 943382310, 264134145, 110060599, 662341190, + 707099896, 778109433, 209892183, 129970328, 614555781, 65561327, 723924768, + 308208692, 907464540, 511861513, 664166961, 278299804, 383189150, 305144703, + 399367644, 745158781, 611505481, 788035592, 958094209, 4691422, 982804694, + 182195783, 644444281, 888532003, 913888496, 781449985, 252740240, 661510236, + 998487245, 284318090, 646237565, 822471400, 371153017, 988783, 234143485, + 906623027, 265667900, 88762375, 654203306, 124205686, 724165887, 715879556, + 778678123, 201533689, 241172717, 220243793, 300732194, 834092268, 546274723, + 978426161, 544966162, 860580567, 833904274, 408002579, 683573852, 414196298, + 567536223, 401758309, 449922489, 264257881, 552000887, 313883439, 121158141, + 816111867, 426696045, 166578559, 869183250, 677763442, 449243505, 446613544, + 618933881, 765618361, 782239559, 139564825, 17361518, 375149549, 752695711, + 170774896, 24223979, 929368291, 714737788, 968883177, 418171397, 28938451, + 530535587, 831491933, 388232832, 375471966, 501547932, 42057135, 105907929, + 319325198, 866969758, 883623220, 636639049, 98250237, 119670840, 810521959, + 994818843, 979182684, 698619283, 306787611, 79779236, 316097105, 20407838, + 246365554, 405157606, 746584313, 338447287, 956653822, 157277229, 382734547, + 919850823, 17698838, 400783732, 846595424, 820236688, 844188244, 592045378, + 664969413, 199985888, 986952695, 924241714, 545487784, 487539172, 147186879, + 945151212, 958877753, 669099388, 403471548, 499546716, 915071435, 897865485, + 892380510, 328284017, 649646782, 564916899, 126507447, 341928577, 916918420, + 335542645, 562151880, 341948589, 153658487, 915169176, 189949851, 956608598, + 92763236, 671268832, 829439855, 198464213, 96704707, 504412819, 126161975, + 935193455, 513168023, 134286447, 385405295, 615567547, 17991890, 790707341, + 991003956, 917307082, 145826213, 725182412, 707571456, 193431873, 694550855, + 988821536, 296476226, 166333863, 595537769, 579249117, 788071113, 445822525, + 312987370, 690589050, 707167073, 734770753, 836025747, 398024391, 614034356, + 19892950, 177961692, 901857208, 570179250, 880745468, 628351955, 471663624, + 537067058, 620422588, 801133337, 443608528, 655426152, 630822673, 323931531, + 616054005, 715419230, 344542774, 569479396, 46182177, 115731968, 615621055, + 927437470, 415304055, 613134814, 593402338, 555887984, 424883671, 737555229, + 580850096, 206291958, 408415618, 568495923, 383046806, 331153888, 630013482, + 639299672, 932192570, 426968629, 665396997, 377560684, 425576288, 499413833, + 304016029, 435936610, 890997684, 37462641, 308478314, 648743689, 968679592, + 6563304, 528867706, 815369648, 699526086, 854594514, 77461257, 912978080, + 437849059, 584065006, 448033159, 851418436, 275202511, 933127854, 57918210, + 936121297, 728315416, 493270959, 635640085, 751603865, 815510463, 322128401, + 817518864, 113319096, 719706704, 151675058, 579563270, 817496583, 331259914, + 304828788, 832758432, 514693374, 628452536, 859015740, 54698207, 502378937, + 925823748, 468799569, 912430738, 503849861, 155092332, 42145830, 16914543, + 954818713, 944191613, 753948564, 101131208, 628620169, 514926770, 674609079, + 477754503, 226746575, 399775590, 317837974, 685000591, 380154246, 862619940, + 156768091, 907663822, 640534228, 509892852, 140342102, 997418526, 552535460, + 430179820, 454222315, 646598713, 14409817, 280310343, 324342456, 625965172, + 814280682, 974660429, 122025967, 697839974, 290110820, 878936393, 874327021, + 252896959, 368474189, 596100537, 759459589, 74112139, 496075772, 660681195, + 476919942, 732314798, 881551587, 600771213, 916355905, 62502174, 722694262, + 846208181, 235701369, 377851030, 444635218, 905821472, 6007590, 14543647, + 806494416, 995077069, 714758118, 844053358, 554781732, 772216007, 970855797, + 411569324, 513182664, 137085083, 204095216, 632442670, 843815967, 289982568, + 631746100, 825138049, 349162102, 5326115, 207201935, 835205999, 161469959, + 312314799, 644367317, 122663749, 602404965, 763996480, 974548439, 732304994, + 808596406, 180421152, 975264158, 122323736, 966123769, 50110342, 744171007, + 561228509, 513803739, 631885254, 848740278, 38362310, 334317889, 407483295, + 704719903, 793514069, 3850010, 47429717, 332085264, 296925009, 179969654, + 285965854, 188329006, 353044452, 907132439, 173498729, 971005353, 886796300, + 374137584, 167007939, 257311427, 69578518, 986207933, 820577598, 762893591, + 855603877, 154159499, 81230719, 988672413, 560039653, 187206037, 124634358, + 756546188, 562543979, 382863463, 791317508, 638677331, 472652962, 704857946, + 755439531, 209470628, 413904724, 236402946, 980178476, 925780627, 624361832, + 986373739, 865597279, 733945791, 40519093, 346073968, 531933636, 452742332, + 388931131, 509971886, 203046081, 86591499, 107265603, 170834917, 222658017, + 931432329, 545903464, 244840320, 750824817, 665373361, 418717528, 723513553, + 572491457, 458224851, 688126547, 872604574, 477404041, 810687226, 902428227, + 809180291, 181691685, 593946617, 443990866, 886931195, 671951824, 117916938, + 88508493, 101987861, 998221579, 302729532, 637782794, 713816070, 909221425, + 478649015, 947515758, 588376423, 102208139, 387839447, 126033549, 266213171, + 286274226, 201637730, 911783168, 261943681, 622500013, 456472374, 708804967, + 489562877, 836248357, 622073857, 432626926, 157337505, 416320771, 436152162, + 592575425, 42633820, 518316330, 29165774, 254298082, 747662083, 309417930, + 635421959, 306846172 + }; assertEquals(false, solution1.isPossible(target)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1356Test.java b/src/test/java/com/fishercoder/secondthousand/_1356Test.java index 1d2bf6fd38..c7d6e7b468 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1356Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1356Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1356; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1356Test { private _1356.Solution1 solution1; @@ -16,27 +16,34 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{0, 1, 2, 4, 8, 3, 5, 6, 7}, solution1.sortByBits(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8})); + assertArrayEquals( + new int[] {0, 1, 2, 4, 8, 3, 5, 6, 7}, + solution1.sortByBits(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8})); } @Test public void test2() { - assertArrayEquals(new int[]{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}, solution1.sortByBits(new int[]{1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1})); + assertArrayEquals( + new int[] {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}, + solution1.sortByBits(new int[] {1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1})); } @Test public void test3() { - assertArrayEquals(new int[]{10000, 10000}, solution1.sortByBits(new int[]{10000, 10000})); + assertArrayEquals(new int[] {10000, 10000}, solution1.sortByBits(new int[] {10000, 10000})); } @Test public void test4() { - assertArrayEquals(new int[]{2, 3, 5, 17, 7, 11, 13, 19}, solution1.sortByBits(new int[]{2, 3, 5, 7, 11, 13, 17, 19})); + assertArrayEquals( + new int[] {2, 3, 5, 17, 7, 11, 13, 19}, + solution1.sortByBits(new int[] {2, 3, 5, 7, 11, 13, 17, 19})); } @Test public void test5() { - assertArrayEquals(new int[]{10, 100, 10000, 1000}, solution1.sortByBits(new int[]{10, 100, 1000, 10000})); + assertArrayEquals( + new int[] {10, 100, 10000, 1000}, + solution1.sortByBits(new int[] {10, 100, 1000, 10000})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1357Test.java b/src/test/java/com/fishercoder/secondthousand/_1357Test.java index 3ba69d344f..d242401a7f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1357Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1357Test.java @@ -1,22 +1,34 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1357; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1357Test { private _1357.Solution1.Cashier cashier; @Test public void test1() { - cashier = new _1357.Solution1.Cashier(3, 50, new int[]{1, 2, 3, 4, 5, 6, 7}, new int[]{100, 200, 300, 400, 300, 200, 100}); - assertEquals(500.0, cashier.getBill(new int[]{1, 2}, new int[]{1, 2}), 0); - assertEquals(4000.0, cashier.getBill(new int[]{3, 7}, new int[]{10, 10}), 0); - assertEquals(800.0, cashier.getBill(new int[]{1, 2, 3, 4, 5, 6, 7}, new int[]{1, 1, 1, 1, 1, 1, 1}), 0); - assertEquals(4000.0, cashier.getBill(new int[]{4}, new int[]{10}), 0); - assertEquals(4000.0, cashier.getBill(new int[]{7, 3}, new int[]{10, 10}), 0); - assertEquals(7350.0, cashier.getBill(new int[]{7, 5, 3, 1, 6, 4, 2}, new int[]{10, 10, 10, 9, 9, 9, 7}), 0); - assertEquals(2500.0, cashier.getBill(new int[]{2, 3, 5}, new int[]{5, 3, 2}), 0); + cashier = + new _1357.Solution1.Cashier( + 3, + 50, + new int[] {1, 2, 3, 4, 5, 6, 7}, + new int[] {100, 200, 300, 400, 300, 200, 100}); + assertEquals(500.0, cashier.getBill(new int[] {1, 2}, new int[] {1, 2}), 0); + assertEquals(4000.0, cashier.getBill(new int[] {3, 7}, new int[] {10, 10}), 0); + assertEquals( + 800.0, + cashier.getBill(new int[] {1, 2, 3, 4, 5, 6, 7}, new int[] {1, 1, 1, 1, 1, 1, 1}), + 0); + assertEquals(4000.0, cashier.getBill(new int[] {4}, new int[] {10}), 0); + assertEquals(4000.0, cashier.getBill(new int[] {7, 3}, new int[] {10, 10}), 0); + assertEquals( + 7350.0, + cashier.getBill( + new int[] {7, 5, 3, 1, 6, 4, 2}, new int[] {10, 10, 10, 9, 9, 9, 7}), + 0); + assertEquals(2500.0, cashier.getBill(new int[] {2, 3, 5}, new int[] {5, 3, 2}), 0); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1358Test.java b/src/test/java/com/fishercoder/secondthousand/_1358Test.java index 961fce80d8..22d27c1804 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1358Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1358Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1358; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1358Test { private _1358.Solution1 solution1; @@ -46,7 +46,9 @@ public void test6() { @Test public void test7() { - assertEquals(1244858478, solution1.numberOfSubstrings("cccbbbacababcccabcaaaababacaccbccccabcbcbcbabcabbcbbccaabababcabbaabcabbabcbaccbccaaababcbbbbcbbcaccacccabcabaabaaaccbcaccccbabccabacacbbbccbacbbbbbacbcabcabccbaccccccccaacabababababccbbcccbbcbcaabbcbbbbbcaacacaacccbbbbabcabbcacabbcbaabcaabcbcaaaabbcbbbacccbacaabacbbaacbcbacaaabcbaacbcbaccabccbacbacbabbbabbbcbcaaaaccccacbaaaaccbbccaaacbbabbbcabbaccbabbacbaccaaaababbbcbcaaccacbacbbaaabacbcacacacbccaaabbcccbbcaccbccbabcabcaacbaaacbbcababbbcbabbaacbcaaccbcacccabaacabcacaaccacacbcaaccbacccaacccbbbcbbcababbcbcacaccacccabababccbaaaabcaacaacbcbaababaccaaabcccababcbaaccbbabcacbbcbcccbbacacbbbacbbcbccabcbbabbbcbacbabcaacaacbaabcbbbcbcbcbaacaabcaccacccaacccccbcbccabbbacaccaababcbabcbacbccacbcccbaacccbbcabacaacabababcbcaacaacbabaccacccbbbbaabacbcaaaaaaaaaccbacaaabaaccbbacbaaacbcbbcaccbabbabbbabbbbccbaacbbabbbbaaabcabbbbbbbacbcacacaacaccbaccbcabbbbaabbacacbbcabcaaaaabbbcaacbabcbbcacbabbbaaaacbcbaabbcbbaacbacacbcbccbccacaccaacccbccbcbbcabacbbaabcbbcacbabaabacccbaacbbaaccbcababbcbcbbbcaacababaccbcccbbcbababccccaccbccccabaabcabbcacccbcbacaacccabbaacbbbbcbcbacacabaaaaabcbbbabbabcbcccabbaaaccbaaaabbaabbacbccabbbcaacbbbcabbcbcbbcbacbaababaabaaacbcaabcacbccaaacacabbccbcbcbbabcbbccacacbbcacaccaaacbabcababcbcbbcbcaccccabcbccbaacaacbbaaacbbccbbccbbcacbcabbacccaaabaacbabaacbaabaaabcabcbcaaaccaaccbbbccbcbacbacbababbcbcacaaaabcbaccccaccabcaabcabbbcabbbcaaccbcacaccbabbbcbacabbaccabbabcaccbbacabbbabbcaaaabbacaabaacbccacbaabbacbbabcbacabbacbbcbbcbbaabaabcabaaabcccbbcbbccbbccbccabbbabababcabcbbbaaaabbaacaccbaabcaacccbabbacacabcbbbababcbaababcbbaccaaaabbacccbacbcaacacaacacabcaacabbacacbcbacaabaaccaacbaaabbcaaabbbbbcbcbbcccbabcabbbabacaaaaaacacaacacacbaabccbacacabbaaababcaabbabbccabaaababbabbbbabcababbaacbcccbabbccbcaabccabbcbabaaaacbabcbbcbbabcbbaaacccacccbbbcbbccbcbaaaaacaaccabcbaacabcbabaaacbacccacabaacbababbcbbcbababcaaccabbcbbacaacaaccbacbbccbbaaccbbcaccaccbbaacccacaabbbcaabcbcbcaacbabacccbabcaababcaababbbcacbaabccaccabcacaaaaabaacaaaaababbbbbcaabaccbabacbaacbcababcbbaccaccbabcbbcbbbccbbcbbcabbbccaaccccaaccabaabcbcbcacbcbaabccaacabaaabacabacbccccccbbacabbaccacccaaaaabacaababcbababaaaccaabacbbbcacccccbccbaacbbccacacababbaacabbabcaaccccbababcbaacbccbbabbcbcaccbabaacbbcbbcaaccabccaacbbbaccaababbacabbcabcbccaabcbabaabaaababaaacbaacabaccaaacbaabaccbbcaaaabacacbabbaaabcbaaabbacbaabacababaabcccabbacaaaabccacbabbcbabbccaabacccabaccabcccaabcbbbcacbccabcacabaccbcabacbcbbabcbabcaaacbababaccbcccbacbcbbbcccbbcacbbaccbbbccaacaccbbbabacbbabcbaabcbacaabbbbcaacabbbbabcbabaaabacbbcacbaacbbccbabbcbccacaabcabaaaabbccabaabccabbcabccacccccbbacabbbbbbbcbccbbbcccaccccbcaaccbcacaacacbbbaaccbcabcbccccaabbbcccaacbbccacbcbcacabaccbaaaabaaccacbabccccacaccababcacbcbbcbbbaaabacbaccabcabbbbaababbabcaacbcbcbccccaabbccccbaccbabaabbacbacaabbbbbacbcbcbccccbaccbbacabcbabbaabccacaaaaabcbaaabcbcacccaccbabaccacbcaaaabaabcbaacabacbacaaabcaacaaccbcaabbcbcbaabcccacaabcccabccaacbcbbbaccacbacbabbccaaacbabacbcababbcabcbbbbacaaaacacccbaccbbabbbccbccbacabbbcaabaccaccbcbbacbacacaaaaacbcababaaabccbcaabaabccbbbcbccbbacaccbacbcaaabacabcccacbaccbbccccabcaaabcccbacabbbbcaacbbbacacaaacccaaccbbaccbcabacaccbcbabcabbacaacaaaabaacbaccbacccbaccaaabbbbcbaacbcacaaaaaacbccccabcbaaaccccacbbcacccabbccabbcaaccbbccccbbaaacabbcbbbabacaaccbbaabaabaacbbacacbbbbbccbaaaabcbaaccacabacbaaaaabcbabbaabbbcbbbacbbbcbbbcaaacacbcbbcaccaabbcaacaaacbcbbcaaaccccbabababbaabaacacababbabcccccbaccaccabcbccbccbbababbbacbbcaaaaccbaacaabccacaabcbbabcbbccaabbbacacccabbabbaacaccbbabbbabccccbcbbcbbcbbccacccbcacbcacccbccabcccbcacbacaccbacbacaaacabacbbacabababacaabcbaccbbabcaaacbbbabacbaabbccabbbcbbbbccacaccccaabcbcbbcccabbababcbaaaacccaccabbabaababccbaabbbcaacbaacabaababcbacbbabbcbacccaaaaaaaaaacbcaccbacacbbccaabbcbacbbccbabaaabacccbaccbbbbbbcaaababaabbbcbbababaabaaacbbbacaabcbbccbbacccabbbcbcbacbccacbcbbaccacbccbaaaccbcbaaacbaabaccbbaaabaaccabbcaccccacbaacaacabbcccbccbbaaacaacbcaacbbcaccbbabcaaaacccaabacbababcbcbcccbcccaabcaccbacbabcbaaccaacaaaaacababacaccccccbaabcbbacaccbbaabaacaccbccbacaaabcccbcbaabbcabbbabbbcbbbabccbbacccabbccabbccabcacbcaacaccbccccaaacbcbabbabbaacbcbcbcbcbbcbaccbcbcbacbbcaaaaaabbaccbcbabbabbabaacacbcbabcccbbaaccbaaaabcabbccbabbabaababaaababcabcacaccccbaaabcacbababacacaacaaacaabaabbbbbcacabbacbcaacbbccacccbabbcbaaacaabaacaabaacbbaabcaaacbccabbbcbacccabcbacacacbcabbbccacabacbaaababccaababaabacacaaabacacbabcacacacaccacbbcbcbcbcbbbaabaaaabbbacbbaaccabcaabaabcbbbbbabbbababbcbbaacbacbbccbbbbcccabccacbaccaccbbccaaccabbaaaccabccbbabccacaaabbbcacacaabbaabaabcbbaaacacccbccbbbcaabcacbcaabaaccccccabcaabcacbccaacbcaaaccbccbcacbcabaacaaaccabbbcbccbcabaabbcacbcbacccaabaccaabbbabcccbacbbcbcbccbaaccacbcbbacabbababbbbccacbaaabacaacbbacbccbbcbccbaaaaacabbbbbcbacbabbacabbaaaccaaaacccbcbaabbbbcbcaaabcccbbabcacbaccacabbbcaabbacaaabccabacccaccbcbabcbbaabbaccabcaccaaccababcccbbacacaaaacccccbaaaacccbbacbabcbbcabaaccacacaaaccbcbcacabbacccccabcbacbacbcbcbbcaaaccccabccbcacaaaaabacacaacbbbcaaacaabbbabbaaabbabbbcbabaaaaccbbbcccbaacaabacaaacbccbcbabbbcacabaacaabababcbaabcaaaccccbcbccbbaabbacccacccbcaaacccaccaabbbcbaaacccccabcabbbbbbaaacbbccacabacabaabaacbbabaacbcccbabcacaccbacabababbcaaccbacbabababbabbbcabaccbaacbbcacbcacbabbcbbaaabbbcbacbcbcbbbaacbbbbaccabaaaabaaacbbbaccaaabbccabbcbcccabcacbabbbabbbbcbcbabacbcacbcbacaacbaabacbbccacbbaacbaccccaccbacababbbcababbbacaaabacbbabcabbcabbaacaccbbbbcabcccaccacbcaaabaccbaaaacacabcabaabaccaaacbbaabcaccacbbabababcccbccccaaccabbcabaaaacbaacaacabbcbbaacccbabcbcbbbacbbcacbabbbbaccbbbbbaaaabcaabbaabbbabbcbaaccbbabaaabababbabcbcbcabcaccabaacbabcbbcbaaaacbacccbabbbcbbbccabbccaccbabcbbcbbacbcaccbcaaccabbabcbabcabacabbbaaabbacacaaaacbaababbbaaacbcbabacacbcbbacbccaaacbcacaacaccacaabbcbcccbccacbabbcaabcbbcbabababbabbabbcabbbbabbcbaacaacbbbcaaacbbcabcbaabccccabcbaabbabbbbcabcabccbcabcccbbbcbbaacccbbaabaaababccaacbabaaaabacaabbcccabaabaabbcacccabbcbcccbbbaababbabcaabbaaaaccbcbacabacabbbaccbbabbabcaaacbcacabababbbcbccbaaabbcccbbaacaacbababbabbcababcabbcaacbaacaabacbaaacbcbbaccabbbccbbccbbaaacababbabbacbbaccccabaaacbcacabbabaacbbacaacaaacaaaaabbacbaaacbbbacbacbbbbcabbcbbcacbbaaccaaacacbcabacababcbcacabbccccacbbababaccbabcacbcbccacaaacccabaabaabbcabbbacacbabccbcaaaababaabaaaccbbbababcabaababbcababbcacaaacaaaccbcbabcbabcbacbccacabcbcaacbcacbcbcaabcbabaacbacbbcbcbabbbacbaaacccbacabcbcbcbbbabbcbcbbacabcabaaacbbacbbbaabcaaabcbaabcabacacaabaaaaabcccabbacabaccbbbbabbbababaabccabbbacaabcbccacaaaababbcccababaaabaccbaccbaabccbaabcaaaabaccacbabaaaaaccbcbbaabcbaccccbbaaccabbacacaccbabbbbaacabacababcaaaabbacbcbbcbcbababaccbbbaccbbbabcbababcacbbbbcbaabbcbbbccbaccabccababccaccbbacbbaabcaaaacaaccbabbbacaaacabbcacacbcabaacabbbacbaaababaaccccacacacbcbaaabcbbbbcbabcbccbbbaacabcabbcabaacbacbaabbcccaacccbabcaaccaaaaaacabacbacbcbbcccbaccaccacaaabcccbacabcbabaaaababccbaccbbcaaabcccababacccbabcaabcbcabbbbcbccbaccaaccacbaabbbabbcbbaccaaacaaccbbaacbabcbbaaaccabaaabbbaabcacabaaabacbabcaaabbacbbacbaaccaaacabbcaaacbbbacbcbbcbabbabaacbcababbbbbcbbabbacacabbbccbbccbbbcabcbcbccacbaabbcacccbbbbbccbaaccabbcbacbaaaaabababbcccbaabbcababbbbaacbccbbacabbaaacbbccaaaabaabcbacbaccbcccbabaaaccaaccbcccaacabbcbbcbbccaaaabcccbccbaaccabacaaabaaabacacbbaaacbbbcbabbcaabccbcaabbacaaacccbbcaacacbbaccbbabbcbbbaacbccccbabcbbacaccbbcaaaaabcabccccaaccacbcbababcbbaaaabbbcaabbabbcabbaaaabcbbacccbbaabbbacaacacaaaacccbaabacaaccbccacbbcaaacbcaaaaabaaccbcaccabbaaacbbbbabaaaabbcaacabbbccbaacbbbcbaccaabbcabbcbcccacbbbacbbabaaaabacbcbcababcbaaaabcaacbacbbccbaacacccbaacabbcccabbaabaaaabcccbaabbcbcbcacbcaabcccbabaabccccabccbbaaabccaabbacbcccbaacabccacccabbbbcacaaccbccbcccacbaccacaaaababbcabccabcaacacbcacbcccababbababbbccacabbcaccabccacccbababbbcccccacbbacaacaaaacabcacccabbbcabccacaccaabbcaabacbabccccacabcaacabbabccacacbaabaccabaacccbbcabaccaaaaaacbbbbbacacccbaabbaaabaccbaaccaaccaacbaacabbbcaaaaaabccbaccbaaacccaaabcbbbabccbababcbbbcbabcabcccababacabcbabacaacaccbabaaacccacbbcaaaaaccabbcaaccbbbccbabababccccaccbccbcbacaabbabbcbaabbbcabbccaaaabbacababbaaacccaacbcabacacabacabbccabbccccbcbbaabbaacbabbaaaaabaccaaabbcabacabacaccccbcababbacabaabbcbbaccabbbcbccaababbbababacbbcaaccabbabbabbcbaabaacccaaacbabbcbcbcccaababaabbcaaaacbcccaacbccbcccbbbbbcbbcaababccccaaacacaaabbccacabbaabccbcaabbaaccbacabcaccaaababbaabccaaabaababbababcaacbbacccabccbcccccabaacaaccacbcbaaacbbacbbaccabbbbacccaccbaccccbbacacbcccbcaacaccbaccccbcaaaababacbbbaccabccbabaaccaabbbbcaaabcbbbbcbbabbbbaaccabcaacccabacabccaccbbabaacbcaabcbabbbbaabbbbbacbabbbaacaababaabababaaaababcacbccbcbbcacaccaccbababcaacacbcbababacabcbbcbcabbcabaacccaaabbbcabacabbccbccabcccbbaabccaccaacaccaacabbccccbababacbaacacaacaacbbcbcccacccababccabcccaabacbabcbbbcabaaccaaabcbccbcaabaacaccaccacccbaaccbcaabcccabacbbbacbabacaccacccbbbaccacbccbcbbbaabcacccacaabcaaabbbcacacbbbcbccaccbcbabbbccbaacbbcccbbabcbabababcbcccabaabbaabacccbacaaccbbccaacbbbcbaabaaabbcbaccbaccbabaaacbbbcaabacacccabccbbcccabcbbbaaacbccbaaaacbbcbccbacacccccbcbbcccbbaaaccbabaaccabbaabcabccbbbaccaabbbcbbbaaaabccccacbbabbccbccbaccbacbcbccbbcbcabbbcbcabacbabcacaaabccbcbcacbbaacabacaaccaabacbcbaabbaccbcccbbacacbcccabccbaaacacbbabccbcacacccacbaabaaababbabaacacbbcbaccaacabaaaaabcbcccbbabaabcbabbbccabccccbbcbccaaacaabcccacaaacbacabbccbcbaaacbcababaaaaccbcbccacccabbcabbabbccaaababaaaabbabbabcbbaaaccabbcbbccbacbbcaacbabaaaacbaaabaaabaaaaaacabbbbbbabcbacbbbbbbcbccaabccccacaabcaabbabbabacbcccbcbcabacbacabbcbbcbbacbbcabaccabaabababaacbbcbcabbcacacaabbcbcabbcacaaaaacbacacaacbbbbbaaabbbbabcccbaaccccbcccbbccaaccaacaaccccacacacbcabcbccbaaccccabbbbabbacbbbaccccbcccbcabbbbababcaacbbacccbbcbbbcccababacbaacacbaacbbbacacaababccccabcbcbccacbbbaaaccbbcaaacbcaaccbbcbccabbcbcaabacaaacacccaccaaabacbacbabacbbcabaacbccbccaccbcccaaaabbaacbaccbcbbaccccacacaabcccbaacbccaabbcbbbbabacacacbbabaaaabcccccbcbabaaabbbabcabccbbcaababaccacacccbbcabcabbccaaacbabcacbaaaababababcbbbaccccacbacaccbbcccbbbbccaabbccccbabbbccbccbbbbbaaacaaabbcabaabbbcacaaabcbbabaaacbbccabbcbabbccaabacbcaaaccabcbbbaaabacbcaccabbabacccabbcbccbabaccccbbbbabbcbacabcbbbcabbbcccbbbbcccccacaacacabacaaabbcacabaacbbbcaabcbbaccbaaabcaccbaccaacbbbaababaccbcaacacabcacabacabaacbcaacacabacbcbaccacccbaacccaabababbbaabbbaacccbccacbaccbaacabcbbbcaaaabcacbbcbcccbaaacbcabbaaaaabccbcbcccabaabacaccbbbacaaccbcbababcbbbacccbbccbabcccacaabccaaabbcbbbaccbbabcbbabcaabcbaacbbcabcabbbcbaababaacbabbccbcabbabcbbbabcccbbabacbabbaabcaccbccacbabccbaaabbbacccababbaaabbbbabbccabababbcabbabcccccccccbcbccaaacbccabbabbbaccaacacbbcbbbbcbabccbbacbabbababcabbcccbbabaaaaacccacacbaaaaccccbcbabcabbbcbaccbbbbcbbbaaabcbaccbabbaacaaacbcbabaacbcaacbccbcbbacbbcbabcbcaaaaaabbbabcbaacabbaacbcbaaaaacaabbaabbccbcaccacbccabbcaaacbababbcbccbcacbbbcaabaccbcbcbbaaccabbabcabccaccbbaaaaacabbbababccbaccacbcaaaaacccaaacacabacabcbcacaabbcbcacbbcaaccacacacbbbbbbcccbbbccbbabbcccabbccacacbacabababbbaabcbcbbabbaabaababbcaccabbcabacbcacaacbbbbaabbccbaaacccacbbbcbbbababaabaaababcbcbaacccbbccbcbcbaaaacbbbbcaaaabaaabbbccabcbaacabcaacbbcaabacabababbabbbabbbbcccabaccbabbccbbbabcabaabbcacbbcacacbacacababbbccababcbccbabaaaaabccbabbabccacaaabcacacaabbababababaccbbaabcacbbabacbacbbbabaacaabacbbbaaabcaacbcaccbbbabccababcbcbcbcabaaaccbcabcacbbbababaaaababbbbccaacbabaababcbcabccaccbacbabaaaaabbccbcaaaaaabccbbabcaabacbabacccabbcbcbccbacbaabbaacaaacbacbbaaccaabaaabacacccaabccabbbaacaaccacccacacccaccbccabcaaabacacbbccbabbacabbbaaabbabcaacbabbabcbbcaccacccbbccaccbacbcacccbabcbcbcbbabcccccacbabbacacbbabcacabbaababbcccaababaccacaacabacaaaccababacabbcabcabacaccbbcacaaabbaacbbcaabcccbcbabccbabbaccbcabbacabccbcbbcbacabcabbbbcababacaababccbbbccbbaababbcabbcaaaabbbacaabaabccaaccbbcbaabbbccabbccabcbacbcaccabababbbccbbccbbcccbacccccaacbbabccababcbcbcbcaacbbbbaaccacccabbbaabaccbacacbbbcbbabaaaaccabcaabbaccbccbaacabaacaabbaaaacabaaccabacbccabbcccbcccbcaaccaaccbcaabcbabbbaacabbaabcccbaccacbbacbbbcacabbcbaaabcaaaccbbcbaaabbabcaccacbbbbccaccabcaacabcaacbaccbcabbccaaabcbccbaaabbcbaacbccbacbbcbaccbaaabaaaababccbbcbacabcbabcbbacbccaabaaccbabcbcbcaaababbbcbccababbacaccaabcbbaacbabaacabaaaaaabcaabcbbcacbcacabcbbbabacbbbbaabacbcaaaaacaacacbcbcbbcbcbccacbaccacbbcbcbcabcbaaabbcbabacabacbabccbbbcbbcccbaaabcccacabbbcaacaacbaabbcbcbacbbcbbbaaaacbbabcaaacbccbccaacbacaaccaababbacbcaabcbaabcbbcabbabcbccaaaacbabbbcaabccacaaccbbbccbaccbaaccabbcbbbccbcaabbbacbbcacaccacbcbbbbabcccabbccabbcbacaccbaaacbabbcbacccaacaabacbbabcaaacaacbbabcacacaabbbaabaaccccbbcaccbbbacacbbabcaacbbbbbababbaabacbaabbcaabccaaabbacbacacccccbaccbbbccbcaaaabccbbbababbbbbaabccaccaaaccaabbbbacaacbbcaaccccabcaaabcabcaacbcbbcccabaababbbbbabcbcbccababcbccacbcbcacbaabcacccbacaccacabbbababbbabcaabbbcccacccabbcaacababcbbcbbaaccacbbaacbaabcabcababbacbcabaaacccacbbaacbabbcccabcbaaccbbcbcabacbcbbbbcccaccacaacacaacaabbcccaaccbcacbabbacabaabccccaaabccabcabacaabbaaaabcbbbbabbcbbbbabbcbcccbabbccabbaaacbbcabcabbabccccbbacaacbbccbccccababbcacabbacaccbbbcbcaaabcbcbccbbbccaacaaabacacaabacbacbbcaaccaaaaccccbcbbcbaacbcbaccccaccbbcaaccccaabbcbbbabbaaacbcbbaacaccababaaacbbaaccaccbcaacabaccacbbaccaaaacbcbabacabacbbaaababcbbbaacbaccbccbacabacbaaababcbcaccbabbaccbbbcabbabbabcbcaaccaccbbbbacbbaaabcaabacccbbbacbaacabacabbaaabcbcaaaaccccabacaacccacbbbcbababaaabbbaccbcaabbccaabaccbbaababaabbcbbabcbcabbbacabaccbbabcbbbbcacabbacbacacccacbaacabaaaacacbcbaaacbcbbabccbaaabaaabaccccaaabaabcbccaaabcabcacabacccbabccbcacacbbbaaacabaacabbbcaacabcaacbabccacbccbacbcbbcaaaabcbbbbbbcbcbaabbcbcabbbababbabaaacbaaccbacccbbccabacaacbbbbacbbaaccacbcccaacbbbbccaabaccaccbbcaaacabaabcabaacccbabbaacaabaacccabcccccbabaacaaccbcbbabaccbbbcaabacaccbcbacccbccbaacacccacaccabcaababbaaaaccbcabcbbacbccaaaabcacbbacacbaababbccccbabababbaaabbcbabbcaabbacaaaabaaaaaaaaaccbaacbbbaacbbbabccaccacacacbacabbbbabbaacbbbbacbcbbbcacccbabcabbbacabcbbbcbcacbabbacbccbccabcbcbacbbbbcbccacacccaabcbcaabbababababbacabbbbbcaabcacabbbcababaabcbaabaaaacbcbbbcbcbcbacbbcbabccabbcacaaabababacbcaacacabcbccccaacccacbaaaacaccabcabbaccbcbccbabccccaaaaacacabbabcacabcbabccbaccaacbcbcaaaabaacacabaacbaccccabbaccabaabccccaccbccbabcbcccabbbccabaaccbcaccbbabcbabcccbcccaacacaccacbbbacbbbcaacbaabbbcaccccbbccacccacaabbbcabbbacbcacbccbaccbbccabcbbbabcacabbbaacbbbcccaaabacaaabcbcccbccaaabcbbabaabcbacbbbabbccbcacbccaacbcbabbbbababbcacccbabbaaccbbcbcbcacccaabbaabcaabbcacbcbabacbcaabaaabcbaabbbbabacbbcabbaaccbcccbcabcbabccbbcaaccbacabcaacaccbcacbbaccacbbcbbccbaccbcbaccbaabcccbaabacbcaaabcacbbaaaabacaccbbbcbbacabcababbcbbabbccacbabcbcbabcbbaccbacbbbabcbbcaaacbaabcbcbccaccbacacbbabaccccccbccaccbaacabacbccbcaabbaacbcacaabacbacbbaccbabbbbaccccaabbacccababbbbaabccaaccbabbbaabbaacbababcbcbbabcbacbabccccbbcbcabcbbabacacbbccbaabbccacaabbcbccbcbbcccbbababbccccabaacbabaabcaacbbbcacbbabaaabcbcbbbbacaccacacacacacbacabacbcbabcccaaababcaabcbabbcbbacbaacccaaabccacccaaabaaabbccccaccbacbcccaabbacbbccbbbcbaaacabbcbbcacaacbcabcabcbacbababbccabbbbbcbcaaccbcabababbaaacbabcbcaccababbacabaaaaccabaacbbcaaababccaccbaacacacbcabcbabaabcbcbbccbaabaabacaaaaccbbbbabbaabccabbcacacacbcacbccccaacaccbabbbcbbacaccaccbacacbacacbbabaaabaccbcccaacbaaababcbcbbabacacbbcaacbaabbcabbbbccacabaccaacacacccacacacbbcaaaacbccccbcbaaaabccccababcbbcbbbcaaaccbaaccaaacbababccbbbbababcbcabbabbcbbbbbccabaabaabcacaaaababcabbbabbacbaaaaccacbcbacbabcccbaaabbbcbcbcbbbccbabaccabbacacbbcaaacbbaabcacabbbcabcbbccacaacaacbbbbcbbcbbcacccbaacabbaabcbaaabbbaabbcbbaccacbccaacacbbbbbaabbaacabbcacbabbbcabccbabbabcbbbbacabbcaaccacabcbbcaaaccabcbacbaacbacbbacabcaaacaabbbaaccbccabaccbcbcbbbccccbbabcaabbbcabccacacacbbcaccaabbbaaacbaababcaaacbabbbaaaccaaabbaacacabbabcbccbbcaacbbccbccccabccabbabcaccbcbbabaaacaccabcbcbcbbabbaabcaabccbabaabccbabcbcacbcabccbcabaaaaccacbbacbcabaaacacbcababbaacbcaaacccacaaabbbccaaccabbbbcabcbccbcaabbccbacccabcbabbcccacbaabccaabbbbabbcabababaacaaacbaaaacaaabcaccbcabbbcccaabcaaaaabacaaababbacccababbcabbcaacbcaacbabbaccaabbababbabcbaaaaccaaaaaaaccccbbbababbabbbaabbcaabaacbacababcbbcbbbbbbcaaaccbaacbccbabbaabbacabbcbacccaccccacacabcbaabcccabacbcacacabaabcbcbcabacbcaaacbaabccbcaabbaccabcbcbcccbcaaaaaacccbbbccccaaaaccccaccacaabaabbababbcbbaaabacacacbcacccaacbcaaccbaabaccabcacbcbcababbaaacaaacccbbabccabbbbbbccababcaaccabbcbccbaacaabaccbaaacabcbacbccacaaabcbaccacccabacbaabccbccaabacaabbcbccbacbbcabababcccbaccbbacbbcccbbbabccaabcababbcaccaccabbacbacccccabaccaabcbaabbcbababcacbbaacaabcabacccaabcbccabaccccccabbaabcccababbaaacbaacbcbcaabccaccccacaaacaabbccccaacbbccababbbbcbbbaaabaccabcaccacbbbabacbacbbbbccacacbabcbccabcabacbbccbacbccaacbacbcaababccaaababbbbcccbaabbbabbbabaacaabcbacbbccccbcaccbcbccbcccaccbbbbaababacbaccccaaaaccbbaabaaabccbaaaacaaaaccaabaaabaccccacabbabcbbacbacabacabcbbbabccbacbcbacbbbcabcbcccacbababaccbabccbacaabbbccbbcaaaaccbaacbbbaaacbbbccbacccbabccaababababbbbbbcaacccccabbcccccabcbbbabbabbcaacaaabbabbcaacbbcaccabcacbaabcaabbcacccbbaacbbcccccbcccccbaaacbcccaabaaaaaaabbcccbcbacbbaaccaacbabacbccbabaacabbcaabbcbccccacccacbcccbaccbbbcbbccbbcbbabcaacaaabaccacabcbbbacbcabcbccacaaabaabbaccaccbccccabaabcabccbaaaacacacabababcbcbaaabbccaccaaacbbccaaccbbccaaacbbbbaabcbbbccabaacabccbabbcabcababbbccabaaababbbcbbbcbbcbbbacbbbbaacbcacccacccbbcbcbccabbcaabacaaaccabaaacbacbaaabbccccacaabcbbbccababacbaaaccbcacbabaccaccccabcccabccabacacccbccaaabcbacbaacbaabaabbacbbacbbbcccabbccbcccaacababbacaccbabbacbcbabbccaacbabbccbabcaccbbbaaaaacbacbcbaaaccaaacaccbaccaccaaaaabbacaaaabcbbaaabacaccaabcaaaccbaabaccacabccbccccbbbaccaacbaccacaabccbcabacaacccbcbbcacacaaabcbcaaccccccbbcacbacaabccaccabbaaaaacbcccaaacbacaacabbaacbaccababbacbcccbbbbbcabbbacaaccccbaabacbaccacacccbababbbbbbccccbbbbbacabbacbaabbaaacbbcbcaccbabcabcbaaacacbacbababababacbaababacccccacbbcbcacbccbaabcccaccbcabccacbabcbacbbccccbacaccbbbacaaabcbaaaccbbbaaacabababacccbabcaabcbcaaabaabaaacbacbcaabacaaacbcbacccabcabaccaabcbaaabbbcacabbaabacaabbbcaaccbaacbbbcbbbbcccbcaabbacabacaabcabaaabcbbabbaaabbbabcabaacbabbbcbacccabbbabcccaccbbbbbbaacacaabcabcbcbaaabacbaabbacbacabccccaacbcbcabccccaccacabbcacabbccbacacacabccbcaaaabbacccbaacbccbbaccbbbaccaabbacbcaccbababbbccaaccbccccbaabbbacaaababaabacabcbcbaaccbcbcaccccbbcbaabcaaccabaccccbcabbccccbabcbcacbcccacbbacbcabbbbaacbabcbbccbccaaabaccbabbbcbbacacaaabbaacabcbcbccbbacbccaaabacbccaababaccbbcbabccacccabcaccbbcbabbacbbcabbaaaabcacccbcacababccacbbbcbbaacbcbabacbbaaabaababcbaaaabaccbbcccccabbbacaaccbaabbaaaaaababbcaccbbbaacbbacacbaccaaccaccaccaabaabcbabaccccabbacaacacccbacccccacbcbaaabcaaaaccbcacaaccbaaabbcbcacabcacccbbbabbbcaccaaabacbcccbbbacababbacacccbaabcccaccacababcbaccaccabbcaccacccaacacbcccbbabaacbcccacbbaacbbaabbbbcabbcccbbcaaabacabbababccacaccccaabbcbbbbabcaaaabaccccbccabcbabcacacaababccabbbbbaaccaabbcacbacbaabcabbbbccbcbbcbccccbcbabbbbbbabbbacabccbaacbbbabccababccaaabaccbcacbbabacabcaabbcbcacbbccabaaccaabbbccaaabccccbabaacacbbaccabbabababbbacbbbcbaccccbcabacbcbcbaacbcaaababacbcbabcbccabcaccccaaacbaabaccaababaaaabacbccccaccbaaacbcaaabbcbacbbcabcbbbabccccaaaaabbcbacbcbabbabbbbccccaacacccccaaccaabcbbbcaaaccabcaabbaaaccacbbcccbaaccbcbabbbcaccbbaaaabaabbcbcaaacbabbbcacacbacbabacacabbacabcabbabaabcaaaccaabccaccaabbcaccbccbbcacbbaacaababcbcaacbbccabbcccaabcbbccbacabcbcbbbcbbaacaaabbcbbcbbbccbbabccacbbbccbbccbacacaabbbbbaaccbbbaccccbaccccaaaabbabaacbcaaaccbbcbbacbccbabaaacabbabcabbccbbbaaacaccaaccaabbbcbcccaccbcbcccaabbabababcacbaaacabccbacbbcaaabbbbbbbbbccbcccbcbabaaaabbcaacbcbcbbccaabbcbacbabcaaabcbbbcbcbbbccbaacabbcbcbababbacbbbbaaaacbbacbbbbbaacbaccbbbbacbbacaabbcbacccabaccaacbbababbabaaacbaabaccbabcaabbcbaababbacbacacaaacbbbaacbaacccbcabccabacbaaacbccbbcaabcbbcaabaabaaaccacbaacbabccbbbcabbabcbcababcaaabcaabcccabacbbcaacabbbccccacabcaabbaabcbcbacaabcccbbbbabbcbcccabbabaaccaacaccccbacccaacabbbbaabcbcacacbbbbaaaacbcacabaabccaaacbabccbbaaccbbaaaabacccabcabbaabcabccbccbbabacbbcbcccccacbaabacacaccaaaabbccbabccabacaabbbccbcbaabbaaccababccbbbbccaabaaaacccaacbbacacbcaccbbccbcaabbcaccbcacacbcbbacccabcbcaabcabcbbaaccabaaccaaacccccbccbbbcabcbbcbcbababacacabbabaacbcaaaaacbccaccaaabcaaaaaccabccbbbcbbacaacbbbabcbbaaacacbbbcccacbcacabbbcbcabbacacbaaacbbbbcbcaccaaaccbcbcaccaaaccbbcaaaccbaabacbbcaacabbbccaabaacbaabcbcabbabbacbaabcacacbccaccbcabbbcbbcabacbbbcabcabbcbaabbacbcbbcbcbacaacbcabccaacbbcbaabcacbccbbbacabacccbcbbaaaababaaabacaaccabccbcacbabcbaacbcaaacacccbbababcbbbccbcabbcacbabaabbaacabbbbacacbababacbbbaabacbbbaabbaaabccaaaabbaabbaabaabbccabbabaccaccbcaaaacabbcbaabbcbacaacabccbabcbbaacccaaccccabaaaccccbbbaaabbaaabaccccacbbabaacaaacaacbbbbcabbbbabaabaaccbabbbbaaabcaaabaabbcbbaacbcacbcabbcacaaacbaacbbbaaabbbccabbbabbcbacbccbabbbbbbbababaabaaccabcbccccaababbccabcabbccbabaccabcbcacbaabccacaccbbbacbaabacbbcabbcaabbcbbaaacbcbacaacbacabaababaaaaccaaaccccccbcaabcbccaccbaabccccaabbccbbbaaacbbbbabbccbbcacaaacaccaaacababaacabbabcccccbabcbaccaacbccaabbaacaaccbbaaccccbbaaaaacbabbcaacaabbbbcbabacbcacbcabbcacbcabaaabaaabbaacccbcacacaabcbabbaabcacaacabbcacccbacbcbcaaabaccbacacabcbabbcaccabcabcacbabbbbbcbaaacaccaabcccabcbaabcbababbcbacaaccaabcacbbccbaababbcbccaabbbbcacaaabccaaacbbaaccccbababaacccabaababbabccbbcbccccbcbbacbaabaaccabcccacaccabcccaacbcaaccbccccccacbaabbabbabcbaababccbaccccccbbbcaaaccaacacabcabaccabbbacbaccccbccaacabacccbbbcababcbcbaccabacbbbbaaccbbacbabbaaacccbaaabbcbcabcbcaaabcbbccbbbbabcccaaccababccacbcbccaccabbabacbcbbbcacccbaacbcacbbcbcacbcabcbcbabbccacbaacbcbbcbcbabcaacaaabbbaacbbcbcacbaabcbcaaacbccbbaacbbabcabbbbaccbacaccbabbccbbbccabbbcbcccacbcaccbacbacabaacbcacacabbbcbbbabaaccaacacaccbbcbacaacabaaccaacbcccaabacccbcbaaacacacbbccbbccaabacababbcccacccbbcaaacabbbbcbbcbaaacbbacacaaccacabcbaabcbccaabaacacbcacbcbbbacccabbcbbabcbbabaabcaabbbcbaccaabbbcabccacbbcaabcacbcacbbabaaacbcabbcbaaccaaacacccbacbbcccbbbabcbcbacacccbcbaabcaacaaccbaccbbbcccbacabacbbbbbcaaacaabbaabacbbccabbbcaacccccbacabcaababcbccaabbcbaaaacbaccbcccaabaccbaaabbbcacabacaabccbbcaaccacbbcabcabccbbbbcbabacaaaacaacbbbcaacbcbababacbaabaaaabccbbbccbbccaaaaacabaaacbccbabbaaaacaabbccccccbaabcbccbacbcabbcbaacaabbcbccbaaabacccaaccaabbaaaacacabcaaaccabaabccbabbbaabbcbaaaabcbaabaaaacabaccbabcacabbcbcbabccccbcbcaabccacacbcaaacbaccccbcaccbcbcccccccccabccccabbcbbcbbbacacaaabacbcbaacbbacaabccabccabaccbaaabccabbbcaaacbbcaabacbcccbbbcbbcacacaabacbbbacabbabbccaccababcbacaabcacbbcbcbccaabcaccbabcacbbacbaacabcbbabaccccbbccccbccabbbcccabaabbababcabcaccbccabbbababacaccaaaaabbaaccacbabbbcaaacaccaaaccabbabaabccaaabaccccabcabbabcbbbccbacaccbaabbcbaacbcbbcbabcbbccaacaabbcbaaabbbbbaaabaaabcbaccbbbacbcbbcbaaccacbbbbcbcaaabaccbbbabbaabcaccaabacbcbacbabaaacbcbabccabbcacacbbcabccccbbaacaabaccbcbabcbbabaccbbbacbbcbbbbbbbbabccacacabbbccacabcbcbbbcbccacbabccccacacbbccabbbbbbbbacaabbbbcccacacbbaccaaabbaccbacabacaccacbcbbcccacaccaacbaaacabcaccabacbabcacabccaabaaabaabbbaacabaaccbccbbcbcbacccbaccbbbccacbcbccbbacabcabaccaccbaccacaaaaccaacaabaccaaacabaacbcbbaaacccbcaacbaccacbcabcbabccbcaaaaaccbacaaacbbbcaabccbcaabbcbbbacbacbcaacbbcaababacbcbccbcccaacbaabbccbaaccbbbcacbcbabcaacccbabaabbabcbbbacabbbababaabaaaaacbccbaccbabbbcaabcaabcacbaabaababbcacbccbabbbabcabbabcaacbaabaaaccabacacaacaacacabacbabacbbcabaaccbccabbacccccbabaabaacabacbbbcaccabcacabccccccacacbabaccaaaaabcababaabacaabcbcacbbccaabababbcbcccaccccacbbcababbacbabacbbabbbcacbcccbbaabcbaaaccbbbbcbacbabcabaabbccaaaabaccbaaaccbbbaabbbcababbcbacbbabbabbbabbcbabbcbbbcaacbabaabaacbacababcccbacabbacaaccacaabcbbbbaccbabbabacacbcbcaacccaabcbccbabacbbccccabaacabaabcbcbcbcbaaccbaacacbcccaacabaacbabbaabaccbbcccbacbcabccbccccaabaabbbcabbaabbcbcabacacacababcacacbcacbbbbbcabacbcabacaabaaabbacbacbabacacabccabacbabcccbbcbccabbaccacccacbccaaaaaabaabcbbbcacbbbbbcbaaaccccaaabaacbacabbcabaacbbaacacaaccbbaaabcabbacbbbacbbabcaaababccacbbacbccbccbabcccabacacbacbbcaacbaacaabacbcbaacbbcaaabbaccbcbccbcacccabcabbcaaccbaababbccbbaabcabcbbaabcbbcabbaabccbbabccaaaccabacaabcaacbacccaacbaacabccbaacaaccbbbcabbbacbcaaaacbacccaccbaacaaaabccbcbccbbababcbabcaacabaaaaaaccaabcacabbbabbcbcabacbcbcabaabcbccabbcbcaccaccbacaacbbbaabcbccabacaabaaabbbcbbaacabbbccaabccbcbaccacabbabbcbacabcbacbabacbbaaacabaabaaacacacaccabbbccacaccbbbbccaacbccaaaabababacbabaaaaccaaaccbccabcbabcbacaccbccaabbbcacacacabbaacacbcaaacacbbaacbaacacccbabacabbcbbbaabaacaaccbaabcbcbbccabcccbcbbcbcbaaccbaabbccbbacbccbacbcbbbacabaaababbcbccbbaacbbbacabbcbabaccbbaccccbaacabccaccbacccabbbccbcaaccabbbbbbcbabccacbcbacaaaabcabaccbabaabcaaccacbacccbcaccaccaacaaaccbbacaabbccaacbaccccacbaccaababacaacccaabcbcccabcacccbbbbaabaacaabcbabcaccaccaaabacababaacbcccbaaabcacacacacbcaabaccabcabbbcbcbcbaacaaccbcbbccccbbacaccbbbabbacacacaaabbacbbabcbcaaabccacabcbabbcbcbbcaabacbbbbcaababcaabccaaccbbaaccbabccbcbaabbbccacabbaaaccccaacbabbbabcacbabaaccbbccaabbbacccbcacabbbcbcbcbabcccbaababbbbcaabbabbbcbbaaabacbcbcbabcbccbbaabaababbabbbcaccaacacbacbaaccaacacbabbaacaabbaacacccbaabbbbbbaaababacccabccabbacabbbbaabaabcbacbaaacbbaccbaaaabccbacaaabaacbbbaaacbaacbcbcccaacaacbabbccccabbacbaccabccabbbbabaaaacccacbcabacaacbababbcabcbcbccbcaccabbbcbacbabccaccaaabacbacaaacacccbacabaaacabbccaccbbaabbbbaccaccabcaaacbbaabacbacbcabcccacbaccbabacbcacbbcaabcbbbcccaaccccbcaabababbbabaabbccbbbabaaacbbacaaccacbaabcbbabacbabccabccaaccacacabaabcccaabcccccccaabbcacbacabbccbbbbaabaabcaabaaacacbbaabcaacccccacbccbaacbabaabcccabcbabaccccbbbacabcbcbcbaccabbbcbbcabbbbbbcacbcabaabcaabcabaaaaaccccabcacbbccbbaabaccbcabaabababaccacbacbbccabbcbbbaaaaababbbcacacccccaacbbcbabbaaaabcbcbcaacccbccbccacbbbaacabbcbbbcbcabaacabcbabaaaabaacacbbabcabcabccbbacbcbcabccccbcabbcbccabbcbbbaabcccabbccabcbcaaacbbacaccbccbbbaaccccacbcbbacabaaaaaacacbcacabcabcabacccabcabbbcbabbaccbbaacaacbbcbbbbbbbcacaabaccbccacaaabcabaabbaacbbbacbcbcaaabbbbaccbcbacacbbcaacbccccaabaacacacabcbabbcbacababbbbabcaccccccbbcabbabbaabbccbbccaaaabcbabbaacbaabcaaaaabbcccbabcbbabbccaccbccbcaabacbcbcaabcbbbcabacacccaacccbacaabababbccbcbbcaaccbbaacbcaabbbcabbcccbccbbaccaacabababcaaacbbacaaabcabaabcacacacacbaaaabccbcabbccacbccaaccbabacbabababbbabcccbbbbbaccabbbbcacacbaaaababcabcaaaacbabaabbbaabcbcccbcabcaabccbbbccbabbcbbbbcbbcabcababcaacabbaabbccaabcbacccababaacbaacabcbbbabcccbcccbabbabcaacacacaaaabbbbbbabbcbbcacccaaacbcacbbaaccccbbbcabbbabccbcbabcabbacacabbaccabcacacbbacccbcbbccabbaacabbaaacaaabbccaccbacacbbcaacbccabababaabaccbbbaaacccaaccccccabcacabcbabbbbbbbacbbbaccbbcabacbcacabaaacaabaacbbbcabaabbbaabcaccacbababcbcabcaaacbaacaaaccacbbbabaccccabbababbcaaaacaabcbbbcbabacaaabbcaccaabcbbbcaccbaccbabccaaaacbaaaaccacbabbbcbbcaccccabcaaaacbabacccbbaaabbcbbaacbaaaccbccbbabbabbabaaacaaaccaaccacaabcaacaaabcaacaccccabcaaaacbcacaabbabaaababccaababbabccbbccbbbcccaaaaacbccbcbaaccbbcbcbbaacbcabcbacaabcbbaaacaaccaccccbabaaacabcbacaacacabababccabbcbabccccbbccccbccbaabbacbcacbbcacbababbaacbcbcbcbbabbbcbccacaabbbcbabaccabcbacbccbbbaaabacbaababbccacaccaabcbacbaaaccccbcbbcababbacaaacaacabacbcbabccbbcbabaccbccaccaacbacaaacacaacaccbaccbcbbccabbaaabcccccabccaccbbbabbbbbbacacbabcabcababaaaaaccabacaabacbaaabaaaccccabaccbbcccbaaaccbabaacbcbcaccbaabbaccaacaabcbaccaacabcbcaacccccbaabbbccabcabaccacabcababccbaabcacabcbbaacccacbccbbaabbbccaccababbbacbcaccbbaccbcacaabbbcbcbcacbaabbcbaacaabbabbcccbcabbccaabbbcababccccaabcbcbaaaccaacbbacbbcbccbaccaaaccccccccbcbbcbaacbcbaaabbccaccaaaabcbacabcbcaabcbbbcbaaabcabcaaacbaaccaccaccbcacacccccbcabbacbcbcccccabcbcbcabbaaabcacaccbbbcababbaccabcccbcaabbacbbaabaabbabcccbccccccacacccbaaaccabcccaaaaaabbbcbaabcccccaccbccbbbcccaabbacbbababbcbcacabbcabbabacacccabcbbabbcbabbcbccbccaacbbcbbbbabcbcaacbbcacabacbbccbccbcabcabbccbaaacabcccacbccbabcbbcbaccabbcabcabccbbcbcaabccaacbaacbababcbccabcbcaccaccbbcbbcacbaaaccbabbcbabcbaccbaacbcacbbaccbcbaabbcaacbcacabbcbbbcababccbabcbbacaaccbbacbbaabbbcbccbbacbccbcaaaaccbcacbabbabbacacaacaaabcbbabbbcbabcaaaaacacabbcbccaaacabacbaaababacbcacbabacbaaccaaacbbcacbbaccaabbacbcccbccabcacbcbacbabbaaabcbabccbaaaacaaacbbcaabbcaaaababcbaccaabbcaccbacccccaaababaaabcaacabbcbbcbcaabccbbbbcbabccabccbccaccaacccbaaaabbcbbacacccbaabbabbcbbbacaaaabcbbbbacabcaabcbcaaabaacccacbcbccbbcacaacbccbcccbbcaaaccbcbbaabababbaacbaaaccabaacbacbcaacacbbacaacabacabcabccabbcbbaccbcbcbccbbaaabcaabccaacbbcabcccacbccacbbaccabccbaaaaccbbcbacabbcccbbbaaacbbaccbacbbbcbbabbbbccacccacbaabaacbbccaababbacbccbcccccbbbbcbacbabcaababcaabbbabaaaabcacacbbbcababccbcaabacaaacaaaaacbaacabcacaaccabacaabacacccccaccabcbaaaccccabbaaacbabcabbabcaccbaaacaacbbabbcabbbabcaccccbccacabaaccbccacacaacccaabacbaccccabcacaaacaabacabbaaaacaabbacccbbaaaababaaaacbabcbcacbbcbbcbaabaabcbbacacccbbccccbbcabccabaccccccaaabcabacbbabbccbacaaacabccabccacbaabbcbbccbcbaaaabaaacbbbbcccbbbcaccaabcbbbccbacbcbacabbabaabbcababcccabbbcccacbcaaabbabbabbbbaaabbcacccabccaaacbcabbcccabacbbccbabcbbabbcaacbaabaccbbbaabccbacabcccabccaccbcbbccbcbacacaaccacabcaaacbccacbcabcaccbcccbaaababacbbaababaacbaacabcaccbbaccaabaacbccaacaabaabbcabcacabbbababbacaaaabcbbbcccaccbbbaacbabbbbacabbacacbbbbaccabacacbbababaccabcbccbbcacaacacacbbcacaabcaccccacabaabacabbbacbaaacbcacbbccbaacccbcbcacbcaccccabbacbccbabacbaaabbaccabaabaabacaaaabbbabaaabcbcacbaabcbababcabacaaccacacaccaacabaacaacbcbbaccbaacbabacaaccbaacbbaabaaccaccbaabbabbbbbcbccbcbacccacaacabacbbacabbbbbcccbccaaabacccbaacbaccabbccaaaabcbaaacccbbacbaaababbbbbbcabbabacacaaabbaccbcccbaaabbccccbacacbaccbbbcbbcaaaaabaaacaaabacbbaaaaccbaabcaccbabbcbbabcbcbcbccaaaabcaaabccabbaaccacbccaacabbcaaabcacaaabaabacaabcbbbbcaccbacaabaaacacbaaccbbacccaaababbbccbcccbccbabbabaabcbccbccbbacbbbabcbbccbbbccbcbcbcacbcbbcccbbcbaccaccbbabbaaabacbcacacbbacbbcccbbbcbbaacabacbcbcabbacbccbaaabcbbacbbbbbabcbaccabbabcbbcccacccaacbabacbbbcbbacbbabaaaaacacacaaccacaacbbbbaabbacbbaccbbbcccbcabcaaacbbaabacbccaababacccacaaabaccbcabacbaaacaaacabaccbbbabbbbcccabcaaacbcabbaaabbcccaaabbbaacaacbbacbbaaccacbcabcccabcbbbccbbcacbccbbbcabaaaacbbcaccaaaaacaccabcbbabacbcbcaabaaabbccabbbcaaacaaacbbabacccabaacbbbbaccbaabccacbaccbbaabbaaacbbacacacccbacaaaabacabaabaabcbbcbabcaaabacbcbabcccacacbccbccbcbbbbbabccbaaacabbcaacbcabcaabaacabbbaabbacaabbabaacbabccccacccccaaccacabcccacaabaababcbabaccbabaaabcaaaaacaccbcbcaaccbabaacaaabbcccbcababbabbccbcacabacbbcccbcacbbcbaabcababacacbcbaacbbbabbcbacbbaccbcbaabbbbbacabaabcbacaabbbccbbbaabbcbcccaacbcccabacbaaabbccbcbbabaccbbababcbaaacabbaccabbcaabbacaacacaaababbccbabacbabaabbacbbacacaabaabcccacbccbcabaacbccabbbabbbcbbaacbabbbaabbbaccacbacaabccccbacaaacabbaaababcccbabcbbaacababccacbbcbbaabacabccaabbccaaacacacbcaaaccacacacbccbabbbbcbbcbaabababaaccacbaabbccccbbbabbccbbaaacaabacacccbcaacbcbabcbbccbabaacbacabbacabbcbacbaabccbcabbababaaabcacabbabcaaaabbbabcccccaaaccbbacaabacaaabbcbcbabbbcacbacacaabcbcaaacbaabaaabcacbbbbaabbabaacacacbbcaababaabcbccccbaabcbcaaaaacabbbcabbbcaabbcbabcbbccacabcaaabbaccacaccbcaaacbccbcbbbbbccacccacbbcbbacacaabbcbbcccabbbbbaaabbbccbaaccbcaaaabccccacccabbabcaaabcabcccbabbcccbbbacaccbccabcabbcccaacababcbcccccacbccaabcbcacbbaacbcaababbcbabaaacbabacababaabaabaccbcbbcaacabbababccabbbaabcbcbacbacbccccaaccabacbaccbbbccacacaabaaaaacabbaccaccbbaaabaacabacaacbcbbbcaaaabccbcbcccbbcaaaacacbccbacbcbacbbaaabbbaaaacbbbbabbcccaabbaaccbaaaacbacbaacabacacbbcabbaaabaaccbbccbcaacaaabcabacccbbbcaabbcaaccacbbcbccbbcacabcacacbaaacbcbbbaaababbbbabccacabaaabcabaccabbcabcaacbbbabcbcababbaaccacaccbccbccbaacacacacccccababccbcbacbacabbccaacbbaabcbcaabbcacccbbacaaaccabccacaaaacabbacababacacacababbabaabbabcbcabcccabacbcbbabcaccacaacacabbcccbacaaccbbbabaccacbcaaacacacbabccabaaacbacaaacbaabcacbcbcaaaacbbabaacbacaabbaaaabbcbacaaabbbbcccacabacbaccabbabbcaaaacbbccbcbaabbacacabbccbcbaccaaacbabbacccaacaaaacbcacaaabcaacbccbabcaabacaaababccbcacccbbbaaccccbcaaacbbabcabaaaccbcabbcbbaaacacabcbbcccbaabbbccaccbacacbabbbbabccbbbacbaacbaaccbbccccbbbabacbacbabcabcbcabcabacaccbccbbabbbbbbbabaacaacccacbcbaabaabcbcaaababbaaaccabbcacbaaabbbaccbbacbbbacaaaabaabccbbbccabaacbccabccaabbccccbbaaaabbcabacbbccbccaccabcaacbcbcabaabcaabccabbcbbababcacbaacacaaabbccbbbbacccaaaabbacbcbcbaacbcbbcbbcbcacbcbccaccbcaaacccbcccacaccabacbabccaccaaaaabcaaaacccacbcaaabbcabbccaaaabbababacabcccacaaccbacabcbbcacbcacbabbcaccaaacbbacbababaacabbbcbacbaaccabccaacbbbccccabbababbaaabbccbccacbabacbaccabcbabcabacabacbcbbcbbbaaaccaaaacbbacbbaccbbcbabcaacaaababaabcabbbbacacabbacccbcbbabcacbcbabcacbaaccbabacbcbbbcbbaabbacccccccaacaacaababbbaaabacacbaabbcacbccbbaaaccaacacbaaacabcbbabccbbbacabaacbcbaaaabaccacbacbabcaccacbbacbccbcbabcacbccccabaccaabbbbbccbaaacbacbaabaabccbcabbcaacbaabaacbcbbccbcaccccbaacbbbabccbbacacabcbbccaabacabbcbacbaabcccbbabbbaacbcccabcbaabcbaacaabbcbcbbcaabcabcbccbbbbbcacbbbcbaaabbccbbccbaaccbacabbccbccbbaabbabcbbbbabccacbcbbaaabccaabbcacbcacaaaabbbbbbaacbaaabbacacbccccbccacacbcbaaccabbbacaccacbacbabababcbbbcababbaabaacbcbacababcbabacabcabcbcbabacbbbbbbabacacbabaabcccbbaccaacbacbaabcbcaacaabcbabccbcabcbcbcbcbbccabbaaacabcaacbcacccbabbcababccbcbbbbbacbacccbaccccbacccacbccaaaabaaccaabababbbcaabcbcbccbbacbccccccbaaaacaaccacbcbabacabcabaccbaccbcabcabccccaaababcabccabcbaccabcbbbaaccbaaaaaaccacccbbbbccbbbbaababacbacabcacbabcaabbabacababcacbbcbabbaaccabbbaccabbcaacbbacbccacccbcaccbacacccbbccaaacaabaaaccbabcbcccaabacabcabbbcaccbbbbcbccbbccacbbbcaaaccaaaabbbbbabababcbbacaccabaabcbabbaabbcaabaacbcbbabcbbcccbbbacbcabccbbbbcbcababacaaccbcbabcabcbcbbcbccbacbcccbbcaaabacabbabccacababccbbbcacbaababbccbcaccbaccbbbcbbabbbcccbbcabcbbccabbcbcccabcaabcbabcacccaccbabcbbbaccbabcacababcacbcbbbcbabcacbcccabcbbcbabbabcbbbaaaabcbbbaabbbcbaaabccaccabcaacacccaccbaabaccbababbbbcbbccbaacacbcabccbcbacaccaccaccbaccbbaababaacbcbacbcabbbaccaacacbcbabcbabbaabbacbacccaabaaaacbabccbabbcacacbccbcccaabcccbabbabccacbaabbccbaabacbbcbacacaccaacabbbababccbbacccbbaccabcabacaacbbbaccabaaababbbcaaabccaacabcccaabaccbccbbcabacaaacbaabaabababcabcabaaacaccaabacbaccccbccaacabaabaaabaccacccaacbaacaacabcbaabbabaababcccccbcbacaacacbbbaaccaacbcacccccacaabbcbcacbbbabbabbbcbbbbbbcabbbabbccbbcccabcbbbccbaacbacaacbcbaabbbabaabcbbbcccbcbcbaacbabbccbabccaabaccaaabcabaacacccbcbbaccbbaaabbabaaabbaccbbababcbabbbbcbbaccabbbbbbaabaccccacccbabbbaabacccacababcababacbbbbbabcbbbbaacbbcbaaacbabbcabacaaabaaabbbbaabaaaacabccbacaaacaccacaccbaaccbcbbccbabcaccaaacccbacabbabaccabacbcaaaccacbabcbbcaabccaaaababcccabccbaaabaccbbcacccabbcbbaccbcbacabccabacbaaaaaaccbacacabacabcbbcbaccbcaacbaabccabaaabbbbbabbaabbcbbaccccbbaabbaccbbcabbbaacccaaacabcbaabbaaaacccbabababbcbbccbcacaccbcaacbccaccbbaacbabbcbababbaccacbabababbacbccabbccbaacccbaacabcbcbabbbbbacbabaaaaaaabcaccaabacbcabaabbbacabbaccacbacbbbacbaccccbaacbcbaabaabacccacacaacccccacccacbbbccabaccbbbbbcaacbcbbabcacaabcacacacbaababacaaacabbabccacbabacbbaabcaabaaaacbabababcbaababbbcaccaaabaacabbbaacbbacacbcbcaabbcbaccbbacabcacaacbbcaccbcacbcababacaabacbbcbbbcaccbabbcbaacbbcaabcaccbbabaaccccaabaacbcbcbbbbbaacbcbcbaabcaaaaacabccccbcacabbcbcabbabbcaabbbccbbbccabacabaccccbcbabbbbabaccacaabababacababbbabcacbbbaccbabacacaaacacbbabaacbabcbbbccaaccccaabaaaacbbabbaabbaccbbcbbbacccacbccbbbabcacabaaabcabbbcbaabccabbbabcbaccccbabacbcaaaaacbcabbcaabaccaaaacaaabccaccccaabaaabcabaabcacaabccabcabccbaacbccabbaaababacbcbaccaabbbaacbcacabcaaabccbcabacabbccaaaacbcbbbbbcacababcbbbbbcacbbabccccbcbabbbcaacbcbbbcabbbcabcccabcaccbabbbbbccbacabbbaacacbaccbaabcaabcccbcbbababccabbabaacccccbaacbcbabaaabbcbaacabababcccbcababcccbcccabbabccccaccaacaacabacbabbcbbcbcaaaabaccaaccabbbaababbcccaababcbacaccacbccbcbcbcbbaccacacbbcbbcbaabaaacccabcbcacbccbcbbcabaacaaaaccbabbbaaacbcacacccabcbbcaabaacccacbabacaaacbabaaabbbbbcacbacabbaccacbbccaaacaabccbaaacabcbccbbcaaccbcccaacaccbcacaacabcacacbbaaaccbbabbcbbacbacabbacabaccccccbbbcbbaacbcacabbbcbaaccaccbcabbcccabbbbbbcbbbacbcabaaabcbaaccaacbccaaaacbcbbccccabbaaabcaaaabcbbabbaaaabbcbbbaaabbcabcccccccbcacbbcaccccacbbbbcccacabcbbaccbcccccbcacbaacccccbbaabaccbaaabcbbababaaacacaababbaaaacbacbccaabbcbcabababacabcbccbaabcbccbaabbacccbcbbbabacccbcbcacacbcccbbaacbcacbabbbbccaabbcaaacbaabcabbabbcccccbccaacccaccbbaccbcbaaccbaabcccbcbaccacbaababaccbbccaccbcabaabcabbbacbabaaacbcaaaccaaaccacbbaaaccabcbccaabcacbcbcccacbccaabcbaaaaccbabbabacbbbcbacccbaaaacaaacbcbccbaacaabbaccbacbbcbcbaaacbaacbaacaaacccbcacabaccacbbaccbaaabacbbbaabcccaaaacbabccaababaacccccabccaabbababbabaabbccbabacbbbcaccabcaabbbbcbccabaacacbbbccbaacbacbbcabbccbccbcbaaabacaaaabbacbbcccccaabccbaaabbaabccaabaccabbaccabaabbabacbabaacbccbabbaabbacacccacbabbcbbcbcbcbcabccaacbabacbccabaababbcccccbacacccacbacbaacabcacaaacacbcbaccbbccaaccbccbbbcbbcbaacbbbabaabcacaababbccacbbcabcbbcacaccbaaaaabbaaaaabbcacaccbbccbcacacbaaaacbcbabacacbababcabcacaaaabacbcaaacccbbcbbbcbaacacbacaabbcabacabbbbaccaccccbcaabacacabcacbabcbaacabacacbbcacabbbbccaaaccacabcaabcbbbaacacabbaacbabcaacbabcbabacaabcacbacacccacaaabcacccbccbcbbabaaabaaaabbcbbbccabccaabacaccbcbaacbaacbacabccbbaccbccbacbbacbbcbaabcacbcccacabcbbacabbbcacbbbbaabbbccbcbbcbabacccabaabccbcacacaaaccccaabbbcbcbbbacabcacbcbcbbbcbbbbccbacbababacabcabcabbcabcccbbbcaabccaccbcbbacbcbaccaabacacaccbacabbacbaaaabcccabbaabcbccacbcbbaacaaaacbcbbcbbcccbcbcbbcbccccccbacaccaabccaabbccabaaacbbbabbbbacacabaaacbbaccbcaaaaaccbaccbbabcbabbcaaccaccbcccbbaccacbccacbbaabcccccbbcbaaccbbabcbcabccacbbcbccccccccccaabcacbcaabbacbabccccbccbbbbabbbcbccaccaabcabacbbcbaabaaaaaccabaacbccccabccabbbaccccbbcccabacaaccacbccbaaaacaacbccaacacbbaccccacbbccaacabccacbacababbacaccabcbbbaabacaaaaccbcbacbaccbcbbacabaccbcbbbbccacccabcaabccbcbbabbcbabbbcabbccccabaccbacabcbbbbcaaacaabaacabbabccccbaabccbcacacabbbcbccaaccbcbbacacaccbbccbccaacaaacabcabbbaaccbaabaabcacbabccbbaaccbbacbcaacabcabcbbacaaabacbaacbabcacacaaccaabbbbcbcababbbbabbababcbabbbbcacbbbbccaacaacbaaaacbcabbbaabaabcabacccabbcccbcbcbcacbcccabbccccabaaabababccbcbabacaacaccbabcbaaacabbaabacabbbacbbcbbccbabcaaacccbacccabcbbccccbcaacabababacbbcbacbbbaaabacbbbbbcabaabcaacabacbcbcbccaaacbabcbbabbbbccbabacbaaccaaacbaccbbaaaacababcabcbaccbbcabaabcbbbabacccccababcacaacacabbbbcacbacbaabbabcaabaaaaabcbacaaacbcbbbccbcccaacbcabccaccbbbccaaaccacbacabcbcbcbaabccbaccabcbabbbccaacccaaaababccccbaaabacccbcbacbaccbbbabbbacabaacbcaacbaaacbaacabbcbacabcbabbabbcbaaacabcccabcbcababcbaacabccaabacababbabbcbbaabacabbcbbbaccbbbcbcaccacabcccbacaaaaaaacaccbaababaabcaccabbaacbabcbbccbbabaabcbcbaacaccabaccaacbacabbababcbbbcacaacacbcbabcbbbabbbccacbaaabcabaccabbabcaccbcccbabacbbbcccbbbcbcaacbbacaacacacbccccbccaaccbbbccacbccbccaababcaaaaabbccbbccbaababccababbacabbaaaaacbbabbcaacaacbbbcccbbbcabcabbcbbabcbcbcacabaaaaacaaccbcccacbbaccaabacbbbbabacbcaabbbaaaaccaacacccbbcaacbbacacabbaaabacbaccaabbbaacccaacbabbbbaaabccbaaabbaabccaabcababaabacbaaccbbccccccbbacacbaabbcaabcbbbacaaccbaaababcbcbbbabbbbbacaabbaacbcaabbaccbacbbcacbcccaaabaaaabccbbcacaabbabbcabbaccbbabbcaccccbcbcaccacccbcbbcaacbcaacbbbcaacccbbacababaacbaabacaababbcbcbaabccabcbcabbcbbcbaaaaabaaaccbaaabacccaabcabbaacccbcbcbbbaccbcccccbbcbcacaabbcaccaaabcccacbbbbabaccbacccabcacacbaccacbbbbbaaaacacbacbbcbabaaaaccbcbccbbabcaacbaacaaacaabbacacbcaccbccaaccaacacbabacbbbabbcaacbcbbbaaaacccacbaacaaacbcaccaaccbcacbbabacccbccacaaacbbcbcbaabaabbacbbcacbbaabcabcaccbaccbcbbbccccbbbbcaaaabbcbcababcbbacbabcacbcabcaaacbbbcaaabbcaccacbcaacbacccabcbcbcbcaccbcacaabcacacaabaabccbbcabbcccccbcbaccabbbcacbcbbaaabaabbaacbbababaabaaccccacabcbbcababbccabaaaabcccbcaccccaaabbacacbccbaaaccccccbaaacabcccaaaaaabccccccacacabcaabaccaacbcbaabccbacacabaaaabbcbabcbaaacaaabacaacabbaacbbbabababbbcabcbacbabacaccbbbbaaabccbcccbccbbcacabcbacbbcbbaabacbaaaacaaabbacbacbccaacabcbbbaaabaaccbcacccaaacccacbaabcbcacacbacabaacbccbbabcbccaccacaccbcbbaccbacbcccaabcbcabaacbababbcabbacabcaabaabcaaabaccccbcacacccbaaaacccacaabcabbacbbcaaabcaccbabacccaccbaaaaabbbcbaccbaaaabcacacaaaaabbbcbbcacbacacabcabcbbabbacaaacbbcbacbababaababcbbccbacbbbcaccbabaccbcaabbaacbabaccbcababbbccaabaabbbbacaaaccbcbbaabbaabcabacbcbbbbbacacaaacaabcaabacaaaccbaabcacacccccabbbcaaaccaaccbabbacccbbbbcbaacccabcbbbcccabcacaccbbcccacbabcbbaacacaccaabcacbbbaaaabccbbcbacacacbbbbaacacaacbbaaabcbbacacbbbbcaaaaaabbcaacbcbbaabccacbbcbaaaabacacccbcaabaccbacbcabaabacabcacbaabcccccabbcaabbcaacababacbbbcacbcbbcbaccacabaaacabcbbaabbabcacbabcbbacbacabacbcbbcbacbcaaaccabccccbcbcbcccaaccabcabcaccabbbbbaaaacbbcccabccaabaccaccccabccbcaaccacbabbbbcccabbacbbbaababbcbccbccaabbaaabababcaccbcbbcccacacacacccbbaacbababccababbaacbcacbcccccacabaaccaccabcabcaccbaabccaaccabbbabbacccbaaacbbabcbacbacbbacaabccccaacaccbcabcbbcbcbacaaccaacaccacbbcbccccccaacbabbbcccabaabacaaacbbacbaababbbccbcccccbccacbcabbacaacabcabbcccabaccababbaabaacaaacbccbbbccbcaaaaacbaccbaccbcccabaccabbbbacccbbcacbaaaabcaabbbcaaabccabcbabbaaaacbabcbcbcabacbccaabbbcaaacbcacaaabcabbcabccbccaacbccbcbcacaaabaccbcbbbcbcccabbbcbabcaabacacabacccbabbaccbbbabcbababcbbbcbaacaabbaccbaaacacacbaaaaabbcacaacaccaacaabacbabaaabbacbcbacccccbbcbcabaccbcababbcccbcaabbacaaaabcaababcbbcaccbbabcaccbbabcabababbacbcbbcbcacacaaaaacbacbabaababccbbaccccabaaaabcabacbbbaaaabbbccabcabcbccbcaccacbcccbbcbcabccbcbcacacaacbbbccbcbbccacbcbabbbccbcaccbccbaccbcbccbbbacccacbacaacbcababcbaaacccabcbcacbacabaccaaccbabcbbcacbacaccbbababbccbaaccccbcaabbabbccbccaaababacaccccbcbcaababaaabbbbbbbaaccccbaacabacbacaabcbacccbbacacbcbacbcbacaabbbabcbcaccaacabaccabaacaaacccccbcaaabacaccacacccbbabbccccbacbccacaabbcbaaacccbccbabbbbbabbaaaaacbcbbccccccbbbccccbbbcaaabacbbabaabcbcbcbaabbbbcbcbabcabcaaccbabbbabbcbccbacbaaccaacbcccbbcbabbbbbcbacbccabbabacbaaccabbbcbcbbbcccbccbcbcbbbbccacaabbbaaabbaabaabbaabacbbbcabbbbbcacbbccabaaaabbcbacbccccacabcbaccabababaacbbccaacbbcccaccbaaaccccbcbacbbbcbabbcbccbccccbacaaccabbbacccabcbcaccbcbcccbaabcaabbaaacaaabbccbccabbcbaaaabacbcaccabbcbacabaaccacbbaacababaabcacccabbcccababacbbcabcacaababbcbabaacbbbbbbacccbbcbabaccbcbcabcbabaacbbccbcbabaaaabcccbcacbaccbbbbccabaacacabbbcacabaaacabccacabbacaababcbabbbbaabbaccbaaaacaaacacababbbbacbbbbacbcacbabaaaacbacbcbccabccbaccacbabcbbccccbaaccaccbcabbcacaaaacbbbbcabcbccbbcbabaacbbbcabcbabcbbccbcbaabacbbacaabacbbcbbbaccaacbcabccbbaaabbaaaccabbbbabcccbcaaaaabcaaabcbcbcacbbaccabccbbcbabcbbbbaacbbcccbaaabcbccabacaacccacccbacbbaccbacabbcacabbcaabccaacbabaaaaccbabaaaacababbccbaabaabccccbbbcacabaaccacbbccbaccabbacccaaabcabcccbcacbbabbcacacaaaccbaacbccacbabaabaccabbabbabaaacbacccabbcaccababbcbccbbaaaacccbbbcabcacabacbccccacbcbbcbbaaaccbacaacabcbaaaccacabcabcabbbbccacaccabbbccbaccabbacbbacccccbcbbaaababccabaaaacccaabbccacbcbcccbacaaabcaccbaaaaacbaccabcbbcbbcacbbaabbccacbbccccacbcbbabaaacbccaaababcacbbacbccbabacbbacbccaccccbcaabacbcbccaaacbbbbbbaabcbacbaaccbbbaabbccaaabbccbbbbabcacabaacccaacbbbaaccabccbcbcbabbbacabcbabacaabbaacabaaaccbabbabbcabaacaccbabbbbbbbcbcbaaabccacacbacaabbbcababbccbccbcbacaaacbaaaccaccbbbbbaacaaabccaccccbababccbaaaacabbacacaaabbbcbacaabccababaacbbbbbbbabacacabcabcbbcbbcbcabcaacbbcacaaaaabcbacabcbabbaaccbacabbaaaaccbbaabbaacbbcbbcbccbcbabaaaaccabbccabcccaaccbcccbcaccccacbbcbcbaaabbbabbcbccbaccaacbabcaccbaccacccbbcbbaaabaacaaababcabbbcabaabbbabbcbaccaacbaabbccabcbccbbbccccaaaaaabaaccabbcacbcbabcacaabcbcacabbcbacbbbaaaaccbcabbcccbabcbaaaacbccaababccccacaaabbbcbabaaababaababacabaabaacbcaaabcbbcbcabbcbbbababacbcbabaaccaccaabccaaaabbcaaabbaaaccaacacaacaabbbaccbbcbcabbbbbcacacaabbbbcaccabcbabccacabbaabbcabacbacacbcacabacababbaaaaabbcabbabcaccaaacaacbbbcababbbbcbbabbcabababacaaacaaabaccaccabacccabbbababaabbcaaabcbcbbcbbbbaccabccbabacababccaaaabbbbbaabbcaaacacccbbaaabcaaabcacbbcbbccbbccbbcbbaababbcabccbacbbcbcacbcbabcbbacacbbacccbaccccbcbbcaacbcbaacbcaabccbccaaccabbcbaaccbbccaacbcccabcabcbbacccccaaaaaabbabbbbabcacabcbcabbbcabbbaaabccabbaacbbacbabcaacccacabccaabaccaabbabcbccbcaaabcaccaccababcbcacbacbaccbcaacababaaaaacccaabcbccbbacaccbcbabbaaaccbbbbbcbcaccaaaacaccbcaaccabcbacccbbcbabbbbcbcabcaabcccabcaccabacacbbbabaaccabbbbabbccbbbacacaabbcacacccbbcaaacbcccabbacabccaabbabbbabaaabccaabaacacbbcbbbacaabacabbbccccacbcbbacaacaacbbaaacbbbbbaaaaaaababbabccbaccbbacbbcabaacaabcaaaacabaccbbbaacabbbbcbacbbbaabbbacabbbbccbacbaaacbcacccacbbaacbbbbabbcbbccbcbccabbbbcbbabbaaabacaccacacaabaaaaabaccbbaccbaabbbacacbcbcbbbcbcbccbccaaacaaccbacaababbccaaabaabaabbaacbacabbcacbacaabaababbbbcabbabbcaaaccbacaaccbabcbabaacccbbacacccaaabcacaaccbaccbbabbbacaaababaababacccabbbcbaccabacaccbaccbbbbabbcabccacbbcacabaaacbccacabccacbbcbaababababaabcbbbcaaacababbcaaaccbcbacbababcacaabaacacabbaacaabaaccaabbbbcaacaccaaaccabbabbbaacaccbbaacacccbbacaacaaaccabacbcbcacbacbcabcabacbacccbabbbcbccabaaaabaccababbbbbbcacbcbabcabcacacbaacaccaacabaabaabbabbabbccaccaccaaababccaccacbabbaabbcaaaaabccaabbbbaccbcabbacaababccbcacaacbabccacbcabaccacbaaabaccabbabaabccaaaccbbabbccbacabcacabbcaaaabcbccabaaccbbbbbbcbbcbbccaaccbaabcaaccbbccaccbcbcaccaacbcbccabbccaabcbbabacabaabbcbbacacbbbcacabcacbcbbabbabcaacccaacbbaabccbbaabbaacccccbabacccabbcabbccaccaacbcaaabbabbcabbbbbabaaaccaccaaacabcccaccbcabcbabcbccbabcacccbacbaacbcabcbaaabacabcbcababbcbbcccbbbbaccaccabbaabbcbabcbcbaabccbcbabcaabcacbcabcaccaccaccbbbacaccacabccbbcbabcbacbaacacbbbccccabbcbcbabcabaaabbacbacbaabccacacaccccbaaaabccabaaaaacbaabcababccbbbcbbcaaccccacaaaacbacbcbcbabccbbcbbcbabbbaccbabcaabbacccccbaaccabbccbcbbbccbacbccaaacbaababacbbbbcacbcaabacacacbaacbcbbcbcbcaabbbcbbbacbbccbcabaaaaaabbcaabcbcbaccabbbbcabbacbabbbabbcacbbbbbcaccbcbaccbabbcbabcabbccacbbbabcababcbcbacbbacacbccababaabbbaacbacaaccaccbccbabbcbbcaacabcbcbaccccbcbcbcbacaabacbbabcbbacbbcaacbacbcabcaaacaaaccbacaabcabcccaacbaacaabbaabacacbacbababccbabbbcbabcbbabbaabccccbcbbbbbaccbccaaabcbbbbbacabccabbacabaccbbababaabbacaabcbacaacacccabbbabaabcacaccacabbaaacccaacbbcbaaaaacaccabacbcabcabcaabacbaacacbbbccabbacbcbcbabbbcbcccbbcbacacacbcccbcbcbbacacaabbbccacbbacabccbabaccaabcabbcccacacbcbbcacbaabaabaabbcacccaacabccaacabbaaabbccaccabccbaaacacbaaccbacacabbbcbbcaaabcaacccbaccbcbbaabacabcaaabbcbbcbacbccabbabcbbcbccbcbabcaababacbabbaaaaaabbbababbbcbccabcabbabacbbcbbabccaabccacbcaaacbbcababbbccabbabbaaaacbcaababcccbaaccabcbcbbabacbbabccaacccbbaaabcabbcabcacabccabcccaccccccbaacaabcbbcabaabbaccaacaabbbacbcbbbabbacabbcccccacaabcabaabaabbbabcbbabbaaccccacabababccbbbaacacbcacbabccbbabaccbacbcacaabbacaccccbaacabaaacccacbacaaccacbaabccbcaaabaabbcbbaabbcbccbcbccbcbaccabaacaacabacacaccbbabbacbbbcccacacbcabbaacbbbbbcbacababbcacccabacaaaacbcbbcbaabbcbcccbcbccbcbaccbbaabbcacacabaaaaaccabcacbaabaaaacacabcccccabbbcacbabbbbcaabaabbabcabccbcccbabbabacabaaacaacccbbaacbbaaabacaccbcaacbbcaaabcbcbaacabccabcbababbbacacaaaacabbbccbcbaabababbabbbbaabacbccaabbccccccbcbbccaccacbbbaabbcacbccabacbccccaccaabbacabbccccbabaaccccbbabcccbcacaabbacabbbbbbacbabccccccaacbbcbaacbaccbacaccabbabbbcabacabacbbcbabbaabccaaaccccbabbbcbcccaaabacccbccbccacbbbbabbbccabaccaabbabcacababccacabacabbbbbbbbcbbccbcbabbacbbbcbcbbbaacabaacbbcacaaabccbcccbcbcacbbbccacbabccbccacabbaccbaaabbcccbbabcccccbbccacbccccbaaaaababcabacaabacbabccbcbabcaacbababaacbacacbaabcbacabaccababbbbbaccbcaccbacaacaacbbaacccbacabcaacabbaaaaacccabbcaacabcccbcacbbcbabacacacaccaccbcaabcbcbbbbcbccaaacbccbaacaaaaccacbaaaaacaccccccaacbccbcccbccaaabbbbaacbbbaaabaacbccabbbcaccacbbcabcbcaccacccbaacababbaaaabacbccacbcababbbbaacaacaccaccbbaabcbbaaccccbbbcbababacacacbbacbaaaabacacccbcabcaaaabcbbcbaacccbbbbabcaaccbccccaccbcacccbacccbacaabbacbbaaacabaccabcabbcabccacabaaabbbacbbbbccbabbcaaabccaaacbccababacccaaaaccaccaccaccbacbbacabbcabaccbbaacabcbcaaaacbabacabaabccaacbabbabccacabaaccbbcacbabaaccaabbbabccccabbbababbcacabcccabacabacbccacabcbbccaccabaabacbcccaaccabcbabbcacbcbbccacabbaaacbccbcacccbaccaabbaabbabaaaaccacbbccababcaabcbcbbbbcabbccbbcbcbbaaaccccacbbabbaccaacbacbccacccabcbabaaabcbaabccbcbcbaabcbbababbcabcacbbbcabcbcaacbaccbcabaabbccabaaacacabaccacbbcbcbcccbabcacabbbaccbbcacbcbccbbacaacbabbcacbbabacccbbccbabaccbbcccacccaccccabbcbbcacabacbcaacacaccaacacaacacaababcbbbcbacaabcbccaacabcacbcacbbbaaacacbcbccabcaccaaabbcaaabcabccbbacaaabbbabcbabcccccccccbbbaabaccbcabaacabaababcccbcbababcaaacccbcbcccbabacbccbbaaacaaaacabaabaacbbabbbaaccbaaacbccabacbbcccbbcbabaabcacaccacbcbabacbcbcbcaabbacaacaacbbabccbaacacbabaabcbbccaccbbbcaacbbcaccbbcbaaabbcbcbacbbaacabcbaccbccbaacabbbcacbcccaccbbaaccccbbcabcaabccbbbabaacbcabcbbbbcbaacbccbacbcaaabbcaaaaaabbaababaabaaacbcbbbaaababaacbacbabbcbbcbabcaccaacababbbbcaaaabbbaabbabacaaaaacccbaccaabbbabbbcbabaaabcaacbcbbcbbbbbabbccabbabccccbacbbabaaccbbaabbabbcacaaacaccabbaaacabccaacacacbbcacbaabbacaccbbabbccbacbcccabacccbaabbabcbbccacabbcbaabbbabbcaaaabbccbbcccaababbccaabbbabcbabbcbcaabbaacbbcabbaabbcaabcaaccabacaacbaabbbbbacabcaaabbcbcbbbaaccbaacccaccbbaabaabbbbabcbcabbaccbaacccabbbabbcaaaabcbbcaabbcccbcabbbcbbccccbabbcbccacbabbcaabcabccaccccbabbcabacbababbcbbcbbbcccbcaabcbbcabaccbabcbacabcbbabcaacccaaabcabacbccaaabcabaccccbaaabbbccbbabbabccbabccbabbccccbbccacbcabbcabaccaaaabccbbcaaaccacbabbccabbbcacaacaabaabcbbaacacabbabbcbaacaaccaabbccccaccaaacbaaacaccabcbbacbcacaaaacaaaccaacbaaccbbacbaabccbbcbacbccaabbabbacacbcbaacbbcabbbabcccccbcacaabbaabaacbbbbbcccbcacbbabcaabcabbacabbbcacababcbabbbbcbaaccabacaabbaaabcbcccaabaacbbacacbacbacacccbcbacaaccbaababbacaacacbbacbcaaabacbbbcbbcccbacaabaabbabaabbcabbbbcbbcccbabcbaccbaabbcbccaabababbcacaaaccbbbaacaaababbbacbaaaaaabbacbaacbcbacaccacbcccaacbbabacbcabbcabacabbccbbccbaaababbaccbbbbabbacabbacbccaccaabbbabbcbbaccaaabbbcbaabcbbbbcbbbabbbbbabcacacaacabcaaaaaabbaccaaccbcacccaacaabcbaababcbcbbbaabbcbbaaccccaaaccabcabcbbacbaaaacabacbabcccbcaccbbabbabcbbabbccbbcbcababaccbcbbaccaaaabbbbcaaaccabbbcabacaccbaabcabbcaacabbbaaababbcccabacaabbcaaaababacbccbccbcaccbaacbcbbabbaaacbacbbbbbacaaacccbcaaaabbccacbcbabbababcccacacaabacacbbcccaacabcccacccababaabccbcaabcccbacbacbababacaabacaabababbababaabcaacaacacaccaacaaccbbaabccabaaacccacacbbbcabbbcaaaaccbaacaaccbaabbabaccbbcbabbabbcccbcaccaccabbacbbbabcccabcbbbbabaabcbcccbacbacbaabbcbcbabbbccaabbcacacbcbbbaaccaabcbccbbaccabaacacbcacbbababbabcaacbbbbccbabbbbacababbabacaabacabbcaaaccbbbbcaaabcacabacaaacbccccabccbababcbaaccaacbbbccaacabbbbbcacbcaaabbaababacacccbccccbcabccbccbacccacababbccbacbcbcababaaccabbaccacccababccccaccbbcaaaaccaccabcaabbcbcaabbbaacbabaabaaabbacabaccbbccbcabcaacaaacacccbcbccacabbcbaacbccbaaccacacacababacbbbbacbbcccacbcbbcbbcbaacbcabcbaacaacccacabaccbbabacbaaaabbbcccbbabbabaccccabacaababccccaccbabcabccbbaccbaabcacaabacccbcacaacabacbbcccaccacacacabbbbbccbaaabbcbaccbaaaabbcabcbaacbbcccabbabbbbaccacbabcacacbaabcaacbccacacbcccbcbacaabacaacbacccaabaabbabcaaccacababaabacaabaacbccabcaaacbbbacccacaaaaaaaabcccaabcaaccbabacbbaabbcabbbbbcbcabbbbbccacacbabbaabbcbacabbacbaaabcaaccbbbbabacbcaaababacbacbacbccccacbcbccbccabacbaacaabcbacccacbcaccbcaaccbbbabbbbaaccbbabbabcbbccbcbbcbaccbbababbaabbbbbcaaaabaccababccacaccaabbbcbccacbcabcbbcccccacbabcbcbccaabababbcbbabbababcccabacbcccbcaaabacbacbacaaaaacbbabacaacbcabaaaccabcabacccabcbabacaaccbcccaaabbaccbcbbaccccbcccbaaacccbccaccccabccbababcbccccbbcbaacccaabbcbbbbcabaabcbaabcbbaaccacabcbbccccbabcccbacababbacccccaaabbabcbcbabcbbabbbbaaccaccaaacacaababbbcbabcbcbaacbaacbbcccbabbbbaccbacbcabbbbcbcbaaacaacccbbcbbbaababacccccbbccbaaaabbbacbcacabcbbababcbbbaaaaccccababcabbaacbaaccabcbaababcbbcacaabcaaaccbccabcababacccabaccbbacaabbabccccaaaabbbbabcabaabbbbccabcacccccaaacbbbacbcacaccccacbcaabbbcababcaacaaccaacbbacaaccccbababbbbbbcccbccbbacaabcacbccbbabbaababcbbacaccbabacbbbcbbabcabbaabcabcacaacccbcbaabbaccabaccccabacbaccaaababbabaaaabbbaaacbcacbbcacabaabccaacacacabacbbbbbcabbbbbccbbcabcbbcacbcbcccaabccbcaaabaccaabacccccbb")); + assertEquals( + 1244858478, + solution1.numberOfSubstrings( + "cccbbbacababcccabcaaaababacaccbccccabcbcbcbabcabbcbbccaabababcabbaabcabbabcbaccbccaaababcbbbbcbbcaccacccabcabaabaaaccbcaccccbabccabacacbbbccbacbbbbbacbcabcabccbaccccccccaacabababababccbbcccbbcbcaabbcbbbbbcaacacaacccbbbbabcabbcacabbcbaabcaabcbcaaaabbcbbbacccbacaabacbbaacbcbacaaabcbaacbcbaccabccbacbacbabbbabbbcbcaaaaccccacbaaaaccbbccaaacbbabbbcabbaccbabbacbaccaaaababbbcbcaaccacbacbbaaabacbcacacacbccaaabbcccbbcaccbccbabcabcaacbaaacbbcababbbcbabbaacbcaaccbcacccabaacabcacaaccacacbcaaccbacccaacccbbbcbbcababbcbcacaccacccabababccbaaaabcaacaacbcbaababaccaaabcccababcbaaccbbabcacbbcbcccbbacacbbbacbbcbccabcbbabbbcbacbabcaacaacbaabcbbbcbcbcbaacaabcaccacccaacccccbcbccabbbacaccaababcbabcbacbccacbcccbaacccbbcabacaacabababcbcaacaacbabaccacccbbbbaabacbcaaaaaaaaaccbacaaabaaccbbacbaaacbcbbcaccbabbabbbabbbbccbaacbbabbbbaaabcabbbbbbbacbcacacaacaccbaccbcabbbbaabbacacbbcabcaaaaabbbcaacbabcbbcacbabbbaaaacbcbaabbcbbaacbacacbcbccbccacaccaacccbccbcbbcabacbbaabcbbcacbabaabacccbaacbbaaccbcababbcbcbbbcaacababaccbcccbbcbababccccaccbccccabaabcabbcacccbcbacaacccabbaacbbbbcbcbacacabaaaaabcbbbabbabcbcccabbaaaccbaaaabbaabbacbccabbbcaacbbbcabbcbcbbcbacbaababaabaaacbcaabcacbccaaacacabbccbcbcbbabcbbccacacbbcacaccaaacbabcababcbcbbcbcaccccabcbccbaacaacbbaaacbbccbbccbbcacbcabbacccaaabaacbabaacbaabaaabcabcbcaaaccaaccbbbccbcbacbacbababbcbcacaaaabcbaccccaccabcaabcabbbcabbbcaaccbcacaccbabbbcbacabbaccabbabcaccbbacabbbabbcaaaabbacaabaacbccacbaabbacbbabcbacabbacbbcbbcbbaabaabcabaaabcccbbcbbccbbccbccabbbabababcabcbbbaaaabbaacaccbaabcaacccbabbacacabcbbbababcbaababcbbaccaaaabbacccbacbcaacacaacacabcaacabbacacbcbacaabaaccaacbaaabbcaaabbbbbcbcbbcccbabcabbbabacaaaaaacacaacacacbaabccbacacabbaaababcaabbabbccabaaababbabbbbabcababbaacbcccbabbccbcaabccabbcbabaaaacbabcbbcbbabcbbaaacccacccbbbcbbccbcbaaaaacaaccabcbaacabcbabaaacbacccacabaacbababbcbbcbababcaaccabbcbbacaacaaccbacbbccbbaaccbbcaccaccbbaacccacaabbbcaabcbcbcaacbabacccbabcaababcaababbbcacbaabccaccabcacaaaaabaacaaaaababbbbbcaabaccbabacbaacbcababcbbaccaccbabcbbcbbbccbbcbbcabbbccaaccccaaccabaabcbcbcacbcbaabccaacabaaabacabacbccccccbbacabbaccacccaaaaabacaababcbababaaaccaabacbbbcacccccbccbaacbbccacacababbaacabbabcaaccccbababcbaacbccbbabbcbcaccbabaacbbcbbcaaccabccaacbbbaccaababbacabbcabcbccaabcbabaabaaababaaacbaacabaccaaacbaabaccbbcaaaabacacbabbaaabcbaaabbacbaabacababaabcccabbacaaaabccacbabbcbabbccaabacccabaccabcccaabcbbbcacbccabcacabaccbcabacbcbbabcbabcaaacbababaccbcccbacbcbbbcccbbcacbbaccbbbccaacaccbbbabacbbabcbaabcbacaabbbbcaacabbbbabcbabaaabacbbcacbaacbbccbabbcbccacaabcabaaaabbccabaabccabbcabccacccccbbacabbbbbbbcbccbbbcccaccccbcaaccbcacaacacbbbaaccbcabcbccccaabbbcccaacbbccacbcbcacabaccbaaaabaaccacbabccccacaccababcacbcbbcbbbaaabacbaccabcabbbbaababbabcaacbcbcbccccaabbccccbaccbabaabbacbacaabbbbbacbcbcbccccbaccbbacabcbabbaabccacaaaaabcbaaabcbcacccaccbabaccacbcaaaabaabcbaacabacbacaaabcaacaaccbcaabbcbcbaabcccacaabcccabccaacbcbbbaccacbacbabbccaaacbabacbcababbcabcbbbbacaaaacacccbaccbbabbbccbccbacabbbcaabaccaccbcbbacbacacaaaaacbcababaaabccbcaabaabccbbbcbccbbacaccbacbcaaabacabcccacbaccbbccccabcaaabcccbacabbbbcaacbbbacacaaacccaaccbbaccbcabacaccbcbabcabbacaacaaaabaacbaccbacccbaccaaabbbbcbaacbcacaaaaaacbccccabcbaaaccccacbbcacccabbccabbcaaccbbccccbbaaacabbcbbbabacaaccbbaabaabaacbbacacbbbbbccbaaaabcbaaccacabacbaaaaabcbabbaabbbcbbbacbbbcbbbcaaacacbcbbcaccaabbcaacaaacbcbbcaaaccccbabababbaabaacacababbabcccccbaccaccabcbccbccbbababbbacbbcaaaaccbaacaabccacaabcbbabcbbccaabbbacacccabbabbaacaccbbabbbabccccbcbbcbbcbbccacccbcacbcacccbccabcccbcacbacaccbacbacaaacabacbbacabababacaabcbaccbbabcaaacbbbabacbaabbccabbbcbbbbccacaccccaabcbcbbcccabbababcbaaaacccaccabbabaababccbaabbbcaacbaacabaababcbacbbabbcbacccaaaaaaaaaacbcaccbacacbbccaabbcbacbbccbabaaabacccbaccbbbbbbcaaababaabbbcbbababaabaaacbbbacaabcbbccbbacccabbbcbcbacbccacbcbbaccacbccbaaaccbcbaaacbaabaccbbaaabaaccabbcaccccacbaacaacabbcccbccbbaaacaacbcaacbbcaccbbabcaaaacccaabacbababcbcbcccbcccaabcaccbacbabcbaaccaacaaaaacababacaccccccbaabcbbacaccbbaabaacaccbccbacaaabcccbcbaabbcabbbabbbcbbbabccbbacccabbccabbccabcacbcaacaccbccccaaacbcbabbabbaacbcbcbcbcbbcbaccbcbcbacbbcaaaaaabbaccbcbabbabbabaacacbcbabcccbbaaccbaaaabcabbccbabbabaababaaababcabcacaccccbaaabcacbababacacaacaaacaabaabbbbbcacabbacbcaacbbccacccbabbcbaaacaabaacaabaacbbaabcaaacbccabbbcbacccabcbacacacbcabbbccacabacbaaababccaababaabacacaaabacacbabcacacacaccacbbcbcbcbcbbbaabaaaabbbacbbaaccabcaabaabcbbbbbabbbababbcbbaacbacbbccbbbbcccabccacbaccaccbbccaaccabbaaaccabccbbabccacaaabbbcacacaabbaabaabcbbaaacacccbccbbbcaabcacbcaabaaccccccabcaabcacbccaacbcaaaccbccbcacbcabaacaaaccabbbcbccbcabaabbcacbcbacccaabaccaabbbabcccbacbbcbcbccbaaccacbcbbacabbababbbbccacbaaabacaacbbacbccbbcbccbaaaaacabbbbbcbacbabbacabbaaaccaaaacccbcbaabbbbcbcaaabcccbbabcacbaccacabbbcaabbacaaabccabacccaccbcbabcbbaabbaccabcaccaaccababcccbbacacaaaacccccbaaaacccbbacbabcbbcabaaccacacaaaccbcbcacabbacccccabcbacbacbcbcbbcaaaccccabccbcacaaaaabacacaacbbbcaaacaabbbabbaaabbabbbcbabaaaaccbbbcccbaacaabacaaacbccbcbabbbcacabaacaabababcbaabcaaaccccbcbccbbaabbacccacccbcaaacccaccaabbbcbaaacccccabcabbbbbbaaacbbccacabacabaabaacbbabaacbcccbabcacaccbacabababbcaaccbacbabababbabbbcabaccbaacbbcacbcacbabbcbbaaabbbcbacbcbcbbbaacbbbbaccabaaaabaaacbbbaccaaabbccabbcbcccabcacbabbbabbbbcbcbabacbcacbcbacaacbaabacbbccacbbaacbaccccaccbacababbbcababbbacaaabacbbabcabbcabbaacaccbbbbcabcccaccacbcaaabaccbaaaacacabcabaabaccaaacbbaabcaccacbbabababcccbccccaaccabbcabaaaacbaacaacabbcbbaacccbabcbcbbbacbbcacbabbbbaccbbbbbaaaabcaabbaabbbabbcbaaccbbabaaabababbabcbcbcabcaccabaacbabcbbcbaaaacbacccbabbbcbbbccabbccaccbabcbbcbbacbcaccbcaaccabbabcbabcabacabbbaaabbacacaaaacbaababbbaaacbcbabacacbcbbacbccaaacbcacaacaccacaabbcbcccbccacbabbcaabcbbcbabababbabbabbcabbbbabbcbaacaacbbbcaaacbbcabcbaabccccabcbaabbabbbbcabcabccbcabcccbbbcbbaacccbbaabaaababccaacbabaaaabacaabbcccabaabaabbcacccabbcbcccbbbaababbabcaabbaaaaccbcbacabacabbbaccbbabbabcaaacbcacabababbbcbccbaaabbcccbbaacaacbababbabbcababcabbcaacbaacaabacbaaacbcbbaccabbbccbbccbbaaacababbabbacbbaccccabaaacbcacabbabaacbbacaacaaacaaaaabbacbaaacbbbacbacbbbbcabbcbbcacbbaaccaaacacbcabacababcbcacabbccccacbbababaccbabcacbcbccacaaacccabaabaabbcabbbacacbabccbcaaaababaabaaaccbbbababcabaababbcababbcacaaacaaaccbcbabcbabcbacbccacabcbcaacbcacbcbcaabcbabaacbacbbcbcbabbbacbaaacccbacabcbcbcbbbabbcbcbbacabcabaaacbbacbbbaabcaaabcbaabcabacacaabaaaaabcccabbacabaccbbbbabbbababaabccabbbacaabcbccacaaaababbcccababaaabaccbaccbaabccbaabcaaaabaccacbabaaaaaccbcbbaabcbaccccbbaaccabbacacaccbabbbbaacabacababcaaaabbacbcbbcbcbababaccbbbaccbbbabcbababcacbbbbcbaabbcbbbccbaccabccababccaccbbacbbaabcaaaacaaccbabbbacaaacabbcacacbcabaacabbbacbaaababaaccccacacacbcbaaabcbbbbcbabcbccbbbaacabcabbcabaacbacbaabbcccaacccbabcaaccaaaaaacabacbacbcbbcccbaccaccacaaabcccbacabcbabaaaababccbaccbbcaaabcccababacccbabcaabcbcabbbbcbccbaccaaccacbaabbbabbcbbaccaaacaaccbbaacbabcbbaaaccabaaabbbaabcacabaaabacbabcaaabbacbbacbaaccaaacabbcaaacbbbacbcbbcbabbabaacbcababbbbbcbbabbacacabbbccbbccbbbcabcbcbccacbaabbcacccbbbbbccbaaccabbcbacbaaaaabababbcccbaabbcababbbbaacbccbbacabbaaacbbccaaaabaabcbacbaccbcccbabaaaccaaccbcccaacabbcbbcbbccaaaabcccbccbaaccabacaaabaaabacacbbaaacbbbcbabbcaabccbcaabbacaaacccbbcaacacbbaccbbabbcbbbaacbccccbabcbbacaccbbcaaaaabcabccccaaccacbcbababcbbaaaabbbcaabbabbcabbaaaabcbbacccbbaabbbacaacacaaaacccbaabacaaccbccacbbcaaacbcaaaaabaaccbcaccabbaaacbbbbabaaaabbcaacabbbccbaacbbbcbaccaabbcabbcbcccacbbbacbbabaaaabacbcbcababcbaaaabcaacbacbbccbaacacccbaacabbcccabbaabaaaabcccbaabbcbcbcacbcaabcccbabaabccccabccbbaaabccaabbacbcccbaacabccacccabbbbcacaaccbccbcccacbaccacaaaababbcabccabcaacacbcacbcccababbababbbccacabbcaccabccacccbababbbcccccacbbacaacaaaacabcacccabbbcabccacaccaabbcaabacbabccccacabcaacabbabccacacbaabaccabaacccbbcabaccaaaaaacbbbbbacacccbaabbaaabaccbaaccaaccaacbaacabbbcaaaaaabccbaccbaaacccaaabcbbbabccbababcbbbcbabcabcccababacabcbabacaacaccbabaaacccacbbcaaaaaccabbcaaccbbbccbabababccccaccbccbcbacaabbabbcbaabbbcabbccaaaabbacababbaaacccaacbcabacacabacabbccabbccccbcbbaabbaacbabbaaaaabaccaaabbcabacabacaccccbcababbacabaabbcbbaccabbbcbccaababbbababacbbcaaccabbabbabbcbaabaacccaaacbabbcbcbcccaababaabbcaaaacbcccaacbccbcccbbbbbcbbcaababccccaaacacaaabbccacabbaabccbcaabbaaccbacabcaccaaababbaabccaaabaababbababcaacbbacccabccbcccccabaacaaccacbcbaaacbbacbbaccabbbbacccaccbaccccbbacacbcccbcaacaccbaccccbcaaaababacbbbaccabccbabaaccaabbbbcaaabcbbbbcbbabbbbaaccabcaacccabacabccaccbbabaacbcaabcbabbbbaabbbbbacbabbbaacaababaabababaaaababcacbccbcbbcacaccaccbababcaacacbcbababacabcbbcbcabbcabaacccaaabbbcabacabbccbccabcccbbaabccaccaacaccaacabbccccbababacbaacacaacaacbbcbcccacccababccabcccaabacbabcbbbcabaaccaaabcbccbcaabaacaccaccacccbaaccbcaabcccabacbbbacbabacaccacccbbbaccacbccbcbbbaabcacccacaabcaaabbbcacacbbbcbccaccbcbabbbccbaacbbcccbbabcbabababcbcccabaabbaabacccbacaaccbbccaacbbbcbaabaaabbcbaccbaccbabaaacbbbcaabacacccabccbbcccabcbbbaaacbccbaaaacbbcbccbacacccccbcbbcccbbaaaccbabaaccabbaabcabccbbbaccaabbbcbbbaaaabccccacbbabbccbccbaccbacbcbccbbcbcabbbcbcabacbabcacaaabccbcbcacbbaacabacaaccaabacbcbaabbaccbcccbbacacbcccabccbaaacacbbabccbcacacccacbaabaaababbabaacacbbcbaccaacabaaaaabcbcccbbabaabcbabbbccabccccbbcbccaaacaabcccacaaacbacabbccbcbaaacbcababaaaaccbcbccacccabbcabbabbccaaababaaaabbabbabcbbaaaccabbcbbccbacbbcaacbabaaaacbaaabaaabaaaaaacabbbbbbabcbacbbbbbbcbccaabccccacaabcaabbabbabacbcccbcbcabacbacabbcbbcbbacbbcabaccabaabababaacbbcbcabbcacacaabbcbcabbcacaaaaacbacacaacbbbbbaaabbbbabcccbaaccccbcccbbccaaccaacaaccccacacacbcabcbccbaaccccabbbbabbacbbbaccccbcccbcabbbbababcaacbbacccbbcbbbcccababacbaacacbaacbbbacacaababccccabcbcbccacbbbaaaccbbcaaacbcaaccbbcbccabbcbcaabacaaacacccaccaaabacbacbabacbbcabaacbccbccaccbcccaaaabbaacbaccbcbbaccccacacaabcccbaacbccaabbcbbbbabacacacbbabaaaabcccccbcbabaaabbbabcabccbbcaababaccacacccbbcabcabbccaaacbabcacbaaaababababcbbbaccccacbacaccbbcccbbbbccaabbccccbabbbccbccbbbbbaaacaaabbcabaabbbcacaaabcbbabaaacbbccabbcbabbccaabacbcaaaccabcbbbaaabacbcaccabbabacccabbcbccbabaccccbbbbabbcbacabcbbbcabbbcccbbbbcccccacaacacabacaaabbcacabaacbbbcaabcbbaccbaaabcaccbaccaacbbbaababaccbcaacacabcacabacabaacbcaacacabacbcbaccacccbaacccaabababbbaabbbaacccbccacbaccbaacabcbbbcaaaabcacbbcbcccbaaacbcabbaaaaabccbcbcccabaabacaccbbbacaaccbcbababcbbbacccbbccbabcccacaabccaaabbcbbbaccbbabcbbabcaabcbaacbbcabcabbbcbaababaacbabbccbcabbabcbbbabcccbbabacbabbaabcaccbccacbabccbaaabbbacccababbaaabbbbabbccabababbcabbabcccccccccbcbccaaacbccabbabbbaccaacacbbcbbbbcbabccbbacbabbababcabbcccbbabaaaaacccacacbaaaaccccbcbabcabbbcbaccbbbbcbbbaaabcbaccbabbaacaaacbcbabaacbcaacbccbcbbacbbcbabcbcaaaaaabbbabcbaacabbaacbcbaaaaacaabbaabbccbcaccacbccabbcaaacbababbcbccbcacbbbcaabaccbcbcbbaaccabbabcabccaccbbaaaaacabbbababccbaccacbcaaaaacccaaacacabacabcbcacaabbcbcacbbcaaccacacacbbbbbbcccbbbccbbabbcccabbccacacbacabababbbaabcbcbbabbaabaababbcaccabbcabacbcacaacbbbbaabbccbaaacccacbbbcbbbababaabaaababcbcbaacccbbccbcbcbaaaacbbbbcaaaabaaabbbccabcbaacabcaacbbcaabacabababbabbbabbbbcccabaccbabbccbbbabcabaabbcacbbcacacbacacababbbccababcbccbabaaaaabccbabbabccacaaabcacacaabbababababaccbbaabcacbbabacbacbbbabaacaabacbbbaaabcaacbcaccbbbabccababcbcbcbcabaaaccbcabcacbbbababaaaababbbbccaacbabaababcbcabccaccbacbabaaaaabbccbcaaaaaabccbbabcaabacbabacccabbcbcbccbacbaabbaacaaacbacbbaaccaabaaabacacccaabccabbbaacaaccacccacacccaccbccabcaaabacacbbccbabbacabbbaaabbabcaacbabbabcbbcaccacccbbccaccbacbcacccbabcbcbcbbabcccccacbabbacacbbabcacabbaababbcccaababaccacaacabacaaaccababacabbcabcabacaccbbcacaaabbaacbbcaabcccbcbabccbabbaccbcabbacabccbcbbcbacabcabbbbcababacaababccbbbccbbaababbcabbcaaaabbbacaabaabccaaccbbcbaabbbccabbccabcbacbcaccabababbbccbbccbbcccbacccccaacbbabccababcbcbcbcaacbbbbaaccacccabbbaabaccbacacbbbcbbabaaaaccabcaabbaccbccbaacabaacaabbaaaacabaaccabacbccabbcccbcccbcaaccaaccbcaabcbabbbaacabbaabcccbaccacbbacbbbcacabbcbaaabcaaaccbbcbaaabbabcaccacbbbbccaccabcaacabcaacbaccbcabbccaaabcbccbaaabbcbaacbccbacbbcbaccbaaabaaaababccbbcbacabcbabcbbacbccaabaaccbabcbcbcaaababbbcbccababbacaccaabcbbaacbabaacabaaaaaabcaabcbbcacbcacabcbbbabacbbbbaabacbcaaaaacaacacbcbcbbcbcbccacbaccacbbcbcbcabcbaaabbcbabacabacbabccbbbcbbcccbaaabcccacabbbcaacaacbaabbcbcbacbbcbbbaaaacbbabcaaacbccbccaacbacaaccaababbacbcaabcbaabcbbcabbabcbccaaaacbabbbcaabccacaaccbbbccbaccbaaccabbcbbbccbcaabbbacbbcacaccacbcbbbbabcccabbccabbcbacaccbaaacbabbcbacccaacaabacbbabcaaacaacbbabcacacaabbbaabaaccccbbcaccbbbacacbbabcaacbbbbbababbaabacbaabbcaabccaaabbacbacacccccbaccbbbccbcaaaabccbbbababbbbbaabccaccaaaccaabbbbacaacbbcaaccccabcaaabcabcaacbcbbcccabaababbbbbabcbcbccababcbccacbcbcacbaabcacccbacaccacabbbababbbabcaabbbcccacccabbcaacababcbbcbbaaccacbbaacbaabcabcababbacbcabaaacccacbbaacbabbcccabcbaaccbbcbcabacbcbbbbcccaccacaacacaacaabbcccaaccbcacbabbacabaabccccaaabccabcabacaabbaaaabcbbbbabbcbbbbabbcbcccbabbccabbaaacbbcabcabbabccccbbacaacbbccbccccababbcacabbacaccbbbcbcaaabcbcbccbbbccaacaaabacacaabacbacbbcaaccaaaaccccbcbbcbaacbcbaccccaccbbcaaccccaabbcbbbabbaaacbcbbaacaccababaaacbbaaccaccbcaacabaccacbbaccaaaacbcbabacabacbbaaababcbbbaacbaccbccbacabacbaaababcbcaccbabbaccbbbcabbabbabcbcaaccaccbbbbacbbaaabcaabacccbbbacbaacabacabbaaabcbcaaaaccccabacaacccacbbbcbababaaabbbaccbcaabbccaabaccbbaababaabbcbbabcbcabbbacabaccbbabcbbbbcacabbacbacacccacbaacabaaaacacbcbaaacbcbbabccbaaabaaabaccccaaabaabcbccaaabcabcacabacccbabccbcacacbbbaaacabaacabbbcaacabcaacbabccacbccbacbcbbcaaaabcbbbbbbcbcbaabbcbcabbbababbabaaacbaaccbacccbbccabacaacbbbbacbbaaccacbcccaacbbbbccaabaccaccbbcaaacabaabcabaacccbabbaacaabaacccabcccccbabaacaaccbcbbabaccbbbcaabacaccbcbacccbccbaacacccacaccabcaababbaaaaccbcabcbbacbccaaaabcacbbacacbaababbccccbabababbaaabbcbabbcaabbacaaaabaaaaaaaaaccbaacbbbaacbbbabccaccacacacbacabbbbabbaacbbbbacbcbbbcacccbabcabbbacabcbbbcbcacbabbacbccbccabcbcbacbbbbcbccacacccaabcbcaabbababababbacabbbbbcaabcacabbbcababaabcbaabaaaacbcbbbcbcbcbacbbcbabccabbcacaaabababacbcaacacabcbccccaacccacbaaaacaccabcabbaccbcbccbabccccaaaaacacabbabcacabcbabccbaccaacbcbcaaaabaacacabaacbaccccabbaccabaabccccaccbccbabcbcccabbbccabaaccbcaccbbabcbabcccbcccaacacaccacbbbacbbbcaacbaabbbcaccccbbccacccacaabbbcabbbacbcacbccbaccbbccabcbbbabcacabbbaacbbbcccaaabacaaabcbcccbccaaabcbbabaabcbacbbbabbccbcacbccaacbcbabbbbababbcacccbabbaaccbbcbcbcacccaabbaabcaabbcacbcbabacbcaabaaabcbaabbbbabacbbcabbaaccbcccbcabcbabccbbcaaccbacabcaacaccbcacbbaccacbbcbbccbaccbcbaccbaabcccbaabacbcaaabcacbbaaaabacaccbbbcbbacabcababbcbbabbccacbabcbcbabcbbaccbacbbbabcbbcaaacbaabcbcbccaccbacacbbabaccccccbccaccbaacabacbccbcaabbaacbcacaabacbacbbaccbabbbbaccccaabbacccababbbbaabccaaccbabbbaabbaacbababcbcbbabcbacbabccccbbcbcabcbbabacacbbccbaabbccacaabbcbccbcbbcccbbababbccccabaacbabaabcaacbbbcacbbabaaabcbcbbbbacaccacacacacacbacabacbcbabcccaaababcaabcbabbcbbacbaacccaaabccacccaaabaaabbccccaccbacbcccaabbacbbccbbbcbaaacabbcbbcacaacbcabcabcbacbababbccabbbbbcbcaaccbcabababbaaacbabcbcaccababbacabaaaaccabaacbbcaaababccaccbaacacacbcabcbabaabcbcbbccbaabaabacaaaaccbbbbabbaabccabbcacacacbcacbccccaacaccbabbbcbbacaccaccbacacbacacbbabaaabaccbcccaacbaaababcbcbbabacacbbcaacbaabbcabbbbccacabaccaacacacccacacacbbcaaaacbccccbcbaaaabccccababcbbcbbbcaaaccbaaccaaacbababccbbbbababcbcabbabbcbbbbbccabaabaabcacaaaababcabbbabbacbaaaaccacbcbacbabcccbaaabbbcbcbcbbbccbabaccabbacacbbcaaacbbaabcacabbbcabcbbccacaacaacbbbbcbbcbbcacccbaacabbaabcbaaabbbaabbcbbaccacbccaacacbbbbbaabbaacabbcacbabbbcabccbabbabcbbbbacabbcaaccacabcbbcaaaccabcbacbaacbacbbacabcaaacaabbbaaccbccabaccbcbcbbbccccbbabcaabbbcabccacacacbbcaccaabbbaaacbaababcaaacbabbbaaaccaaabbaacacabbabcbccbbcaacbbccbccccabccabbabcaccbcbbabaaacaccabcbcbcbbabbaabcaabccbabaabccbabcbcacbcabccbcabaaaaccacbbacbcabaaacacbcababbaacbcaaacccacaaabbbccaaccabbbbcabcbccbcaabbccbacccabcbabbcccacbaabccaabbbbabbcabababaacaaacbaaaacaaabcaccbcabbbcccaabcaaaaabacaaababbacccababbcabbcaacbcaacbabbaccaabbababbabcbaaaaccaaaaaaaccccbbbababbabbbaabbcaabaacbacababcbbcbbbbbbcaaaccbaacbccbabbaabbacabbcbacccaccccacacabcbaabcccabacbcacacabaabcbcbcabacbcaaacbaabccbcaabbaccabcbcbcccbcaaaaaacccbbbccccaaaaccccaccacaabaabbababbcbbaaabacacacbcacccaacbcaaccbaabaccabcacbcbcababbaaacaaacccbbabccabbbbbbccababcaaccabbcbccbaacaabaccbaaacabcbacbccacaaabcbaccacccabacbaabccbccaabacaabbcbccbacbbcabababcccbaccbbacbbcccbbbabccaabcababbcaccaccabbacbacccccabaccaabcbaabbcbababcacbbaacaabcabacccaabcbccabaccccccabbaabcccababbaaacbaacbcbcaabccaccccacaaacaabbccccaacbbccababbbbcbbbaaabaccabcaccacbbbabacbacbbbbccacacbabcbccabcabacbbccbacbccaacbacbcaababccaaababbbbcccbaabbbabbbabaacaabcbacbbccccbcaccbcbccbcccaccbbbbaababacbaccccaaaaccbbaabaaabccbaaaacaaaaccaabaaabaccccacabbabcbbacbacabacabcbbbabccbacbcbacbbbcabcbcccacbababaccbabccbacaabbbccbbcaaaaccbaacbbbaaacbbbccbacccbabccaababababbbbbbcaacccccabbcccccabcbbbabbabbcaacaaabbabbcaacbbcaccabcacbaabcaabbcacccbbaacbbcccccbcccccbaaacbcccaabaaaaaaabbcccbcbacbbaaccaacbabacbccbabaacabbcaabbcbccccacccacbcccbaccbbbcbbccbbcbbabcaacaaabaccacabcbbbacbcabcbccacaaabaabbaccaccbccccabaabcabccbaaaacacacabababcbcbaaabbccaccaaacbbccaaccbbccaaacbbbbaabcbbbccabaacabccbabbcabcababbbccabaaababbbcbbbcbbcbbbacbbbbaacbcacccacccbbcbcbccabbcaabacaaaccabaaacbacbaaabbccccacaabcbbbccababacbaaaccbcacbabaccaccccabcccabccabacacccbccaaabcbacbaacbaabaabbacbbacbbbcccabbccbcccaacababbacaccbabbacbcbabbccaacbabbccbabcaccbbbaaaaacbacbcbaaaccaaacaccbaccaccaaaaabbacaaaabcbbaaabacaccaabcaaaccbaabaccacabccbccccbbbaccaacbaccacaabccbcabacaacccbcbbcacacaaabcbcaaccccccbbcacbacaabccaccabbaaaaacbcccaaacbacaacabbaacbaccababbacbcccbbbbbcabbbacaaccccbaabacbaccacacccbababbbbbbccccbbbbbacabbacbaabbaaacbbcbcaccbabcabcbaaacacbacbababababacbaababacccccacbbcbcacbccbaabcccaccbcabccacbabcbacbbccccbacaccbbbacaaabcbaaaccbbbaaacabababacccbabcaabcbcaaabaabaaacbacbcaabacaaacbcbacccabcabaccaabcbaaabbbcacabbaabacaabbbcaaccbaacbbbcbbbbcccbcaabbacabacaabcabaaabcbbabbaaabbbabcabaacbabbbcbacccabbbabcccaccbbbbbbaacacaabcabcbcbaaabacbaabbacbacabccccaacbcbcabccccaccacabbcacabbccbacacacabccbcaaaabbacccbaacbccbbaccbbbaccaabbacbcaccbababbbccaaccbccccbaabbbacaaababaabacabcbcbaaccbcbcaccccbbcbaabcaaccabaccccbcabbccccbabcbcacbcccacbbacbcabbbbaacbabcbbccbccaaabaccbabbbcbbacacaaabbaacabcbcbccbbacbccaaabacbccaababaccbbcbabccacccabcaccbbcbabbacbbcabbaaaabcacccbcacababccacbbbcbbaacbcbabacbbaaabaababcbaaaabaccbbcccccabbbacaaccbaabbaaaaaababbcaccbbbaacbbacacbaccaaccaccaccaabaabcbabaccccabbacaacacccbacccccacbcbaaabcaaaaccbcacaaccbaaabbcbcacabcacccbbbabbbcaccaaabacbcccbbbacababbacacccbaabcccaccacababcbaccaccabbcaccacccaacacbcccbbabaacbcccacbbaacbbaabbbbcabbcccbbcaaabacabbababccacaccccaabbcbbbbabcaaaabaccccbccabcbabcacacaababccabbbbbaaccaabbcacbacbaabcabbbbccbcbbcbccccbcbabbbbbbabbbacabccbaacbbbabccababccaaabaccbcacbbabacabcaabbcbcacbbccabaaccaabbbccaaabccccbabaacacbbaccabbabababbbacbbbcbaccccbcabacbcbcbaacbcaaababacbcbabcbccabcaccccaaacbaabaccaababaaaabacbccccaccbaaacbcaaabbcbacbbcabcbbbabccccaaaaabbcbacbcbabbabbbbccccaacacccccaaccaabcbbbcaaaccabcaabbaaaccacbbcccbaaccbcbabbbcaccbbaaaabaabbcbcaaacbabbbcacacbacbabacacabbacabcabbabaabcaaaccaabccaccaabbcaccbccbbcacbbaacaababcbcaacbbccabbcccaabcbbccbacabcbcbbbcbbaacaaabbcbbcbbbccbbabccacbbbccbbccbacacaabbbbbaaccbbbaccccbaccccaaaabbabaacbcaaaccbbcbbacbccbabaaacabbabcabbccbbbaaacaccaaccaabbbcbcccaccbcbcccaabbabababcacbaaacabccbacbbcaaabbbbbbbbbccbcccbcbabaaaabbcaacbcbcbbccaabbcbacbabcaaabcbbbcbcbbbccbaacabbcbcbababbacbbbbaaaacbbacbbbbbaacbaccbbbbacbbacaabbcbacccabaccaacbbababbabaaacbaabaccbabcaabbcbaababbacbacacaaacbbbaacbaacccbcabccabacbaaacbccbbcaabcbbcaabaabaaaccacbaacbabccbbbcabbabcbcababcaaabcaabcccabacbbcaacabbbccccacabcaabbaabcbcbacaabcccbbbbabbcbcccabbabaaccaacaccccbacccaacabbbbaabcbcacacbbbbaaaacbcacabaabccaaacbabccbbaaccbbaaaabacccabcabbaabcabccbccbbabacbbcbcccccacbaabacacaccaaaabbccbabccabacaabbbccbcbaabbaaccababccbbbbccaabaaaacccaacbbacacbcaccbbccbcaabbcaccbcacacbcbbacccabcbcaabcabcbbaaccabaaccaaacccccbccbbbcabcbbcbcbababacacabbabaacbcaaaaacbccaccaaabcaaaaaccabccbbbcbbacaacbbbabcbbaaacacbbbcccacbcacabbbcbcabbacacbaaacbbbbcbcaccaaaccbcbcaccaaaccbbcaaaccbaabacbbcaacabbbccaabaacbaabcbcabbabbacbaabcacacbccaccbcabbbcbbcabacbbbcabcabbcbaabbacbcbbcbcbacaacbcabccaacbbcbaabcacbccbbbacabacccbcbbaaaababaaabacaaccabccbcacbabcbaacbcaaacacccbbababcbbbccbcabbcacbabaabbaacabbbbacacbababacbbbaabacbbbaabbaaabccaaaabbaabbaabaabbccabbabaccaccbcaaaacabbcbaabbcbacaacabccbabcbbaacccaaccccabaaaccccbbbaaabbaaabaccccacbbabaacaaacaacbbbbcabbbbabaabaaccbabbbbaaabcaaabaabbcbbaacbcacbcabbcacaaacbaacbbbaaabbbccabbbabbcbacbccbabbbbbbbababaabaaccabcbccccaababbccabcabbccbabaccabcbcacbaabccacaccbbbacbaabacbbcabbcaabbcbbaaacbcbacaacbacabaababaaaaccaaaccccccbcaabcbccaccbaabccccaabbccbbbaaacbbbbabbccbbcacaaacaccaaacababaacabbabcccccbabcbaccaacbccaabbaacaaccbbaaccccbbaaaaacbabbcaacaabbbbcbabacbcacbcabbcacbcabaaabaaabbaacccbcacacaabcbabbaabcacaacabbcacccbacbcbcaaabaccbacacabcbabbcaccabcabcacbabbbbbcbaaacaccaabcccabcbaabcbababbcbacaaccaabcacbbccbaababbcbccaabbbbcacaaabccaaacbbaaccccbababaacccabaababbabccbbcbccccbcbbacbaabaaccabcccacaccabcccaacbcaaccbccccccacbaabbabbabcbaababccbaccccccbbbcaaaccaacacabcabaccabbbacbaccccbccaacabacccbbbcababcbcbaccabacbbbbaaccbbacbabbaaacccbaaabbcbcabcbcaaabcbbccbbbbabcccaaccababccacbcbccaccabbabacbcbbbcacccbaacbcacbbcbcacbcabcbcbabbccacbaacbcbbcbcbabcaacaaabbbaacbbcbcacbaabcbcaaacbccbbaacbbabcabbbbaccbacaccbabbccbbbccabbbcbcccacbcaccbacbacabaacbcacacabbbcbbbabaaccaacacaccbbcbacaacabaaccaacbcccaabacccbcbaaacacacbbccbbccaabacababbcccacccbbcaaacabbbbcbbcbaaacbbacacaaccacabcbaabcbccaabaacacbcacbcbbbacccabbcbbabcbbabaabcaabbbcbaccaabbbcabccacbbcaabcacbcacbbabaaacbcabbcbaaccaaacacccbacbbcccbbbabcbcbacacccbcbaabcaacaaccbaccbbbcccbacabacbbbbbcaaacaabbaabacbbccabbbcaacccccbacabcaababcbccaabbcbaaaacbaccbcccaabaccbaaabbbcacabacaabccbbcaaccacbbcabcabccbbbbcbabacaaaacaacbbbcaacbcbababacbaabaaaabccbbbccbbccaaaaacabaaacbccbabbaaaacaabbccccccbaabcbccbacbcabbcbaacaabbcbccbaaabacccaaccaabbaaaacacabcaaaccabaabccbabbbaabbcbaaaabcbaabaaaacabaccbabcacabbcbcbabccccbcbcaabccacacbcaaacbaccccbcaccbcbcccccccccabccccabbcbbcbbbacacaaabacbcbaacbbacaabccabccabaccbaaabccabbbcaaacbbcaabacbcccbbbcbbcacacaabacbbbacabbabbccaccababcbacaabcacbbcbcbccaabcaccbabcacbbacbaacabcbbabaccccbbccccbccabbbcccabaabbababcabcaccbccabbbababacaccaaaaabbaaccacbabbbcaaacaccaaaccabbabaabccaaabaccccabcabbabcbbbccbacaccbaabbcbaacbcbbcbabcbbccaacaabbcbaaabbbbbaaabaaabcbaccbbbacbcbbcbaaccacbbbbcbcaaabaccbbbabbaabcaccaabacbcbacbabaaacbcbabccabbcacacbbcabccccbbaacaabaccbcbabcbbabaccbbbacbbcbbbbbbbbabccacacabbbccacabcbcbbbcbccacbabccccacacbbccabbbbbbbbacaabbbbcccacacbbaccaaabbaccbacabacaccacbcbbcccacaccaacbaaacabcaccabacbabcacabccaabaaabaabbbaacabaaccbccbbcbcbacccbaccbbbccacbcbccbbacabcabaccaccbaccacaaaaccaacaabaccaaacabaacbcbbaaacccbcaacbaccacbcabcbabccbcaaaaaccbacaaacbbbcaabccbcaabbcbbbacbacbcaacbbcaababacbcbccbcccaacbaabbccbaaccbbbcacbcbabcaacccbabaabbabcbbbacabbbababaabaaaaacbccbaccbabbbcaabcaabcacbaabaababbcacbccbabbbabcabbabcaacbaabaaaccabacacaacaacacabacbabacbbcabaaccbccabbacccccbabaabaacabacbbbcaccabcacabccccccacacbabaccaaaaabcababaabacaabcbcacbbccaabababbcbcccaccccacbbcababbacbabacbbabbbcacbcccbbaabcbaaaccbbbbcbacbabcabaabbccaaaabaccbaaaccbbbaabbbcababbcbacbbabbabbbabbcbabbcbbbcaacbabaabaacbacababcccbacabbacaaccacaabcbbbbaccbabbabacacbcbcaacccaabcbccbabacbbccccabaacabaabcbcbcbcbaaccbaacacbcccaacabaacbabbaabaccbbcccbacbcabccbccccaabaabbbcabbaabbcbcabacacacababcacacbcacbbbbbcabacbcabacaabaaabbacbacbabacacabccabacbabcccbbcbccabbaccacccacbccaaaaaabaabcbbbcacbbbbbcbaaaccccaaabaacbacabbcabaacbbaacacaaccbbaaabcabbacbbbacbbabcaaababccacbbacbccbccbabcccabacacbacbbcaacbaacaabacbcbaacbbcaaabbaccbcbccbcacccabcabbcaaccbaababbccbbaabcabcbbaabcbbcabbaabccbbabccaaaccabacaabcaacbacccaacbaacabccbaacaaccbbbcabbbacbcaaaacbacccaccbaacaaaabccbcbccbbababcbabcaacabaaaaaaccaabcacabbbabbcbcabacbcbcabaabcbccabbcbcaccaccbacaacbbbaabcbccabacaabaaabbbcbbaacabbbccaabccbcbaccacabbabbcbacabcbacbabacbbaaacabaabaaacacacaccabbbccacaccbbbbccaacbccaaaabababacbabaaaaccaaaccbccabcbabcbacaccbccaabbbcacacacabbaacacbcaaacacbbaacbaacacccbabacabbcbbbaabaacaaccbaabcbcbbccabcccbcbbcbcbaaccbaabbccbbacbccbacbcbbbacabaaababbcbccbbaacbbbacabbcbabaccbbaccccbaacabccaccbacccabbbccbcaaccabbbbbbcbabccacbcbacaaaabcabaccbabaabcaaccacbacccbcaccaccaacaaaccbbacaabbccaacbaccccacbaccaababacaacccaabcbcccabcacccbbbbaabaacaabcbabcaccaccaaabacababaacbcccbaaabcacacacacbcaabaccabcabbbcbcbcbaacaaccbcbbccccbbacaccbbbabbacacacaaabbacbbabcbcaaabccacabcbabbcbcbbcaabacbbbbcaababcaabccaaccbbaaccbabccbcbaabbbccacabbaaaccccaacbabbbabcacbabaaccbbccaabbbacccbcacabbbcbcbcbabcccbaababbbbcaabbabbbcbbaaabacbcbcbabcbccbbaabaababbabbbcaccaacacbacbaaccaacacbabbaacaabbaacacccbaabbbbbbaaababacccabccabbacabbbbaabaabcbacbaaacbbaccbaaaabccbacaaabaacbbbaaacbaacbcbcccaacaacbabbccccabbacbaccabccabbbbabaaaacccacbcabacaacbababbcabcbcbccbcaccabbbcbacbabccaccaaabacbacaaacacccbacabaaacabbccaccbbaabbbbaccaccabcaaacbbaabacbacbcabcccacbaccbabacbcacbbcaabcbbbcccaaccccbcaabababbbabaabbccbbbabaaacbbacaaccacbaabcbbabacbabccabccaaccacacabaabcccaabcccccccaabbcacbacabbccbbbbaabaabcaabaaacacbbaabcaacccccacbccbaacbabaabcccabcbabaccccbbbacabcbcbcbaccabbbcbbcabbbbbbcacbcabaabcaabcabaaaaaccccabcacbbccbbaabaccbcabaabababaccacbacbbccabbcbbbaaaaababbbcacacccccaacbbcbabbaaaabcbcbcaacccbccbccacbbbaacabbcbbbcbcabaacabcbabaaaabaacacbbabcabcabccbbacbcbcabccccbcabbcbccabbcbbbaabcccabbccabcbcaaacbbacaccbccbbbaaccccacbcbbacabaaaaaacacbcacabcabcabacccabcabbbcbabbaccbbaacaacbbcbbbbbbbcacaabaccbccacaaabcabaabbaacbbbacbcbcaaabbbbaccbcbacacbbcaacbccccaabaacacacabcbabbcbacababbbbabcaccccccbbcabbabbaabbccbbccaaaabcbabbaacbaabcaaaaabbcccbabcbbabbccaccbccbcaabacbcbcaabcbbbcabacacccaacccbacaabababbccbcbbcaaccbbaacbcaabbbcabbcccbccbbaccaacabababcaaacbbacaaabcabaabcacacacacbaaaabccbcabbccacbccaaccbabacbabababbbabcccbbbbbaccabbbbcacacbaaaababcabcaaaacbabaabbbaabcbcccbcabcaabccbbbccbabbcbbbbcbbcabcababcaacabbaabbccaabcbacccababaacbaacabcbbbabcccbcccbabbabcaacacacaaaabbbbbbabbcbbcacccaaacbcacbbaaccccbbbcabbbabccbcbabcabbacacabbaccabcacacbbacccbcbbccabbaacabbaaacaaabbccaccbacacbbcaacbccabababaabaccbbbaaacccaaccccccabcacabcbabbbbbbbacbbbaccbbcabacbcacabaaacaabaacbbbcabaabbbaabcaccacbababcbcabcaaacbaacaaaccacbbbabaccccabbababbcaaaacaabcbbbcbabacaaabbcaccaabcbbbcaccbaccbabccaaaacbaaaaccacbabbbcbbcaccccabcaaaacbabacccbbaaabbcbbaacbaaaccbccbbabbabbabaaacaaaccaaccacaabcaacaaabcaacaccccabcaaaacbcacaabbabaaababccaababbabccbbccbbbcccaaaaacbccbcbaaccbbcbcbbaacbcabcbacaabcbbaaacaaccaccccbabaaacabcbacaacacabababccabbcbabccccbbccccbccbaabbacbcacbbcacbababbaacbcbcbcbbabbbcbccacaabbbcbabaccabcbacbccbbbaaabacbaababbccacaccaabcbacbaaaccccbcbbcababbacaaacaacabacbcbabccbbcbabaccbccaccaacbacaaacacaacaccbaccbcbbccabbaaabcccccabccaccbbbabbbbbbacacbabcabcababaaaaaccabacaabacbaaabaaaccccabaccbbcccbaaaccbabaacbcbcaccbaabbaccaacaabcbaccaacabcbcaacccccbaabbbccabcabaccacabcababccbaabcacabcbbaacccacbccbbaabbbccaccababbbacbcaccbbaccbcacaabbbcbcbcacbaabbcbaacaabbabbcccbcabbccaabbbcababccccaabcbcbaaaccaacbbacbbcbccbaccaaaccccccccbcbbcbaacbcbaaabbccaccaaaabcbacabcbcaabcbbbcbaaabcabcaaacbaaccaccaccbcacacccccbcabbacbcbcccccabcbcbcabbaaabcacaccbbbcababbaccabcccbcaabbacbbaabaabbabcccbccccccacacccbaaaccabcccaaaaaabbbcbaabcccccaccbccbbbcccaabbacbbababbcbcacabbcabbabacacccabcbbabbcbabbcbccbccaacbbcbbbbabcbcaacbbcacabacbbccbccbcabcabbccbaaacabcccacbccbabcbbcbaccabbcabcabccbbcbcaabccaacbaacbababcbccabcbcaccaccbbcbbcacbaaaccbabbcbabcbaccbaacbcacbbaccbcbaabbcaacbcacabbcbbbcababccbabcbbacaaccbbacbbaabbbcbccbbacbccbcaaaaccbcacbabbabbacacaacaaabcbbabbbcbabcaaaaacacabbcbccaaacabacbaaababacbcacbabacbaaccaaacbbcacbbaccaabbacbcccbccabcacbcbacbabbaaabcbabccbaaaacaaacbbcaabbcaaaababcbaccaabbcaccbacccccaaababaaabcaacabbcbbcbcaabccbbbbcbabccabccbccaccaacccbaaaabbcbbacacccbaabbabbcbbbacaaaabcbbbbacabcaabcbcaaabaacccacbcbccbbcacaacbccbcccbbcaaaccbcbbaabababbaacbaaaccabaacbacbcaacacbbacaacabacabcabccabbcbbaccbcbcbccbbaaabcaabccaacbbcabcccacbccacbbaccabccbaaaaccbbcbacabbcccbbbaaacbbaccbacbbbcbbabbbbccacccacbaabaacbbccaababbacbccbcccccbbbbcbacbabcaababcaabbbabaaaabcacacbbbcababccbcaabacaaacaaaaacbaacabcacaaccabacaabacacccccaccabcbaaaccccabbaaacbabcabbabcaccbaaacaacbbabbcabbbabcaccccbccacabaaccbccacacaacccaabacbaccccabcacaaacaabacabbaaaacaabbacccbbaaaababaaaacbabcbcacbbcbbcbaabaabcbbacacccbbccccbbcabccabaccccccaaabcabacbbabbccbacaaacabccabccacbaabbcbbccbcbaaaabaaacbbbbcccbbbcaccaabcbbbccbacbcbacabbabaabbcababcccabbbcccacbcaaabbabbabbbbaaabbcacccabccaaacbcabbcccabacbbccbabcbbabbcaacbaabaccbbbaabccbacabcccabccaccbcbbccbcbacacaaccacabcaaacbccacbcabcaccbcccbaaababacbbaababaacbaacabcaccbbaccaabaacbccaacaabaabbcabcacabbbababbacaaaabcbbbcccaccbbbaacbabbbbacabbacacbbbbaccabacacbbababaccabcbccbbcacaacacacbbcacaabcaccccacabaabacabbbacbaaacbcacbbccbaacccbcbcacbcaccccabbacbccbabacbaaabbaccabaabaabacaaaabbbabaaabcbcacbaabcbababcabacaaccacacaccaacabaacaacbcbbaccbaacbabacaaccbaacbbaabaaccaccbaabbabbbbbcbccbcbacccacaacabacbbacabbbbbcccbccaaabacccbaacbaccabbccaaaabcbaaacccbbacbaaababbbbbbcabbabacacaaabbaccbcccbaaabbccccbacacbaccbbbcbbcaaaaabaaacaaabacbbaaaaccbaabcaccbabbcbbabcbcbcbccaaaabcaaabccabbaaccacbccaacabbcaaabcacaaabaabacaabcbbbbcaccbacaabaaacacbaaccbbacccaaababbbccbcccbccbabbabaabcbccbccbbacbbbabcbbccbbbccbcbcbcacbcbbcccbbcbaccaccbbabbaaabacbcacacbbacbbcccbbbcbbaacabacbcbcabbacbccbaaabcbbacbbbbbabcbaccabbabcbbcccacccaacbabacbbbcbbacbbabaaaaacacacaaccacaacbbbbaabbacbbaccbbbcccbcabcaaacbbaabacbccaababacccacaaabaccbcabacbaaacaaacabaccbbbabbbbcccabcaaacbcabbaaabbcccaaabbbaacaacbbacbbaaccacbcabcccabcbbbccbbcacbccbbbcabaaaacbbcaccaaaaacaccabcbbabacbcbcaabaaabbccabbbcaaacaaacbbabacccabaacbbbbaccbaabccacbaccbbaabbaaacbbacacacccbacaaaabacabaabaabcbbcbabcaaabacbcbabcccacacbccbccbcbbbbbabccbaaacabbcaacbcabcaabaacabbbaabbacaabbabaacbabccccacccccaaccacabcccacaabaababcbabaccbabaaabcaaaaacaccbcbcaaccbabaacaaabbcccbcababbabbccbcacabacbbcccbcacbbcbaabcababacacbcbaacbbbabbcbacbbaccbcbaabbbbbacabaabcbacaabbbccbbbaabbcbcccaacbcccabacbaaabbccbcbbabaccbbababcbaaacabbaccabbcaabbacaacacaaababbccbabacbabaabbacbbacacaabaabcccacbccbcabaacbccabbbabbbcbbaacbabbbaabbbaccacbacaabccccbacaaacabbaaababcccbabcbbaacababccacbbcbbaabacabccaabbccaaacacacbcaaaccacacacbccbabbbbcbbcbaabababaaccacbaabbccccbbbabbccbbaaacaabacacccbcaacbcbabcbbccbabaacbacabbacabbcbacbaabccbcabbababaaabcacabbabcaaaabbbabcccccaaaccbbacaabacaaabbcbcbabbbcacbacacaabcbcaaacbaabaaabcacbbbbaabbabaacacacbbcaababaabcbccccbaabcbcaaaaacabbbcabbbcaabbcbabcbbccacabcaaabbaccacaccbcaaacbccbcbbbbbccacccacbbcbbacacaabbcbbcccabbbbbaaabbbccbaaccbcaaaabccccacccabbabcaaabcabcccbabbcccbbbacaccbccabcabbcccaacababcbcccccacbccaabcbcacbbaacbcaababbcbabaaacbabacababaabaabaccbcbbcaacabbababccabbbaabcbcbacbacbccccaaccabacbaccbbbccacacaabaaaaacabbaccaccbbaaabaacabacaacbcbbbcaaaabccbcbcccbbcaaaacacbccbacbcbacbbaaabbbaaaacbbbbabbcccaabbaaccbaaaacbacbaacabacacbbcabbaaabaaccbbccbcaacaaabcabacccbbbcaabbcaaccacbbcbccbbcacabcacacbaaacbcbbbaaababbbbabccacabaaabcabaccabbcabcaacbbbabcbcababbaaccacaccbccbccbaacacacacccccababccbcbacbacabbccaacbbaabcbcaabbcacccbbacaaaccabccacaaaacabbacababacacacababbabaabbabcbcabcccabacbcbbabcaccacaacacabbcccbacaaccbbbabaccacbcaaacacacbabccabaaacbacaaacbaabcacbcbcaaaacbbabaacbacaabbaaaabbcbacaaabbbbcccacabacbaccabbabbcaaaacbbccbcbaabbacacabbccbcbaccaaacbabbacccaacaaaacbcacaaabcaacbccbabcaabacaaababccbcacccbbbaaccccbcaaacbbabcabaaaccbcabbcbbaaacacabcbbcccbaabbbccaccbacacbabbbbabccbbbacbaacbaaccbbccccbbbabacbacbabcabcbcabcabacaccbccbbabbbbbbbabaacaacccacbcbaabaabcbcaaababbaaaccabbcacbaaabbbaccbbacbbbacaaaabaabccbbbccabaacbccabccaabbccccbbaaaabbcabacbbccbccaccabcaacbcbcabaabcaabccabbcbbababcacbaacacaaabbccbbbbacccaaaabbacbcbcbaacbcbbcbbcbcacbcbccaccbcaaacccbcccacaccabacbabccaccaaaaabcaaaacccacbcaaabbcabbccaaaabbababacabcccacaaccbacabcbbcacbcacbabbcaccaaacbbacbababaacabbbcbacbaaccabccaacbbbccccabbababbaaabbccbccacbabacbaccabcbabcabacabacbcbbcbbbaaaccaaaacbbacbbaccbbcbabcaacaaababaabcabbbbacacabbacccbcbbabcacbcbabcacbaaccbabacbcbbbcbbaabbacccccccaacaacaababbbaaabacacbaabbcacbccbbaaaccaacacbaaacabcbbabccbbbacabaacbcbaaaabaccacbacbabcaccacbbacbccbcbabcacbccccabaccaabbbbbccbaaacbacbaabaabccbcabbcaacbaabaacbcbbccbcaccccbaacbbbabccbbacacabcbbccaabacabbcbacbaabcccbbabbbaacbcccabcbaabcbaacaabbcbcbbcaabcabcbccbbbbbcacbbbcbaaabbccbbccbaaccbacabbccbccbbaabbabcbbbbabccacbcbbaaabccaabbcacbcacaaaabbbbbbaacbaaabbacacbccccbccacacbcbaaccabbbacaccacbacbabababcbbbcababbaabaacbcbacababcbabacabcabcbcbabacbbbbbbabacacbabaabcccbbaccaacbacbaabcbcaacaabcbabccbcabcbcbcbcbbccabbaaacabcaacbcacccbabbcababccbcbbbbbacbacccbaccccbacccacbccaaaabaaccaabababbbcaabcbcbccbbacbccccccbaaaacaaccacbcbabacabcabaccbaccbcabcabccccaaababcabccabcbaccabcbbbaaccbaaaaaaccacccbbbbccbbbbaababacbacabcacbabcaabbabacababcacbbcbabbaaccabbbaccabbcaacbbacbccacccbcaccbacacccbbccaaacaabaaaccbabcbcccaabacabcabbbcaccbbbbcbccbbccacbbbcaaaccaaaabbbbbabababcbbacaccabaabcbabbaabbcaabaacbcbbabcbbcccbbbacbcabccbbbbcbcababacaaccbcbabcabcbcbbcbccbacbcccbbcaaabacabbabccacababccbbbcacbaababbccbcaccbaccbbbcbbabbbcccbbcabcbbccabbcbcccabcaabcbabcacccaccbabcbbbaccbabcacababcacbcbbbcbabcacbcccabcbbcbabbabcbbbaaaabcbbbaabbbcbaaabccaccabcaacacccaccbaabaccbababbbbcbbccbaacacbcabccbcbacaccaccaccbaccbbaababaacbcbacbcabbbaccaacacbcbabcbabbaabbacbacccaabaaaacbabccbabbcacacbccbcccaabcccbabbabccacbaabbccbaabacbbcbacacaccaacabbbababccbbacccbbaccabcabacaacbbbaccabaaababbbcaaabccaacabcccaabaccbccbbcabacaaacbaabaabababcabcabaaacaccaabacbaccccbccaacabaabaaabaccacccaacbaacaacabcbaabbabaababcccccbcbacaacacbbbaaccaacbcacccccacaabbcbcacbbbabbabbbcbbbbbbcabbbabbccbbcccabcbbbccbaacbacaacbcbaabbbabaabcbbbcccbcbcbaacbabbccbabccaabaccaaabcabaacacccbcbbaccbbaaabbabaaabbaccbbababcbabbbbcbbaccabbbbbbaabaccccacccbabbbaabacccacababcababacbbbbbabcbbbbaacbbcbaaacbabbcabacaaabaaabbbbaabaaaacabccbacaaacaccacaccbaaccbcbbccbabcaccaaacccbacabbabaccabacbcaaaccacbabcbbcaabccaaaababcccabccbaaabaccbbcacccabbcbbaccbcbacabccabacbaaaaaaccbacacabacabcbbcbaccbcaacbaabccabaaabbbbbabbaabbcbbaccccbbaabbaccbbcabbbaacccaaacabcbaabbaaaacccbabababbcbbccbcacaccbcaacbccaccbbaacbabbcbababbaccacbabababbacbccabbccbaacccbaacabcbcbabbbbbacbabaaaaaaabcaccaabacbcabaabbbacabbaccacbacbbbacbaccccbaacbcbaabaabacccacacaacccccacccacbbbccabaccbbbbbcaacbcbbabcacaabcacacacbaababacaaacabbabccacbabacbbaabcaabaaaacbabababcbaababbbcaccaaabaacabbbaacbbacacbcbcaabbcbaccbbacabcacaacbbcaccbcacbcababacaabacbbcbbbcaccbabbcbaacbbcaabcaccbbabaaccccaabaacbcbcbbbbbaacbcbcbaabcaaaaacabccccbcacabbcbcabbabbcaabbbccbbbccabacabaccccbcbabbbbabaccacaabababacababbbabcacbbbaccbabacacaaacacbbabaacbabcbbbccaaccccaabaaaacbbabbaabbaccbbcbbbacccacbccbbbabcacabaaabcabbbcbaabccabbbabcbaccccbabacbcaaaaacbcabbcaabaccaaaacaaabccaccccaabaaabcabaabcacaabccabcabccbaacbccabbaaababacbcbaccaabbbaacbcacabcaaabccbcabacabbccaaaacbcbbbbbcacababcbbbbbcacbbabccccbcbabbbcaacbcbbbcabbbcabcccabcaccbabbbbbccbacabbbaacacbaccbaabcaabcccbcbbababccabbabaacccccbaacbcbabaaabbcbaacabababcccbcababcccbcccabbabccccaccaacaacabacbabbcbbcbcaaaabaccaaccabbbaababbcccaababcbacaccacbccbcbcbcbbaccacacbbcbbcbaabaaacccabcbcacbccbcbbcabaacaaaaccbabbbaaacbcacacccabcbbcaabaacccacbabacaaacbabaaabbbbbcacbacabbaccacbbccaaacaabccbaaacabcbccbbcaaccbcccaacaccbcacaacabcacacbbaaaccbbabbcbbacbacabbacabaccccccbbbcbbaacbcacabbbcbaaccaccbcabbcccabbbbbbcbbbacbcabaaabcbaaccaacbccaaaacbcbbccccabbaaabcaaaabcbbabbaaaabbcbbbaaabbcabcccccccbcacbbcaccccacbbbbcccacabcbbaccbcccccbcacbaacccccbbaabaccbaaabcbbababaaacacaababbaaaacbacbccaabbcbcabababacabcbccbaabcbccbaabbacccbcbbbabacccbcbcacacbcccbbaacbcacbabbbbccaabbcaaacbaabcabbabbcccccbccaacccaccbbaccbcbaaccbaabcccbcbaccacbaababaccbbccaccbcabaabcabbbacbabaaacbcaaaccaaaccacbbaaaccabcbccaabcacbcbcccacbccaabcbaaaaccbabbabacbbbcbacccbaaaacaaacbcbccbaacaabbaccbacbbcbcbaaacbaacbaacaaacccbcacabaccacbbaccbaaabacbbbaabcccaaaacbabccaababaacccccabccaabbababbabaabbccbabacbbbcaccabcaabbbbcbccabaacacbbbccbaacbacbbcabbccbccbcbaaabacaaaabbacbbcccccaabccbaaabbaabccaabaccabbaccabaabbabacbabaacbccbabbaabbacacccacbabbcbbcbcbcbcabccaacbabacbccabaababbcccccbacacccacbacbaacabcacaaacacbcbaccbbccaaccbccbbbcbbcbaacbbbabaabcacaababbccacbbcabcbbcacaccbaaaaabbaaaaabbcacaccbbccbcacacbaaaacbcbabacacbababcabcacaaaabacbcaaacccbbcbbbcbaacacbacaabbcabacabbbbaccaccccbcaabacacabcacbabcbaacabacacbbcacabbbbccaaaccacabcaabcbbbaacacabbaacbabcaacbabcbabacaabcacbacacccacaaabcacccbccbcbbabaaabaaaabbcbbbccabccaabacaccbcbaacbaacbacabccbbaccbccbacbbacbbcbaabcacbcccacabcbbacabbbcacbbbbaabbbccbcbbcbabacccabaabccbcacacaaaccccaabbbcbcbbbacabcacbcbcbbbcbbbbccbacbababacabcabcabbcabcccbbbcaabccaccbcbbacbcbaccaabacacaccbacabbacbaaaabcccabbaabcbccacbcbbaacaaaacbcbbcbbcccbcbcbbcbccccccbacaccaabccaabbccabaaacbbbabbbbacacabaaacbbaccbcaaaaaccbaccbbabcbabbcaaccaccbcccbbaccacbccacbbaabcccccbbcbaaccbbabcbcabccacbbcbccccccccccaabcacbcaabbacbabccccbccbbbbabbbcbccaccaabcabacbbcbaabaaaaaccabaacbccccabccabbbaccccbbcccabacaaccacbccbaaaacaacbccaacacbbaccccacbbccaacabccacbacababbacaccabcbbbaabacaaaaccbcbacbaccbcbbacabaccbcbbbbccacccabcaabccbcbbabbcbabbbcabbccccabaccbacabcbbbbcaaacaabaacabbabccccbaabccbcacacabbbcbccaaccbcbbacacaccbbccbccaacaaacabcabbbaaccbaabaabcacbabccbbaaccbbacbcaacabcabcbbacaaabacbaacbabcacacaaccaabbbbcbcababbbbabbababcbabbbbcacbbbbccaacaacbaaaacbcabbbaabaabcabacccabbcccbcbcbcacbcccabbccccabaaabababccbcbabacaacaccbabcbaaacabbaabacabbbacbbcbbccbabcaaacccbacccabcbbccccbcaacabababacbbcbacbbbaaabacbbbbbcabaabcaacabacbcbcbccaaacbabcbbabbbbccbabacbaaccaaacbaccbbaaaacababcabcbaccbbcabaabcbbbabacccccababcacaacacabbbbcacbacbaabbabcaabaaaaabcbacaaacbcbbbccbcccaacbcabccaccbbbccaaaccacbacabcbcbcbaabccbaccabcbabbbccaacccaaaababccccbaaabacccbcbacbaccbbbabbbacabaacbcaacbaaacbaacabbcbacabcbabbabbcbaaacabcccabcbcababcbaacabccaabacababbabbcbbaabacabbcbbbaccbbbcbcaccacabcccbacaaaaaaacaccbaababaabcaccabbaacbabcbbccbbabaabcbcbaacaccabaccaacbacabbababcbbbcacaacacbcbabcbbbabbbccacbaaabcabaccabbabcaccbcccbabacbbbcccbbbcbcaacbbacaacacacbccccbccaaccbbbccacbccbccaababcaaaaabbccbbccbaababccababbacabbaaaaacbbabbcaacaacbbbcccbbbcabcabbcbbabcbcbcacabaaaaacaaccbcccacbbaccaabacbbbbabacbcaabbbaaaaccaacacccbbcaacbbacacabbaaabacbaccaabbbaacccaacbabbbbaaabccbaaabbaabccaabcababaabacbaaccbbccccccbbacacbaabbcaabcbbbacaaccbaaababcbcbbbabbbbbacaabbaacbcaabbaccbacbbcacbcccaaabaaaabccbbcacaabbabbcabbaccbbabbcaccccbcbcaccacccbcbbcaacbcaacbbbcaacccbbacababaacbaabacaababbcbcbaabccabcbcabbcbbcbaaaaabaaaccbaaabacccaabcabbaacccbcbcbbbaccbcccccbbcbcacaabbcaccaaabcccacbbbbabaccbacccabcacacbaccacbbbbbaaaacacbacbbcbabaaaaccbcbccbbabcaacbaacaaacaabbacacbcaccbccaaccaacacbabacbbbabbcaacbcbbbaaaacccacbaacaaacbcaccaaccbcacbbabacccbccacaaacbbcbcbaabaabbacbbcacbbaabcabcaccbaccbcbbbccccbbbbcaaaabbcbcababcbbacbabcacbcabcaaacbbbcaaabbcaccacbcaacbacccabcbcbcbcaccbcacaabcacacaabaabccbbcabbcccccbcbaccabbbcacbcbbaaabaabbaacbbababaabaaccccacabcbbcababbccabaaaabcccbcaccccaaabbacacbccbaaaccccccbaaacabcccaaaaaabccccccacacabcaabaccaacbcbaabccbacacabaaaabbcbabcbaaacaaabacaacabbaacbbbabababbbcabcbacbabacaccbbbbaaabccbcccbccbbcacabcbacbbcbbaabacbaaaacaaabbacbacbccaacabcbbbaaabaaccbcacccaaacccacbaabcbcacacbacabaacbccbbabcbccaccacaccbcbbaccbacbcccaabcbcabaacbababbcabbacabcaabaabcaaabaccccbcacacccbaaaacccacaabcabbacbbcaaabcaccbabacccaccbaaaaabbbcbaccbaaaabcacacaaaaabbbcbbcacbacacabcabcbbabbacaaacbbcbacbababaababcbbccbacbbbcaccbabaccbcaabbaacbabaccbcababbbccaabaabbbbacaaaccbcbbaabbaabcabacbcbbbbbacacaaacaabcaabacaaaccbaabcacacccccabbbcaaaccaaccbabbacccbbbbcbaacccabcbbbcccabcacaccbbcccacbabcbbaacacaccaabcacbbbaaaabccbbcbacacacbbbbaacacaacbbaaabcbbacacbbbbcaaaaaabbcaacbcbbaabccacbbcbaaaabacacccbcaabaccbacbcabaabacabcacbaabcccccabbcaabbcaacababacbbbcacbcbbcbaccacabaaacabcbbaabbabcacbabcbbacbacabacbcbbcbacbcaaaccabccccbcbcbcccaaccabcabcaccabbbbbaaaacbbcccabccaabaccaccccabccbcaaccacbabbbbcccabbacbbbaababbcbccbccaabbaaabababcaccbcbbcccacacacacccbbaacbababccababbaacbcacbcccccacabaaccaccabcabcaccbaabccaaccabbbabbacccbaaacbbabcbacbacbbacaabccccaacaccbcabcbbcbcbacaaccaacaccacbbcbccccccaacbabbbcccabaabacaaacbbacbaababbbccbcccccbccacbcabbacaacabcabbcccabaccababbaabaacaaacbccbbbccbcaaaaacbaccbaccbcccabaccabbbbacccbbcacbaaaabcaabbbcaaabccabcbabbaaaacbabcbcbcabacbccaabbbcaaacbcacaaabcabbcabccbccaacbccbcbcacaaabaccbcbbbcbcccabbbcbabcaabacacabacccbabbaccbbbabcbababcbbbcbaacaabbaccbaaacacacbaaaaabbcacaacaccaacaabacbabaaabbacbcbacccccbbcbcabaccbcababbcccbcaabbacaaaabcaababcbbcaccbbabcaccbbabcabababbacbcbbcbcacacaaaaacbacbabaababccbbaccccabaaaabcabacbbbaaaabbbccabcabcbccbcaccacbcccbbcbcabccbcbcacacaacbbbccbcbbccacbcbabbbccbcaccbccbaccbcbccbbbacccacbacaacbcababcbaaacccabcbcacbacabaccaaccbabcbbcacbacaccbbababbccbaaccccbcaabbabbccbccaaababacaccccbcbcaababaaabbbbbbbaaccccbaacabacbacaabcbacccbbacacbcbacbcbacaabbbabcbcaccaacabaccabaacaaacccccbcaaabacaccacacccbbabbccccbacbccacaabbcbaaacccbccbabbbbbabbaaaaacbcbbccccccbbbccccbbbcaaabacbbabaabcbcbcbaabbbbcbcbabcabcaaccbabbbabbcbccbacbaaccaacbcccbbcbabbbbbcbacbccabbabacbaaccabbbcbcbbbcccbccbcbcbbbbccacaabbbaaabbaabaabbaabacbbbcabbbbbcacbbccabaaaabbcbacbccccacabcbaccabababaacbbccaacbbcccaccbaaaccccbcbacbbbcbabbcbccbccccbacaaccabbbacccabcbcaccbcbcccbaabcaabbaaacaaabbccbccabbcbaaaabacbcaccabbcbacabaaccacbbaacababaabcacccabbcccababacbbcabcacaababbcbabaacbbbbbbacccbbcbabaccbcbcabcbabaacbbccbcbabaaaabcccbcacbaccbbbbccabaacacabbbcacabaaacabccacabbacaababcbabbbbaabbaccbaaaacaaacacababbbbacbbbbacbcacbabaaaacbacbcbccabccbaccacbabcbbccccbaaccaccbcabbcacaaaacbbbbcabcbccbbcbabaacbbbcabcbabcbbccbcbaabacbbacaabacbbcbbbaccaacbcabccbbaaabbaaaccabbbbabcccbcaaaaabcaaabcbcbcacbbaccabccbbcbabcbbbbaacbbcccbaaabcbccabacaacccacccbacbbaccbacabbcacabbcaabccaacbabaaaaccbabaaaacababbccbaabaabccccbbbcacabaaccacbbccbaccabbacccaaabcabcccbcacbbabbcacacaaaccbaacbccacbabaabaccabbabbabaaacbacccabbcaccababbcbccbbaaaacccbbbcabcacabacbccccacbcbbcbbaaaccbacaacabcbaaaccacabcabcabbbbccacaccabbbccbaccabbacbbacccccbcbbaaababccabaaaacccaabbccacbcbcccbacaaabcaccbaaaaacbaccabcbbcbbcacbbaabbccacbbccccacbcbbabaaacbccaaababcacbbacbccbabacbbacbccaccccbcaabacbcbccaaacbbbbbbaabcbacbaaccbbbaabbccaaabbccbbbbabcacabaacccaacbbbaaccabccbcbcbabbbacabcbabacaabbaacabaaaccbabbabbcabaacaccbabbbbbbbcbcbaaabccacacbacaabbbcababbccbccbcbacaaacbaaaccaccbbbbbaacaaabccaccccbababccbaaaacabbacacaaabbbcbacaabccababaacbbbbbbbabacacabcabcbbcbbcbcabcaacbbcacaaaaabcbacabcbabbaaccbacabbaaaaccbbaabbaacbbcbbcbccbcbabaaaaccabbccabcccaaccbcccbcaccccacbbcbcbaaabbbabbcbccbaccaacbabcaccbaccacccbbcbbaaabaacaaababcabbbcabaabbbabbcbaccaacbaabbccabcbccbbbccccaaaaaabaaccabbcacbcbabcacaabcbcacabbcbacbbbaaaaccbcabbcccbabcbaaaacbccaababccccacaaabbbcbabaaababaababacabaabaacbcaaabcbbcbcabbcbbbababacbcbabaaccaccaabccaaaabbcaaabbaaaccaacacaacaabbbaccbbcbcabbbbbcacacaabbbbcaccabcbabccacabbaabbcabacbacacbcacabacababbaaaaabbcabbabcaccaaacaacbbbcababbbbcbbabbcabababacaaacaaabaccaccabacccabbbababaabbcaaabcbcbbcbbbbaccabccbabacababccaaaabbbbbaabbcaaacacccbbaaabcaaabcacbbcbbccbbccbbcbbaababbcabccbacbbcbcacbcbabcbbacacbbacccbaccccbcbbcaacbcbaacbcaabccbccaaccabbcbaaccbbccaacbcccabcabcbbacccccaaaaaabbabbbbabcacabcbcabbbcabbbaaabccabbaacbbacbabcaacccacabccaabaccaabbabcbccbcaaabcaccaccababcbcacbacbaccbcaacababaaaaacccaabcbccbbacaccbcbabbaaaccbbbbbcbcaccaaaacaccbcaaccabcbacccbbcbabbbbcbcabcaabcccabcaccabacacbbbabaaccabbbbabbccbbbacacaabbcacacccbbcaaacbcccabbacabccaabbabbbabaaabccaabaacacbbcbbbacaabacabbbccccacbcbbacaacaacbbaaacbbbbbaaaaaaababbabccbaccbbacbbcabaacaabcaaaacabaccbbbaacabbbbcbacbbbaabbbacabbbbccbacbaaacbcacccacbbaacbbbbabbcbbccbcbccabbbbcbbabbaaabacaccacacaabaaaaabaccbbaccbaabbbacacbcbcbbbcbcbccbccaaacaaccbacaababbccaaabaabaabbaacbacabbcacbacaabaababbbbcabbabbcaaaccbacaaccbabcbabaacccbbacacccaaabcacaaccbaccbbabbbacaaababaababacccabbbcbaccabacaccbaccbbbbabbcabccacbbcacabaaacbccacabccacbbcbaababababaabcbbbcaaacababbcaaaccbcbacbababcacaabaacacabbaacaabaaccaabbbbcaacaccaaaccabbabbbaacaccbbaacacccbbacaacaaaccabacbcbcacbacbcabcabacbacccbabbbcbccabaaaabaccababbbbbbcacbcbabcabcacacbaacaccaacabaabaabbabbabbccaccaccaaababccaccacbabbaabbcaaaaabccaabbbbaccbcabbacaababccbcacaacbabccacbcabaccacbaaabaccabbabaabccaaaccbbabbccbacabcacabbcaaaabcbccabaaccbbbbbbcbbcbbccaaccbaabcaaccbbccaccbcbcaccaacbcbccabbccaabcbbabacabaabbcbbacacbbbcacabcacbcbbabbabcaacccaacbbaabccbbaabbaacccccbabacccabbcabbccaccaacbcaaabbabbcabbbbbabaaaccaccaaacabcccaccbcabcbabcbccbabcacccbacbaacbcabcbaaabacabcbcababbcbbcccbbbbaccaccabbaabbcbabcbcbaabccbcbabcaabcacbcabcaccaccaccbbbacaccacabccbbcbabcbacbaacacbbbccccabbcbcbabcabaaabbacbacbaabccacacaccccbaaaabccabaaaaacbaabcababccbbbcbbcaaccccacaaaacbacbcbcbabccbbcbbcbabbbaccbabcaabbacccccbaaccabbccbcbbbccbacbccaaacbaababacbbbbcacbcaabacacacbaacbcbbcbcbcaabbbcbbbacbbccbcabaaaaaabbcaabcbcbaccabbbbcabbacbabbbabbcacbbbbbcaccbcbaccbabbcbabcabbccacbbbabcababcbcbacbbacacbccababaabbbaacbacaaccaccbccbabbcbbcaacabcbcbaccccbcbcbcbacaabacbbabcbbacbbcaacbacbcabcaaacaaaccbacaabcabcccaacbaacaabbaabacacbacbababccbabbbcbabcbbabbaabccccbcbbbbbaccbccaaabcbbbbbacabccabbacabaccbbababaabbacaabcbacaacacccabbbabaabcacaccacabbaaacccaacbbcbaaaaacaccabacbcabcabcaabacbaacacbbbccabbacbcbcbabbbcbcccbbcbacacacbcccbcbcbbacacaabbbccacbbacabccbabaccaabcabbcccacacbcbbcacbaabaabaabbcacccaacabccaacabbaaabbccaccabccbaaacacbaaccbacacabbbcbbcaaabcaacccbaccbcbbaabacabcaaabbcbbcbacbccabbabcbbcbccbcbabcaababacbabbaaaaaabbbababbbcbccabcabbabacbbcbbabccaabccacbcaaacbbcababbbccabbabbaaaacbcaababcccbaaccabcbcbbabacbbabccaacccbbaaabcabbcabcacabccabcccaccccccbaacaabcbbcabaabbaccaacaabbbacbcbbbabbacabbcccccacaabcabaabaabbbabcbbabbaaccccacabababccbbbaacacbcacbabccbbabaccbacbcacaabbacaccccbaacabaaacccacbacaaccacbaabccbcaaabaabbcbbaabbcbccbcbccbcbaccabaacaacabacacaccbbabbacbbbcccacacbcabbaacbbbbbcbacababbcacccabacaaaacbcbbcbaabbcbcccbcbccbcbaccbbaabbcacacabaaaaaccabcacbaabaaaacacabcccccabbbcacbabbbbcaabaabbabcabccbcccbabbabacabaaacaacccbbaacbbaaabacaccbcaacbbcaaabcbcbaacabccabcbababbbacacaaaacabbbccbcbaabababbabbbbaabacbccaabbccccccbcbbccaccacbbbaabbcacbccabacbccccaccaabbacabbccccbabaaccccbbabcccbcacaabbacabbbbbbacbabccccccaacbbcbaacbaccbacaccabbabbbcabacabacbbcbabbaabccaaaccccbabbbcbcccaaabacccbccbccacbbbbabbbccabaccaabbabcacababccacabacabbbbbbbbcbbccbcbabbacbbbcbcbbbaacabaacbbcacaaabccbcccbcbcacbbbccacbabccbccacabbaccbaaabbcccbbabcccccbbccacbccccbaaaaababcabacaabacbabccbcbabcaacbababaacbacacbaabcbacabaccababbbbbaccbcaccbacaacaacbbaacccbacabcaacabbaaaaacccabbcaacabcccbcacbbcbabacacacaccaccbcaabcbcbbbbcbccaaacbccbaacaaaaccacbaaaaacaccccccaacbccbcccbccaaabbbbaacbbbaaabaacbccabbbcaccacbbcabcbcaccacccbaacababbaaaabacbccacbcababbbbaacaacaccaccbbaabcbbaaccccbbbcbababacacacbbacbaaaabacacccbcabcaaaabcbbcbaacccbbbbabcaaccbccccaccbcacccbacccbacaabbacbbaaacabaccabcabbcabccacabaaabbbacbbbbccbabbcaaabccaaacbccababacccaaaaccaccaccaccbacbbacabbcabaccbbaacabcbcaaaacbabacabaabccaacbabbabccacabaaccbbcacbabaaccaabbbabccccabbbababbcacabcccabacabacbccacabcbbccaccabaabacbcccaaccabcbabbcacbcbbccacabbaaacbccbcacccbaccaabbaabbabaaaaccacbbccababcaabcbcbbbbcabbccbbcbcbbaaaccccacbbabbaccaacbacbccacccabcbabaaabcbaabccbcbcbaabcbbababbcabcacbbbcabcbcaacbaccbcabaabbccabaaacacabaccacbbcbcbcccbabcacabbbaccbbcacbcbccbbacaacbabbcacbbabacccbbccbabaccbbcccacccaccccabbcbbcacabacbcaacacaccaacacaacacaababcbbbcbacaabcbccaacabcacbcacbbbaaacacbcbccabcaccaaabbcaaabcabccbbacaaabbbabcbabcccccccccbbbaabaccbcabaacabaababcccbcbababcaaacccbcbcccbabacbccbbaaacaaaacabaabaacbbabbbaaccbaaacbccabacbbcccbbcbabaabcacaccacbcbabacbcbcbcaabbacaacaacbbabccbaacacbabaabcbbccaccbbbcaacbbcaccbbcbaaabbcbcbacbbaacabcbaccbccbaacabbbcacbcccaccbbaaccccbbcabcaabccbbbabaacbcabcbbbbcbaacbccbacbcaaabbcaaaaaabbaababaabaaacbcbbbaaababaacbacbabbcbbcbabcaccaacababbbbcaaaabbbaabbabacaaaaacccbaccaabbbabbbcbabaaabcaacbcbbcbbbbbabbccabbabccccbacbbabaaccbbaabbabbcacaaacaccabbaaacabccaacacacbbcacbaabbacaccbbabbccbacbcccabacccbaabbabcbbccacabbcbaabbbabbcaaaabbccbbcccaababbccaabbbabcbabbcbcaabbaacbbcabbaabbcaabcaaccabacaacbaabbbbbacabcaaabbcbcbbbaaccbaacccaccbbaabaabbbbabcbcabbaccbaacccabbbabbcaaaabcbbcaabbcccbcabbbcbbccccbabbcbccacbabbcaabcabccaccccbabbcabacbababbcbbcbbbcccbcaabcbbcabaccbabcbacabcbbabcaacccaaabcabacbccaaabcabaccccbaaabbbccbbabbabccbabccbabbccccbbccacbcabbcabaccaaaabccbbcaaaccacbabbccabbbcacaacaabaabcbbaacacabbabbcbaacaaccaabbccccaccaaacbaaacaccabcbbacbcacaaaacaaaccaacbaaccbbacbaabccbbcbacbccaabbabbacacbcbaacbbcabbbabcccccbcacaabbaabaacbbbbbcccbcacbbabcaabcabbacabbbcacababcbabbbbcbaaccabacaabbaaabcbcccaabaacbbacacbacbacacccbcbacaaccbaababbacaacacbbacbcaaabacbbbcbbcccbacaabaabbabaabbcabbbbcbbcccbabcbaccbaabbcbccaabababbcacaaaccbbbaacaaababbbacbaaaaaabbacbaacbcbacaccacbcccaacbbabacbcabbcabacabbccbbccbaaababbaccbbbbabbacabbacbccaccaabbbabbcbbaccaaabbbcbaabcbbbbcbbbabbbbbabcacacaacabcaaaaaabbaccaaccbcacccaacaabcbaababcbcbbbaabbcbbaaccccaaaccabcabcbbacbaaaacabacbabcccbcaccbbabbabcbbabbccbbcbcababaccbcbbaccaaaabbbbcaaaccabbbcabacaccbaabcabbcaacabbbaaababbcccabacaabbcaaaababacbccbccbcaccbaacbcbbabbaaacbacbbbbbacaaacccbcaaaabbccacbcbabbababcccacacaabacacbbcccaacabcccacccababaabccbcaabcccbacbacbababacaabacaabababbababaabcaacaacacaccaacaaccbbaabccabaaacccacacbbbcabbbcaaaaccbaacaaccbaabbabaccbbcbabbabbcccbcaccaccabbacbbbabcccabcbbbbabaabcbcccbacbacbaabbcbcbabbbccaabbcacacbcbbbaaccaabcbccbbaccabaacacbcacbbababbabcaacbbbbccbabbbbacababbabacaabacabbcaaaccbbbbcaaabcacabacaaacbccccabccbababcbaaccaacbbbccaacabbbbbcacbcaaabbaababacacccbccccbcabccbccbacccacababbccbacbcbcababaaccabbaccacccababccccaccbbcaaaaccaccabcaabbcbcaabbbaacbabaabaaabbacabaccbbccbcabcaacaaacacccbcbccacabbcbaacbccbaaccacacacababacbbbbacbbcccacbcbbcbbcbaacbcabcbaacaacccacabaccbbabacbaaaabbbcccbbabbabaccccabacaababccccaccbabcabccbbaccbaabcacaabacccbcacaacabacbbcccaccacacacabbbbbccbaaabbcbaccbaaaabbcabcbaacbbcccabbabbbbaccacbabcacacbaabcaacbccacacbcccbcbacaabacaacbacccaabaabbabcaaccacababaabacaabaacbccabcaaacbbbacccacaaaaaaaabcccaabcaaccbabacbbaabbcabbbbbcbcabbbbbccacacbabbaabbcbacabbacbaaabcaaccbbbbabacbcaaababacbacbacbccccacbcbccbccabacbaacaabcbacccacbcaccbcaaccbbbabbbbaaccbbabbabcbbccbcbbcbaccbbababbaabbbbbcaaaabaccababccacaccaabbbcbccacbcabcbbcccccacbabcbcbccaabababbcbbabbababcccabacbcccbcaaabacbacbacaaaaacbbabacaacbcabaaaccabcabacccabcbabacaaccbcccaaabbaccbcbbaccccbcccbaaacccbccaccccabccbababcbccccbbcbaacccaabbcbbbbcabaabcbaabcbbaaccacabcbbccccbabcccbacababbacccccaaabbabcbcbabcbbabbbbaaccaccaaacacaababbbcbabcbcbaacbaacbbcccbabbbbaccbacbcabbbbcbcbaaacaacccbbcbbbaababacccccbbccbaaaabbbacbcacabcbbababcbbbaaaaccccababcabbaacbaaccabcbaababcbbcacaabcaaaccbccabcababacccabaccbbacaabbabccccaaaabbbbabcabaabbbbccabcacccccaaacbbbacbcacaccccacbcaabbbcababcaacaaccaacbbacaaccccbababbbbbbcccbccbbacaabcacbccbbabbaababcbbacaccbabacbbbcbbabcabbaabcabcacaacccbcbaabbaccabaccccabacbaccaaababbabaaaabbbaaacbcacbbcacabaabccaacacacabacbbbbbcabbbbbccbbcabcbbcacbcbcccaabccbcaaabaccaabacccccbb")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1360Test.java b/src/test/java/com/fishercoder/secondthousand/_1360Test.java index 5199fd5b39..9f4854c784 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1360Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1360Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1360; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1360Test { private _1360.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(15, solution1.daysBetweenDates("2020-01-15", "2019-12-31")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1361Test.java b/src/test/java/com/fishercoder/secondthousand/_1361Test.java index 3156c3f019..d065fda7e6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1361Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1361Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1361; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1361Test { private _1361.Solution1 solution1; @@ -16,22 +16,31 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.validateBinaryTreeNodes(4, new int[]{1, -1, 3, -1}, new int[]{2, -1, -1, -1})); + assertEquals( + true, + solution1.validateBinaryTreeNodes( + 4, new int[] {1, -1, 3, -1}, new int[] {2, -1, -1, -1})); } @Test public void test2() { - assertEquals(false, solution1.validateBinaryTreeNodes(4, new int[]{1, -1, 3, -1}, new int[]{2, 3, -1, -1})); + assertEquals( + false, + solution1.validateBinaryTreeNodes( + 4, new int[] {1, -1, 3, -1}, new int[] {2, 3, -1, -1})); } @Test public void test3() { - assertEquals(false, solution1.validateBinaryTreeNodes(2, new int[]{1, 0}, new int[]{-1, -1})); + assertEquals( + false, solution1.validateBinaryTreeNodes(2, new int[] {1, 0}, new int[] {-1, -1})); } @Test public void test4() { - assertEquals(false, solution1.validateBinaryTreeNodes(6, new int[]{1, -1, -1, 4, -1, -1}, new int[]{2, -1, -1, 5, -1, -1})); + assertEquals( + false, + solution1.validateBinaryTreeNodes( + 6, new int[] {1, -1, -1, 4, -1, -1}, new int[] {2, -1, -1, 5, -1, -1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1362Test.java b/src/test/java/com/fishercoder/secondthousand/_1362Test.java index c249fdffd4..176f2cb8c5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1362Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1362Test.java @@ -5,8 +5,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1362Test { private _1362.Solution1 solution1; @@ -29,5 +27,4 @@ public void test2() { public void test3() { CommonUtils.printArray(solution1.closestDivisors(999)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1365Test.java b/src/test/java/com/fishercoder/secondthousand/_1365Test.java index f4a0ab2ba9..0c6a009eae 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1365Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1365Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1365; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1365Test { private _1365.Solution1 solution1; private static int[] nums; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{8, 1, 2, 2, 3}; - assertArrayEquals(new int[]{4, 0, 1, 1, 3}, solution1.smallerNumbersThanCurrent(nums)); + nums = new int[] {8, 1, 2, 2, 3}; + assertArrayEquals(new int[] {4, 0, 1, 1, 3}, solution1.smallerNumbersThanCurrent(nums)); } @Test public void test2() { - nums = new int[]{6, 5, 4, 8}; - assertArrayEquals(new int[]{2, 1, 0, 3}, solution1.smallerNumbersThanCurrent(nums)); + nums = new int[] {6, 5, 4, 8}; + assertArrayEquals(new int[] {2, 1, 0, 3}, solution1.smallerNumbersThanCurrent(nums)); } @Test public void test3() { - nums = new int[]{7, 7, 7, 7}; - assertArrayEquals(new int[]{0, 0, 0, 0}, solution1.smallerNumbersThanCurrent(nums)); + nums = new int[] {7, 7, 7, 7}; + assertArrayEquals(new int[] {0, 0, 0, 0}, solution1.smallerNumbersThanCurrent(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1366Test.java b/src/test/java/com/fishercoder/secondthousand/_1366Test.java index b1972b4ce6..2d3ad6d720 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1366Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1366Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1366; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1366Test { private _1366.Solution1 solution1; private static String[] votes; @@ -12,36 +12,35 @@ public class _1366Test { @Test public void test1() { solution1 = new _1366.Solution1(); - votes = new String[]{"ABC", "ACB", "ABC", "ACB", "ACB"}; + votes = new String[] {"ABC", "ACB", "ABC", "ACB", "ACB"}; assertEquals("ACB", solution1.rankTeams(votes)); } @Test public void test2() { solution1 = new _1366.Solution1(); - votes = new String[]{"WXYZ", "XYZW"}; + votes = new String[] {"WXYZ", "XYZW"}; assertEquals("XWYZ", solution1.rankTeams(votes)); } @Test public void test3() { solution1 = new _1366.Solution1(); - votes = new String[]{"ZMNAGUEDSJYLBOPHRQICWFXTVK"}; + votes = new String[] {"ZMNAGUEDSJYLBOPHRQICWFXTVK"}; assertEquals("ZMNAGUEDSJYLBOPHRQICWFXTVK", solution1.rankTeams(votes)); } @Test public void test4() { solution1 = new _1366.Solution1(); - votes = new String[]{"BCA", "CAB", "CBA", "ABC", "ACB", "BAC"}; + votes = new String[] {"BCA", "CAB", "CBA", "ABC", "ACB", "BAC"}; assertEquals("ABC", solution1.rankTeams(votes)); } @Test public void test5() { solution1 = new _1366.Solution1(); - votes = new String[]{"M", "M", "M", "M"}; + votes = new String[] {"M", "M", "M", "M"}; assertEquals("M", solution1.rankTeams(votes)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1367Test.java b/src/test/java/com/fishercoder/secondthousand/_1367Test.java index 8129695953..c434020f6b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1367Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1367Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1367; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1367Test { private _1367.Solution1 solution1; @@ -17,25 +16,36 @@ public class _1367Test { @Test public void test1() { solution1 = new _1367.Solution1(); - ListNode head = LinkedListUtils.contructLinkedList(new int[]{4, 2, 8}); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, 3)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {4, 2, 8}); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, + 3)); assertEquals(true, solution1.isSubPath(head, root)); } @Test public void test2() { solution1 = new _1367.Solution1(); - ListNode head = LinkedListUtils.contructLinkedList(new int[]{1, 4, 2, 6}); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, 3)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {1, 4, 2, 6}); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, + 3)); assertEquals(true, solution1.isSubPath(head, root)); } @Test public void test3() { solution1 = new _1367.Solution1(); - ListNode head = LinkedListUtils.contructLinkedList(new int[]{1, 4, 2, 6, 8}); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, 3)); + ListNode head = LinkedListUtils.contructLinkedList(new int[] {1, 4, 2, 6, 8}); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 4, 4, null, 2, 2, null, 1, null, 6, 8, null, null, null, null, 1, + 3)); assertEquals(false, solution1.isSubPath(head, root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1370Test.java b/src/test/java/com/fishercoder/secondthousand/_1370Test.java index b3b6ae7d91..0f66fc1be4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1370Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1370Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1370; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1370Test { private _1370.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals("ops", solution1.sortString("spo")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1371Test.java b/src/test/java/com/fishercoder/secondthousand/_1371Test.java index c1ccf29055..8dbba215a4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1371Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1371Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1371; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1371Test { private _1371.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(1, solution1.findTheLongestSubstring("id")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1372Test.java b/src/test/java/com/fishercoder/secondthousand/_1372Test.java index 29439eb534..227d57fad0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1372Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1372Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1372; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1372Test { private _1372.Solution1 solution1; @@ -16,7 +15,11 @@ public class _1372Test { @Test public void test1() { solution1 = new _1372.Solution1(); - root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 1, 1, 1, null, null, 1, 1, null, 1, null, null, null, 1, null, 1)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, null, 1, 1, 1, null, null, 1, 1, null, 1, null, null, null, 1, + null, 1)); TreeUtils.printBinaryTree(root); assertEquals(3, solution1.longestZigZag(root)); } @@ -24,7 +27,9 @@ public void test1() { @Test public void test2() { solution1 = new _1372.Solution1(); - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 1, 1, null, 1, null, null, 1, 1, null, 1)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(1, 1, 1, null, 1, null, null, 1, 1, null, 1)); TreeUtils.printBinaryTree(root); assertEquals(4, solution1.longestZigZag(root)); } @@ -36,5 +41,4 @@ public void test3() { TreeUtils.printBinaryTree(root); assertEquals(0, solution1.longestZigZag(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1373Test.java b/src/test/java/com/fishercoder/secondthousand/_1373Test.java index e13a06d5cb..2a0a770a9c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1373Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1373Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1373; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1373Test { private _1373.Solution1 solution1; @@ -48,7 +47,10 @@ public void test4() { @Test public void test5() { solution1 = new _1373.Solution1(); - root = TreeUtils.constructBinaryTree(Arrays.asList(1, 4, 3, 2, 4, 2, 5, null, null, null, null, null, null, 4, 6)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 1, 4, 3, 2, 4, 2, 5, null, null, null, null, null, null, 4, 6)); TreeUtils.printBinaryTree(root); assertEquals(20, solution1.maxSumBST(root)); } @@ -56,9 +58,11 @@ public void test5() { @Test public void test6() { solution1 = new _1373.Solution1(); - root = TreeUtils.constructBinaryTree(Arrays.asList(4, 8, null, 6, 1, 9, null, -5, 4, null, null, null, -3, null, 10)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 4, 8, null, 6, 1, 9, null, -5, 4, null, null, null, -3, null, 10)); TreeUtils.printBinaryTree(root); assertEquals(14, solution1.maxSumBST(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1374Test.java b/src/test/java/com/fishercoder/secondthousand/_1374Test.java index 8d1c848b03..bdc0454d51 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1374Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1374Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1374; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1374Test { private _1374.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(7, solution1.generateTheString(7).length()); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1375Test.java b/src/test/java/com/fishercoder/secondthousand/_1375Test.java index 6a0711d7f5..749d41b93d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1375Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1375Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1375; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1375Test { private _1375.Solution1 solution1; private static int[] light; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - light = new int[]{2, 1, 3, 5, 4}; + light = new int[] {2, 1, 3, 5, 4}; assertEquals(3, solution1.numTimesAllBlue(light)); } @Test public void test2() { - light = new int[]{3, 2, 4, 1, 5}; + light = new int[] {3, 2, 4, 1, 5}; assertEquals(2, solution1.numTimesAllBlue(light)); } @Test public void test3() { - light = new int[]{1, 2, 3, 4, 5, 6}; + light = new int[] {1, 2, 3, 4, 5, 6}; assertEquals(6, solution1.numTimesAllBlue(light)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1376Test.java b/src/test/java/com/fishercoder/secondthousand/_1376Test.java index 4ff35a69b2..df64e6c252 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1376Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1376Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1376; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1376Test { private _1376.Solution1 solution1; private static int[] manager; @@ -13,49 +13,48 @@ public class _1376Test { @Test public void test1() { solution1 = new _1376.Solution1(); - manager = new int[]{-1}; - informTime = new int[]{0}; + manager = new int[] {-1}; + informTime = new int[] {0}; assertEquals(0, solution1.numOfMinutes(1, 0, manager, informTime)); } @Test public void test2() { solution1 = new _1376.Solution1(); - manager = new int[]{2, 2, -1, 2, 2, 2}; - informTime = new int[]{0, 0, 1, 0, 0, 0}; + manager = new int[] {2, 2, -1, 2, 2, 2}; + informTime = new int[] {0, 0, 1, 0, 0, 0}; assertEquals(1, solution1.numOfMinutes(6, 2, manager, informTime)); } @Test public void test3() { solution1 = new _1376.Solution1(); - manager = new int[]{1, 2, 3, 4, 5, 6, -1}; - informTime = new int[]{0, 6, 5, 4, 3, 2, 1}; + manager = new int[] {1, 2, 3, 4, 5, 6, -1}; + informTime = new int[] {0, 6, 5, 4, 3, 2, 1}; assertEquals(21, solution1.numOfMinutes(7, 6, manager, informTime)); } @Test public void test4() { solution1 = new _1376.Solution1(); - manager = new int[]{-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6}; - informTime = new int[]{1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; + manager = new int[] {-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6}; + informTime = new int[] {1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; assertEquals(3, solution1.numOfMinutes(15, 0, manager, informTime)); } @Test public void test5() { solution1 = new _1376.Solution1(); - manager = new int[]{3, 3, -1, 2}; - informTime = new int[]{0, 0, 162, 914}; + manager = new int[] {3, 3, -1, 2}; + informTime = new int[] {0, 0, 162, 914}; assertEquals(1076, solution1.numOfMinutes(4, 2, manager, informTime)); } @Test public void test6() { solution1 = new _1376.Solution1(); - manager = new int[]{5, 9, 6, 10, -1, 8, 9, 1, 9, 3, 4}; - informTime = new int[]{0, 213, 0, 253, 686, 170, 975, 0, 261, 309, 337}; + manager = new int[] {5, 9, 6, 10, -1, 8, 9, 1, 9, 3, 4}; + informTime = new int[] {0, 213, 0, 253, 686, 170, 975, 0, 261, 309, 337}; assertEquals(2560, solution1.numOfMinutes(11, 4, manager, informTime)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1377Test.java b/src/test/java/com/fishercoder/secondthousand/_1377Test.java index bb96e6702b..64ed5506cc 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1377Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1377Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1377; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1377Test { private _1377.Solution1 solution1; private static int[][] edges; @@ -17,64 +17,68 @@ public void setup() { @Test public void test1() { - edges = new int[][]{ - {1, 2}, - {1, 3}, - {1, 7}, - {2, 4}, - {2, 6}, - {3, 5}, - }; + edges = + new int[][] { + {1, 2}, + {1, 3}, + {1, 7}, + {2, 4}, + {2, 6}, + {3, 5}, + }; assertEquals(0.16666666666666666, solution1.frogPosition(7, edges, 2, 4), 0); } @Test public void test2() { - edges = new int[][]{ - {1, 2}, - {1, 3}, - {1, 7}, - {2, 4}, - {2, 6}, - {3, 5}, - }; + edges = + new int[][] { + {1, 2}, + {1, 3}, + {1, 7}, + {2, 4}, + {2, 6}, + {3, 5}, + }; assertEquals(0.3333333333333333, solution1.frogPosition(7, edges, 1, 7), 0); } @Test public void test3() { - edges = new int[][]{ - {1, 2}, - {1, 3}, - {1, 7}, - {2, 4}, - {2, 6}, - {3, 5}, - }; + edges = + new int[][] { + {1, 2}, + {1, 3}, + {1, 7}, + {2, 4}, + {2, 6}, + {3, 5}, + }; assertEquals(0.16666666666666666, solution1.frogPosition(7, edges, 20, 6), 0); } @Test public void test4() { - edges = new int[][]{ - {2, 1}, - {3, 2}, - }; + edges = + new int[][] { + {2, 1}, + {3, 2}, + }; assertEquals(1.0, solution1.frogPosition(3, edges, 1, 2), 0); } @Test public void test5() { - edges = new int[][]{ - {2, 1}, - {3, 2}, - {4, 1}, - {5, 1}, - {6, 4}, - {7, 1}, - {8, 7}, - }; + edges = + new int[][] { + {2, 1}, + {3, 2}, + {4, 1}, + {5, 1}, + {6, 4}, + {7, 1}, + {8, 7}, + }; assertEquals(0.0, solution1.frogPosition(8, edges, 7, 7), 0); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1379Test.java b/src/test/java/com/fishercoder/secondthousand/_1379Test.java index 66115546a9..85d3c42465 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1379Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1379Test.java @@ -3,11 +3,10 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1379; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _1379Test { private _1379.Solution1 solution1; private _1379.Solution2 solution2; @@ -40,8 +39,12 @@ public void test2() { @Test public void test3() { - original = TreeUtils.constructBinaryTree(Arrays.asList(8, null, 6, null, 5, null, 4, null, 3, null, 2, null, 1)); - cloned = TreeUtils.constructBinaryTree(Arrays.asList(8, null, 6, null, 5, null, 4, null, 3, null, 2, null, 1)); + original = + TreeUtils.constructBinaryTree( + Arrays.asList(8, null, 6, null, 5, null, 4, null, 3, null, 2, null, 1)); + cloned = + TreeUtils.constructBinaryTree( + Arrays.asList(8, null, 6, null, 5, null, 4, null, 3, null, 2, null, 1)); target = TreeUtils.constructBinaryTree(Arrays.asList(4, null, 3, null, 2, null, 1)); TreeUtils.printBinaryTree(solution1.getTargetCopy(original, cloned, target)); } @@ -61,5 +64,4 @@ public void test5() { target = TreeUtils.constructBinaryTree(Arrays.asList(2, 3)); TreeUtils.printBinaryTree(solution1.getTargetCopy(original, cloned, target)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1380Test.java b/src/test/java/com/fishercoder/secondthousand/_1380Test.java index 5c32dd1e61..d1a98b373d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1380Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1380Test.java @@ -1,14 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1380; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - - public class _1380Test { private _1380.Solution1 solution1; private _1380.Solution2 solution2; @@ -22,13 +20,13 @@ public void setup() { @Test public void test1() { - matrix = new int[][]{ - {3, 7, 8}, - {9, 11, 13}, - {15, 16, 17} - }; + matrix = + new int[][] { + {3, 7, 8}, + {9, 11, 13}, + {15, 16, 17} + }; assertEquals(Arrays.asList(15), solution1.luckyNumbers(matrix)); assertEquals(Arrays.asList(15), solution2.luckyNumbers(matrix)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1381Test.java b/src/test/java/com/fishercoder/secondthousand/_1381Test.java index ef65f94d92..667f90a74f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1381Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1381Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1381; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1381Test { private _1381.Solution1.CustomStack customStack; private _1381.Solution2.CustomStack customStack2; @@ -39,7 +39,5 @@ public void test2() { assertEquals(140, customStack2.pop()); assertEquals(130, customStack2.pop()); assertEquals(99, customStack2.pop()); - } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1382Test.java b/src/test/java/com/fishercoder/secondthousand/_1382Test.java index 75f8dbfe15..394636d1cc 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1382Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1382Test.java @@ -3,11 +3,10 @@ import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1382; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - public class _1382Test { private _1382.Solution1 solution1; @@ -18,16 +17,19 @@ public void setup() { @Test public void test1() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 2, null, 3, null, 4, null, null)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(1, null, 2, null, 3, null, 4, null, null)); TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution1.balanceBST(root)); } @Test public void test2() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 2, null, 3, null, 4, null, 5, null, null)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList(1, null, 2, null, 3, null, 4, null, 5, null, null)); TreeUtils.printBinaryTree(root); TreeUtils.printBinaryTree(solution1.balanceBST(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1385Test.java b/src/test/java/com/fishercoder/secondthousand/_1385Test.java index 0ef4d248dc..b6c0ee5463 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1385Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1385Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1385; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1385Test { private _1385.Solution1 solution1; @@ -16,7 +16,7 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.findTheDistanceValue(new int[]{4, 5, 8}, new int[]{10, 9, 1, 8}, 2)); + assertEquals( + 2, solution1.findTheDistanceValue(new int[] {4, 5, 8}, new int[] {10, 9, 1, 8}, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1386Test.java b/src/test/java/com/fishercoder/secondthousand/_1386Test.java index 745619104d..06e34bf841 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1386Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1386Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1386; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1386Test { private _1386.Solution1 solution1; @@ -16,33 +16,44 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.maxNumberOfFamilies(3, new int[][]{ - {1, 2}, - {1, 3}, - {1, 8}, - {2, 6}, - {3, 1}, - {3, 10}, - })); + assertEquals( + 4, + solution1.maxNumberOfFamilies( + 3, + new int[][] { + {1, 2}, + {1, 3}, + {1, 8}, + {2, 6}, + {3, 1}, + {3, 10}, + })); } @Test public void test2() { - assertEquals(2, solution1.maxNumberOfFamilies(2, new int[][]{ - {2, 1}, - {1, 8}, - {2, 6}, - })); + assertEquals( + 2, + solution1.maxNumberOfFamilies( + 2, + new int[][] { + {2, 1}, + {1, 8}, + {2, 6}, + })); } @Test public void test3() { - assertEquals(4, solution1.maxNumberOfFamilies(4, new int[][]{ - {4, 3}, - {1, 4}, - {4, 6}, - {1, 7}, - })); + assertEquals( + 4, + solution1.maxNumberOfFamilies( + 4, + new int[][] { + {4, 3}, + {1, 4}, + {4, 6}, + {1, 7}, + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1387Test.java b/src/test/java/com/fishercoder/secondthousand/_1387Test.java index 23a0000f09..c882128ccb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1387Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1387Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1387; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1387Test { private _1387.Solution1 solution1; @@ -28,4 +28,4 @@ public void test2() { public void test3() { assertEquals(7, solution1.getKth(7, 11, 4)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1388Test.java b/src/test/java/com/fishercoder/secondthousand/_1388Test.java index 35bc0e916f..0653e73c02 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1388Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1388Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1388; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1388Test { private _1388.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(10, solution1.maxSizeSlices(new int[]{1, 2, 3, 4, 5, 6})); + assertEquals(10, solution1.maxSizeSlices(new int[] {1, 2, 3, 4, 5, 6})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1389Test.java b/src/test/java/com/fishercoder/secondthousand/_1389Test.java index 2996bb330b..b68c453eb7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1389Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1389Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1389; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1389Test { private _1389.Solution1 solution1; @@ -16,17 +16,20 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{0, 4, 1, 3, 2}, solution1.createTargetArray(new int[]{0, 1, 2, 3, 4}, new int[]{0, 1, 2, 2, 1})); + assertArrayEquals( + new int[] {0, 4, 1, 3, 2}, + solution1.createTargetArray(new int[] {0, 1, 2, 3, 4}, new int[] {0, 1, 2, 2, 1})); } @Test public void test2() { - assertArrayEquals(new int[]{0, 1, 2, 3, 4}, solution1.createTargetArray(new int[]{1, 2, 3, 4, 0}, new int[]{0, 1, 2, 3, 0})); + assertArrayEquals( + new int[] {0, 1, 2, 3, 4}, + solution1.createTargetArray(new int[] {1, 2, 3, 4, 0}, new int[] {0, 1, 2, 3, 0})); } @Test public void test3() { - assertArrayEquals(new int[]{1}, solution1.createTargetArray(new int[]{1}, new int[]{0})); + assertArrayEquals(new int[] {1}, solution1.createTargetArray(new int[] {1}, new int[] {0})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1390Test.java b/src/test/java/com/fishercoder/secondthousand/_1390Test.java index 90caefccbe..0485b6c084 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1390Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1390Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1390; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1390Test { private _1390.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(32, solution1.sumFourDivisors(new int[]{21, 4, 7})); + assertEquals(32, solution1.sumFourDivisors(new int[] {21, 4, 7})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1392Test.java b/src/test/java/com/fishercoder/secondthousand/_1392Test.java index 46018de88e..96bc768abe 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1392Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1392Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1392; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1392Test { private _1392.Solution1 solution1; @@ -42,12 +42,17 @@ public void test5() { @Test public void test6() { - assertEquals("", solution1.longestPrefix("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab")); + assertEquals( + "", + solution1.longestPrefix( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab")); } @Test public void test7() { - assertEquals("abbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaa", solution1.longestPrefix("abbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaababababbaaabaaaaabbabbababbbbbbbbabbbaabbababaaaaaabaabbbbaaaaabbabbbaababbbaaababababbabbaaabbabbbaabbbababaabbbbbabbbabaaaaabbaaababbaabaaabababaabaaaaabbabbaabbabbaaaaaaabbaabbbaabbbbbbbaaaaabbabbaabbbaabbabbbaaabababaabababbaabbabbbaabababbbabbbbaabbbaabbabbabbababbbaabbaababbbbbaabaaabbbbbababaaaaaaaaaabaabbaabbbbbbbbaababbbabbabababaaaabbbaabbababbbbaabbbaabbababbbabaaaabaaabbbbaababbbaababbbbbaabbbaabbbababbbabbabbbaaaabbbbbaaaaaaabaaabbbbbbbaabbabbaaaaaaaabbbbabbaabaabbbaabababaabbbabababaaaaabbaaabbbaaaaaaabbbbabaababaababbbbbbaaaaabbaabbaabbbaabaaabbbbabbbbbaaaaaaababaaaabbaaaaaaaaaaabbabbaaaabbaabbbbababaabababababbabaaaaaaabbbaabbaaaabaaaaaabbabaaabbbaabbbbbbbabbaabbaababbbbabaabbbababbaabababbbbabbabababbababbbbabbbbaabbabbbbbaabaabbbabbabbbabbbaabaaaabbabbabaaabbbbbbabaaababbababbababaabababaabbbbbbbbbabbabaaaababbbbabbaaabbbaabaabbbaabaaaaaabbbaabbbaabaaaabbaaaabbabababbababbbababbabbaaaabbbaaabaaaabbababbababbabababbbaabaaaabbbaaabbaaaabbbbbbbbbaabaaaabababbbababaaaabaaaaaaabbaabbbbbabbaaaaabbababbbbbabbbabbbbbaaabbaaaaaababaaaaaaaaabbaaaaaababaaabaaabbabaaaaabbbbabbaabbbbabbbbaaaaaaabbaabbbaabbbbabbbbaaabbaabbbbbaaababbbbabaaaaaabaababaabbbaaabbbbbabbbbbbbbbbabaaabbbaabaaabbabaaaabababbaabaaaabaabbabbbaaaababaaaabbaabaaabbabbabbaaabbaabbaabbbaabbabbabbabbabbabbababaabaabaababbbbabbabaababaabbbbbaabaababbabbaaabbbabaaababaababbbabbbabaabbbaaaaabaaabaaaabbababbbaaabaabaabbbbaaaababaaabaababbabababbaaababaaabaaaaabbababbaababbbbabaaaabbabbbaaabbabbbbbbabbaaababaababbbbaababbbbabbabaabbabbabbbbabbbabbaabbbabbabbbbbaabbbabaaabababbabbaaaaabbabbbababbbababbbbaaabbabbabaababbabbaabbababbbbabbaaabbbaaabaaabbbbbabbbbaaabaaabaaaaaaabbbbaabbbaaabaabbbbaaabaaabaaaaabbbbbbbbababbabbaaaaabababaaaaaabbbbbbaaabbbbaaabaabbaababbbbaaaaaabbabbbaaabbbbababaababaabbabbbabbaaabaaabbabbbbbabaabbbaabbaabbbabaabbbbaabbbaabaaaaabbaaabbaaababbaababbabbbbaabbabaababababbaababbbabbababaabaabbbbbbaabbaabbaababaabaabaaaabbaabbbabbbbabababbababaabaaabaabaabbabbababababbbaabababbabbbbbaaabaaabaabbbababbbaaaababbbbaabababbbabaabaaabbaaaababababbababababaaaaaaaaababababaabbbbbbbbabbaabbabababababbaaaaaabbababbabbbbbabbaaababbaaabaabbaababbaabbabbaaabaaaababbababaabbbaaaaaabbabbbaaaaabbabbaababaabaabaabbbaaabbbbabababbbaaabaaaabbbbbbaaababbabaabbbbababbabaabaaabbaaabaababababbbbbaaababbbbaabaabbbaabbbbaabaabbbbbabbaaaaaabaababbbabbaaaaaaaabbbbbbaabbaaabbbbbbabaabbabaaabaaabbbaabbaaaabaaabaabbbaaabaaabbaabbaaaabbababbbbbbbabbaabaaaaabbbababbbbbbbbaababaababbbbbababbabbbaaaabbbabbbaabbaaababbaaaabbbbbbaababaaabbabbbbbbbababbbbbbbabbabbabbbbaaabaaababbbbbaabababababbaabbbaaaabbbbaababaaabaaababbbbaaabbabbbbaaabbaaababaabbbaaaaaababbbaaabbbaabaabaaabbabbbaabaababbaabbaabbaabbaaaaaaaaabaaababbbbabbabbaaabbaabababaabaaaababbbbbbbbabbbaabbabbaabaaababbabbaaaaaabababbabaabaabbbbabaaabbbaaabbaaaaababbaabababbaabaaaaabbbaabbbbaaaaabbbaaabbbabbbaaaaabbabbbbaababaaaabbaaabaababbaaaaabbbaabaabbabaabbabbbaaaaababaabbbababbaaaaabbaabbaababbaabbabbbbababbbabaaaaabaaabbbabaaaaaabbbaaaaaaaababaaaababbbbaabbaababbaaaaabaabbaababbbbaabbbbababbbbbbaabaabbbbbbbbabbaabbaabababaaabaabbabbaaaabbbaaabaababaababbababababbbbbababbaaabaaabbbbbaabbbaabaaababbabbaaababaaaababbaaabaabaabaababbabbbabaabbbbbabaabbbaaabaaaababababbbababaaaaabbbababaaaabbababaaaababbbbabaaaaaabbabaabbbaababbaaabbabbaaababbbaabbbbbbbabbabbabaabbbbbbaaabbbabaabbaabbbbbbbbaabbabaabbbaaaaabaabbbabbbbbbaabaababbbbabbbbbbaabbbaaaaaaabbbababbbbabbbabbabbbabbabbabbabbbaabaaaabbbaaaaababbbaabbbaababbabaabbaababbbabbabaaaaaabaaaababababaababbaabbabbbbabaaabbbbaaababaabaabbababaaaababbbbbbbabaabbbabaabaabbaabbabbbababaabaabaaabaabbaabaabbbaaabbababbbaabbaabbbaaaabbbaabaababbbababbbaababbbababbbababbaabaaabbaaabbbaabbaaaabbaaabbbbbabbbbbababbabaaabbabbababbbaabbaabbbaabbbaababbbabbbaabbabaaabbaaaabbabbbabbbbbbaaabbbbbabbabbbaabaaabaabbaabbbabbbabbababababababbaaabbbbbababbabbbbbbabbabbbabbabababbaaababbaaababaaaaabbbabbbabbaaabaabbbaabbaaababbaabbaababababbbbabbbbaabbbaababbaaaabbababbabaaaabbaabaabaabaabababbbbabbbaababbabaaababaabababbabbbbabbabbabbbbbbbbababbabaaabbbabaabbbbbabaabaaaabbababbbbbaabaabaaabaabbbbbaaababbbbabbabaaaabbabaaabbbaaaabaabaaabbbbbaababbbababbbbbbababaaababbababbbbbbbabbbaabbbabaababbbaaaaaaaaaababbaabaabbbbbaababbabaaaabbbaaabaaababbbbaabaaabababbbabbababbaabbbbababaababbababbaaabbbaaabbbbaaabbabbababbbabababaabbaaaaaaabbbbbbbbbaaaababbbaabbbbabbabbbbbaabbaaabaababbbabbbaabbbabaababbaaaaababbbabbababbabbababaabababaabbabaaaabbbaabbababaababbaabababbbbabbaabbaababbaaaaabaaaaaabbaabababaaaaabaabbbaababababaaabaaababbababbabbbbaabbbaaabaababaaabbbaaabaabbbbaabbabaabaabbabbbbabaaabaabbbaaaaababbbbbbbabbbabbbaaabbabbaaaaabbabaaaaabbaaaaaabbbbbbbaabaabbbbbbbbabaaaabababaaabaaabaaabaababbaabbaababbbbaaabbbbaaabaaabbabbababababaaaaaaaaababaabbaabaaaabbbabbbaababababaabaaababbbaabbaaabbbbaaaabababaabaaabbabaaaababbabbaaaabbbaaaaaaaaaaaaaaaabbaabaabbbbbaabaaaaabaaababbabbbbbbaaaabbaabaaaaabbabbbbbababaabbabbabbabbabbaaabaabaabbbbbabbaabbababbabaabbaaaaabbababbaaabaaaaaaabbaaabbbbbbbbabaaaabbbbbabbbaaaabbaaaaababaaabbaabbbbbaaaabaaabbbaabbaaaababbaabaabbaaaabbaaaabbaabaabbabbababaabaaaaaaabababaabaaababbabbbbbbabbbbabbabbbabbbabaababaaababbbbbbaaaabbbababbbabbbaaaaaabaabbbaabbbababbbbbbbbabaabbabbbbbbaaabbbbbababbabbabbaabbaabaaabbaaaabaaababaaabbbbbbababbaabbaaababbabbbaabababbbbbaaaaaaaaabaabaabaababbaabaaaababaabbabaabbbbaaaabaabbbbbbbabbaaabbbabbaababbabaabbbaabbbbaabaaaaabbbabaabaabbabaabbabababaabbbabbbbbbabbbbbbabaabbbbaabaabbbaaaaababbaaabbbabaaababbbaabbabbaaabaabaabbbbbabbbabaabbabababbbabbbbbbbbabbaaaaabaaaaaaabbabbbaaaababbbbaabaabbbbbbbaabbbaabaabaabababbaaabababaabaaabaaabbbbbabbabaaaaabababababbbaababbabaaabbbbaabababbbbabbabaaaaaabbabbbbaabaaaaabbbbbaaaaababbbbbbaabbbaababaaaabaaaaabbabbabbabbabbbababbbbbbbaaaaaabaabaabbaaaabbbabaaaabbbbaaabaaabbbaababbbabbaabbbbbabbaaababaababbbbabaababaabaaabababbaaabbbaaababaaaabaabaabbbbaabaabaaabbbbababaaaababbaaabbaaabbaabbbbbabbbaaaabbbabbaaaaaabababbbaabaabbabbabbbbabbbbbbabbbbbabbabbbababbabaabbbababaaababbbbbabbbbaabbbaaaabbaabbbaababbbabaaaabbbaaababbbaabbaaabbabbaabbbabbbbbaaaaaaaaabbabbabbabbbbbabbbbaaabbbabbababaabababbaabbbbbbbbbaabaababababaabaaaaabababaaaaaaabbababbabbaabaababaaaabbababbbaaaabaaaabbbaabbbbbbabbbbabbabaabbbaaababababbababbbaabaaaaaabaaabaaaaabbabbbaaabbabbabbbabbbbabbabaabaabbbbbaabbbbabbbaaaaabbbaaabbabbbabbbbababbaabbbaabababbabbbabbbaabbabbbbababbbbbbabbabaabababbbbbababbbbabbbabbbabbabbabbaababbbbaaabaaabbabaaabababababbbaaababbabbabaaabbabbababaaaaabbabaaaabbbbbbbbaaabaaabbbabbaaaabbbbbaababbbbbbabbbbbbbbabaabbbaabaaaabababbbabaaaaaaabaabbbbaaaabbabaaabbaaaaaaabbaaababbbbaaaabaaababbabababababbaaaabaabaaabbabaaababaabaaabaabbabbbbbaabaababaabbbbababaaaaaaaabbaabbbabbaaabbbaababbbbaaabaabbababbaaaaaaaababbbbaaaabbbaababbbaaabaabbbabbbbabbbbaabababaabbbabbabaabaaabaabbaaabaabbaabbbabaabbbbbbbbaaaabbaabbbbbbaabbbababaaaabbbabababbbbbbaaababbbaabaabbbbbbaaaabbbaabbbbbbaaaabbabaaabbbaaabbbbbabbbbabaaabaabbbaaaaaabaabbaababaabaaababbbbbbaaaabababbabbaababbbabbababaaaabbbaabaababbaaaabbaaaaaaabbbabbbabbbbbaaabbbaabababbabbababbabbababbbabbabaaaabbabbbaaaaabbaabbababbabaabbaaaaabbaabbbbbbabbbabaabbbabbbabaaabbbaaabaaabbaababbbbabbbbabbabbababbabaaababaabbbbbbabaabaabaaabbbaabbaaabaabbbbbbbaabbababaabbbbbbababbbbaabaaabbaabaaabbaaaaaabaaababaababaabbabbbbababbaabababbabbabbababaaabbbababbbabbaabaabaaababababbbbababaaabaaabaababaabaaaaaaabbbabaaaaabaabbbbbabbabbbaabaabaabaababbaaaaaabbbabbabababaabbabbaabbaabbaabbbbabbaababbabaaababaabaababaaabbabbbaabaaabaabbaabbbababababaabbbaabbabbbaaaabbbabaabbabbabbabaaabbabababbbbababbaaabaaaabbabbbaaabbbabbabbaabbaabbaaabbbaaabbaaababaaababbaabbaabaaaaabbbbbbababbaabababaaaababaaabbababaaaaaabaaabbabbabaabbbabaababbaaabbabaaabbbaaaaaababbaaaabbaaaaabbabbabbbaaabaabaaabbaabbbaaabbbabbaaabaaababbaaaaaabaaaaaaabbabaababaaaaabaabaaaaaaabbabbbaaabaabbbbbababaaabbabaaababbaabbaabbabbbababbabaabbaaabbbbbabbbbbbaabbbaabaaaabbaaabbbaabaaabaaaabbbabbbbabbbbbbbaabaabbbabababbbababbabbabaabbbbababaaababbbbbbabbbababbaababaabaaaabaabbbbaaababbaaaabaaaaabbabaaababbaabbaaaabaabbbabbbabbaabbabbbabaababbaabababbaabbbbbabbbaaaabbabaaabbaaabaababbabbabababbabbabbbabababaabbbbaababbaabbbabaabaaabbababababbababbbbbabbbabbaabbbbabaabbbbabaabbbbbaabbabaaaabbaaaababbaabaabaabbbbbaaaabbababbbabbbaabbaaaabbabaababbababbbbababaaabaabbbbbbbabbbbabaaaaaababaaabbbaabbbabaaabbbaaabbbaabababbaabbaaababaaaabababbbaaaaaabbbbaabbbabbbbbaaabaaabaaabbaabbbaababaaabaabababaabbaabbababbaaaabbbaaaababaabbbabbbbbbabbbaaaababbbbbbbbbabbbbaaabbabaaabbbabbbaabaaaabbabbbbaaababaabbabaaaababbabaaabbabbabbbbaaabbababbbababbbbbbbabababbbbaabaabbbabbbababbaabbbbbabaabbbabaaaabaaaaaaabbbbbbaaaaaaaaabaaabaaababbaabaaaaababbbbaaabbaabbbabbabababbaabbababbaaababbbbbbaabbbbbaaaaabbbbbbaabbaaaaaabbbababbbaababbbaaabbaabbbaabaaaaaababbaaabbbabaaabbabababbaaabababaaaababaabbbbbaaaaabababbabbaaababbabaabbbabbbbbabbbabbbaaabbabbbaaaaaababbabababbaaaaaaabaaaabbaaaaababbbabaabbbaaaabbbaaabbaabaaaabbabbbababaabbbbbaaaaabbaaaaaaabaababbaabbbabaabbbbabbbaaabaabbaabaabbbaaababbabbbbbabbbbabaabbaabbbabbaaababbbabbbbaababbbabbaabbbaaaaaabbababbbbbabaaaaaaaaabababaabbbaabbaabbbaabbbaaabbaabbaabbabbabaaaaabaaaabbaaabbaabbabbbaaaabbbaaabaababaaabbaaabbbaabaababbaaaababaababaabababbbaaaaabbbbbabababbbaaaabaaaaaabbbababaabbbbaaaabbbbbaabbaaaaaaaabbaabbbbbbbbbaabbbababbaabbabbaabaababbbbbabababbbbbabaabbbaaabbbababbaaaabababaaaababbabbbbbbbbababbaaabbabbaaabababbbababaabaaaaaaaaababbaababbbaaabbabbbaabaaaaaababaaabbaabbbabaabbabbbbababaaaaaababbabbaaabbaabaaaaaaaabbbaaabababbbbabbbababbaabbabaaaaaabababbaaaabbaaaaabaabbbbaabaababababbbabaaabbbbbaababaaaabababbaabaabbaaaaaaabbbaaaaaabbaaabbaaaaabbbbbbbaaababbbababbbaabbaabbbbaaabbabbbbaabaabbaaabbabaaaabaaabaaababaabbabbbabaaaaaaabaababbaabbabbbbbbaaabbbaaaaaaabbaabbbabaaabbaabbabaaabaaaaaaaabbabbbaaaaabababbbbbabbbaaaaabbbbaaaaabababbbabaababababbaaababbaabbbaaaaabaabababaababbbabbbaabbaaaaaabbaaabbbbbbababaaabbaaabaabaaaabbabaaababbbbbbbbbbbababbabbaaabbbabbababbabbbbbbabaaaabbabbbababbbabbbbaaabbaaaaababbbbababbbbbaaabbaaabbbbbbbaaaabbbabaabbbaabababaababbaabaaababbbbbaaaababaaabbbbabaaababbabababbaaaababaaabaaaaaabaaaabaaaabaabbaaaaaabbabaabaabababbbbabbbabbaababbbbabbbabbbabbbbaaabbbbaabbbaababaababbaaabaaababababbbbbbbbaaaabaaaaaaaabaaaaaaabbbababbaabbbaaabbbaaabaababbabbaaaabaaabbabbaaabbaaabbbabbababbaabaaabbbababbabbaabaabbaabbbbaabbbbbabbabbbbbaaabbbaaabbbbbaaabbaaaaabbbbbbaaabbaabbabaaababbabababaaaabbababbaabaaaaaabbabaaabbababaaabbaaabbabbaaaabbbabbbaaaaababbaaaaaaaaaabbabaabbbbaaaababbbbbbabaaabbbbbaabbbbbababbaabbbbaaaabaabbbababbabaaababaaabbabbbabbababababaabababaaaabbbbbaaababaaaaababaabaabbaaaababaaaabbbaaaaaaaabaaaabbbaaababbbaaaaabaaaababababbbabbbaabaaabbaabaaababaabbbaaaaaabaaaaabbaabbbbaabbabbbbabbabaaaaabbabbaabaabbabbaababbaaabbabbbbbbbbbbaabababaaabbbabbaaabbbbabbbbbbabaaaaaaaaaaababababbabbbaaaabbbbabbaabaababbbbaababaaaaaaabaabbbaabbaabaabaaababbaababaabbbbbbabbaaabaabaaaabbbbabbababaaabaabbaabababbbbbaaaaabbaaaabbbaabaaaaaaaababbaaabaaaaabbbabbbbbaaaaaabbababaaaaababbbbbbaaabbaaaabbaabaaaabbbbbabaaabbbaaabaaaaabbbaabbaaabbabbaaabaabbbaababbbbaabbababbbabbaaabbbababbbbbbbbbbbaaababaabababaaaababbbbababaabaabaaabbbababaaaaaaabbaaaababaabaabbaabbabbbabaabbabbbbbbabbabbaabbabbabbbbabbabaabbabaaaabbaaabababbaabbaaaabbbbabbbaabaaaaaaaabbbbbbbbabbbaaabbbaaabbaaabbbbbabbaaabbabbababaaabaaababbbbbaabbaabbaabbbabaaabbbaaaabbabbabbaaababbbbbbaaabbabbbaaaaaaaaaababaabbaabaabbaababaabaaabbbabbababbabbababbbababbababaabbbabbabbbbbbaabbaababbaaaabbbaabbbbaabbbbbbabbbababbbbbbbaaaabbbbbbabaaaaabbbbaaabaabbabaaabaaaaaaaaaaababaabbbbabababbbabaaabbbbbabbbbbbaabaabbbbaaabaabbbabaabaaabbbababaaabaabbaabbbbaaaaababababbabaabbbaabaababbbbbaabaabababbabbaabbbabaaaaaaaabbabbaaaaaaaabbaabbbabbbaabbbabababbbababbbaababaaaaaababbaaaabbaaaaaaaaaaabbbbaabbbbbbbabbbababbaaabbbaaabaaabaabbaabaaaaabbbabbbbbbabbabbabbaaaabaaabbaaaaaaabbbbabababbbbbaababaaaababbabaaaababbbbbaaaabbaaaabbbbaaabbbabaabaaaaaaaabbbbaaabbabaaabaabbbbabbbaaabaabaababaaababaaaaaaabaabbaabaaabaaaabbbbaaabaaaabaaaaaababaaaaabbabbaaababaaababbbbaabbbbbbabaababbbbbaabbbaababaaabaabbaaaabaaaaabaababbabbbabbaabaabbaabbaabbbbababbbbbbbbaabbbaababbabbbaabbabaaaaaaabbbbaaaababbabaaaaababbbabbbabbbabbbaaaaaaaaabaaaababbbaabababbabbaababbaaabbbbbbbabbbbbabaaabbbabbbbbaabbabbaaababbbababaabbaaabbbbbababaabaaabababbbbbaabbbabbbaababbbabaaaababbbaabbaaabbabbababababaabbabaaabaabbabaaabbabbbaaaaaabaaaaabbabbbbabbababbbabbaababbbaaabbbbbaaababaaaaabbbababaaabaabaaaaabbbaaaabbbbbabbabaaabbbabbbbbaaaabaabbbaaabbbbbaaabbaaaaabbbbabaabaaabbaaaababababbbbaaaaababaabaababaaabaabbabbabbaabbaaabaabaaabbbababaabbabbbaababbbbaaaabbabbabbbbbbbbaababbbbabbabaaabbbaabbabbaabaabbaabbbbabbabaabbbabbbbbbbabbbbaaaabbbbabbaabaaaababaaaabaaaaababbaaaabbbaaaabbabbabbababbbbaaabbbbbbbabbbaaabaaaaabaaababbabbaaabbaaaaabaaabbbabbabbabaaababbbbbaaaabbbabaabbabaaaaaaaaaabbabbbababbaaabbbaabbababbaabaaabbbbabbbaababbbabaabbbbbbabaabbaabaabbbabaaaabbababbabbabaabababaabbbbabbbaaaaabaaabbabaabaabaaabaaaabaabbaabbaabbbababaababbababbbbbababaaababbaabbbbbbbbbaaaaabbbababaabaababbaabbabababababbbaaabbbbbabbbbaaababbabaababbbbabbabbaabbaaabbaabbabbababbbbaabaabbbbbbabbaababbaabababbaaaabaabbabbaaaaabbaabbbbbbbabbbbbaaaabbaaaabaaabaaabbbbbbaaabbbaaaabbbaaababbabbbbbbbbabaababaabbabbbaabbabaaaaabababaaaabbbaabaabaaaaabaaabbaabbbaaabababbabbbaabababbbbbbbbbabbbbabaabbaabababaabaaababbaaaabbaabbbabbbabbbaabaabababaabbbbaabbbaaaaaabaababaabbbbabbababaabbabbbbaaabaabaaabaaabaaaabbaabaabbbabaaabbabbaabbabbbbababbbaaababababababbbbabaababaaaaabbbbbabaababbbabaabbaababbabaabbaabbbaaabababababbababaaabaaaaabababbbaabbabbbabbbababaaabbbbbaaaaaabbababbabbbaaabbbbbaabbbbaaabababaababaaaaabaaaaaaaabbabaabbaabababbabaababbabbbaaabbaabbaaaaaaabaaabaaabaaabbababbabbbbbbaababbabaabaaabbbabbbaaabbaababbbaabbbbbbbbbaabbbabaabbbaaaabbabbbaabababbaaabaabbaaababaaabbaabbbbaaaabaaaabbabbaabaabbaababbbbababbabbabbbababaabbabbbaabaabababbbbaaaabaabbaaababababbbabababbbababaabbaabbaaabababbaabbbbbbbabbaabbababbaabbbaababbabbbbbbbbaaabaaaabbaabbaabbabbbaaababaaaaabbaababbbabbbabbabaabababbbaaaaabaabaabababbabababababbbbababbabbbbbbaabaaaabaabbbaabaabaabaababaabababbaababbaaabaabaababbaabbbaabbbbabbaababbabaabbabbbbaaababaaabbbbbbaaaababaabbbaaabbbbbbaababbbbbbabababbabbbbaababbbabbbbaabaabaabaabbbababbaaabbbaabaaabaaaababbabbbaaabbaaaaababababbbbabaaaabaabbaabbbabbbabaaaaabbbbbbbabbabbaabaaaaabbbbbaaababababaaabbabbaabbbabaabbabaaaabbbbbbabaabbbbbbaababbbbbbbabaababaabaabbbaaabbbbaaaaabbbbbaaaabbababbbbaabbabbbaabaabaaaaaabbaaaabbbbabbbbababbababbabbbababbaaabbbbababaaabbaabbbabbabbabaabbaabbbbaabaaababbbbbbbbbbbabaaaabbaaabaaababaaabbbbbaabbbbaaababaaaaababbbbbaaaabababbaaabaaaabbabaabbaabaaabaaaaaaabbbbbbbaaabbbaabbbabbaaababaabbbbbabbbbbabaabbababbbbbababababbababbbbbaaaaaabaaababbbbaabababaaabaabbbaababbbbbabbbbbbaabaabbabbbaaaaaaabbaabbbaabbbaabbbbaabbaaabababbbbbbbbaaabaabbbababaaababaabbaabbbabbaabbbaabbbbbbbbbabababbaaabaabaabbaababaaabbabbbaaaaaababaaaaaaaabbaaaabbabbabaaaabbbabbbaaabbbbababbabbababbaaaaaabaaabaaaaabaabbababababaabaabbbbbbbaababaaaaabababaaaaabaababaababbbbbabbabbbaababbbabbababbbababbbbabaabbaaaabbbabbaabbaababaaaabababbbbabbbabaaabbababbbabbababaaaabbabababbaabbbbabaabaaaaaababbaabbbaaaabbbbababbbbaaaabbaaaabbbaababbbabaabbbaabaabbabbabbabbbbbabbbbabbabaaaabaaaabaabaababbabbbbbbbaaabbbbabbbabababbbbbaaaabbabbbaababaaaaabbbaabababaabbbaabaababbaabbbabaaabbabbabbbbbbbaabbbaaabbababbababbabbbaaaaaaaabaabbbaabbababaaaaaabaabaabbaaabbbbbabaabaaaabbbbababbbbbbbbababbbbaaabbaaababaaabbabbababbababaaaaabbbaabaabababbababbbbaaaaaaaababbbbaaababaaabaabaabaaaabbbbaabbbaabbbbaaabbbabbaabaabbaabaaabbabbaaaaaababaaabababbababbaabbaaaabaaabbabbbaaabbabbaaaaaabaaaaaababbbbbaababaaabbbaabbaaaaabbbabbaabbaaaaaaaabaabaaabbabbbbababbabaaaabbbbabaaababaaabaabbaabbabbbbbaabbaaabbabbbabbbbbbbbabaabababaabbbbbaaababbaababbababbaababbaaaabbabaaababaabbbababbaaaababaaabaaabababbaaaaabaabaabbbaaaaaabbbaaababbabbaabbaaaaaabbbabbbbbabaabbaaaabbabbbbaaaaaaababbababbbbbababbbaabaaabaabaaababababaaabaaaababbbbaaabaababbaaabbbbaaaaaababbabaaaabaaabaabbaaaabbabbbbabababbaabbbabbbbabaaabbbaabbbaabbababaaababaabaabbabbaaaababababaaaabbaabaaaabbbaaabaababababaabbabbaaabbaabaaaaababababbbbbbbababaaabbbbbbbabaabbaabbbbabaaaaaaaabbbbaaababaaabaabaabbbbababaababbbabbaababbbbbbbabbbbabbaabababbaabababaaaabaaaababbbabbabaaaabbaabaaaababbaaabbbbabaabbaaabbbabbababbbaabbabaabaabbbaaabbbbaabbbbbabbaaaabbbbabbababababababbbbbaaababaabbaabbaaaaaaabbabaabbabbaaaaabaabbaababbababaaabbbaababbbbbaabaaaabaabaaaababbbbaababbbbabbaabbbbbaaaaaabbaaabbaaabbbbaabbaababaaababbbabbbbbaabaabbbbbaabbbbaaabbbbbbbbbbaabbbbabbbbbbbbaabaabaababbaaaabbbaabaaabbabbabaaaabbbaaaabbbbbbabbaaabbabbaababaabbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaa")); + assertEquals( + "abbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaa", + solution1.longestPrefix( + "abbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaababababbaaabaaaaabbabbababbbbbbbbabbbaabbababaaaaaabaabbbbaaaaabbabbbaababbbaaababababbabbaaabbabbbaabbbababaabbbbbabbbabaaaaabbaaababbaabaaabababaabaaaaabbabbaabbabbaaaaaaabbaabbbaabbbbbbbaaaaabbabbaabbbaabbabbbaaabababaabababbaabbabbbaabababbbabbbbaabbbaabbabbabbababbbaabbaababbbbbaabaaabbbbbababaaaaaaaaaabaabbaabbbbbbbbaababbbabbabababaaaabbbaabbababbbbaabbbaabbababbbabaaaabaaabbbbaababbbaababbbbbaabbbaabbbababbbabbabbbaaaabbbbbaaaaaaabaaabbbbbbbaabbabbaaaaaaaabbbbabbaabaabbbaabababaabbbabababaaaaabbaaabbbaaaaaaabbbbabaababaababbbbbbaaaaabbaabbaabbbaabaaabbbbabbbbbaaaaaaababaaaabbaaaaaaaaaaabbabbaaaabbaabbbbababaabababababbabaaaaaaabbbaabbaaaabaaaaaabbabaaabbbaabbbbbbbabbaabbaababbbbabaabbbababbaabababbbbabbabababbababbbbabbbbaabbabbbbbaabaabbbabbabbbabbbaabaaaabbabbabaaabbbbbbabaaababbababbababaabababaabbbbbbbbbabbabaaaababbbbabbaaabbbaabaabbbaabaaaaaabbbaabbbaabaaaabbaaaabbabababbababbbababbabbaaaabbbaaabaaaabbababbababbabababbbaabaaaabbbaaabbaaaabbbbbbbbbaabaaaabababbbababaaaabaaaaaaabbaabbbbbabbaaaaabbababbbbbabbbabbbbbaaabbaaaaaababaaaaaaaaabbaaaaaababaaabaaabbabaaaaabbbbabbaabbbbabbbbaaaaaaabbaabbbaabbbbabbbbaaabbaabbbbbaaababbbbabaaaaaabaababaabbbaaabbbbbabbbbbbbbbbabaaabbbaabaaabbabaaaabababbaabaaaabaabbabbbaaaababaaaabbaabaaabbabbabbaaabbaabbaabbbaabbabbabbabbabbabbababaabaabaababbbbabbabaababaabbbbbaabaababbabbaaabbbabaaababaababbbabbbabaabbbaaaaabaaabaaaabbababbbaaabaabaabbbbaaaababaaabaababbabababbaaababaaabaaaaabbababbaababbbbabaaaabbabbbaaabbabbbbbbabbaaababaababbbbaababbbbabbabaabbabbabbbbabbbabbaabbbabbabbbbbaabbbabaaabababbabbaaaaabbabbbababbbababbbbaaabbabbabaababbabbaabbababbbbabbaaabbbaaabaaabbbbbabbbbaaabaaabaaaaaaabbbbaabbbaaabaabbbbaaabaaabaaaaabbbbbbbbababbabbaaaaabababaaaaaabbbbbbaaabbbbaaabaabbaababbbbaaaaaabbabbbaaabbbbababaababaabbabbbabbaaabaaabbabbbbbabaabbbaabbaabbbabaabbbbaabbbaabaaaaabbaaabbaaababbaababbabbbbaabbabaababababbaababbbabbababaabaabbbbbbaabbaabbaababaabaabaaaabbaabbbabbbbabababbababaabaaabaabaabbabbababababbbaabababbabbbbbaaabaaabaabbbababbbaaaababbbbaabababbbabaabaaabbaaaababababbababababaaaaaaaaababababaabbbbbbbbabbaabbabababababbaaaaaabbababbabbbbbabbaaababbaaabaabbaababbaabbabbaaabaaaababbababaabbbaaaaaabbabbbaaaaabbabbaababaabaabaabbbaaabbbbabababbbaaabaaaabbbbbbaaababbabaabbbbababbabaabaaabbaaabaababababbbbbaaababbbbaabaabbbaabbbbaabaabbbbbabbaaaaaabaababbbabbaaaaaaaabbbbbbaabbaaabbbbbbabaabbabaaabaaabbbaabbaaaabaaabaabbbaaabaaabbaabbaaaabbababbbbbbbabbaabaaaaabbbababbbbbbbbaababaababbbbbababbabbbaaaabbbabbbaabbaaababbaaaabbbbbbaababaaabbabbbbbbbababbbbbbbabbabbabbbbaaabaaababbbbbaabababababbaabbbaaaabbbbaababaaabaaababbbbaaabbabbbbaaabbaaababaabbbaaaaaababbbaaabbbaabaabaaabbabbbaabaababbaabbaabbaabbaaaaaaaaabaaababbbbabbabbaaabbaabababaabaaaababbbbbbbbabbbaabbabbaabaaababbabbaaaaaabababbabaabaabbbbabaaabbbaaabbaaaaababbaabababbaabaaaaabbbaabbbbaaaaabbbaaabbbabbbaaaaabbabbbbaababaaaabbaaabaababbaaaaabbbaabaabbabaabbabbbaaaaababaabbbababbaaaaabbaabbaababbaabbabbbbababbbabaaaaabaaabbbabaaaaaabbbaaaaaaaababaaaababbbbaabbaababbaaaaabaabbaababbbbaabbbbababbbbbbaabaabbbbbbbbabbaabbaabababaaabaabbabbaaaabbbaaabaababaababbababababbbbbababbaaabaaabbbbbaabbbaabaaababbabbaaababaaaababbaaabaabaabaababbabbbabaabbbbbabaabbbaaabaaaababababbbababaaaaabbbababaaaabbababaaaababbbbabaaaaaabbabaabbbaababbaaabbabbaaababbbaabbbbbbbabbabbabaabbbbbbaaabbbabaabbaabbbbbbbbaabbabaabbbaaaaabaabbbabbbbbbaabaababbbbabbbbbbaabbbaaaaaaabbbababbbbabbbabbabbbabbabbabbabbbaabaaaabbbaaaaababbbaabbbaababbabaabbaababbbabbabaaaaaabaaaababababaababbaabbabbbbabaaabbbbaaababaabaabbababaaaababbbbbbbabaabbbabaabaabbaabbabbbababaabaabaaabaabbaabaabbbaaabbababbbaabbaabbbaaaabbbaabaababbbababbbaababbbababbbababbaabaaabbaaabbbaabbaaaabbaaabbbbbabbbbbababbabaaabbabbababbbaabbaabbbaabbbaababbbabbbaabbabaaabbaaaabbabbbabbbbbbaaabbbbbabbabbbaabaaabaabbaabbbabbbabbababababababbaaabbbbbababbabbbbbbabbabbbabbabababbaaababbaaababaaaaabbbabbbabbaaabaabbbaabbaaababbaabbaababababbbbabbbbaabbbaababbaaaabbababbabaaaabbaabaabaabaabababbbbabbbaababbabaaababaabababbabbbbabbabbabbbbbbbbababbabaaabbbabaabbbbbabaabaaaabbababbbbbaabaabaaabaabbbbbaaababbbbabbabaaaabbabaaabbbaaaabaabaaabbbbbaababbbababbbbbbababaaababbababbbbbbbabbbaabbbabaababbbaaaaaaaaaababbaabaabbbbbaababbabaaaabbbaaabaaababbbbaabaaabababbbabbababbaabbbbababaababbababbaaabbbaaabbbbaaabbabbababbbabababaabbaaaaaaabbbbbbbbbaaaababbbaabbbbabbabbbbbaabbaaabaababbbabbbaabbbabaababbaaaaababbbabbababbabbababaabababaabbabaaaabbbaabbababaababbaabababbbbabbaabbaababbaaaaabaaaaaabbaabababaaaaabaabbbaababababaaabaaababbababbabbbbaabbbaaabaababaaabbbaaabaabbbbaabbabaabaabbabbbbabaaabaabbbaaaaababbbbbbbabbbabbbaaabbabbaaaaabbabaaaaabbaaaaaabbbbbbbaabaabbbbbbbbabaaaabababaaabaaabaaabaababbaabbaababbbbaaabbbbaaabaaabbabbababababaaaaaaaaababaabbaabaaaabbbabbbaababababaabaaababbbaabbaaabbbbaaaabababaabaaabbabaaaababbabbaaaabbbaaaaaaaaaaaaaaaabbaabaabbbbbaabaaaaabaaababbabbbbbbaaaabbaabaaaaabbabbbbbababaabbabbabbabbabbaaabaabaabbbbbabbaabbababbabaabbaaaaabbababbaaabaaaaaaabbaaabbbbbbbbabaaaabbbbbabbbaaaabbaaaaababaaabbaabbbbbaaaabaaabbbaabbaaaababbaabaabbaaaabbaaaabbaabaabbabbababaabaaaaaaabababaabaaababbabbbbbbabbbbabbabbbabbbabaababaaababbbbbbaaaabbbababbbabbbaaaaaabaabbbaabbbababbbbbbbbabaabbabbbbbbaaabbbbbababbabbabbaabbaabaaabbaaaabaaababaaabbbbbbababbaabbaaababbabbbaabababbbbbaaaaaaaaabaabaabaababbaabaaaababaabbabaabbbbaaaabaabbbbbbbabbaaabbbabbaababbabaabbbaabbbbaabaaaaabbbabaabaabbabaabbabababaabbbabbbbbbabbbbbbabaabbbbaabaabbbaaaaababbaaabbbabaaababbbaabbabbaaabaabaabbbbbabbbabaabbabababbbabbbbbbbbabbaaaaabaaaaaaabbabbbaaaababbbbaabaabbbbbbbaabbbaabaabaabababbaaabababaabaaabaaabbbbbabbabaaaaabababababbbaababbabaaabbbbaabababbbbabbabaaaaaabbabbbbaabaaaaabbbbbaaaaababbbbbbaabbbaababaaaabaaaaabbabbabbabbabbbababbbbbbbaaaaaabaabaabbaaaabbbabaaaabbbbaaabaaabbbaababbbabbaabbbbbabbaaababaababbbbabaababaabaaabababbaaabbbaaababaaaabaabaabbbbaabaabaaabbbbababaaaababbaaabbaaabbaabbbbbabbbaaaabbbabbaaaaaabababbbaabaabbabbabbbbabbbbbbabbbbbabbabbbababbabaabbbababaaababbbbbabbbbaabbbaaaabbaabbbaababbbabaaaabbbaaababbbaabbaaabbabbaabbbabbbbbaaaaaaaaabbabbabbabbbbbabbbbaaabbbabbababaabababbaabbbbbbbbbaabaababababaabaaaaabababaaaaaaabbababbabbaabaababaaaabbababbbaaaabaaaabbbaabbbbbbabbbbabbabaabbbaaababababbababbbaabaaaaaabaaabaaaaabbabbbaaabbabbabbbabbbbabbabaabaabbbbbaabbbbabbbaaaaabbbaaabbabbbabbbbababbaabbbaabababbabbbabbbaabbabbbbababbbbbbabbabaabababbbbbababbbbabbbabbbabbabbabbaababbbbaaabaaabbabaaabababababbbaaababbabbabaaabbabbababaaaaabbabaaaabbbbbbbbaaabaaabbbabbaaaabbbbbaababbbbbbabbbbbbbbabaabbbaabaaaabababbbabaaaaaaabaabbbbaaaabbabaaabbaaaaaaabbaaababbbbaaaabaaababbabababababbaaaabaabaaabbabaaababaabaaabaabbabbbbbaabaababaabbbbababaaaaaaaabbaabbbabbaaabbbaababbbbaaabaabbababbaaaaaaaababbbbaaaabbbaababbbaaabaabbbabbbbabbbbaabababaabbbabbabaabaaabaabbaaabaabbaabbbabaabbbbbbbbaaaabbaabbbbbbaabbbababaaaabbbabababbbbbbaaababbbaabaabbbbbbaaaabbbaabbbbbbaaaabbabaaabbbaaabbbbbabbbbabaaabaabbbaaaaaabaabbaababaabaaababbbbbbaaaabababbabbaababbbabbababaaaabbbaabaababbaaaabbaaaaaaabbbabbbabbbbbaaabbbaabababbabbababbabbababbbabbabaaaabbabbbaaaaabbaabbababbabaabbaaaaabbaabbbbbbabbbabaabbbabbbabaaabbbaaabaaabbaababbbbabbbbabbabbababbabaaababaabbbbbbabaabaabaaabbbaabbaaabaabbbbbbbaabbababaabbbbbbababbbbaabaaabbaabaaabbaaaaaabaaababaababaabbabbbbababbaabababbabbabbababaaabbbababbbabbaabaabaaababababbbbababaaabaaabaababaabaaaaaaabbbabaaaaabaabbbbbabbabbbaabaabaabaababbaaaaaabbbabbabababaabbabbaabbaabbaabbbbabbaababbabaaababaabaababaaabbabbbaabaaabaabbaabbbababababaabbbaabbabbbaaaabbbabaabbabbabbabaaabbabababbbbababbaaabaaaabbabbbaaabbbabbabbaabbaabbaaabbbaaabbaaababaaababbaabbaabaaaaabbbbbbababbaabababaaaababaaabbababaaaaaabaaabbabbabaabbbabaababbaaabbabaaabbbaaaaaababbaaaabbaaaaabbabbabbbaaabaabaaabbaabbbaaabbbabbaaabaaababbaaaaaabaaaaaaabbabaababaaaaabaabaaaaaaabbabbbaaabaabbbbbababaaabbabaaababbaabbaabbabbbababbabaabbaaabbbbbabbbbbbaabbbaabaaaabbaaabbbaabaaabaaaabbbabbbbabbbbbbbaabaabbbabababbbababbabbabaabbbbababaaababbbbbbabbbababbaababaabaaaabaabbbbaaababbaaaabaaaaabbabaaababbaabbaaaabaabbbabbbabbaabbabbbabaababbaabababbaabbbbbabbbaaaabbabaaabbaaabaababbabbabababbabbabbbabababaabbbbaababbaabbbabaabaaabbababababbababbbbbabbbabbaabbbbabaabbbbabaabbbbbaabbabaaaabbaaaababbaabaabaabbbbbaaaabbababbbabbbaabbaaaabbabaababbababbbbababaaabaabbbbbbbabbbbabaaaaaababaaabbbaabbbabaaabbbaaabbbaabababbaabbaaababaaaabababbbaaaaaabbbbaabbbabbbbbaaabaaabaaabbaabbbaababaaabaabababaabbaabbababbaaaabbbaaaababaabbbabbbbbbabbbaaaababbbbbbbbbabbbbaaabbabaaabbbabbbaabaaaabbabbbbaaababaabbabaaaababbabaaabbabbabbbbaaabbababbbababbbbbbbabababbbbaabaabbbabbbababbaabbbbbabaabbbabaaaabaaaaaaabbbbbbaaaaaaaaabaaabaaababbaabaaaaababbbbaaabbaabbbabbabababbaabbababbaaababbbbbbaabbbbbaaaaabbbbbbaabbaaaaaabbbababbbaababbbaaabbaabbbaabaaaaaababbaaabbbabaaabbabababbaaabababaaaababaabbbbbaaaaabababbabbaaababbabaabbbabbbbbabbbabbbaaabbabbbaaaaaababbabababbaaaaaaabaaaabbaaaaababbbabaabbbaaaabbbaaabbaabaaaabbabbbababaabbbbbaaaaabbaaaaaaabaababbaabbbabaabbbbabbbaaabaabbaabaabbbaaababbabbbbbabbbbabaabbaabbbabbaaababbbabbbbaababbbabbaabbbaaaaaabbababbbbbabaaaaaaaaabababaabbbaabbaabbbaabbbaaabbaabbaabbabbabaaaaabaaaabbaaabbaabbabbbaaaabbbaaabaababaaabbaaabbbaabaababbaaaababaababaabababbbaaaaabbbbbabababbbaaaabaaaaaabbbababaabbbbaaaabbbbbaabbaaaaaaaabbaabbbbbbbbbaabbbababbaabbabbaabaababbbbbabababbbbbabaabbbaaabbbababbaaaabababaaaababbabbbbbbbbababbaaabbabbaaabababbbababaabaaaaaaaaababbaababbbaaabbabbbaabaaaaaababaaabbaabbbabaabbabbbbababaaaaaababbabbaaabbaabaaaaaaaabbbaaabababbbbabbbababbaabbabaaaaaabababbaaaabbaaaaabaabbbbaabaababababbbabaaabbbbbaababaaaabababbaabaabbaaaaaaabbbaaaaaabbaaabbaaaaabbbbbbbaaababbbababbbaabbaabbbbaaabbabbbbaabaabbaaabbabaaaabaaabaaababaabbabbbabaaaaaaabaababbaabbabbbbbbaaabbbaaaaaaabbaabbbabaaabbaabbabaaabaaaaaaaabbabbbaaaaabababbbbbabbbaaaaabbbbaaaaabababbbabaababababbaaababbaabbbaaaaabaabababaababbbabbbaabbaaaaaabbaaabbbbbbababaaabbaaabaabaaaabbabaaababbbbbbbbbbbababbabbaaabbbabbababbabbbbbbabaaaabbabbbababbbabbbbaaabbaaaaababbbbababbbbbaaabbaaabbbbbbbaaaabbbabaabbbaabababaababbaabaaababbbbbaaaababaaabbbbabaaababbabababbaaaababaaabaaaaaabaaaabaaaabaabbaaaaaabbabaabaabababbbbabbbabbaababbbbabbbabbbabbbbaaabbbbaabbbaababaababbaaabaaababababbbbbbbbaaaabaaaaaaaabaaaaaaabbbababbaabbbaaabbbaaabaababbabbaaaabaaabbabbaaabbaaabbbabbababbaabaaabbbababbabbaabaabbaabbbbaabbbbbabbabbbbbaaabbbaaabbbbbaaabbaaaaabbbbbbaaabbaabbabaaababbabababaaaabbababbaabaaaaaabbabaaabbababaaabbaaabbabbaaaabbbabbbaaaaababbaaaaaaaaaabbabaabbbbaaaababbbbbbabaaabbbbbaabbbbbababbaabbbbaaaabaabbbababbabaaababaaabbabbbabbababababaabababaaaabbbbbaaababaaaaababaabaabbaaaababaaaabbbaaaaaaaabaaaabbbaaababbbaaaaabaaaababababbbabbbaabaaabbaabaaababaabbbaaaaaabaaaaabbaabbbbaabbabbbbabbabaaaaabbabbaabaabbabbaababbaaabbabbbbbbbbbbaabababaaabbbabbaaabbbbabbbbbbabaaaaaaaaaaababababbabbbaaaabbbbabbaabaababbbbaababaaaaaaabaabbbaabbaabaabaaababbaababaabbbbbbabbaaabaabaaaabbbbabbababaaabaabbaabababbbbbaaaaabbaaaabbbaabaaaaaaaababbaaabaaaaabbbabbbbbaaaaaabbababaaaaababbbbbbaaabbaaaabbaabaaaabbbbbabaaabbbaaabaaaaabbbaabbaaabbabbaaabaabbbaababbbbaabbababbbabbaaabbbababbbbbbbbbbbaaababaabababaaaababbbbababaabaabaaabbbababaaaaaaabbaaaababaabaabbaabbabbbabaabbabbbbbbabbabbaabbabbabbbbabbabaabbabaaaabbaaabababbaabbaaaabbbbabbbaabaaaaaaaabbbbbbbbabbbaaabbbaaabbaaabbbbbabbaaabbabbababaaabaaababbbbbaabbaabbaabbbabaaabbbaaaabbabbabbaaababbbbbbaaabbabbbaaaaaaaaaababaabbaabaabbaababaabaaabbbabbababbabbababbbababbababaabbbabbabbbbbbaabbaababbaaaabbbaabbbbaabbbbbbabbbababbbbbbbaaaabbbbbbabaaaaabbbbaaabaabbabaaabaaaaaaaaaaababaabbbbabababbbabaaabbbbbabbbbbbaabaabbbbaaabaabbbabaabaaabbbababaaabaabbaabbbbaaaaababababbabaabbbaabaababbbbbaabaabababbabbaabbbabaaaaaaaabbabbaaaaaaaabbaabbbabbbaabbbabababbbababbbaababaaaaaababbaaaabbaaaaaaaaaaabbbbaabbbbbbbabbbababbaaabbbaaabaaabaabbaabaaaaabbbabbbbbbabbabbabbaaaabaaabbaaaaaaabbbbabababbbbbaababaaaababbabaaaababbbbbaaaabbaaaabbbbaaabbbabaabaaaaaaaabbbbaaabbabaaabaabbbbabbbaaabaabaababaaababaaaaaaabaabbaabaaabaaaabbbbaaabaaaabaaaaaababaaaaabbabbaaababaaababbbbaabbbbbbabaababbbbbaabbbaababaaabaabbaaaabaaaaabaababbabbbabbaabaabbaabbaabbbbababbbbbbbbaabbbaababbabbbaabbabaaaaaaabbbbaaaababbabaaaaababbbabbbabbbabbbaaaaaaaaabaaaababbbaabababbabbaababbaaabbbbbbbabbbbbabaaabbbabbbbbaabbabbaaababbbababaabbaaabbbbbababaabaaabababbbbbaabbbabbbaababbbabaaaababbbaabbaaabbabbababababaabbabaaabaabbabaaabbabbbaaaaaabaaaaabbabbbbabbababbbabbaababbbaaabbbbbaaababaaaaabbbababaaabaabaaaaabbbaaaabbbbbabbabaaabbbabbbbbaaaabaabbbaaabbbbbaaabbaaaaabbbbabaabaaabbaaaababababbbbaaaaababaabaababaaabaabbabbabbaabbaaabaabaaabbbababaabbabbbaababbbbaaaabbabbabbbbbbbbaababbbbabbabaaabbbaabbabbaabaabbaabbbbabbabaabbbabbbbbbbabbbbaaaabbbbabbaabaaaababaaaabaaaaababbaaaabbbaaaabbabbabbababbbbaaabbbbbbbabbbaaabaaaaabaaababbabbaaabbaaaaabaaabbbabbabbabaaababbbbbaaaabbbabaabbabaaaaaaaaaabbabbbababbaaabbbaabbababbaabaaabbbbabbbaababbbabaabbbbbbabaabbaabaabbbabaaaabbababbabbabaabababaabbbbabbbaaaaabaaabbabaabaabaaabaaaabaabbaabbaabbbababaababbababbbbbababaaababbaabbbbbbbbbaaaaabbbababaabaababbaabbabababababbbaaabbbbbabbbbaaababbabaababbbbabbabbaabbaaabbaabbabbababbbbaabaabbbbbbabbaababbaabababbaaaabaabbabbaaaaabbaabbbbbbbabbbbbaaaabbaaaabaaabaaabbbbbbaaabbbaaaabbbaaababbabbbbbbbbabaababaabbabbbaabbabaaaaabababaaaabbbaabaabaaaaabaaabbaabbbaaabababbabbbaabababbbbbbbbbabbbbabaabbaabababaabaaababbaaaabbaabbbabbbabbbaabaabababaabbbbaabbbaaaaaabaababaabbbbabbababaabbabbbbaaabaabaaabaaabaaaabbaabaabbbabaaabbabbaabbabbbbababbbaaababababababbbbabaababaaaaabbbbbabaababbbabaabbaababbabaabbaabbbaaabababababbababaaabaaaaabababbbaabbabbbabbbababaaabbbbbaaaaaabbababbabbbaaabbbbbaabbbbaaabababaababaaaaabaaaaaaaabbabaabbaabababbabaababbabbbaaabbaabbaaaaaaabaaabaaabaaabbababbabbbbbbaababbabaabaaabbbabbbaaabbaababbbaabbbbbbbbbaabbbabaabbbaaaabbabbbaabababbaaabaabbaaababaaabbaabbbbaaaabaaaabbabbaabaabbaababbbbababbabbabbbababaabbabbbaabaabababbbbaaaabaabbaaababababbbabababbbababaabbaabbaaabababbaabbbbbbbabbaabbababbaabbbaababbabbbbbbbbaaabaaaabbaabbaabbabbbaaababaaaaabbaababbbabbbabbabaabababbbaaaaabaabaabababbabababababbbbababbabbbbbbaabaaaabaabbbaabaabaabaababaabababbaababbaaabaabaababbaabbbaabbbbabbaababbabaabbabbbbaaababaaabbbbbbaaaababaabbbaaabbbbbbaababbbbbbabababbabbbbaababbbabbbbaabaabaabaabbbababbaaabbbaabaaabaaaababbabbbaaabbaaaaababababbbbabaaaabaabbaabbbabbbabaaaaabbbbbbbabbabbaabaaaaabbbbbaaababababaaabbabbaabbbabaabbabaaaabbbbbbabaabbbbbbaababbbbbbbabaababaabaabbbaaabbbbaaaaabbbbbaaaabbababbbbaabbabbbaabaabaaaaaabbaaaabbbbabbbbababbababbabbbababbaaabbbbababaaabbaabbbabbabbabaabbaabbbbaabaaababbbbbbbbbbbabaaaabbaaabaaababaaabbbbbaabbbbaaababaaaaababbbbbaaaabababbaaabaaaabbabaabbaabaaabaaaaaaabbbbbbbaaabbbaabbbabbaaababaabbbbbabbbbbabaabbababbbbbababababbababbbbbaaaaaabaaababbbbaabababaaabaabbbaababbbbbabbbbbbaabaabbabbbaaaaaaabbaabbbaabbbaabbbbaabbaaabababbbbbbbbaaabaabbbababaaababaabbaabbbabbaabbbaabbbbbbbbbabababbaaabaabaabbaababaaabbabbbaaaaaababaaaaaaaabbaaaabbabbabaaaabbbabbbaaabbbbababbabbababbaaaaaabaaabaaaaabaabbababababaabaabbbbbbbaababaaaaabababaaaaabaababaababbbbbabbabbbaababbbabbababbbababbbbabaabbaaaabbbabbaabbaababaaaabababbbbabbbabaaabbababbbabbababaaaabbabababbaabbbbabaabaaaaaababbaabbbaaaabbbbababbbbaaaabbaaaabbbaababbbabaabbbaabaabbabbabbabbbbbabbbbabbabaaaabaaaabaabaababbabbbbbbbaaabbbbabbbabababbbbbaaaabbabbbaababaaaaabbbaabababaabbbaabaababbaabbbabaaabbabbabbbbbbbaabbbaaabbababbababbabbbaaaaaaaabaabbbaabbababaaaaaabaabaabbaaabbbbbabaabaaaabbbbababbbbbbbbababbbbaaabbaaababaaabbabbababbababaaaaabbbaabaabababbababbbbaaaaaaaababbbbaaababaaabaabaabaaaabbbbaabbbaabbbbaaabbbabbaabaabbaabaaabbabbaaaaaababaaabababbababbaabbaaaabaaabbabbbaaabbabbaaaaaabaaaaaababbbbbaababaaabbbaabbaaaaabbbabbaabbaaaaaaaabaabaaabbabbbbababbabaaaabbbbabaaababaaabaabbaabbabbbbbaabbaaabbabbbabbbbbbbbabaabababaabbbbbaaababbaababbababbaababbaaaabbabaaababaabbbababbaaaababaaabaaabababbaaaaabaabaabbbaaaaaabbbaaababbabbaabbaaaaaabbbabbbbbabaabbaaaabbabbbbaaaaaaababbababbbbbababbbaabaaabaabaaababababaaabaaaababbbbaaabaababbaaabbbbaaaaaababbabaaaabaaabaabbaaaabbabbbbabababbaabbbabbbbabaaabbbaabbbaabbababaaababaabaabbabbaaaababababaaaabbaabaaaabbbaaabaababababaabbabbaaabbaabaaaaababababbbbbbbababaaabbbbbbbabaabbaabbbbabaaaaaaaabbbbaaababaaabaabaabbbbababaababbbabbaababbbbbbbabbbbabbaabababbaabababaaaabaaaababbbabbabaaaabbaabaaaababbaaabbbbabaabbaaabbbabbababbbaabbabaabaabbbaaabbbbaabbbbbabbaaaabbbbabbababababababbbbbaaababaabbaabbaaaaaaabbabaabbabbaaaaabaabbaababbababaaabbbaababbbbbaabaaaabaabaaaababbbbaababbbbabbaabbbbbaaaaaabbaaabbaaabbbbaabbaababaaababbbabbbbbaabaabbbbbaabbbbaaabbbbbbbbbbaabbbbabbbbbbbbaabaabaababbaaaabbbaabaaabbabbabaaaabbbaaaabbbbbbabbaaabbabbaababaabbbaaabbabbaaaaaabbabaabbabbaabbabaababbbabbaabaabbbabbaabbbbbbabaaaaabbababaabaaaabaaaaabaabbbabbbbaaaababbbbbaabbaabbbaaabaabaababaaababaabbaaaabbbaababbbaabaabaaabbbbabbaaabbbabaabbbabaabbbbaabaaaaabbabbbaabaabaaaaabaabaabbaaaabaabbaabbbabaabaababaabababbbabbaaabbbabababbbbababaaaabbbbababbbabbaaabbabbaaaaaaabbbabbbbbaabababbbbabbaaabababbbaaabbbbbbbbabababbbaabbbabbbaababbbaabbbaababaabbbaaaaaaabaabbabbaaaaaaababababbbbbaaaaabbababaabababbbabbaaaaaaaabbabbaabbbaaaabbabaaababaabaabbaababaababaabbabbabbbaaaabbbaabaabbbbababaabbbaaaabbbbbaaabbaabaaabbbaaaabbbababababbabbbbbaaababbaabbaaabbbabbbabaaaabbbaabbabaababbababbaaababbbaabbaabbaababbababaabbbababaaaabbabaaaaaababababbaabaababbbaaabaabaababbbbaaabbbbbaaabbabaaabbbaabaaabaabaababababaabaaaaaaaabbaabbbaaabababbbbbbabbbabbbbabbbabaabbbabbbaaabaaababaaaaababbabbbbaaaabbbababaabababbabbaaaabaabbabbbbbbbabbabbbbbbababbbabbabbabbabaabaaabbbbaaabbbbaabbabbbaaaaaabbabbbbbbaabbababbaaaabbbabaababaabbbaabbaabbaaaaabaaababaabbabaabaabaabbaabaaaabbabaaabaabababbaabbababbbabbabbbbabbbbababbabbbbbaabbaabababbaabaababaabaaabbaabababaabaaaababbbaabbabbaaaabbabaaaaaababbaaabaaabbabaaabaaaaaabbbbbbaabaabbababaaabababaaabbbbbabaaababbaaabbbbabaaababaaaabaababababbbabbbbabbbabbbbaabbbabbaabbaabaabbbababaaabbaabaaaabaabbbbbbababbbababaabababbbaabbbbbabbaaaaaabbababbbabaaabaabaabbbaabaaabbbabaaaabababbbbaaaabbaaabbbaababaaaaabaabbaababaabbabaabbaaabbbbbaababababbbabbbaaaaaaabaaaabbabaaababbaaaaabababababaaababbbabaaabaaaaabaaaaaaabaabbbaabbbbbabaaaababaaaaaaaabbaabbbbbbabaaabbababbbbbaaaabaaabababaababababbbaabaabaabaaabaabbaababbbbaabbaaabbaaaababaaababababbbaaababbababaaabbabaaabbaaaaaaababaababbaaaabbbbaababbbabaaabababaabbbabbabababbababbaaabaabbbbbbaaaabbbbababbabaaabababbbbbbbbabbbbaaabaaababaaaababaabababbbabaaabaabbbbbbbbbaabaaababbabababbbaabbaababbaaaabbbabababaaabbbaaabbaababbabbaababbbabbbaabbbbaaaaaaaabbabaaabbabbaaaabbbaaaaaaabbbbaaaabbabaabbabbbbbabaabbbbbaaabbbabbbaabbaabbabbabbaaabaabaabbaabbbbaabbaaaaabaaaaabababaaababaababababbbbaabababbbbaabaabbaaaababbbaaababaaaabbbabababaabbbabbbbaababbabaaaabababbaaaabaabaabbbababbbbabbaaaaaaababbabbbabaaabaabbaabaaabbbbaabbaabbababaabaaabaababbaabbbbbbaaababbbbbbababbaabaaabbbaaababaaaaabbabaaaaaaaabbbababbabababbabbbaababaaaabaabaabbbbbbaabbbaaaababaaaabbbaabaaaaabbabaabaaabaaabbabbabaaaaabaaaabbaabaaabaabbbabaaaabbaabababaaaabaaababbbbaabbbbbabaababbababaaaababbbbabbaaababbabbabbaabababbbbaabbaaabaabababbbabbbabbbbabaaabbbabbaaabbabbbababbbbaaaaabbbaaabbaaaabbabbaabaaabbbbbaabbbabbabaabbabbbaaaabbbbaaaabaabbaabababbbbbabbbabbbbaabbabbaaaaaabaababaaaaabbabaabbbbbaaaabbaabbaabbbaabaaaabbabbbbbbaaaabbbbaaaaaaabaaabbaababaaaaaaabaaabababbbbabbababbbbbaaabbabbaaaabbaaabbbabbbaababbaaabbbbbaaaaabaaaabaaaaaaaabaaaabaababbabababbaabababbaabbaabaababbbababbbbbabaaabaabaabbabbbababbbbabaaaaaabbbaaaabaaabbaaabbabbbbaaabbaaaabbaabbbbbbababaabbbabbabababaabaabbaabaaaababbabababbabbaaabbabbaabbbbbaaaaabbbabaabaaabaaababbabaaaabaababbabbaaaaabababbbbaaabaaabbababbabbbbabaaaaaabaaabbabbaabbaabaaabbbbbaaaababaaaababbabaaaabbabaabbabbaababbbaaabaabbabbabbbabbbabbbbbbbbabbabbaababbbabaaaaaaaaaaababbbaabbbabbbaababababaaabbabaababbaabbaaaaabababbbbbaabbabbabaabaaabaaaabbabbbbaabbabbbaababbabbaabbababaaabbaaabbbbaaaabbbbabbbbabbbabbbbaaabbaaabaabaabbaabbabbaaaaababbbaaabbbbbbbbbbaaaabbaaaabbaabaaaaabaabbbbbaabaaabbabbabaababbbbbbbaabaaababbaaabaabbababaaaababbabbabbbbaabbbaaabbbbbaaaabbbababbbabbaabaaabbabaabbabaaaaaaaabababbbababbbbabbbbbabbaaaabbabaabaabbabaaaaabbaababaabbaabaababbaaaaabbaaaabbbbaabaaabbabaaaabbababbaaabababaaaaabaaabaaabbbaababababaabbabbbbbbabbaaaaabbbaabaaaaabbbaabaaabbaaabababbabbbbbbbaaaabbaaabbabbbbbbbbbaabababbbbabbbbabbbbaaaabaababbbabbaabababababbaaababbaaabababaaabaaabaaabaabbbbbbbbbabbbaaabbabbbbabbbababaaaaaabbbbbbbbbbaababbbbaaaababaabbaabbaabaabababbbbabbabbbbbabbabbbabaaabbaababaabababbabaabbbbbaabbbbabbbabaaabbbbaaaaabbbabbbbababbbabaabbaabbabbaabbabbaabbbbabbbbabbaabaaaaaaabaaaabbaaaabbbbbabababbbbaabbbbbbabbbaaaababbbbababbbbabaabaabbaabaabbaaabaabbbbabaaaabbabbabaaaaaababbbbbbabbaabaaababbabbbaaaaabaaaabbaaabbbbaaabaaaabbbaabaababaababababaabaaabbaabaabbaabbbbabbabbbbaaabbabaabbbaabbabaaaaabbaabaabababbbaabbbabaabaaaababaabbbbbabaaaabaabbbbbbbbbabbaaaaabbbbabbbaaabbbbbbaababbaababbbbbbbbbababbabbbabbabaabaaabababbbbababaabbbbabbaabbbabaababbbbbbbabaabaabbbabbbaaabbbabaaaabbbbbbbbabbaababbbbbaabbbababbbbbaaaaabbbbbbbbabbabbbababababaababbbaaabbabbababbabaaaaaabaaabaabbaabaaabaabaabbbabbabaaaaabbbabbabbabbbbababbabbbabbbabaababaaaaaabbaabaaaaaaabbabaabaabbbbaaaaaababaaabbbbababbaabbaaababaaabbaaabaabbbbbbabbbaabaaabbabaabbbbbaaaabaabbbbbabbabaaaaaaaaaabbbbbaabbbbaabbbbbbaabbababbbaabaabbbabbaabaabbbbaaaabbabaabaabbabbabababbbbbbabbbbbbaabbabaababaabaababababbabbaaabbbbaaababbbaaaaaaaaabaabbbbababbbbaaaaabbbbbbbabaaaaaabbabbbababbbbbabbaaaaabbaabbbaabbbaaaaabaaaaaabbaaabbbbbbbbbbbbbababbbaabbbbbabaaababbbbaabaabbbbabaaaaababbbbbbbbbbbaabaaaaabaaabababbbabbaabaabaaaababbababaaaabbabababbbababbabbaababbaabaaabaabaaaababbbbabbbabbbbaaabbbbbbbbaaabaababaabbbbaabababaaaabbaababbaababababbaabababbbbbbaabaabaaaaabbbbaabbaaabaaabbbaababababababbbabababaaaabbaaaaaababaabbaabbaababbbababbaababaaabbbaababbbababbbabbabbbbababbbbbabbabbbbaaabbbbbaaabaaabbabbaabbaababbbaaabbbabababbbbbbabbbaaababaaaaaaaaabaabaaaababbbaababbbbbaabbabaaabbaaaabbabbaababbbaabbbababaababaabbbbbababbaaaaaaabbaaaabaaaaaaaabaaabbbaabbaababaabaabbbaaabbaaaabbbaaabaabbbbaaaabbbbbaaabbaaabbbababaaaaabbbbbaaabbaabbbabbabbbbababaaabbbabbbaaabbbaaabaaabbaaaabaaabbabbabbbaabbaaabbabbbaabbaababbbaababaaabababbaabaabbaabbbabbbaabbabbabbabbababbaabaabbbbaabaabbabbbbbbbbbbaabbababbabaaabaaabbababbabbbbbbaabaabbaababaabababbbbbabaabaabbaaaababaaaabbbbbbaabaabbbbaababbbbabbbaaaaabaababababbabbababaabaabbbbbbaaabbaabbabbabbbaabbbaabbbbaabbbbbbbaabbaabaaaabbabbbaabababbbabaaabbbbbbbbabbbbbbababababaaaaaabaaabaabbbbbabbbbabbbaaabbaaababbaabbbbbaaaaabbbabaaabbaaaabaaababaaaabaabbabbabaabaaaaaaabaababaabaaaaaaabbaaaabaababbbbbbababbbabbaabbbbbbbbabababbbbbbbabbbabababaaabaabbaabbbaababbaabaaabbbaaaabababababbbbbbbbaababbbababbabbbaaaaaabbabbabaabaababbabaabbaabbbaaabbaaababbaaabaabbbbbbbaaabaabbbaabbbabaabaaabaaaabaaabbbbbbbbbaababbaabaaaabbbaabbbbaaababaabaaabaaaaabaababbaabaaaabbbabbababaaaabaaaabbaaaaaababababaaabbaabbabbbaaabaaaaaaaabababbabaaaabbabbabbbbbaaaaaaabbbbbaaabbaabbbbbaabbabbbabbabbbaaaababaaabbbababaaabbbbbbbbbabaabaaabbbaaabababbabbababababbbbbabbbabaaaabbbabbbabbbaaabbaabbaabbabbaabaaabbbbaaaabababbabaaaabbbabaaaaaabbabbaabbaaaaaaaabaaabaaabbbbaabbbbbaabbaabaababaaaabbbbbaabaabbabbbbabbbaabaabaaabbabbbabaabaabbabbabbabaabbababababbababbaaabaaabbbabbaaaaababbbaaaaabbbaaaaabbabaaabaabbaaabbbaaabbabbbaabbabbbabbabbbbbbbbbbaaababaaabbababbbaababbaabbaababbbbababbbabababbabbbabbabababbaaabbaabaaaabbbaaabbababbbaaaaaabaabbabaabaabaaaaabbbabaaabaaaaabbbbabbbbbabbaababbabaabbbabbaababbbbbbaabaabbabbbbbbbaaabbbbabbaaabbababbbabbabbabbabaaaaabbaaaaabbaaaabaaabbbbaabbabaababbbbababbbbbbbaabbbabbaaaabaabbbaabbaaabbabaaaaabbaaabaababbbbbbaabaaabababbabaabaabbbabaabbbbbbbaabaaabbbbaabababbaabaaaababbbabbabbaabbbbaaabaabbbababbbaaaabbaababbababaaabaaaabaaaaaaaaabbbbbabbaaabbabaaabbaaabaabaababaaaabbbaababaabaaaabbbabbbbaaababaaabbbabbabbbababaaababbabaabbbaaabbaabbbabbaabbbabaabbaaababbbabbaaaabbaaababbabbaaabaabbbbbbaaaaaaabababbabaabaaabbabbaaaaabbabababbbbababbbbababbbbaabbababaaaaababbabaaababaaaabbaabbbabbaaaaaabaaabbabbbaabbabbaaabbabbaabbbabbaaaaaabbbabbbaababbbbbaabbaaaaaababbabbbaaaaabababbaaabbbaabbabbaaababbbbbaabbbbbabbbababaaabbabbaabaaabbbbbaabbabbbbabbbbaabbbbbbbbaaabaababaabbaabaaababbaababbbbbabaababbbaabbbabbbbbababaaabbbabbaaaababbabbaaaabababbbbabbbabaabbbbaaabbaaaabaabbabaabbbaabbbabbbbbabbabaabaaabbbaabbaabbbbbbbbababbbabbbbabababbaaababaabbbbbaabbbbbbaaaabababbababaabbaaabaaabbaabbaaabbbbbabbabbabbaaaabababaaababababaaabbabbbaabbaaabababbabbbaaabbbbaabbaabbabbbaaaaabbbbabbbbbabbaaababaabbbbaabbbbaaaabaababbbabbaabbbabbbbbaaaaabbababbbaabbbbaaabbaaabbbaaaaaaabbabbbbbabbbbaababaabbbaaabbabbbbbbaabbabbabbaababbaaababbabbabaabaabbbaaabbabaaaaababbabbabababbabbbbabaaababbaabbaabbaababbabaabbabbbbbabbaabbbbababbbbaaabbbaabaabbababaaaabaababbbbabaaababbbbababbbabbbbbbbbabbaababaabaaaabbbbbbaabbaaabbbababbbbabbbbbabbbbaabababaabbbaababaaaabbabbaaaabaaababbaabbbaababaabaabbabbabaabaabbbbbbaaaababbbbbbbaabbbababababaaabbaabbaabbaaaaaaabbaaabbbaabbababaaabbaaaaabababbabbabbbaabaaaaababbbbbabaaaababababaabaabbbbabbabaababbbabbaababababbaabaabbbbaabbabbbaaabbaaaabbaabbaabbbbabbbbabbbbbabbbaaabaaabbaaabaababbbbbbbbbbbbaabaaabbbbabbabbbbbbaaabbaabbabaaaabaabbbbbabbbababbabbabaabaabaaababbbbbbbbabababaaaabbbaababbaabaaabaababbbaababbbbbabaabaabbbbabaababbabababbaaabaababbababbbabbbbbbabaabababaaabbabbababbbbbabbbbbbbbabaaabbaaaaabaaaaabbaaabaaaaaaabaaabbabbbbbbabbbabbbbbababbbbbabaabaaaabbabbbababbbbbabaabbbaaababaaaaaabbabaabbbbbbbbabbaabaabaabbabbabbbababbbbabaababaababaabbabbbabbbabaaabaaabaababbaabaaababababbbaaabbbabbbbbbbbbabbabbababbbbbbbaaaaabbaabbababbbbabaaabbababaabaaaaaaababbabababbaabaabaaababbbabbbbbabababaabbbabaaabaabaabbaabbbbbbbaabaabbaababbbaaabbbabbaaabaabbbbaaaabbaababbababbbaabaaaabbbabbabaabaababbaababbbbbbababbbbbbaaabaabbbbababaabbbbaabbbabbabaaabbaaaaabbbabbaaaabbabaabbbaaaabbababbabbbaabaabbbbaabbabaaababaabaaaaabaabbabbbabbbaabbababbababaababbbababaaabaabbabaabbbbaaaaaaaababbbbbbbbbbababbbbababbbbbabaaabbbbbabbbabaaaabbbaabaaabaaabbbabbbbaaaabaaabababbbabaaaabbbbbabbbbaabbabaabbabababaabbbababbbabbbabbbbbbbbaaabbabbaabbabbbbbbbbbbbbbbbabaaaababababbbabaaababbabbaaabbabbababbaaaaaaaaabbaabbaababbbabbaabbabaabababaabaaaabbababbbabaabbbaaaaabaababbaabbaabbaaabaaabbbbaaababbbabababababbbbaababbbababaabaaaaaababbbaabbaaaababbabbaabbbbbbbbabbaabbbbbaabaababbaaaaaabaaaabbbabaabbbaaabbbababbbaababbbabbaabaaabbabaaaabaabaaaabbbababaabbaabaabaabaabbaabbbbbbbabababaabbbbababaababaaabbbbaabbbbbbaabbbbaaabbbaabababbaababababbaaaabbbbbabababbbbbbaababaabbbabaabbbabbabbbbbababababbababbbbaaabaaaaaabbbbbbbbbbaaaaaaabbaaabaaaababbaaaaabbbaaaaababbaaabbbbbaaabbaabbababaabbaabaaaaabbaaabbbaaababbabaaabbabbabbabbbabbababbbaabaaaaaaaababbbbbaabbaabbaaaaaaabbbbbbbabbabbabbbababbbababbaabbbabbbaaabbbbaabaabaaaaabaaaaabbbaaababbbababbbabbabaabaabaaaabababaabbbabbbababbaaabaababbbaaabaaaabaaaabbbbaabbabababababababababbabbaabbaaabbbbaabbbabbbbbbaaaaabbbaabbbbababbbabaaaaabaabbabbaabbaabaaababaaaabaababbbaabbabbaaaaabaaabaababbababbababbaaabbbbbababbbbaabbaabaabbabbbbbaabbbaababbbaaabababbaabbabaaabaabbaaaabaaaabababbbbbbbbbaabbaaaaabbabaabbbbaaabbaaaaaaabaabbbabbabbbbbbaaabbaaabbbababbabbbababbbbaaabaabaabbbaabaababbaabbaaababbbabbaabaabaababbabababaabbabbaabbaabaabbbbbaabbbabbabbbabbbbaabbbbaaabaaabbaaaaababbbababbbabbbbabaabbaabababaaabbbbaaaaabbbbabbbabbbbbaabbaabbbbaaaabbbbbbbbabbbaabaaabbbbabaabaababbbbabaabaabaabbbbbbbbaaabbbaabbaaababbabbaaabbabbbbbabbaababaabbaabbaabbabbaabbabbaabaaaabbaaaaaaabbbbaaaabaaabbbbbaabaababbbaabbababbbbabbabbbaaaaabbaabbababbaaaaaababbabbaababaaaaabaabbababbbbbaabbaaaabaaabaabbbbbaabbabbbabaaabaabababbbaaaaabbbbbbbabbaaaaaaaababbaaaaaabababaaabbbbaaabbabaaabbabaaaabbaaaaaabababaaaabbaaabbbabbbbabbbabbaabbbabaabbbbbbaababaabbaabaabbbbbabbbababbabaaabbabbbbababaaaaaaaaaabbbbaaaabbabaabbaaaaaaaaaabbaaabbabbbbbababbbbbbbbbbaabbbbbbabaabbbaaaabbaabbaaaaaaabaabbaaabbabbbababbbbabbabbbbabaaaaaabaabbaaaaaaabbabababbabbabbbbbbabaaabbabbbabbaaabbbaabbbbbabaabbbbababababbabbbbbbabbbbbabbbabbabaaabbababbabbabaaaaaabaabbabbaaababbaabbbaaabbabaabbbabaaaabaabbbabbaaababaaaabbabbbabaaaaaababaabbaabbbbabbaababaababaabaaaaabbaaaaaabbbbabbbaaababbababaaababaababaabbabbbabbabbaabbaabbbbabbaaaaaaababaaaabaabbbbbaabaabbbaababbbaaabbaaaabbabbaababbaabbbaabbabaaaabbabbbbaaabaaabbabbaabaabababaaaabaaaaabbaaababbaaabaaabaaababaabbbabbabaabaabbaaababbbbababbaaababbabbbabbbbabaaabbabbaaabbbababbababababbaabbbbbababababaababbbabaaaabbaabaaaabababaabbabbaabaaaababaaaabaabbbababbaaabaaaabaabbbbababaaaaabaabababbaaaaabbbababbbaababbabbaaaababaaaaabaabaaaaaabaaabbbabababababaabbbabaaabbaabbbbabaabaaabababbbaabbaabbaabbababaaaaabbbbabaabbabbabbbbaabbbaaaabbbaabaabbabbababbaaaaaaabbaabaaaaaabbabbabaabaaabbaaabbababbabbbbbbabbaabbaabababbaabaaabaabbbbbbbabbaaaabaaaaaabbabbbbaaabbaabbbbaaaabababaababbabaaaabbabbbbaabbbbbbbbbbbaabbaabbbaabbbbbaaababbbaabbabaabbaabbbbabbbabaaabbaabababbabaabaabbbaaaaabaabbbaabbaabbbaabbababbababbababbbaaaabaabbbabbaaaabaaabbaaaabbbbbbaabaaaabbababbaabaababbababaaaaaabbabbbbbababbabaababaabababaababbbaabaaaabbabbaaababbaabaaababbbaaabbaabbbbbbabbbbbbbbabaabaabbbbbabababbabaaabaaabaaaabbbababaababbabbaaaabababababaabbbababbabbbbbabaabbabbaabaaababbabbbbaabbabbabbbbababaaabbababbaabaaaabbbbabbbabaaababaabbaaaabbbaaaabababaabbbabababbbbbbaababbababbaabbbbaaaabaabbaaaabbbabbaaabaaaabbababaaaaaaabaabbaaabbaabaabbbaaabbbbbaababbbbbbbababbaababaabbbaababbbabbbbbbbaabaaaabbabaabaababaaaaabbaaaaabaabababaaaaaaabbabaabababbbaaaabababbbbbbbaababbbabaaaaaababbabbabaabaaaaaaaabbaabaabaabbbababbbbababababbaabaaaabbbbabbababaaabbaaabbbababbbbabbbaabbbbbaabaaaaaaabbaaabbbbbaaabbbababbbabbbaabbabaaaababbaaabbbbbababbaaaabbbbaaaaabaabbbbaaabbbababaaabbbbababaaaaaaaaababbaaabaababbabbabbaababababbababbbaaaaaabaabaabaaababaaaababbababbbababbbabbaabbbbbaabbbbaabbbbbabaaaaabbbabababaaabbbaabbbaaaaababbbaaaaaaabbbbaababbbbbababbabbababbabbaaabbabaaaabbbbabbaabbabbaaabbbababbbbaaabbaaaabbbbaaabbbabbbababbababaaaaabaaabaaabbabbbbabababbbbbbbabaabbbbbababbaaaabbabbabaabbabbababbbabbababbaaaaabbaabaaabaabbbabbbabababaabaabbbbbbabbaababbaaabbababbabbaaaabaabbabbbabbaaaabababbbaabbbaaababaabaaaabbabbbaaaabaaabaabbbaaaaabbbbbbbbaaaaabbbababbbaaabbaaabaababbaabbaaaabababbbaabaaabaaabbbbaaaabbbaaabbbbbaabbaabbbaaabbbabababbbbbbaaaaaabababbabaabbbbababbabbbababbbababbbbabbbbabaaaaabbaaaaaababaabbabbaabaababbaaabbaaaabbbabbbbaabbabaabaababaababaaabbbbbaabbabbabaabaabbabbbabbabababbbbbaabbbaabaaaaabbbbabaaaabbabbbaabaabbabaababbbabaaabababbbaabbababbaaabaaaabbaaabaaaabbbbbabbbabbbbbaaabaabbabababababbaaaaaabaaaabaabbbababbabababbbaabbabbabbaababbabbbbaaabbabbababbbaabbabbbbaabbbabaabbababbaababbaaabaababaaaabbaaabbbbabbbbaaabbbbaabaaabaabababbbaabababbaaabbbbbabbbabbabbbabbabbabaaababbbbaabbabaaaabbbaaabbaaaaababaababbaabbbababababbbbaaaaaabbaabaaaabaaaaaaabbabbbbaababbbbababbaaaabbbaabbbbaaaabaababaabbbbbaaabbbbaabaaaababababbbaabbaaaabaabbabbabbababbaababaabbbbbbbbbababbbaaaabbabaaabbaaabbababbbbbbbbbbaababbabbbababbaaabaaaaabbbbbaaaabaaaabbabaababbaabbbabbaabbbaaaabbabaababaaabbbababbababaabaaabaaabaaaabbbaabbbbabaabbaaaaaaabbaaaaabbbabbbaabbbaabababbaaabbaaabbaabbbabbaabbaaabbababababbbbabbaaaabaabaaaabaaabbbaabaaaaabbbabbaaabaaabaababaaaaaababbbabaaabbaababbbabaabaabbabaababbaaabaaabbbbaabbbbbabaabbbbaababaaaabbbbbbaababaababaaabbbaaaaaaaaaababbbaababbababbbabbababababaaabbaaabbaababbbbabbbbbbbababaaabbbbabbabbabbbaaaabbbbbbaabbbbbaaabbbabbaabbaaaabaabbbbbbbabaababbababbbababababbababbbaababbbabbabaababbabbaabababbaabaabaabbaaabbaaababbbbbbababaaababbbabbbababbbbabbaabbaaabbbaabaaaaaaabbaababaababaabbabbbbbaaaabbbabbababbbbbabbababaaaaabbabbababaaabaabaabaaaaabbabbabababbababbbaaaababbaaaaaaabbaaababaababbbbaaaabbbaabaababaaaabbababaaabbaaabaaabbaaaababbaabbbbbbabbbaabaaaaaabbbaaabbaabbabaaaabaaabbababaaababababbbbaabbbaabbbababbaababbbabbbabbabaabbababababbbbbaabaaabbbaababbbbabbbaabbabaaabbbbbabbbabbbbabaabbabbbbaabaaabbbaabaaaabaabbaabbaabababaaabbbbaaaaaabbbababbabaaabbbbababbabaaabbbaaaaaaabbababbbbabaaabababbaaaaabbbaababbaaababbababaabbbbbabaaababbbbbbbaaaaaaabbaaabbababbabbbaaaaababbaaaaabaabbaabaabaaabaaaaababbabbaaabbabbbbaabbabbabbabbbbabaabbabababbabbbbaababbabbbabbabbbabaaaaaababbbabaaaaabbbbbaaaababbbbababbbbbabbbbbbbbabbaaabbabaaaaabbaabbabaabbaabbaababbabaabaaababbbbbaaababababbaabbaabbabbababbabbaaaabababbbbabbbaaabababaaaabbbabbaabbbabaabbaaaabbaababababbbababbbbababaaaabaaabbbabbaabbbaabbabbbabbbaaabaaabaaaabaabababbbabbaaaabbaababababaabaabbaabbaababbaaabaababbbbabaaaaaabbbaabbaaabaabbbbaaabbaabaabbaababaabbbabbbabbbabaaababaababaababaaabbbbbabbbbbaabbbaaabaabbbabaabababbabababaaaabbbaabbbabaaabbabbbaabbbaabaaaaabbbabbabaababaaaababbbbaaaaaabaaaabbabbbbabbbaabaabbbabaabbbabababbbbbbbbaabaabbaaaaabbbbabbbaabbabaaabaaaabbabaabbbbbbaaaabbbababaabaabbbaaaaaaaabbbbabbbabbbaaabbbbabaabbaaabbababaabaabbaabaababbabbbabbbababbbbabbbbabbbaabbbabbaababbabbabbaabaabbaababbababababaaabbaabaabaaabababbabaabbaaababbbaaababbababaabbabaaabbbaaaabaababbbabaabbaaaabbbaababaabbbbaababbbbbaabbaaaaaabababaaabbababbaaabbaabababaabbbbbbabbbbbaabaabbaaabbaabbbbabbbaabbabaaaabbbababaabaabaaaabbabbbabbaabbbbbabaaabbabbabbbbbaabaaabbabababbaaabbbaabaabbbbbaaaaabbaaaabbbabbbaabaabbabbabbabbaabababbbbbbbbabaabaabbbabbbabbababbbaabbabaabbbaabaaaabbaabbaabbbabaabbaabaabbbabaaabbaaabbbaaaabbbbbaaaabbbabbbbaaababbbbbbbbababbaabbabbabbbbbabaaaabaabbaabbbbbabbabaaaaaabaababbabbabbaabbabbbabbbbaaabbbaabbbaabbbaaaababbbbbaaabaababbbbbabbbaabbaabbbbaaabbbbbbaabaaaabaaabaaabbabbaaabbaababaaabbaababbabbaaaabababbbabbaaabaaaaabbaabababbaabaaaabaabbbbaaaaabbaabbbaaabbabbbaaabbabbbabbbbbbababbbbaaabaaababbbabbaababbbbbabbabababbbbbabbaaaaaabbababbbababaaababbaabbabbbbaaabbbababaaaabababaaababbbababaabaaaabbabbbbabababababbbbbbaaabaaabaaabaababaaababbababbababbabbbabaabbabaaaaabaaabaaaabaaaabbabbaababbaababaabaabaabaabbaababbaaaabaaaaaaaaabbbaabaabaababbaaaabbababaababaaabababaabbbbbaaabaabbbbaaaaaaabbaabababaabbbabbaaabbaaabaaababaaababbabbbbabaabbaaaaaababbbaaababbaaabbabababbbaaaabaaaabaabbabbaaaaababaaabbaabbbbabaabbbbbbbaaabbaabbbaabbbbbbbbbbaaaabbabaabaaababbabbbaabababbaaaabaabbabbbaaaabaaaaaaaaabaaabaabbbbbababbbbababbbbaaabbbaabababbbbbbbaabbaaabbbaabbaabaabababaabbababbbabaaaabbabaabbbaabbababbaaabbabbaabaaaaaaabbbbabaaabbbababbabbaababaabababbaaaabbabababbbaabbbaabbaaabaaabbabbbbbbaababaaabbbaaabbabbbaabbbaabbabbaababbbabbaabbbaaaaabbabaaabaaabaaabaaaabbabaabbabbbbbabaababbabbbbbbaaabbababaaaabaabbbaababaabaaaabaabaabbaaababbbbbbaabbbbbbaaabbaaaaabaabbbbababbaaabaaabbabbaaabbababbabaaabbababbbaabaabbbabbbabbbbabbbbbbbbbabababbbababbbababbbabbbabbaabaaababaabbbbaaaabbaabaaabbbbbbbaaabababbbbaabababbababaaabaabbabbaabbabaaabbabaababbababaaabbbbbbaabbbaaaabaaabaababbbbabaaabbaaababbbbabaaaaabbbabaabaabbabaabbaaaabbaabbbbabbababbaaaababbbababbabbbbaaabbaaabaabababbbaaaaaaabbbbbaaababaaaabbbbaabaaaabaaababbbabbaaabaaabbabbabbbabaaaababaaaababaababaaaababbaaaaababbaababaaabbaabbbbaababbbaabaaababaaaabbbaabbbbbbaabbbbabbbabbaababbbbaabbbabaaaabaaabbbbbbaabaababababaaababbabbbbaababaaabaabbaabaaaaabbbbbbabbababaabaaabaabbaaabaaaaabbbaabbababbababaaababaaabbabbababaaaaababaabbbbbababaaaabaabbabababaabbaabaabababbbbaabbabaaaabbbbbbaaababbbbababbbbbabbaabbbbabbaababababbbbaaabbababbbbabaaabbbaaaababaababaaaabbababbabbbbbbaabaaaabaabbbbbbbbbababbbabbabbbbbabaabbababbaabbaabbbbbaabbbbbabaababaabaaaabbabbaabaabaabbababbababaaaabababaaaababababaabbbbaaaabbbabaababbabaaaaaaabbbbaaababbaaaabbbbabbbbaaaaaabaaaabbababaababbabbaabbbaaabbbbaaaaabababaabaaabbbaaabaaaaaaababababababbbaabbaabaaabbabbaabbbbaaaabbbababaabbbbbbbabbabaaabbaaaaaaabbababababbbbababbbababaaabbbabbbbababbbbbbbbabbbbababbabbbbaabaaaaababbabababaabbbaaabaabaabbaabaabbbbabbbbabaabababbabbaaaabaaaababbabababababaabbabbaabaabaaaabbaaabababbaababbabaaaaabbaaabaabaaabbbbbbabaababbbaabbaaabaababaaaaaaabbbaaabaaabbbbbabaaabbabbaabaabbaaababbbaabbbaabaaabaababaabbbbbabaaaaaaaaaaaabbaabbababaababbbbbaabbabaabbaabbaababaabbaaabbabbabbbbabbbabbabaaaababaabbabbabababbaaaaaaababbbabbbbabababbaabbbabababbbabbabbabbbabbbbbbababbaaabbaababaaaaabbbaaabababbabbaaabbabbaaaabaababaabbbaaabaaaabaabbabbaabaaaabbbbbabbabbbabaaabbbbbbababababaaaa")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1394Test.java b/src/test/java/com/fishercoder/secondthousand/_1394Test.java index ba43433c7d..df68892540 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1394Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1394Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1394; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1394Test { private _1394.Solution1 solution1; @@ -17,23 +17,21 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.findLucky(new int[]{2, 2, 3, 4})); + assertEquals(2, solution1.findLucky(new int[] {2, 2, 3, 4})); } @Test public void test2() { - assertEquals(3, solution1.findLucky(new int[]{1, 2, 2, 3, 3, 3})); + assertEquals(3, solution1.findLucky(new int[] {1, 2, 2, 3, 3, 3})); } @Test public void test3() { - assertEquals(-1, solution1.findLucky(new int[]{2, 2, 2, 3, 3})); + assertEquals(-1, solution1.findLucky(new int[] {2, 2, 2, 3, 3})); } @Test public void test4() { - assertEquals(-1, solution1.findLucky(new int[]{5})); + assertEquals(-1, solution1.findLucky(new int[] {5})); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1395Test.java b/src/test/java/com/fishercoder/secondthousand/_1395Test.java index 59e433fe98..759ddd2f4b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1395Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1395Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1395; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1395Test { private _1395.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numTeams(new int[]{2, 5, 3, 4, 1})); + assertEquals(3, solution1.numTeams(new int[] {2, 5, 3, 4, 1})); } @Test public void test2() { - assertEquals(0, solution1.numTeams(new int[]{2, 1, 3})); + assertEquals(0, solution1.numTeams(new int[] {2, 1, 3})); } @Test public void test3() { - assertEquals(4, solution1.numTeams(new int[]{1, 2, 3, 4})); + assertEquals(4, solution1.numTeams(new int[] {1, 2, 3, 4})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1399Test.java b/src/test/java/com/fishercoder/secondthousand/_1399Test.java index bd99b7a777..49a955e2b7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1399Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1399Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1399; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1399Test { private _1399.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals(5, solution1.countLargestGroup(24)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1400Test.java b/src/test/java/com/fishercoder/secondthousand/_1400Test.java index e0f0b2b750..079bfc4dd7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1400Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1400Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1400; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1400Test { private _1400.Solution1 solution1; @@ -48,5 +48,4 @@ public void test6() { public void test7() { assertEquals(true, solution1.canConstruct("jsautfnlcmwqpzycehdulmdencthhlzsnijd", 35)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1401Test.java b/src/test/java/com/fishercoder/secondthousand/_1401Test.java index e72c4a55ec..d809f47579 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1401Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1401Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1401; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1401Test { private _1401.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(false, solution1.checkOverlap(1, 1, 1, 1, -3, 2, -1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1403Test.java b/src/test/java/com/fishercoder/secondthousand/_1403Test.java index d971b77376..9d045f5287 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1403Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1403Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1403; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1403Test { private _1403.Solution1 solution1; @@ -18,17 +17,16 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(10, 9), solution1.minSubsequence(new int[]{4, 3, 10, 9, 8})); + assertEquals(Arrays.asList(10, 9), solution1.minSubsequence(new int[] {4, 3, 10, 9, 8})); } @Test public void test2() { - assertEquals(Arrays.asList(7, 7, 6), solution1.minSubsequence(new int[]{4, 4, 7, 6, 7})); + assertEquals(Arrays.asList(7, 7, 6), solution1.minSubsequence(new int[] {4, 4, 7, 6, 7})); } @Test public void test3() { - assertEquals(Arrays.asList(6), solution1.minSubsequence(new int[]{6})); + assertEquals(Arrays.asList(6), solution1.minSubsequence(new int[] {6})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1408Test.java b/src/test/java/com/fishercoder/secondthousand/_1408Test.java index 9f9c73a514..60ec328985 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1408Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1408Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1408; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1408; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1408Test { private _1408.Solution1 solution1; @@ -22,10 +21,9 @@ public void setup() { @Test public void test1() { - words = new String[]{"mass", "as", "hero", "superhero"}; + words = new String[] {"mass", "as", "hero", "superhero"}; expected = Arrays.asList("as", "hero"); actual = solution1.stringMatching(words); assertEquals(expected.containsAll(actual), actual.containsAll(expected)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1409Test.java b/src/test/java/com/fishercoder/secondthousand/_1409Test.java index 6212b90172..60d5da1bea 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1409Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1409Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1409; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1409Test { private _1409.Solution1 solution1; private static int[] queries; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - queries = new int[]{3, 1, 2, 1}; - assertArrayEquals(new int[]{2, 1, 2, 1}, solution1.processQueries(queries, 5)); + queries = new int[] {3, 1, 2, 1}; + assertArrayEquals(new int[] {2, 1, 2, 1}, solution1.processQueries(queries, 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1410Test.java b/src/test/java/com/fishercoder/secondthousand/_1410Test.java index f40f2c97c8..9c13a19a69 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1410Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1410Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1410; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1410Test { private _1410.Solution1 solution1; @@ -16,7 +16,8 @@ public void setup() { @Test public void test1() { - assertEquals("& is an HTML entity but &ambassador; is not.", solution1.entityParser("& is an HTML entity but &ambassador; is not.")); + assertEquals( + "& is an HTML entity but &ambassador; is not.", + solution1.entityParser("& is an HTML entity but &ambassador; is not.")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1413Test.java b/src/test/java/com/fishercoder/secondthousand/_1413Test.java index 25a5a0e8a3..d5b9e02f44 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1413Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1413Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1413; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1413Test { private _1413.Solution1 solution1; private static int[] nums; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{-3, 2, -3, 4, 2}; + nums = new int[] {-3, 2, -3, 4, 2}; assertEquals(5, solution1.minStartValue(nums)); } @Test public void test2() { - nums = new int[]{1, 2}; + nums = new int[] {1, 2}; assertEquals(1, solution1.minStartValue(nums)); } @Test public void test3() { - nums = new int[]{1, -2, -3}; + nums = new int[] {1, -2, -3}; assertEquals(5, solution1.minStartValue(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1414Test.java b/src/test/java/com/fishercoder/secondthousand/_1414Test.java index 55918fbfbf..db6846082a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1414Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1414Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1414; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1414Test { private _1414.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(3, solution1.findMinFibonacciNumbers(19)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1415Test.java b/src/test/java/com/fishercoder/secondthousand/_1415Test.java index 2898b04c3f..f71e4c28ee 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1415Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1415Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1415; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1415Test { private _1415.Solution1 solution1; @@ -19,5 +19,4 @@ public void setup() { public void test1() { assertEquals("cab", solution1.getHappyString(3, 9)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1417Test.java b/src/test/java/com/fishercoder/secondthousand/_1417Test.java index 39da21c693..84143d509d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1417Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1417Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1417; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1417Test { private _1417.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals("c2o0v1i9d", solution1.reformat("covid2019")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1418Test.java b/src/test/java/com/fishercoder/secondthousand/_1418Test.java index 6b19cf9aa4..b2724bbc27 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1418Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1418Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1418; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1418; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1418Test { private _1418.Solution1 solution1; @@ -21,23 +20,51 @@ public void setup() { @Test public void test1() { - orders = Arrays.asList(Arrays.asList("Laura", "2", "Bean Burrito"), Arrays.asList("Jhon", "2", "Beef Burrito"), Arrays.asList("Melissa", "2", "Soda")); - expected = Arrays.asList(Arrays.asList("Table", "Bean Burrito", "Beef Burrito", "Soda"), Arrays.asList("2", "1", "1", "1")); + orders = + Arrays.asList( + Arrays.asList("Laura", "2", "Bean Burrito"), + Arrays.asList("Jhon", "2", "Beef Burrito"), + Arrays.asList("Melissa", "2", "Soda")); + expected = + Arrays.asList( + Arrays.asList("Table", "Bean Burrito", "Beef Burrito", "Soda"), + Arrays.asList("2", "1", "1", "1")); assertEquals(expected, solution1.displayTable(orders)); } @Test public void test2() { - orders = Arrays.asList(Arrays.asList("James", "12", "Fried Chicken"), Arrays.asList("Ratesh", "12", "Fried Chicken"), Arrays.asList("Amadeus", "12", "Fried Chicken"), Arrays.asList("Adam", "1", "Canadian Waffles"), Arrays.asList("Brianna", "1", "Canadian Waffles")); - expected = Arrays.asList(Arrays.asList("Table", "Canadian Waffles", "Fried Chicken"), Arrays.asList("1", "2", "0"), Arrays.asList("12", "0", "3")); + orders = + Arrays.asList( + Arrays.asList("James", "12", "Fried Chicken"), + Arrays.asList("Ratesh", "12", "Fried Chicken"), + Arrays.asList("Amadeus", "12", "Fried Chicken"), + Arrays.asList("Adam", "1", "Canadian Waffles"), + Arrays.asList("Brianna", "1", "Canadian Waffles")); + expected = + Arrays.asList( + Arrays.asList("Table", "Canadian Waffles", "Fried Chicken"), + Arrays.asList("1", "2", "0"), + Arrays.asList("12", "0", "3")); assertEquals(expected, solution1.displayTable(orders)); } @Test public void test3() { - orders = Arrays.asList(Arrays.asList("David", "3", "Ceviche"), Arrays.asList("Corina", "10", "Beef Burrito"), Arrays.asList("David", "3", "Fried Chicken"), Arrays.asList("Carla", "5", "Water"), Arrays.asList("Carla", "5", "Ceviche"), Arrays.asList("Rous", "3", "Ceviche")); - expected = Arrays.asList(Arrays.asList("Table", "Beef Burrito", "Ceviche", "Fried Chicken", "Water"), Arrays.asList("3", "0", "2", "1", "0"), Arrays.asList("5", "0", "1", "0", "1"), Arrays.asList("10", "1", "0", "0", "0")); + orders = + Arrays.asList( + Arrays.asList("David", "3", "Ceviche"), + Arrays.asList("Corina", "10", "Beef Burrito"), + Arrays.asList("David", "3", "Fried Chicken"), + Arrays.asList("Carla", "5", "Water"), + Arrays.asList("Carla", "5", "Ceviche"), + Arrays.asList("Rous", "3", "Ceviche")); + expected = + Arrays.asList( + Arrays.asList("Table", "Beef Burrito", "Ceviche", "Fried Chicken", "Water"), + Arrays.asList("3", "0", "2", "1", "0"), + Arrays.asList("5", "0", "1", "0", "1"), + Arrays.asList("10", "1", "0", "0", "0")); assertEquals(expected, solution1.displayTable(orders)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1422Test.java b/src/test/java/com/fishercoder/secondthousand/_1422Test.java index bff3252cb3..2e24796e2a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1422Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1422Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1422; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1422Test { private _1422.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(5, solution1.maxScore("00111")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1423Test.java b/src/test/java/com/fishercoder/secondthousand/_1423Test.java index e2d73dc0ab..35993ff149 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1423Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1423Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1423; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1423Test { private _1423.Solution1 solution1; private _1423.Solution2 solution2; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { - cardPoints = new int[]{1, 2, 3, 4, 5, 6, 1}; + cardPoints = new int[] {1, 2, 3, 4, 5, 6, 1}; expected = 12; k = 3; assertEquals(expected, solution1.maxScore(cardPoints, k)); @@ -30,7 +30,7 @@ public void test1() { @Test public void test2() { - cardPoints = new int[]{96, 90, 41, 82, 39, 74, 64, 50, 30}; + cardPoints = new int[] {96, 90, 41, 82, 39, 74, 64, 50, 30}; expected = 536; k = 8; assertEquals(expected, solution1.maxScore(cardPoints, k)); @@ -39,11 +39,10 @@ public void test2() { @Test public void test3() { - cardPoints = new int[]{100, 40, 17, 9, 73, 75}; + cardPoints = new int[] {100, 40, 17, 9, 73, 75}; expected = 248; k = 3; assertEquals(expected, solution1.maxScore(cardPoints, k)); assertEquals(expected, solution2.maxScore(cardPoints, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1424Test.java b/src/test/java/com/fishercoder/secondthousand/_1424Test.java index b72b8c684c..d0662b8efb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1424Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1424Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1424; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1424Test { private _1424.Solution1 solution1; @@ -18,26 +17,25 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{1, 4, 2, 7, 5, 3, 8, 6, 9}, solution1.findDiagonalOrder( - Arrays.asList( - Arrays.asList(1, 2, 3), - Arrays.asList(4, 5, 6), - Arrays.asList(7, 8, 9) - )) - ); + assertArrayEquals( + new int[] {1, 4, 2, 7, 5, 3, 8, 6, 9}, + solution1.findDiagonalOrder( + Arrays.asList( + Arrays.asList(1, 2, 3), + Arrays.asList(4, 5, 6), + Arrays.asList(7, 8, 9)))); } @Test public void test2() { - assertArrayEquals(new int[]{1, 6, 2, 8, 7, 3, 9, 4, 12, 10, 5, 13, 11, 14, 15, 16}, solution1.findDiagonalOrder( - Arrays.asList( - Arrays.asList(1, 2, 3, 4, 5), - Arrays.asList(6, 7), - Arrays.asList(8), - Arrays.asList(9, 10, 11), - Arrays.asList(12, 13, 14, 15, 16) - )) - ); + assertArrayEquals( + new int[] {1, 6, 2, 8, 7, 3, 9, 4, 12, 10, 5, 13, 11, 14, 15, 16}, + solution1.findDiagonalOrder( + Arrays.asList( + Arrays.asList(1, 2, 3, 4, 5), + Arrays.asList(6, 7), + Arrays.asList(8), + Arrays.asList(9, 10, 11), + Arrays.asList(12, 13, 14, 15, 16)))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1426Test.java b/src/test/java/com/fishercoder/secondthousand/_1426Test.java index 4e148e55d5..18c21d3f57 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1426Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1426Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1426; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1426Test { private _1426.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{1, 1, 3, 3, 5, 5, 7, 7}; + arr = new int[] {1, 1, 3, 3, 5, 5, 7, 7}; assertEquals(0, solution1.countElements(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1427Test.java b/src/test/java/com/fishercoder/secondthousand/_1427Test.java index 3cf5c6cd6d..98a3fd7305 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1427Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1427Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1427; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1427Test { private _1427.Solution1 solution1; private static int[][] shift; @@ -17,11 +17,11 @@ public void setup() { @Test public void test1() { - shift = new int[][]{ - {0, 1}, - {1, 2}, - }; + shift = + new int[][] { + {0, 1}, + {1, 2}, + }; assertEquals("cab", solution1.stringShift("abc", shift)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1428Test.java b/src/test/java/com/fishercoder/secondthousand/_1428Test.java index 8270bd667f..05f2410374 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1428Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1428Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.BinaryMatrix; import com.fishercoder.common.classes.BinaryMatrixImpl; import com.fishercoder.solutions.secondthousand._1428; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1428Test { private _1428.Solution1 solution1; private static BinaryMatrix binaryMatrix; @@ -19,11 +19,12 @@ public void setup() { @Test public void test1() { - binaryMatrix = new BinaryMatrixImpl(new int[][]{ - {0, 0}, - {1, 1} - }); + binaryMatrix = + new BinaryMatrixImpl( + new int[][] { + {0, 0}, + {1, 1} + }); assertEquals(0, solution1.leftMostColumnWithOne(binaryMatrix)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1431Test.java b/src/test/java/com/fishercoder/secondthousand/_1431Test.java index 22eaef0d6d..3722420667 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1431Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1431Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1431; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1431Test { private _1431.Solution1 solution1; private static int[] candies; @@ -19,8 +18,9 @@ public void setup() { @Test public void test1() { - candies = new int[]{2, 3, 5, 1, 3}; - assertEquals(Arrays.asList(true, true, true, false, true), solution1.kidsWithCandies(candies, 3)); + candies = new int[] {2, 3, 5, 1, 3}; + assertEquals( + Arrays.asList(true, true, true, false, true), + solution1.kidsWithCandies(candies, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1432Test.java b/src/test/java/com/fishercoder/secondthousand/_1432Test.java index 220e458425..0fbaf30195 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1432Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1432Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1432; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1432Test { private _1432.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(888, solution1.maxDiff(555)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1436Test.java b/src/test/java/com/fishercoder/secondthousand/_1436Test.java index 108bc8cdb8..4b3623fe6f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1436Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1436Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1436; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1436; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1436Test { private _1436.Solution1 solution1; @@ -20,8 +19,11 @@ public void setup() { @Test public void test1() { - paths = Arrays.asList(Arrays.asList("Lima", "Sao Paulo"), Arrays.asList("New York", "Lima"), Arrays.asList("London", "New York")); + paths = + Arrays.asList( + Arrays.asList("Lima", "Sao Paulo"), + Arrays.asList("New York", "Lima"), + Arrays.asList("London", "New York")); assertEquals("Sao Paulo", solution1.destCity(paths)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1437Test.java b/src/test/java/com/fishercoder/secondthousand/_1437Test.java index cb4c16e0fe..538d9a7a94 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1437Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1437Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1437; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1437Test { private _1437.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 0, 0, 0, 1, 0, 0, 1}; + nums = new int[] {1, 0, 0, 0, 1, 0, 0, 1}; assertEquals(true, solution1.kLengthApart(nums, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1438Test.java b/src/test/java/com/fishercoder/secondthousand/_1438Test.java index 0fe4af5957..9452de4fea 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1438Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1438Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1438; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1438Test { private _1438.Solution1 solution1; private static int[] nums; @@ -20,7 +20,7 @@ public void setup() { @Test public void test1() { expected = 2; - nums = new int[]{8, 2, 4, 7}; + nums = new int[] {8, 2, 4, 7}; limit = 4; assertEquals(expected, solution1.longestSubarray(nums, limit)); } @@ -28,7 +28,7 @@ public void test1() { @Test public void test2() { expected = 4; - nums = new int[]{10, 1, 2, 4, 7, 2}; + nums = new int[] {10, 1, 2, 4, 7, 2}; limit = 5; assertEquals(expected, solution1.longestSubarray(nums, limit)); } @@ -36,9 +36,8 @@ public void test2() { @Test public void test3() { expected = 3; - nums = new int[]{4, 2, 2, 2, 4, 4, 2, 2}; + nums = new int[] {4, 2, 2, 2, 4, 4, 2, 2}; limit = 0; assertEquals(expected, solution1.longestSubarray(nums, limit)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1439Test.java b/src/test/java/com/fishercoder/secondthousand/_1439Test.java index 56ea739440..6c468a1410 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1439Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1439Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1439; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1439Test { private _1439.Solution1 solution1; private static int[][] mat; @@ -20,7 +20,9 @@ public void setup() { @Test public void test1() { - mat = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3,11],[2,4,6]"); + mat = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3,11],[2,4,6]"); expected = 7; k = 5; assertEquals(expected, solution1.kthSmallest(mat, k)); @@ -28,7 +30,9 @@ public void test1() { @Test public void test2() { - mat = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3,11],[2,4,6]"); + mat = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3,11],[2,4,6]"); expected = 17; k = 9; assertEquals(expected, solution1.kthSmallest(mat, k)); @@ -36,7 +40,9 @@ public void test2() { @Test public void test3() { - mat = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,10,10],[1,4,5],[2,3,6]"); + mat = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,10,10],[1,4,5],[2,3,6]"); expected = 9; k = 7; assertEquals(expected, solution1.kthSmallest(mat, k)); @@ -44,10 +50,11 @@ public void test3() { @Test public void test4() { - mat = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,1,10],[2,2,9]"); + mat = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,1,10],[2,2,9]"); expected = 12; k = 7; assertEquals(expected, solution1.kthSmallest(mat, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1441Test.java b/src/test/java/com/fishercoder/secondthousand/_1441Test.java index ea83e2389b..448e1b2a30 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1441Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1441Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1441; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1441Test { private _1441.Solution1 solution1; private static int[] target; @@ -19,8 +18,7 @@ public void setup() { @Test public void test1() { - target = new int[]{1, 3}; + target = new int[] {1, 3}; assertEquals(Arrays.asList("Push", "Push", "Pop", "Push"), solution1.buildArray(target, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1446Test.java b/src/test/java/com/fishercoder/secondthousand/_1446Test.java index 78cabcf4eb..5753ac2279 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1446Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1446Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1446; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1446Test { private _1446.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.maxPower("leetcode")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1447Test.java b/src/test/java/com/fishercoder/secondthousand/_1447Test.java index e0fda03eb8..c9e47d63e3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1447Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1447Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1447; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1447Test { private _1447.Solution1 solution1; @@ -20,5 +19,4 @@ public void setup() { public void test1() { assertEquals(Arrays.asList("1/2"), solution1.simplifiedFractions(2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1448Test.java b/src/test/java/com/fishercoder/secondthousand/_1448Test.java index d6d13ad53e..66dca235b1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1448Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1448Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1448; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1448Test { private _1448.Solution1 solution1; @@ -47,5 +46,4 @@ public void test5() { root = TreeUtils.constructBinaryTree(Arrays.asList(9, null, 3, 6)); assertEquals(1, solution1.goodNodes(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1450Test.java b/src/test/java/com/fishercoder/secondthousand/_1450Test.java index 8f9fd9dbd2..32c84e6b98 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1450Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1450Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1450; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1450Test { private _1450.Solution1 solution1; private static int[] startTime; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - startTime = new int[]{1, 2, 3}; - endTime = new int[]{3, 2, 7}; + startTime = new int[] {1, 2, 3}; + endTime = new int[] {3, 2, 7}; assertEquals(1, solution1.busyStudent(startTime, endTime, 4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1451Test.java b/src/test/java/com/fishercoder/secondthousand/_1451Test.java index d55ff85236..472b600a06 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1451Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1451Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1451; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1451Test { private _1451.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("Is cool leetcode", solution1.arrangeWords("Leetcode is cool")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1452Test.java b/src/test/java/com/fishercoder/secondthousand/_1452Test.java index 51e54fbbbc..455100f19a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1452Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1452Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1452; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1452; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1452Test { private _1452.Solution1 solution1; @@ -33,10 +32,28 @@ public void test1() { @Test public void test2() { favoriteCompanies = new ArrayList<>(); - favoriteCompanies.add(Arrays.asList("nxaqhyoprhlhvhyojanr", "ovqdyfqmlpxapbjwtssm", "qmsbphxzmnvflrwyvxlc", "udfuxjdxkxwqnqvgjjsp", "yawoixzhsdkaaauramvg", "zycidpyopumzgdpamnty"));//6 - favoriteCompanies.add(Arrays.asList("nxaqhyoprhlhvhyojanr", "ovqdyfqmlpxapbjwtssm", "udfuxjdxkxwqnqvgjjsp", "yawoixzhsdkaaauramvg", "zycidpyopumzgdpamnty"));//5 - favoriteCompanies.add(Arrays.asList("ovqdyfqmlpxapbjwtssm", "qmsbphxzmnvflrwyvxlc", "udfuxjdxkxwqnqvgjjsp", "yawoixzhsdkaaauramvg", "zycidpyopumzgdpamnty"));//5 + favoriteCompanies.add( + Arrays.asList( + "nxaqhyoprhlhvhyojanr", + "ovqdyfqmlpxapbjwtssm", + "qmsbphxzmnvflrwyvxlc", + "udfuxjdxkxwqnqvgjjsp", + "yawoixzhsdkaaauramvg", + "zycidpyopumzgdpamnty")); // 6 + favoriteCompanies.add( + Arrays.asList( + "nxaqhyoprhlhvhyojanr", + "ovqdyfqmlpxapbjwtssm", + "udfuxjdxkxwqnqvgjjsp", + "yawoixzhsdkaaauramvg", + "zycidpyopumzgdpamnty")); // 5 + favoriteCompanies.add( + Arrays.asList( + "ovqdyfqmlpxapbjwtssm", + "qmsbphxzmnvflrwyvxlc", + "udfuxjdxkxwqnqvgjjsp", + "yawoixzhsdkaaauramvg", + "zycidpyopumzgdpamnty")); // 5 assertEquals(Arrays.asList(0), solution1.peopleIndexes(favoriteCompanies)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1455Test.java b/src/test/java/com/fishercoder/secondthousand/_1455Test.java index 4a16c688a6..216b93b41c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1455Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1455Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1455; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1455Test { private _1455.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(4, solution1.isPrefixOfWord("i love eating burger", "burg")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1456Test.java b/src/test/java/com/fishercoder/secondthousand/_1456Test.java index a6d10737ed..a001e5fc20 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1456Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1456Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1456; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1456Test { private _1456.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(3, solution1.maxVowels("abciiidef", 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1457Test.java b/src/test/java/com/fishercoder/secondthousand/_1457Test.java index 31e2cf2b6b..35f96690cd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1457Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1457Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1457; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1457Test { private _1457.Solution1 solution1; @@ -23,5 +22,4 @@ public void test1() { TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(2, 3, 1, 3, 1, null, 1)); assertEquals(2, solution1.pseudoPalindromicPaths(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1460Test.java b/src/test/java/com/fishercoder/secondthousand/_1460Test.java index c1bef57645..ec0c6e1ad1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1460Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1460Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1460; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1460Test { private _1460.Solution1 solution1; private static int[] target; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - target = new int[]{1, 2, 3, 4}; - arr = new int[]{2, 4, 1, 3}; + target = new int[] {1, 2, 3, 4}; + arr = new int[] {2, 4, 1, 3}; assertEquals(true, solution1.canBeEqual(target, arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1461Test.java b/src/test/java/com/fishercoder/secondthousand/_1461Test.java index 3912ffd5f0..a724aa9718 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1461Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1461Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1461; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1461Test { private _1461.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(true, solution1.hasAllCodes("00110110", 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1462Test.java b/src/test/java/com/fishercoder/secondthousand/_1462Test.java index 0a0bb10192..28eef6bca4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1462Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1462Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1462; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1462Test { private _1462.Solution1 solution1; @@ -19,28 +18,41 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(false, true), solution1.checkIfPrerequisite(3, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[1,0],[2,0]"), - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[0,1],[2,0]"))); + assertEquals( + Arrays.asList(false, true), + solution1.checkIfPrerequisite( + 3, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,0],[2,0]"), + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,1],[2,0]"))); } @Test public void test2() { - assertEquals(Arrays.asList(true, true), - solution1.checkIfPrerequisite(3, + assertEquals( + Arrays.asList(true, true), + solution1.checkIfPrerequisite( + 3, CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( "[1,2],[1,0],[2,0]"), - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[1,0],[1,2]"))); + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[1,0],[1,2]"))); } @Test public void test3() { - assertEquals(Arrays.asList(true, false, true, true, true, true, true, true, false, false, true, true, false, false, true, true, true, true, false, false, true, false, true, false, true, false, true, true, false, true, true, false, false, true, false, false, true, true, true, false), - solution1.checkIfPrerequisite(7, + assertEquals( + Arrays.asList( + true, false, true, true, true, true, true, true, false, false, true, true, + false, false, true, true, true, true, false, false, true, false, true, + false, true, false, true, true, false, true, true, false, false, true, + false, false, true, true, true, false), + solution1.checkIfPrerequisite( + 7, CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( "[2,3],[2,1],[2,0],[3,4],[3,6],[5,1],[5,0],[1,4],[1,0],[4,0],[0,6]"), - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[3,0],[6,4],[5,6],[2,6],[2,3],[5,6],[4,0],[2,6],[3,5],[5,3],[1,6],[1,0],[3,5],[6,5],[2,3],[3,0],[3,4],[3,4],[2,5],[0,3],[4,0],[6,4],[5,0],[6,5],[5,6],[6,5],[1,0],[3,4],[1,5],[1,4],[3,6],[0,1],[1,2],[5,1],[5,3],[5,3],[3,4],[5,4],[5,4],[5,3]"))); + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[3,0],[6,4],[5,6],[2,6],[2,3],[5,6],[4,0],[2,6],[3,5],[5,3],[1,6],[1,0],[3,5],[6,5],[2,3],[3,0],[3,4],[3,4],[2,5],[0,3],[4,0],[6,4],[5,0],[6,5],[5,6],[6,5],[1,0],[3,4],[1,5],[1,4],[3,6],[0,1],[1,2],[5,1],[5,3],[5,3],[3,4],[5,4],[5,4],[5,3]"))); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1464Test.java b/src/test/java/com/fishercoder/secondthousand/_1464Test.java index 5ae409707e..90ceb195fa 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1464Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1464Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1464; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1464Test { private _1464.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{3, 4, 5, 2}; + nums = new int[] {3, 4, 5, 2}; assertEquals(12, solution1.maxProduct(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1466Test.java b/src/test/java/com/fishercoder/secondthousand/_1466Test.java index 95e220cb5f..1e77c533c0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1466Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1466Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1466; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1466Test { private _1466.Solution1 solution1; private _1466.Solution2 solution2; @@ -19,18 +19,13 @@ public void setup() { @Test public void test1() { - connections = new int[][]{ - {0, 1}, {1, 3}, {2, 3}, {4, 0}, {4, 5} - }; + connections = new int[][] {{0, 1}, {1, 3}, {2, 3}, {4, 0}, {4, 5}}; assertEquals(3, solution1.minReorder(6, connections)); } @Test public void test2() { - connections = new int[][]{ - {0, 1}, {1, 3}, {2, 3}, {4, 0}, {4, 5} - }; + connections = new int[][] {{0, 1}, {1, 3}, {2, 3}, {4, 0}, {4, 5}}; assertEquals(3, solution2.minReorder(6, connections)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1469Test.java b/src/test/java/com/fishercoder/secondthousand/_1469Test.java index f13e852953..2d18b767c8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1469Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1469Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1469; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1469Test { private _1469.Solution1 solution1; @@ -19,12 +18,19 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(4), solution1.getLonelyNodes(TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, 4)))); + assertEquals( + Arrays.asList(4), + solution1.getLonelyNodes( + TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, 4)))); } @Test public void test2() { - assertEquals(Arrays.asList(6, 2), solution1.getLonelyNodes(TreeUtils.constructBinaryTree(Arrays.asList(7, 1, 4, 6, null, 5, 3, null, null, null, null, null, 2)))); + assertEquals( + Arrays.asList(6, 2), + solution1.getLonelyNodes( + TreeUtils.constructBinaryTree( + Arrays.asList( + 7, 1, 4, 6, null, 5, 3, null, null, null, null, null, 2)))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1470Test.java b/src/test/java/com/fishercoder/secondthousand/_1470Test.java index 79a97d5157..40d0e67851 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1470Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1470Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1470; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1470Test { private _1470.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 5, 1, 3, 4, 7}; - assertArrayEquals(new int[]{2, 3, 5, 4, 1, 7}, solution1.shuffle(nums, 3)); + nums = new int[] {2, 5, 1, 3, 4, 7}; + assertArrayEquals(new int[] {2, 3, 5, 4, 1, 7}, solution1.shuffle(nums, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1471Test.java b/src/test/java/com/fishercoder/secondthousand/_1471Test.java index f7ae39abc4..66870118ea 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1471Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1471Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1471; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1471Test { private _1471.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 4, 5}; - assertArrayEquals(new int[]{5, 1}, solution1.getStrongest(nums, 2)); + nums = new int[] {1, 2, 3, 4, 5}; + assertArrayEquals(new int[] {5, 1}, solution1.getStrongest(nums, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1472Test.java b/src/test/java/com/fishercoder/secondthousand/_1472Test.java index 194b334da3..da38f127aa 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1472Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1472Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1472; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1472Test { private _1472.Solution1.BrowserHistory browserHistory; @@ -22,5 +22,4 @@ public void test1() { assertEquals("google.com", browserHistory.back(2)); assertEquals("leetcode.com", browserHistory.back(7)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1474Test.java b/src/test/java/com/fishercoder/secondthousand/_1474Test.java index ba56285d98..e6c37eb7ea 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1474Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1474Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1474; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1474Test { private _1474.Solution1 solution1; private static ListNode head; @@ -19,14 +19,19 @@ public void setup() { @Test public void test1() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 2, 6, 7, 11, 12}), solution1.deleteNodes(head, 2, 3)); + head = + LinkedListUtils.contructLinkedList( + new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 6, 7, 11, 12}), + solution1.deleteNodes(head, 2, 3)); } @Test public void test2() { - head = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}); - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 5, 9}), solution1.deleteNodes(head, 1, 3)); + head = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 5, 9}), + solution1.deleteNodes(head, 1, 3)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1475Test.java b/src/test/java/com/fishercoder/secondthousand/_1475Test.java index 33bbbfb589..8c920fe8a6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1475Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1475Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1475; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1475Test { private _1475.Solution1 solution1; private static int[] prices; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - prices = new int[]{8, 4, 6, 2, 3}; - assertArrayEquals(new int[]{4, 2, 4, 2, 3}, solution1.finalPrices(prices)); + prices = new int[] {8, 4, 6, 2, 3}; + assertArrayEquals(new int[] {4, 2, 4, 2, 3}, solution1.finalPrices(prices)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1476Test.java b/src/test/java/com/fishercoder/secondthousand/_1476Test.java index 9f27059847..80931ad63d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1476Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1476Test.java @@ -1,26 +1,26 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1476; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1476Test { private _1476.Solution1.SubrectangleQueries solution1; private static int[][] rectangle; @Test public void test1() { - rectangle = new int[][]{ - {1, 2, 1}, - {4, 3, 4}, - {3, 2, 1}, - {1, 1, 1} - }; + rectangle = + new int[][] { + {1, 2, 1}, + {4, 3, 4}, + {3, 2, 1}, + {1, 1, 1} + }; solution1 = new _1476.Solution1.SubrectangleQueries(rectangle); assertEquals(1, solution1.getValue(0, 2)); solution1.updateSubrectangle(0, 0, 3, 2, 5); assertEquals(5, solution1.getValue(0, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1480Test.java b/src/test/java/com/fishercoder/secondthousand/_1480Test.java index 599f026fcf..1a37e2e62e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1480Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1480Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1480; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1480Test { private _1480.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 2, 3, 4}; - assertArrayEquals(new int[]{1, 3, 6, 10}, solution1.runningSum(nums)); + nums = new int[] {1, 2, 3, 4}; + assertArrayEquals(new int[] {1, 3, 6, 10}, solution1.runningSum(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1481Test.java b/src/test/java/com/fishercoder/secondthousand/_1481Test.java index 42c9486807..e12ba4457d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1481Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1481Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1481; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1481Test { private _1481.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{5, 5, 4}; + arr = new int[] {5, 5, 4}; assertEquals(1, solution1.findLeastNumOfUniqueInts(arr, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1482Test.java b/src/test/java/com/fishercoder/secondthousand/_1482Test.java index d5e363c81d..2128c8d339 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1482Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1482Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1482; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1482Test { private _1482.Solution1 solution1; private static int expected; @@ -21,7 +21,7 @@ public void setup() { @Test public void test1() { expected = 3; - bloomDay = new int[]{1, 10, 3, 10, 2}; + bloomDay = new int[] {1, 10, 3, 10, 2}; m = 3; k = 1; assertEquals(expected, solution1.minDays(bloomDay, m, k)); @@ -30,7 +30,7 @@ public void test1() { @Test public void test2() { expected = -1; - bloomDay = new int[]{1, 10, 3, 10, 2}; + bloomDay = new int[] {1, 10, 3, 10, 2}; m = 3; k = 2; assertEquals(expected, solution1.minDays(bloomDay, m, k)); @@ -39,7 +39,7 @@ public void test2() { @Test public void test3() { expected = 9; - bloomDay = new int[]{1, 10, 2, 9, 3, 8, 4, 7, 5, 6}; + bloomDay = new int[] {1, 10, 2, 9, 3, 8, 4, 7, 5, 6}; m = 4; k = 2; assertEquals(expected, solution1.minDays(bloomDay, m, k)); diff --git a/src/test/java/com/fishercoder/secondthousand/_1485Test.java b/src/test/java/com/fishercoder/secondthousand/_1485Test.java index 06a2a2806f..f51ae82a5f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1485Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1485Test.java @@ -25,5 +25,4 @@ public void test1() { _1485.NodeCopy actual = solution1.copyRandomBinaryTree(root); System.out.println("Finished."); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1486Test.java b/src/test/java/com/fishercoder/secondthousand/_1486Test.java index ee81d7c20a..a479da36dd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1486Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1486Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1486; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1486Test { private _1486.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(8, solution1.xorOperation(5, 0)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1487Test.java b/src/test/java/com/fishercoder/secondthousand/_1487Test.java index d2eb83a7d1..249a437690 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1487Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1487Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1487; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1487Test { private _1487.Solution1 solution1; private static String[] names; @@ -17,8 +17,8 @@ public void setup() { @Test public void test1() { - names = new String[]{"pes", "fifa", "gta", "pes(2019)"}; - assertArrayEquals(new String[]{"pes", "fifa", "gta", "pes(2019)"}, solution1.getFolderNames(names)); + names = new String[] {"pes", "fifa", "gta", "pes(2019)"}; + assertArrayEquals( + new String[] {"pes", "fifa", "gta", "pes(2019)"}, solution1.getFolderNames(names)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1490Test.java b/src/test/java/com/fishercoder/secondthousand/_1490Test.java index f5f4a3d180..87600a51ef 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1490Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1490Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.Node; import com.fishercoder.solutions.secondthousand._1490; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1490Test { private _1490.Solution1 solution1; @@ -26,5 +26,4 @@ public void test1() { child.children.add(rightGrandChild); assertEquals(root, solution1.cloneTree(root)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1491Test.java b/src/test/java/com/fishercoder/secondthousand/_1491Test.java index aedea7e95f..636ec664d2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1491Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1491Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1491; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1491Test { private _1491.Solution1 solution1; private static int[] salary; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - salary = new int[]{4000, 3000, 1000, 2000}; + salary = new int[] {4000, 3000, 1000, 2000}; assertEquals(2500.0000, solution1.average(salary)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1492Test.java b/src/test/java/com/fishercoder/secondthousand/_1492Test.java index 6b00bdf546..859435f4ec 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1492Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1492Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1492; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1492Test { private _1492.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(3, solution1.kthFactor(12, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1493Test.java b/src/test/java/com/fishercoder/secondthousand/_1493Test.java index a41da8c07d..2d3b90cdc1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1493Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1493Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1493; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1493Test { private _1493.Solution1 solution1; private _1493.Solution2 solution2; @@ -19,20 +19,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 0, 1}; + nums = new int[] {1, 1, 0, 1}; assertEquals(3, solution1.longestSubarray(nums)); } @Test public void test2() { - nums = new int[]{1, 1, 0, 1}; + nums = new int[] {1, 1, 0, 1}; assertEquals(3, solution2.longestSubarray(nums)); } @Test public void test3() { - nums = new int[]{0, 1, 1, 1, 0, 1, 1, 0, 1}; + nums = new int[] {0, 1, 1, 1, 0, 1, 1, 0, 1}; assertEquals(5, solution2.longestSubarray(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1496Test.java b/src/test/java/com/fishercoder/secondthousand/_1496Test.java index 7a3810eba8..5f7edc4323 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1496Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1496Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1496; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1496Test { private _1496.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(false, solution1.isPathCrossing("NES")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1502Test.java b/src/test/java/com/fishercoder/secondthousand/_1502Test.java index 757ac577f6..89a612829a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1502Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1502Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1502; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1502Test { private _1502.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{3, 5, 1}; + arr = new int[] {3, 5, 1}; assertEquals(true, solution1.canMakeArithmeticProgression(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1507Test.java b/src/test/java/com/fishercoder/secondthousand/_1507Test.java index 372d25e7a0..adc6105e74 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1507Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1507Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1507; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1507Test { private _1507.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("2052-10-20", solution1.reformatDate("20th Oct 2052")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1508Test.java b/src/test/java/com/fishercoder/secondthousand/_1508Test.java index 70ea497413..6baef1bc88 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1508Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1508Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1508; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1508Test { private _1508.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(13, solution1.rangeSum(new int[]{1, 2, 3, 4}, 4, 1, 5)); + assertEquals(13, solution1.rangeSum(new int[] {1, 2, 3, 4}, 4, 1, 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1509Test.java b/src/test/java/com/fishercoder/secondthousand/_1509Test.java index 57ecd5bc65..022fe68cac 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1509Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1509Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1509; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1509Test { private _1509.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.minDifference(new int[]{6, 6, 0, 1, 1, 4, 6})); + assertEquals(2, solution1.minDifference(new int[] {6, 6, 0, 1, 1, 4, 6})); } @Test public void test2() { - assertEquals(1, solution1.minDifference(new int[]{82, 81, 95, 75, 20})); + assertEquals(1, solution1.minDifference(new int[] {82, 81, 95, 75, 20})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1512Test.java b/src/test/java/com/fishercoder/secondthousand/_1512Test.java index cdda30460e..f1d64261e8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1512Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1512Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1512; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1512Test { private _1512.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.numIdenticalPairs(new int[]{1, 2, 3, 1, 1, 3})); + assertEquals(4, solution1.numIdenticalPairs(new int[] {1, 2, 3, 1, 1, 3})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1514Test.java b/src/test/java/com/fishercoder/secondthousand/_1514Test.java index 1cd40182e2..9c34abb670 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1514Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1514Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1514; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1514Test { private _1514.Solution1 solution1; private static int[][] edges; @@ -19,61 +19,237 @@ public void setup() { @Test public void test1() { - assertEquals(0.25, solution1.maxProbability(3, new int[][]{ - {0, 1}, - {1, 2}, - {0, 2} - }, new double[]{0.5, 0.5, 0.2}, 0, 2)); + assertEquals( + 0.25, + solution1.maxProbability( + 3, + new int[][] { + {0, 1}, + {1, 2}, + {0, 2} + }, + new double[] {0.5, 0.5, 0.2}, + 0, + 2)); } @Test public void test2() { - assertEquals(0.3, solution1.maxProbability(3, new int[][]{ - {0, 1}, - {1, 2}, - {0, 2} - }, new double[]{0.5, 0.5, 0.3}, 0, 2)); + assertEquals( + 0.3, + solution1.maxProbability( + 3, + new int[][] { + {0, 1}, + {1, 2}, + {0, 2} + }, + new double[] {0.5, 0.5, 0.3}, + 0, + 2)); } @Test public void test3() { - assertEquals(0.0, solution1.maxProbability(3, new int[][]{ - {0, 1} - }, new double[]{0.5}, 0, 2)); + assertEquals( + 0.0, solution1.maxProbability(3, new int[][] {{0, 1}}, new double[] {0.5}, 0, 2)); } @Test public void test4() { - assertEquals(0.16, solution1.maxProbability(5, new int[][]{ - {2, 3}, - {1, 2}, - {3, 4}, - {1, 3}, - {1, 4}, - {0, 1}, - {2, 4}, - {0, 4}, - {0, 2}, - }, new double[]{0.06, 0.26, 0.49, 0.25, 0.2, 0.64, 0.23, 0.21, 0.77}, 0, 3)); + assertEquals( + 0.16, + solution1.maxProbability( + 5, + new int[][] { + {2, 3}, + {1, 2}, + {3, 4}, + {1, 3}, + {1, 4}, + {0, 1}, + {2, 4}, + {0, 4}, + {0, 2}, + }, + new double[] {0.06, 0.26, 0.49, 0.25, 0.2, 0.64, 0.23, 0.21, 0.77}, + 0, + 3)); } @Test public void test5() { - assertEquals(0.21390, solution1.maxProbability(5, new int[][]{ - {1, 4}, - {2, 4}, - {0, 4}, - {0, 3}, - {0, 2}, - {2, 3}, - }, new double[]{0.37, 0.17, 0.93, 0.23, 0.39, 0.04}, 3, 4)); + assertEquals( + 0.21390, + solution1.maxProbability( + 5, + new int[][] { + {1, 4}, + {2, 4}, + {0, 4}, + {0, 3}, + {0, 2}, + {2, 3}, + }, + new double[] {0.37, 0.17, 0.93, 0.23, 0.39, 0.04}, + 3, + 4)); } @Test public void test6() { - edges = CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray("[448,931],[234,889],[214,962],[576,746],[678,734],[214,928],[602,779],[190,968],[227,858],[714,842],[177,345],[705,994],[365,998],[307,336],[123,914],[398,487],[112,234],[44,357],[318,506],[311,926],[559,735],[28,299],[689,723],[29,566],[355,476],[507,813],[799,841],[166,581],[499,522],[155,508],[80,954],[412,564],[502,618],[59,746],[272,400],[75,312],[510,887],[303,524],[646,845],[786,928],[124,151],[109,858],[96,762],[291,798],[69,303],[27,112],[292,774],[257,384],[59,755],[140,245],[431,769],[60,338],[173,403],[95,666],[165,384],[298,894],[963,980],[325,945],[419,440],[338,424],[344,846],[396,449],[76,242],[620,981],[264,433],[580,686],[196,682],[272,926],[223,593],[644,785],[487,924],[289,511],[714,988],[625,987],[50,362],[88,664],[233,352],[32,754],[206,961],[641,810],[301,570],[77,523],[26,109],[482,580],[528,683],[128,228],[436,452],[253,844],[126,877],[462,994],[204,337],[380,625],[179,807],[635,726],[143,748],[594,798],[972,996],[328,780],[267,831],[176,399],[257,600],[495,735],[844,893],[102,803],[62,942],[354,903],[234,301],[306,854],[63,555],[39,179],[125,749],[414,487],[80,291],[416,835],[77,951],[10,384],[637,798],[248,966],[646,879],[210,839],[675,876],[580,990],[187,245],[18,876],[881,933],[422,747],[422,432],[635,742],[813,976],[719,900],[149,672],[518,999],[342,746],[121,262],[457,876],[534,984],[219,524],[192,228],[636,671],[196,835],[323,658],[360,747],[643,969],[95,414],[199,325],[169,471],[50,235],[307,517],[500,927],[226,886],[131,962],[65,313],[470,514],[851,987],[437,665],[284,620],[468,752],[54,781],[266,885],[362,825],[0,90],[14,619],[259,686],[171,180],[249,520],[240,245],[225,264],[128,372],[198,383],[306,422],[46,376],[107,797],[746,961],[401,474],[346,435],[241,355],[109,919],[497,541],[271,871],[329,953],[376,541],[564,626],[91,514],[8,610],[595,865],[888,971],[852,905],[532,974],[211,653],[288,410],[463,501],[258,987],[99,515],[494,780],[562,891],[392,620],[293,409],[161,250],[460,527],[801,939],[275,929],[76,553],[236,555],[192,257],[497,604],[140,931],[224,845],[159,339],[328,902],[63,658],[231,626],[862,947],[305,469],[109,426],[216,499],[156,162],[297,685],[101,719],[524,978],[794,914],[933,950],[859,982],[626,929],[162,685],[252,904],[95,837],[293,705],[117,120],[334,880],[19,937],[304,989],[391,800],[54,80],[266,970],[99,916],[34,819],[163,348],[507,725],[295,826],[99,308],[378,463],[799,833],[389,975],[699,709],[836,967],[38,990],[586,871],[664,958],[840,990],[333,379],[71,282],[487,778],[766,845],[225,732],[446,703],[672,762],[342,512],[693,862],[80,316],[325,836],[118,738],[278,297],[107,205],[442,743],[715,812],[40,660],[138,272],[234,941],[804,812],[459,631],[45,798],[246,556],[396,797],[817,894],[548,603],[233,613],[386,742],[215,974],[102,628],[44,555],[210,281],[191,270],[119,979],[613,995],[794,987],[151,814],[621,719],[322,986],[144,200],[625,653],[574,632],[123,735],[528,612],[344,351],[203,298],[357,763],[303,357],[55,555],[209,916],[97,979],[602,994],[74,104],[94,665],[561,884],[202,843],[849,876],[630,683],[37,315],[335,705],[63,569],[76,594],[377,984],[246,735],[49,328],[29,380],[394,397],[66,158],[270,648],[581,944],[304,480],[161,459],[626,782],[169,403],[19,904],[289,387],[200,402],[276,608],[45,662],[339,569],[103,673],[328,602],[328,905],[438,910],[675,679],[125,313],[383,656],[179,266],[807,968],[176,946],[250,466],[106,295],[409,627],[399,708],[350,812],[54,363],[482,774],[217,411],[58,73],[865,912],[387,554],[21,876],[263,374],[784,969],[391,997],[170,181],[56,163],[510,575],[159,925],[14,532],[605,699],[834,845],[119,835],[522,931],[341,749],[361,469],[187,437],[78,613],[814,950],[443,996],[542,876],[378,694],[170,183],[560,803],[320,486],[50,530],[817,941],[209,521],[258,322],[235,540],[595,950],[191,497],[16,953],[299,436],[236,568],[160,298],[812,874],[173,916],[731,770],[341,768],[76,956],[788,858],[67,639],[331,674],[693,792],[62,188],[555,626],[313,473],[172,470],[245,250],[10,116],[754,976],[665,694],[530,947],[506,785],[752,854],[437,788],[61,731],[361,926],[318,909],[405,470],[331,919],[577,589],[931,976],[288,746],[151,340],[279,654],[397,523],[113,496],[318,807],[84,955],[290,637],[517,966],[687,858],[342,741],[238,554],[809,924],[76,162],[941,975],[109,452],[21,663],[207,583],[670,838],[150,558],[801,874],[318,483],[286,377],[173,216],[111,431],[463,489],[630,884],[623,782],[193,305],[8,690],[476,937],[35,938],[159,317],[96,977],[198,488],[460,461],[537,607],[426,451],[42,90],[488,794],[56,819],[43,66],[96,200],[383,743],[293,299],[119,218],[531,720],[432,582],[338,888],[560,700],[619,747],[400,488],[569,968],[519,569],[284,628],[32,438],[369,706],[282,283],[645,959],[129,381],[667,725],[313,549],[9,66],[495,619],[393,729],[425,888],[26,390],[145,568],[126,288],[318,418],[115,695],[215,449],[521,645],[228,962],[180,838],[53,318],[41,820],[772,801],[292,729],[138,835],[538,557],[588,698],[85,169],[503,883],[499,603],[542,954],[439,727],[514,923],[291,843],[269,875],[645,672],[535,825],[19,279],[121,962],[60,240],[181,902],[110,907],[649,995],[30,687],[481,678],[147,300],[663,810],[392,742],[345,568],[600,848],[732,815],[320,717],[577,994],[454,790],[427,491],[43,983],[83,172],[308,398],[391,817],[575,629],[393,931],[601,797],[485,685],[41,95],[139,463],[507,549],[843,980],[342,652],[111,972],[167,309],[71,834],[386,418],[57,991],[133,715],[692,835],[376,513],[164,308],[851,877],[581,774],[755,849],[608,900],[360,409],[21,507],[128,680],[252,965],[83,936],[572,871],[309,378],[80,232],[714,855],[489,559],[146,996],[533,549],[189,401],[288,312],[196,202],[268,408],[213,522],[486,817],[231,402],[14,804],[825,897],[408,594],[524,618],[10,487],[262,860],[301,862],[246,634],[582,969],[284,976],[271,286],[397,606],[239,422],[432,443],[359,907],[355,826],[268,468],[173,451],[356,854],[546,992],[170,411],[486,758],[84,771],[868,898],[149,735],[767,833],[12,102],[302,509],[414,711],[970,991],[83,771],[97,715],[389,595],[215,374],[182,381],[313,453],[531,835],[461,666],[496,596],[58,241],[334,996],[526,987],[263,567],[200,883],[73,419],[58,293],[553,785],[502,593],[462,475],[606,662],[84,107],[698,720],[99,672],[528,817],[260,582],[563,773],[187,305],[253,752],[152,981],[379,410],[30,515],[248,439],[217,406],[113,127],[332,498],[142,878],[136,396],[228,388],[11,884],[42,255],[4,175],[660,860],[521,863],[69,328],[796,817],[92,464],[142,217],[214,691],[981,989],[354,895],[268,669],[80,524],[703,723],[129,292],[141,216],[634,807],[350,625],[53,151],[106,708],[2,872],[93,723],[35,984],[778,829],[521,583],[95,607],[342,933],[425,983],[71,89],[3,94],[448,676],[362,822],[233,740],[145,786],[2,784],[47,974],[287,981],[565,711],[34,138],[312,605],[566,879],[335,740],[255,878],[657,987],[207,781],[235,865],[435,808],[292,588],[126,196],[834,988],[530,961],[536,709],[461,824],[394,577],[192,832],[525,752],[297,725],[33,35],[257,838],[65,276],[402,876],[478,747],[692,801],[61,809],[466,550],[261,412],[178,608],[134,266],[611,765],[45,740],[6,719],[154,406],[268,662],[46,233],[761,977],[74,370],[151,581],[21,753],[268,995],[25,573],[772,937],[27,181],[275,556],[11,45],[375,915],[649,991],[515,616],[123,987],[522,544],[320,488],[210,370],[101,702],[216,659],[396,812],[657,911],[672,674],[14,540],[140,580],[403,835],[230,608],[120,315],[275,304],[806,973],[49,796],[398,729],[527,772],[113,674],[154,452],[233,971],[362,480],[467,509],[249,797],[33,666],[9,991],[219,576],[136,857],[911,945],[521,791],[98,949],[337,507],[446,522],[589,891],[578,609],[835,987],[99,464],[192,845],[10,731],[479,506],[286,456],[137,677],[211,239],[116,161],[699,752],[20,251],[692,893],[580,957],[636,837],[180,972],[424,546],[317,331],[175,915],[19,187],[360,862],[43,944],[322,849],[614,665],[85,985],[156,337],[401,751],[202,327],[250,836],[557,788],[470,988],[4,282],[683,932],[491,534],[765,888],[19,235],[127,843],[339,677],[108,190],[122,199],[213,886],[383,742],[526,932],[163,678],[167,271],[643,914],[271,644],[187,572],[122,679],[398,985],[290,905],[487,741],[81,493],[639,713],[311,790],[3,47],[150,844],[585,979],[283,316],[232,271],[59,616],[233,858],[143,398],[308,966],[452,879],[467,845],[87,674],[464,604],[101,141],[144,972],[372,650],[796,982],[39,568],[95,294],[327,633],[890,962],[282,407],[281,326],[352,788],[570,902],[757,921],[531,784],[236,284],[445,865],[360,724],[317,761],[66,328],[194,340],[409,562],[362,688],[569,876],[195,953],[855,918],[416,864],[213,273],[269,947],[63,529],[833,916],[28,914],[830,940],[203,303],[159,974],[551,819],[300,618],[290,553],[518,921],[158,455],[835,947],[252,508],[117,260],[305,376],[335,465],[96,445],[210,513],[556,644],[300,547],[72,928],[253,558],[343,585],[93,515],[535,810],[385,741],[392,965],[99,141],[188,535],[19,921],[241,596],[141,300],[321,732],[697,727],[170,925],[151,745],[616,856],[383,465],[311,697],[306,695],[160,856],[22,596],[258,718],[194,906],[632,749],[427,987],[307,356],[23,888],[375,968],[186,313],[135,431],[27,439],[331,931],[444,991],[477,675],[728,740],[596,868],[307,857],[223,463],[214,470],[244,263],[610,711],[198,773],[241,984],[335,940],[12,677],[358,538],[675,761],[560,825],[355,929],[821,983],[83,571],[513,702],[341,476],[475,868],[334,352],[811,956],[233,295],[43,557],[487,817],[519,829],[470,728],[574,754],[54,857],[144,828],[140,254],[556,859],[165,868],[317,909],[43,263],[323,380],[119,239],[356,554],[44,511],[626,915],[205,389],[166,816],[521,899],[98,773],[338,343],[79,355],[260,798],[209,850],[166,176],[804,820],[296,805],[85,338],[406,608],[97,954],[201,775],[681,890],[33,601],[251,834],[776,956],[138,551],[195,924],[112,137],[862,987],[461,806],[19,228],[354,647],[257,984],[499,971],[33,237],[30,541],[151,727],[337,529],[25,386],[47,300],[548,582],[302,312],[7,868],[66,117],[154,622],[462,594],[622,752],[641,710],[527,760],[152,536],[406,879],[200,331],[98,866],[245,503],[285,894],[73,583],[2,323],[62,419],[137,407],[199,461],[771,865],[515,721],[168,243],[629,655],[298,432],[442,562],[688,784],[492,747],[638,831],[86,284],[177,514],[633,894],[180,343],[253,830],[208,604],[884,967],[531,592],[131,644],[6,185],[174,319],[169,266],[11,272],[236,897],[232,484],[442,796],[108,642],[173,514],[133,418],[305,807],[8,858],[420,811],[219,246],[305,648],[443,791],[356,828],[76,353],[19,156],[263,631],[126,377],[208,726],[449,814],[236,792],[7,207],[144,156],[143,532],[181,775],[61,125],[266,568],[469,569],[293,797],[299,665],[357,437],[732,916],[231,736],[635,915],[378,632],[83,790],[450,731],[722,894],[678,795],[386,710],[325,411],[131,491],[840,886],[730,761],[401,938],[71,660],[278,426],[668,770],[522,556],[585,864],[429,597],[18,933],[335,618],[220,934],[676,944],[217,548],[413,764],[271,479],[657,804],[56,510],[354,366],[738,904],[117,796],[555,674],[214,684],[285,996],[105,309],[395,558],[153,388],[656,756],[143,688],[341,587],[810,827],[310,648],[3,992],[334,943],[367,768],[376,711],[385,864],[93,472],[473,706],[597,924],[694,845],[47,522],[155,184],[270,718],[213,525],[896,948],[276,673],[115,874],[485,887],[760,825],[66,95],[691,874],[62,787],[440,594],[79,356],[640,672],[527,840],[44,596],[431,762],[16,455],[682,975],[353,567],[731,748],[242,820],[55,387],[476,562],[516,906],[247,834],[652,989],[656,742],[35,962],[310,610],[431,992],[660,679],[440,915],[190,505],[87,566],[418,483],[581,881],[328,681],[83,366],[30,900],[64,432],[134,710],[200,452],[256,440],[575,893],[530,756],[71,666],[739,900],[289,566],[489,575],[196,985],[191,646],[427,697],[231,500],[185,953],[29,134],[80,236],[28,582],[330,724],[690,886],[198,898],[473,681],[439,790],[95,573],[100,942],[460,615],[182,283],[264,380],[424,606],[115,534],[352,792],[34,655],[644,902],[35,724],[400,934],[377,390],[123,257],[257,735],[447,453],[194,593],[190,256],[362,889],[192,993],[210,508],[8,437],[229,428],[2,124],[73,448],[618,763],[469,717],[487,830],[90,700],[111,878],[562,989],[233,252],[340,687],[143,536],[82,202],[145,749],[808,962],[43,405],[340,726],[526,742],[194,889],[553,656],[173,541],[158,905],[264,781],[223,418],[130,598],[93,442],[420,631],[178,556],[40,158],[415,700],[174,520],[454,981],[795,980],[687,759],[651,715],[325,598],[292,715],[175,987],[85,165],[437,807],[719,949],[184,977],[403,725],[309,771],[284,797],[6,512],[41,929],[524,660],[165,229],[741,756],[3,536],[663,752],[291,567],[482,591],[367,428],[720,721],[448,604],[459,525],[185,254],[380,918],[752,841],[64,544],[595,869],[469,559],[122,672],[271,776],[489,770],[26,786],[270,807],[740,986],[31,825],[247,754],[295,703],[13,467],[18,538],[342,609],[176,238],[298,887],[97,474],[29,568],[313,589],[196,271],[601,855],[379,648],[215,834],[258,983],[227,635],[899,944],[290,949],[551,585],[267,688],[536,762],[208,822],[260,357],[167,800],[650,866],[275,490],[94,563],[773,908],[247,612],[105,894],[311,715],[363,724],[197,553],[4,580],[757,883],[258,885],[42,732],[635,667],[72,618],[123,574],[629,988],[327,662],[67,567],[802,898],[126,413],[7,881],[144,540],[378,644],[65,445],[314,843],[0,277],[317,849],[41,406],[738,915],[48,581],[84,227],[161,803],[641,844],[738,767],[335,652],[48,486],[76,857],[363,790],[223,589],[211,681],[22,397],[683,916],[378,645],[207,455],[513,592],[475,849],[13,441],[336,880],[803,926],[32,564],[820,960],[288,931],[735,933],[295,572],[235,434],[27,300],[60,640],[347,839],[674,879],[160,305],[418,628],[59,414],[46,374],[489,930],[740,827],[89,766],[10,44],[431,603],[317,484],[307,945],[65,71],[295,873],[951,989],[477,537],[321,526],[144,830],[263,283],[319,728],[631,745],[339,643],[255,809],[402,510],[133,565],[251,257],[153,829],[32,574],[8,285],[340,350],[334,898],[467,959],[95,643],[266,788],[163,498],[270,621],[503,744],[639,672],[51,66],[553,980],[12,353],[60,626],[367,654],[673,895],[605,882],[469,739],[60,832],[170,913],[101,195],[117,304],[149,292],[92,773],[32,737],[13,885],[502,940],[147,653],[92,268],[375,628],[474,638],[310,746],[258,388],[253,705],[352,371],[11,563],[68,369],[287,599],[310,984],[250,893],[558,614],[530,608],[507,709],[375,392],[360,609],[53,304],[804,991],[608,612],[205,826],[299,582],[407,979],[539,893],[756,789],[228,556],[212,933],[122,309],[223,934],[461,919],[187,836],[728,760],[556,962],[809,884],[185,907],[770,858],[411,876],[451,794],[285,387],[326,541],[614,985],[105,440],[611,986],[283,701],[507,855],[168,731],[412,518],[132,970],[825,853],[293,357],[528,682],[534,610],[37,278],[536,662],[55,128],[158,184],[52,488],[576,648],[50,343],[242,288],[387,938],[282,905],[25,31],[568,955],[139,260],[709,976],[459,854],[47,970],[345,944],[493,838],[316,455],[280,753],[418,692],[468,691],[834,942],[381,644],[51,366],[423,744],[232,914],[24,510],[282,318],[854,895],[284,570],[650,957],[3,390],[290,723],[508,876],[234,843],[291,801],[23,395],[179,766],[142,837],[528,572],[635,984],[446,783],[332,854],[675,875],[497,933],[86,756],[679,965],[78,140],[360,869],[847,925],[197,223],[215,737],[557,709],[403,595],[22,339],[289,341],[125,848],[225,676],[350,608],[355,874],[584,868],[108,325],[615,634],[565,807],[804,981],[167,558],[98,784],[111,489],[43,174],[46,939],[180,690],[293,916],[3,291],[14,545],[74,880],[397,639],[700,962],[310,598],[333,385],[406,907],[72,348],[95,699],[224,397],[639,681],[205,331],[556,887],[78,173],[61,467],[284,464],[463,771],[114,592],[49,412],[292,888],[790,885],[694,914],[464,737],[535,551],[284,313],[92,994],[495,612],[42,378],[764,934],[716,936],[578,679],[268,520],[558,725],[66,953],[69,340],[7,61],[234,731],[128,637],[603,959],[225,886],[131,299],[74,848],[130,968],[216,360],[291,731],[150,770],[454,905],[208,733],[251,381],[218,245],[203,778],[80,226],[238,419],[388,918],[307,983],[76,524],[738,793],[825,975],[251,737],[23,440],[420,782],[791,878],[67,517],[537,689],[473,973],[597,963],[615,732],[206,670],[95,718],[495,711],[725,738],[23,240],[735,879],[70,950],[100,759],[445,617],[139,279],[219,857],[578,820],[419,789],[209,401],[465,492],[457,996],[391,490],[541,926],[623,648],[130,422],[447,945],[648,780],[569,652],[157,752],[199,570],[79,792],[952,994],[165,271],[353,802],[616,884],[261,902],[548,971],[190,696],[207,890],[299,677],[545,833],[37,97],[668,893],[249,842],[7,280],[658,915],[728,782],[773,840],[512,847],[82,142],[912,937],[129,251],[623,968],[97,135],[540,658],[198,592],[443,667],[371,664],[130,381],[35,188],[100,404],[157,436],[350,830],[238,678],[265,786],[539,602],[114,838],[479,962],[26,659],[114,305],[108,418],[50,665],[178,601],[176,861],[191,496],[146,689],[31,685],[752,915],[418,654],[230,588],[568,791],[511,643],[369,973],[5,207],[503,712],[544,976],[379,595],[162,664],[410,558],[330,986],[214,694],[203,315],[485,995],[595,773],[213,795],[50,503],[385,473],[408,428],[653,834],[2,267],[675,910],[129,697],[195,750],[772,967],[643,964],[564,658],[448,586],[926,962],[701,820],[45,409],[781,923],[11,933],[475,565],[143,755],[197,524],[0,720],[642,936],[178,988],[100,395],[458,466],[590,611],[99,232],[504,688],[973,994],[11,849],[662,741],[121,533],[934,972],[642,696],[229,616],[91,512],[314,352],[78,697],[626,980],[131,219],[356,407],[207,511],[219,788],[522,965],[540,591],[422,701],[69,857],[552,608],[493,808],[803,947],[73,836],[51,568],[51,112],[561,741],[360,598],[334,795],[419,524],[201,682],[746,832],[122,800],[629,636],[258,835],[216,248],[419,913],[315,729],[82,594],[159,953],[16,595],[670,717],[643,744],[547,749],[724,855],[836,911],[334,890],[513,993],[337,940],[249,655],[241,322],[457,810],[335,805],[549,789],[649,984],[705,783],[493,501],[409,485],[329,862],[25,412],[167,407],[543,694],[401,506],[278,613],[337,608],[490,745],[220,517],[505,883],[661,925],[194,819],[760,919],[247,495],[742,972],[760,916],[433,692],[265,942],[324,597],[387,412],[95,126],[55,880],[759,972],[887,892],[482,749],[778,916],[699,756],[465,731],[263,640],[77,362],[798,824],[175,774],[124,400],[501,797],[473,647],[101,621],[561,938],[77,437],[234,536],[244,843],[347,837],[199,299],[478,665],[849,945],[45,413],[782,820],[686,773],[83,116],[517,519],[329,852],[253,810],[406,711],[608,725],[599,963],[172,887],[465,998],[132,626],[142,767],[189,365],[91,452],[242,944],[474,747],[183,522],[344,652],[98,948],[183,684],[112,746],[401,922],[79,274],[445,842],[857,860],[90,854],[164,278],[669,706],[160,407],[711,937],[217,704],[428,677],[30,407],[384,952],[371,492],[410,519],[363,592],[159,518],[557,687],[307,677],[513,767],[811,904],[272,749],[758,863],[799,906],[169,752],[547,797],[522,572],[342,646],[8,595],[428,442],[254,772],[346,778],[67,935],[234,284],[92,778],[274,316],[452,674],[66,150],[253,477],[703,848],[869,900],[845,987],[308,359],[425,545],[780,829],[4,846],[502,842],[120,697],[86,768],[206,451],[520,939],[498,813],[495,871],[49,488],[608,797],[181,610],[33,41],[139,293],[96,514],[839,883],[229,722],[8,71],[42,326],[102,684],[618,796],[577,905],[284,734],[187,333],[310,745],[341,997],[629,630],[861,965],[617,964],[220,845],[173,481],[261,878],[335,934],[110,879],[222,266],[446,454],[119,516],[147,660],[122,771],[540,609],[13,670],[269,727]"); - succProb = new double[]{0.88, 0.59, 0.67, 0.93, 0.76, 0.88, 0.9, 0.95, 0.7, 0.95, 0.69, 0.87, 0.7, 0.74, 0.95, 0.89, 0.71, 0.87, 0.83, 0.98, 0.91, 0.75, 0.63, 0.85, 0.9, 0.7, 0.73, 0.58, 0.56, 0.58, 0.88, 0.78, 0.98, 0.58, 0.94, 0.93, 0.91, 0.81, 0.7, 0.71, 0.75, 0.74, 0.78, 0.58, 0.89, 0.68, 0.99, 0.93, 0.63, 0.53, 0.64, 0.57, 0.91, 0.7, 0.99, 0.66, 0.69, 0.89, 0.83, 0.66, 0.77, 0.85, 0.53, 0.96, 0.95, 0.79, 0.86, 0.54, 0.97, 0.61, 0.66, 0.59, 0.67, 0.55, 0.73, 0.68, 0.96, 0.99, 0.59, 0.67, 0.81, 0.61, 0.92, 0.69, 0.93, 0.7, 0.99, 0.76, 0.81, 0.85, 1.0, 0.54, 0.8, 0.55, 0.51, 0.89, 0.83, 0.75, 0.92, 0.75, 0.8, 0.58, 0.88, 0.73, 0.73, 0.93, 0.52, 0.52, 0.61, 0.54, 0.88, 0.55, 0.91, 0.53, 0.63, 0.56, 0.52, 0.92, 0.54, 0.86, 0.8, 0.77, 0.85, 0.66, 0.82, 0.94, 0.84, 0.64, 0.8, 0.52, 0.92, 0.59, 0.97, 0.87, 0.67, 0.71, 0.81, 0.71, 0.93, 0.89, 0.77, 0.59, 0.86, 0.62, 0.64, 0.51, 0.69, 0.93, 0.59, 0.74, 0.99, 0.8, 0.53, 0.85, 0.69, 0.92, 0.62, 0.9, 0.83, 0.74, 0.85, 0.93, 0.87, 0.85, 0.59, 0.93, 0.56, 0.98, 0.59, 0.75, 0.89, 0.64, 0.53, 0.65, 0.72, 0.88, 0.78, 0.76, 0.56, 0.85, 0.71, 0.81, 0.53, 0.77, 0.91, 0.55, 0.7, 0.65, 0.62, 0.67, 0.82, 0.68, 0.72, 0.92, 0.76, 0.67, 0.62, 0.95, 0.64, 0.92, 0.77, 0.93, 0.87, 1.0, 0.92, 0.86, 0.59, 0.62, 0.62, 0.54, 0.65, 0.79, 0.8, 0.93, 0.92, 0.53, 0.88, 0.58, 0.67, 1.0, 0.82, 1.0, 0.7, 0.8, 0.62, 0.68, 0.86, 0.62, 0.69, 0.52, 0.76, 0.53, 0.57, 0.52, 0.55, 0.92, 0.6, 0.98, 0.52, 0.88, 0.89, 0.68, 0.78, 0.87, 0.92, 0.96, 0.82, 0.97, 0.54, 0.92, 0.81, 0.53, 0.92, 0.87, 0.74, 0.68, 0.77, 0.99, 0.89, 0.84, 0.65, 0.88, 0.53, 0.97, 0.66, 0.72, 0.97, 0.56, 0.57, 0.59, 0.76, 0.81, 0.77, 0.95, 0.82, 0.67, 0.61, 0.86, 0.58, 0.83, 0.83, 0.51, 0.65, 0.6, 0.53, 0.61, 0.75, 0.63, 0.8, 0.94, 0.86, 0.75, 0.52, 0.81, 0.91, 0.61, 0.57, 0.78, 0.85, 0.62, 0.56, 0.59, 0.89, 0.56, 0.94, 0.84, 0.88, 0.7, 0.9, 0.72, 0.94, 0.94, 0.91, 0.94, 0.69, 0.98, 0.86, 0.51, 0.69, 0.8, 0.69, 0.89, 0.61, 0.85, 0.55, 0.55, 0.92, 0.85, 0.76, 0.74, 0.91, 0.7, 0.66, 0.54, 0.6, 0.51, 0.55, 0.83, 0.86, 0.66, 0.61, 0.67, 0.67, 0.84, 0.85, 0.68, 0.81, 0.89, 0.73, 0.98, 0.65, 0.96, 0.53, 0.54, 0.7, 0.89, 0.91, 0.82, 0.72, 0.65, 0.93, 1.0, 0.87, 0.92, 0.54, 0.9, 0.71, 0.69, 0.5, 0.75, 0.5, 0.95, 0.98, 0.95, 0.64, 0.84, 0.56, 0.98, 0.9, 0.7, 0.7, 0.51, 0.52, 0.73, 0.9, 0.86, 0.59, 0.69, 0.57, 0.72, 0.87, 0.9, 0.53, 0.79, 0.74, 0.98, 0.83, 0.64, 0.7, 0.78, 0.62, 0.51, 0.85, 0.57, 0.95, 0.54, 0.8, 0.95, 0.97, 0.94, 0.89, 0.53, 0.8, 0.9, 0.81, 0.72, 0.89, 0.69, 0.51, 0.87, 0.54, 0.91, 0.99, 0.67, 0.82, 0.75, 0.84, 0.57, 0.69, 0.69, 0.89, 0.93, 0.51, 0.82, 0.57, 0.73, 0.68, 0.8, 0.62, 0.94, 0.64, 0.6, 0.62, 0.81, 0.52, 0.72, 0.52, 0.92, 0.97, 0.59, 0.86, 0.71, 0.67, 0.75, 0.76, 0.79, 0.88, 0.52, 0.88, 0.88, 0.79, 0.79, 0.83, 0.71, 0.74, 0.62, 0.68, 0.68, 0.7, 0.69, 0.92, 0.98, 0.67, 0.94, 0.7, 0.81, 0.97, 0.63, 0.68, 0.78, 0.92, 0.69, 0.64, 0.52, 0.62, 0.55, 0.51, 0.53, 0.76, 0.71, 0.7, 0.65, 0.61, 0.51, 0.64, 0.85, 0.95, 0.95, 0.61, 0.59, 0.54, 0.81, 0.54, 0.98, 0.7, 0.57, 0.95, 0.85, 0.72, 0.78, 0.98, 0.88, 0.95, 0.86, 0.91, 0.52, 0.79, 0.97, 0.59, 0.69, 0.95, 0.94, 0.54, 0.62, 0.56, 0.51, 0.87, 0.99, 0.52, 0.51, 0.69, 0.9, 0.94, 0.73, 0.79, 1.0, 0.97, 0.5, 0.84, 0.57, 0.55, 0.88, 0.8, 0.96, 0.57, 0.68, 0.82, 0.62, 0.77, 0.73, 0.79, 0.89, 0.54, 0.93, 0.96, 0.77, 0.68, 0.62, 0.66, 0.59, 0.98, 0.57, 0.51, 0.92, 0.59, 0.5, 0.73, 0.62, 0.99, 0.88, 0.68, 0.58, 0.73, 0.59, 0.58, 0.87, 0.93, 0.92, 0.51, 0.88, 0.92, 0.57, 0.55, 0.88, 0.94, 0.95, 0.84, 0.76, 0.87, 0.85, 0.61, 0.7, 0.8, 0.69, 0.59, 0.7, 0.77, 0.91, 0.56, 0.52, 0.85, 0.89, 0.88, 0.55, 0.72, 0.91, 0.7, 0.62, 0.54, 0.94, 0.69, 0.79, 0.64, 0.53, 0.65, 0.73, 0.92, 0.77, 0.77, 0.55, 0.74, 0.96, 0.6, 0.58, 0.88, 0.94, 0.54, 0.58, 0.95, 0.69, 0.9, 0.78, 0.56, 0.51, 0.9, 0.55, 0.58, 0.81, 0.67, 0.82, 0.74, 0.55, 0.8, 0.75, 0.54, 0.7, 0.9, 0.78, 0.8, 0.81, 0.65, 0.93, 0.53, 0.73, 0.6, 0.67, 0.81, 0.62, 0.7, 0.65, 0.72, 0.61, 0.86, 0.99, 0.87, 0.72, 0.53, 0.83, 0.91, 0.81, 0.86, 0.86, 0.78, 0.57, 0.98, 0.56, 0.98, 0.97, 0.56, 0.91, 0.9, 0.6, 0.53, 0.51, 0.87, 0.69, 0.98, 0.52, 0.8, 0.56, 0.57, 0.61, 0.9, 0.73, 0.8, 0.6, 0.9, 0.79, 0.62, 0.57, 0.73, 0.76, 0.97, 0.87, 0.82, 0.76, 0.91, 0.86, 0.88, 0.51, 0.54, 0.77, 0.62, 0.72, 0.51, 0.92, 0.52, 0.82, 0.94, 0.81, 0.59, 0.66, 0.58, 0.67, 0.92, 0.5, 0.91, 0.97, 0.93, 0.81, 0.67, 0.68, 0.9, 0.54, 0.9, 0.84, 0.85, 0.62, 0.95, 0.81, 0.76, 0.54, 0.62, 0.83, 0.75, 0.66, 0.8, 0.74, 0.96, 0.84, 0.6, 0.73, 0.81, 0.55, 0.69, 0.81, 0.84, 0.74, 0.77, 0.87, 0.81, 0.82, 0.82, 0.86, 0.51, 0.64, 0.62, 0.69, 0.53, 0.86, 0.53, 0.56, 0.55, 0.95, 0.59, 0.73, 0.62, 0.97, 0.58, 0.68, 0.87, 0.74, 0.81, 0.54, 0.98, 0.86, 0.75, 0.87, 0.53, 0.55, 0.6, 0.79, 0.75, 0.75, 0.55, 0.88, 0.77, 0.75, 0.53, 0.96, 0.84, 0.63, 0.67, 0.89, 0.63, 0.97, 0.62, 0.56, 0.81, 0.61, 0.69, 0.7, 0.98, 0.65, 0.6, 0.96, 0.82, 0.75, 0.69, 0.74, 0.82, 0.91, 0.86, 0.85, 0.89, 0.51, 0.51, 0.6, 0.81, 0.68, 0.9, 0.74, 1.0, 0.85, 0.53, 0.72, 0.5, 0.74, 0.54, 0.69, 0.75, 0.71, 0.95, 0.77, 0.77, 0.84, 0.55, 0.74, 0.61, 0.54, 0.65, 0.94, 0.67, 0.71, 0.65, 0.91, 1.0, 0.7, 0.62, 0.65, 0.81, 0.78, 0.76, 0.88, 0.7, 0.88, 0.79, 0.67, 0.94, 0.98, 0.67, 0.64, 0.63, 0.56, 0.97, 0.68, 0.89, 0.59, 0.7, 0.52, 0.61, 0.84, 0.87, 0.75, 0.9, 0.61, 0.52, 1.0, 0.88, 0.82, 0.64, 0.72, 0.81, 0.89, 0.98, 0.63, 0.99, 0.63, 0.8, 0.72, 0.91, 0.56, 0.98, 0.7, 0.93, 0.68, 0.7, 0.58, 0.93, 0.66, 0.99, 0.81, 0.89, 0.82, 0.94, 0.81, 0.87, 0.57, 0.52, 0.8, 0.84, 0.5, 0.83, 0.73, 0.84, 0.5, 0.72, 0.74, 0.82, 0.56, 0.74, 0.76, 0.83, 0.74, 0.54, 0.62, 0.96, 0.61, 0.53, 0.59, 0.87, 0.96, 0.6, 0.67, 0.99, 0.72, 0.94, 0.57, 0.88, 0.55, 0.77, 0.89, 0.83, 0.68, 0.86, 0.81, 0.6, 0.58, 0.56, 0.79, 0.65, 0.61, 0.54, 0.66, 0.52, 0.61, 0.64, 0.88, 0.71, 0.52, 0.84, 0.81, 0.92, 0.64, 0.64, 0.95, 0.53, 0.92, 0.69, 0.8, 0.81, 0.54, 0.7, 0.55, 0.81, 0.95, 0.99, 0.59, 0.9, 0.97, 0.67, 0.69, 0.88, 0.58, 0.55, 0.58, 0.91, 0.57, 0.8, 0.59, 0.72, 0.64, 0.95, 0.54, 0.51, 0.63, 0.89, 0.92, 0.78, 0.71, 0.66, 0.73, 0.8, 0.66, 0.95, 0.54, 0.51, 0.78, 0.7, 0.76, 0.86, 0.59, 0.76, 0.64, 0.81, 0.58, 0.62, 0.86, 0.89, 0.6, 0.74, 0.78, 0.9, 0.72, 0.91, 0.63, 0.69, 0.76, 0.58, 0.97, 0.9, 0.77, 0.78, 0.5, 0.78, 0.69, 0.78, 1.0, 0.52, 0.81, 0.9, 0.56, 0.69, 0.58, 0.58, 0.6, 0.68, 0.82, 0.99, 0.52, 0.92, 0.67, 0.61, 0.71, 0.99, 0.56, 0.6, 0.62, 0.85, 0.84, 0.99, 0.59, 0.51, 0.78, 0.85, 0.54, 0.7, 0.9, 0.56, 0.89, 0.91, 0.52, 0.5, 0.63, 0.6, 0.65, 0.94, 0.7, 0.93, 0.92, 0.64, 0.89, 0.74, 0.74, 0.64, 0.86, 0.91, 0.55, 0.9, 0.51, 0.86, 0.84, 0.56, 0.98, 1.0, 0.78, 0.72, 0.71, 0.86, 0.99, 0.64, 0.58, 0.51, 0.96, 0.68, 0.91, 0.52, 0.57, 0.79, 0.81, 0.61, 0.57, 0.86, 0.66, 0.76, 0.61, 0.56, 0.73, 0.75, 0.83, 0.69, 0.57, 0.58, 0.59, 0.53, 0.84, 0.8, 0.79, 0.8, 0.75, 0.97, 0.58, 0.89, 0.88, 0.54, 0.75, 0.71, 0.62, 0.76, 0.85, 0.52, 0.94, 0.71, 0.73, 0.8, 0.67, 0.87, 0.54, 0.72, 0.72, 0.64, 0.71, 0.66, 0.68, 0.53, 0.78, 0.65, 0.77, 0.97, 0.84, 0.57, 0.85, 0.67, 0.87, 0.59, 0.68, 0.9, 0.79, 0.54, 0.5, 0.53, 0.97, 0.74, 0.89, 0.98, 0.96, 0.9, 0.84, 0.8, 0.56, 0.67, 0.87, 0.8, 0.77, 0.62, 0.65, 0.74, 0.93, 0.7, 0.81, 0.77, 0.61, 0.85, 0.9, 0.67, 0.73, 0.87, 0.77, 0.91, 0.87, 0.93, 0.61, 0.85, 0.87, 0.76, 0.63, 0.52, 0.95, 0.84, 0.87, 0.55, 0.87, 0.76, 0.58, 0.7, 0.53, 0.93, 0.76, 0.52, 0.79, 0.68, 0.65, 0.66, 0.53, 0.89, 0.5, 0.77, 0.6, 0.52, 0.61, 0.7, 0.63, 0.88, 0.56, 0.68, 0.85, 0.87, 0.73, 0.84, 0.87, 0.55, 0.99, 0.53, 0.82, 0.91, 0.91, 0.81, 0.85, 0.57, 0.58, 0.84, 0.92, 0.74, 0.52, 0.9, 0.88, 0.75, 0.61, 0.62, 0.55, 0.56, 0.92, 0.62, 0.64, 0.56, 0.64, 0.73, 0.88, 0.98, 0.54, 0.75, 0.8, 0.53, 0.92, 0.75, 0.72, 0.94, 0.93, 0.79, 0.95, 0.61, 0.99, 0.57, 0.74, 0.56, 0.76, 0.53, 0.9, 0.65, 0.94, 0.89, 0.84, 0.87, 0.82, 0.67, 0.7, 0.87, 0.92, 0.57, 0.63, 0.87, 0.66, 0.71, 0.61, 0.7, 0.73, 0.92, 0.9, 0.75, 0.84, 0.96, 0.6, 0.58, 0.57, 0.65, 0.64, 0.63, 0.71, 0.62, 0.83, 0.58, 0.79, 0.68, 0.59, 0.85, 0.7, 0.54, 0.63, 0.91, 0.64, 0.74, 0.66, 0.76, 0.76, 0.97, 0.96, 0.95, 0.94, 0.89, 0.67, 0.69, 0.85, 0.82, 0.55, 0.64, 0.89, 0.64, 0.64, 0.87, 0.53, 0.56, 0.68, 0.55, 0.78, 0.94, 0.63, 0.85, 0.61, 0.83, 0.8, 0.61, 0.84, 0.83, 0.91, 0.76, 0.55, 0.84, 0.52, 0.96, 1.0, 0.6, 0.71, 0.97, 0.62, 0.88, 0.52, 0.69, 0.71, 0.82, 0.66, 0.87, 0.66, 0.73, 0.6, 0.58, 0.61, 0.89, 0.84, 0.53, 0.77, 0.83, 0.8, 0.51, 0.63, 0.75, 0.65, 0.95, 0.51, 0.93, 0.53, 0.51, 0.54, 0.74, 0.82, 0.54, 0.56, 0.62, 0.69, 0.7, 0.64, 0.92, 0.5, 0.54, 0.87, 0.91, 0.63, 0.9, 0.59, 0.55, 0.59, 0.6, 0.8, 0.9, 0.54, 0.89, 0.85, 0.65, 0.69, 0.8, 0.88, 0.83, 0.62, 0.75, 0.71, 0.52, 0.71, 0.89, 0.94, 0.56, 0.93, 0.92, 0.78, 0.55, 0.98, 0.52, 0.77, 0.83, 0.92, 0.78, 0.58, 0.66, 0.76, 0.53, 0.7, 0.91, 0.55, 0.55, 0.56, 0.75, 0.75, 0.81, 0.91, 0.55, 0.98, 0.94, 0.64, 0.77, 0.84, 0.93, 0.75, 0.64, 0.93, 0.87, 0.7, 0.82, 0.93, 0.66, 0.74, 0.51, 0.96, 0.85, 0.63, 0.99, 0.59, 0.9, 0.53, 0.87, 0.74, 0.68, 0.74, 1.0, 0.54, 1.0, 0.93, 0.99, 0.65, 0.71, 0.51, 0.99, 0.76, 0.6, 0.61, 0.91, 0.62, 0.93, 0.6, 0.69, 0.57, 0.82, 0.85, 0.84, 0.77, 0.66, 0.77, 0.66, 0.74, 0.94, 0.72, 0.79, 0.66, 0.94, 0.84, 0.84, 0.75, 0.52, 0.66, 0.58, 0.64, 0.52, 0.52, 0.87, 0.69, 0.75, 0.77, 0.68, 0.82, 0.87, 0.95, 0.94, 0.71, 0.53, 0.8, 0.51, 1.0, 0.93, 0.58, 0.65, 0.66, 0.66, 0.93, 1.0, 0.52, 0.52, 0.56, 0.69, 0.66, 0.52, 0.78, 0.54, 0.56, 0.58, 0.82, 0.74, 0.85, 0.51, 0.51, 0.76, 0.87, 0.81, 0.81, 0.87, 0.9, 0.85, 0.92, 0.85, 0.87, 0.97, 0.58, 0.98, 0.54, 0.81, 0.75, 0.72, 0.7, 0.56, 0.83, 0.81, 0.95, 0.8, 0.88, 0.87, 0.55, 0.95, 0.67, 0.68, 0.93, 0.71, 0.53, 0.74, 0.72, 0.92, 0.97, 0.84, 0.81, 0.86, 0.92, 0.56, 0.59, 0.59, 0.81, 0.61, 0.86, 0.89, 0.53, 0.7, 0.61, 0.57, 0.6, 0.95, 0.62, 0.6, 0.94, 0.68, 0.85, 0.72, 0.64, 0.79, 0.7, 0.82, 0.72, 0.93, 0.59, 0.7, 0.67, 0.86, 0.86, 0.77, 0.95, 0.83, 0.82, 0.93, 0.92, 0.61, 0.53, 0.94, 0.66, 0.67, 0.78, 0.88, 0.68, 0.93, 0.9, 0.82, 0.83, 0.73, 0.74, 0.6, 0.95, 0.8, 0.62, 0.99, 0.9, 0.81, 0.58, 0.6, 0.59, 0.6, 0.74, 0.81, 0.69, 0.76, 0.88, 0.82, 0.5, 0.88, 0.9, 0.86, 0.72, 0.56, 0.9, 0.84, 0.78, 0.88, 0.52, 0.83, 0.74, 0.6, 0.7, 0.99, 0.54, 0.6, 0.94, 0.79, 0.96, 0.64, 0.51, 0.64, 0.55, 0.5, 0.92, 0.57, 0.97, 0.62, 0.57, 0.76, 0.57, 0.81, 0.54, 0.59, 0.75, 0.6, 0.97, 0.68, 0.53, 0.6, 0.64, 0.88, 0.88, 0.97, 0.91, 0.62, 0.7, 0.91, 0.56, 0.61, 0.82, 0.99, 0.7, 0.93, 0.93, 0.71, 0.81, 0.64, 0.87, 0.76, 0.75, 0.97, 0.92, 0.91, 0.53, 0.68, 0.78, 0.95, 0.58, 0.72, 0.88, 0.57, 0.61, 0.86, 0.83, 0.91, 0.6, 0.74, 0.83, 0.59, 0.69, 0.77, 0.73, 0.76, 0.8, 0.69, 0.74, 0.85, 0.82, 0.98, 0.75, 0.67, 0.52, 0.57, 0.72, 0.73, 0.71, 0.79, 0.86, 0.55, 0.99, 0.84, 0.97, 0.74, 0.77, 0.71, 0.8, 0.77, 0.85, 0.73, 0.61, 0.85, 0.56, 0.91, 0.74, 0.54, 0.69, 0.84, 0.91, 0.94, 0.86, 0.53, 0.58, 0.53, 0.6, 0.8, 0.84, 0.95, 0.96, 0.72, 0.65, 0.64, 0.84, 0.93, 0.53, 0.63, 0.76, 0.55, 0.9, 0.63, 0.68, 0.93, 0.54, 0.5, 0.55, 0.66, 0.54, 0.81, 0.57, 0.53, 0.64, 0.69, 0.62, 0.65, 0.51, 0.98, 0.75, 0.59, 0.57, 0.62, 0.63, 0.86, 0.78, 0.56, 0.84, 0.82, 0.68, 0.93, 0.77, 0.98, 0.51, 0.79, 0.77, 0.64, 0.85, 0.78, 0.66, 0.54, 0.62, 0.6, 0.93, 0.9, 0.6, 0.96, 0.93, 0.99, 0.52, 0.82, 0.56, 0.72, 0.87, 0.61, 0.5, 0.94, 0.77, 0.63, 0.8, 0.75, 0.87, 0.56, 0.78, 0.89, 0.86, 0.75, 0.93, 0.82, 0.78, 0.76, 0.92, 0.75, 0.58, 0.75, 0.79, 0.95, 0.74, 0.94, 0.69, 0.51, 0.74, 0.68, 0.58, 0.53, 0.94, 0.65, 0.94, 0.72, 0.89, 0.96, 1.0, 0.67, 0.64, 0.87, 0.89, 0.78, 0.76, 0.51, 0.81, 0.9, 0.63, 0.93}; + edges = + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[448,931],[234,889],[214,962],[576,746],[678,734],[214,928],[602,779],[190,968],[227,858],[714,842],[177,345],[705,994],[365,998],[307,336],[123,914],[398,487],[112,234],[44,357],[318,506],[311,926],[559,735],[28,299],[689,723],[29,566],[355,476],[507,813],[799,841],[166,581],[499,522],[155,508],[80,954],[412,564],[502,618],[59,746],[272,400],[75,312],[510,887],[303,524],[646,845],[786,928],[124,151],[109,858],[96,762],[291,798],[69,303],[27,112],[292,774],[257,384],[59,755],[140,245],[431,769],[60,338],[173,403],[95,666],[165,384],[298,894],[963,980],[325,945],[419,440],[338,424],[344,846],[396,449],[76,242],[620,981],[264,433],[580,686],[196,682],[272,926],[223,593],[644,785],[487,924],[289,511],[714,988],[625,987],[50,362],[88,664],[233,352],[32,754],[206,961],[641,810],[301,570],[77,523],[26,109],[482,580],[528,683],[128,228],[436,452],[253,844],[126,877],[462,994],[204,337],[380,625],[179,807],[635,726],[143,748],[594,798],[972,996],[328,780],[267,831],[176,399],[257,600],[495,735],[844,893],[102,803],[62,942],[354,903],[234,301],[306,854],[63,555],[39,179],[125,749],[414,487],[80,291],[416,835],[77,951],[10,384],[637,798],[248,966],[646,879],[210,839],[675,876],[580,990],[187,245],[18,876],[881,933],[422,747],[422,432],[635,742],[813,976],[719,900],[149,672],[518,999],[342,746],[121,262],[457,876],[534,984],[219,524],[192,228],[636,671],[196,835],[323,658],[360,747],[643,969],[95,414],[199,325],[169,471],[50,235],[307,517],[500,927],[226,886],[131,962],[65,313],[470,514],[851,987],[437,665],[284,620],[468,752],[54,781],[266,885],[362,825],[0,90],[14,619],[259,686],[171,180],[249,520],[240,245],[225,264],[128,372],[198,383],[306,422],[46,376],[107,797],[746,961],[401,474],[346,435],[241,355],[109,919],[497,541],[271,871],[329,953],[376,541],[564,626],[91,514],[8,610],[595,865],[888,971],[852,905],[532,974],[211,653],[288,410],[463,501],[258,987],[99,515],[494,780],[562,891],[392,620],[293,409],[161,250],[460,527],[801,939],[275,929],[76,553],[236,555],[192,257],[497,604],[140,931],[224,845],[159,339],[328,902],[63,658],[231,626],[862,947],[305,469],[109,426],[216,499],[156,162],[297,685],[101,719],[524,978],[794,914],[933,950],[859,982],[626,929],[162,685],[252,904],[95,837],[293,705],[117,120],[334,880],[19,937],[304,989],[391,800],[54,80],[266,970],[99,916],[34,819],[163,348],[507,725],[295,826],[99,308],[378,463],[799,833],[389,975],[699,709],[836,967],[38,990],[586,871],[664,958],[840,990],[333,379],[71,282],[487,778],[766,845],[225,732],[446,703],[672,762],[342,512],[693,862],[80,316],[325,836],[118,738],[278,297],[107,205],[442,743],[715,812],[40,660],[138,272],[234,941],[804,812],[459,631],[45,798],[246,556],[396,797],[817,894],[548,603],[233,613],[386,742],[215,974],[102,628],[44,555],[210,281],[191,270],[119,979],[613,995],[794,987],[151,814],[621,719],[322,986],[144,200],[625,653],[574,632],[123,735],[528,612],[344,351],[203,298],[357,763],[303,357],[55,555],[209,916],[97,979],[602,994],[74,104],[94,665],[561,884],[202,843],[849,876],[630,683],[37,315],[335,705],[63,569],[76,594],[377,984],[246,735],[49,328],[29,380],[394,397],[66,158],[270,648],[581,944],[304,480],[161,459],[626,782],[169,403],[19,904],[289,387],[200,402],[276,608],[45,662],[339,569],[103,673],[328,602],[328,905],[438,910],[675,679],[125,313],[383,656],[179,266],[807,968],[176,946],[250,466],[106,295],[409,627],[399,708],[350,812],[54,363],[482,774],[217,411],[58,73],[865,912],[387,554],[21,876],[263,374],[784,969],[391,997],[170,181],[56,163],[510,575],[159,925],[14,532],[605,699],[834,845],[119,835],[522,931],[341,749],[361,469],[187,437],[78,613],[814,950],[443,996],[542,876],[378,694],[170,183],[560,803],[320,486],[50,530],[817,941],[209,521],[258,322],[235,540],[595,950],[191,497],[16,953],[299,436],[236,568],[160,298],[812,874],[173,916],[731,770],[341,768],[76,956],[788,858],[67,639],[331,674],[693,792],[62,188],[555,626],[313,473],[172,470],[245,250],[10,116],[754,976],[665,694],[530,947],[506,785],[752,854],[437,788],[61,731],[361,926],[318,909],[405,470],[331,919],[577,589],[931,976],[288,746],[151,340],[279,654],[397,523],[113,496],[318,807],[84,955],[290,637],[517,966],[687,858],[342,741],[238,554],[809,924],[76,162],[941,975],[109,452],[21,663],[207,583],[670,838],[150,558],[801,874],[318,483],[286,377],[173,216],[111,431],[463,489],[630,884],[623,782],[193,305],[8,690],[476,937],[35,938],[159,317],[96,977],[198,488],[460,461],[537,607],[426,451],[42,90],[488,794],[56,819],[43,66],[96,200],[383,743],[293,299],[119,218],[531,720],[432,582],[338,888],[560,700],[619,747],[400,488],[569,968],[519,569],[284,628],[32,438],[369,706],[282,283],[645,959],[129,381],[667,725],[313,549],[9,66],[495,619],[393,729],[425,888],[26,390],[145,568],[126,288],[318,418],[115,695],[215,449],[521,645],[228,962],[180,838],[53,318],[41,820],[772,801],[292,729],[138,835],[538,557],[588,698],[85,169],[503,883],[499,603],[542,954],[439,727],[514,923],[291,843],[269,875],[645,672],[535,825],[19,279],[121,962],[60,240],[181,902],[110,907],[649,995],[30,687],[481,678],[147,300],[663,810],[392,742],[345,568],[600,848],[732,815],[320,717],[577,994],[454,790],[427,491],[43,983],[83,172],[308,398],[391,817],[575,629],[393,931],[601,797],[485,685],[41,95],[139,463],[507,549],[843,980],[342,652],[111,972],[167,309],[71,834],[386,418],[57,991],[133,715],[692,835],[376,513],[164,308],[851,877],[581,774],[755,849],[608,900],[360,409],[21,507],[128,680],[252,965],[83,936],[572,871],[309,378],[80,232],[714,855],[489,559],[146,996],[533,549],[189,401],[288,312],[196,202],[268,408],[213,522],[486,817],[231,402],[14,804],[825,897],[408,594],[524,618],[10,487],[262,860],[301,862],[246,634],[582,969],[284,976],[271,286],[397,606],[239,422],[432,443],[359,907],[355,826],[268,468],[173,451],[356,854],[546,992],[170,411],[486,758],[84,771],[868,898],[149,735],[767,833],[12,102],[302,509],[414,711],[970,991],[83,771],[97,715],[389,595],[215,374],[182,381],[313,453],[531,835],[461,666],[496,596],[58,241],[334,996],[526,987],[263,567],[200,883],[73,419],[58,293],[553,785],[502,593],[462,475],[606,662],[84,107],[698,720],[99,672],[528,817],[260,582],[563,773],[187,305],[253,752],[152,981],[379,410],[30,515],[248,439],[217,406],[113,127],[332,498],[142,878],[136,396],[228,388],[11,884],[42,255],[4,175],[660,860],[521,863],[69,328],[796,817],[92,464],[142,217],[214,691],[981,989],[354,895],[268,669],[80,524],[703,723],[129,292],[141,216],[634,807],[350,625],[53,151],[106,708],[2,872],[93,723],[35,984],[778,829],[521,583],[95,607],[342,933],[425,983],[71,89],[3,94],[448,676],[362,822],[233,740],[145,786],[2,784],[47,974],[287,981],[565,711],[34,138],[312,605],[566,879],[335,740],[255,878],[657,987],[207,781],[235,865],[435,808],[292,588],[126,196],[834,988],[530,961],[536,709],[461,824],[394,577],[192,832],[525,752],[297,725],[33,35],[257,838],[65,276],[402,876],[478,747],[692,801],[61,809],[466,550],[261,412],[178,608],[134,266],[611,765],[45,740],[6,719],[154,406],[268,662],[46,233],[761,977],[74,370],[151,581],[21,753],[268,995],[25,573],[772,937],[27,181],[275,556],[11,45],[375,915],[649,991],[515,616],[123,987],[522,544],[320,488],[210,370],[101,702],[216,659],[396,812],[657,911],[672,674],[14,540],[140,580],[403,835],[230,608],[120,315],[275,304],[806,973],[49,796],[398,729],[527,772],[113,674],[154,452],[233,971],[362,480],[467,509],[249,797],[33,666],[9,991],[219,576],[136,857],[911,945],[521,791],[98,949],[337,507],[446,522],[589,891],[578,609],[835,987],[99,464],[192,845],[10,731],[479,506],[286,456],[137,677],[211,239],[116,161],[699,752],[20,251],[692,893],[580,957],[636,837],[180,972],[424,546],[317,331],[175,915],[19,187],[360,862],[43,944],[322,849],[614,665],[85,985],[156,337],[401,751],[202,327],[250,836],[557,788],[470,988],[4,282],[683,932],[491,534],[765,888],[19,235],[127,843],[339,677],[108,190],[122,199],[213,886],[383,742],[526,932],[163,678],[167,271],[643,914],[271,644],[187,572],[122,679],[398,985],[290,905],[487,741],[81,493],[639,713],[311,790],[3,47],[150,844],[585,979],[283,316],[232,271],[59,616],[233,858],[143,398],[308,966],[452,879],[467,845],[87,674],[464,604],[101,141],[144,972],[372,650],[796,982],[39,568],[95,294],[327,633],[890,962],[282,407],[281,326],[352,788],[570,902],[757,921],[531,784],[236,284],[445,865],[360,724],[317,761],[66,328],[194,340],[409,562],[362,688],[569,876],[195,953],[855,918],[416,864],[213,273],[269,947],[63,529],[833,916],[28,914],[830,940],[203,303],[159,974],[551,819],[300,618],[290,553],[518,921],[158,455],[835,947],[252,508],[117,260],[305,376],[335,465],[96,445],[210,513],[556,644],[300,547],[72,928],[253,558],[343,585],[93,515],[535,810],[385,741],[392,965],[99,141],[188,535],[19,921],[241,596],[141,300],[321,732],[697,727],[170,925],[151,745],[616,856],[383,465],[311,697],[306,695],[160,856],[22,596],[258,718],[194,906],[632,749],[427,987],[307,356],[23,888],[375,968],[186,313],[135,431],[27,439],[331,931],[444,991],[477,675],[728,740],[596,868],[307,857],[223,463],[214,470],[244,263],[610,711],[198,773],[241,984],[335,940],[12,677],[358,538],[675,761],[560,825],[355,929],[821,983],[83,571],[513,702],[341,476],[475,868],[334,352],[811,956],[233,295],[43,557],[487,817],[519,829],[470,728],[574,754],[54,857],[144,828],[140,254],[556,859],[165,868],[317,909],[43,263],[323,380],[119,239],[356,554],[44,511],[626,915],[205,389],[166,816],[521,899],[98,773],[338,343],[79,355],[260,798],[209,850],[166,176],[804,820],[296,805],[85,338],[406,608],[97,954],[201,775],[681,890],[33,601],[251,834],[776,956],[138,551],[195,924],[112,137],[862,987],[461,806],[19,228],[354,647],[257,984],[499,971],[33,237],[30,541],[151,727],[337,529],[25,386],[47,300],[548,582],[302,312],[7,868],[66,117],[154,622],[462,594],[622,752],[641,710],[527,760],[152,536],[406,879],[200,331],[98,866],[245,503],[285,894],[73,583],[2,323],[62,419],[137,407],[199,461],[771,865],[515,721],[168,243],[629,655],[298,432],[442,562],[688,784],[492,747],[638,831],[86,284],[177,514],[633,894],[180,343],[253,830],[208,604],[884,967],[531,592],[131,644],[6,185],[174,319],[169,266],[11,272],[236,897],[232,484],[442,796],[108,642],[173,514],[133,418],[305,807],[8,858],[420,811],[219,246],[305,648],[443,791],[356,828],[76,353],[19,156],[263,631],[126,377],[208,726],[449,814],[236,792],[7,207],[144,156],[143,532],[181,775],[61,125],[266,568],[469,569],[293,797],[299,665],[357,437],[732,916],[231,736],[635,915],[378,632],[83,790],[450,731],[722,894],[678,795],[386,710],[325,411],[131,491],[840,886],[730,761],[401,938],[71,660],[278,426],[668,770],[522,556],[585,864],[429,597],[18,933],[335,618],[220,934],[676,944],[217,548],[413,764],[271,479],[657,804],[56,510],[354,366],[738,904],[117,796],[555,674],[214,684],[285,996],[105,309],[395,558],[153,388],[656,756],[143,688],[341,587],[810,827],[310,648],[3,992],[334,943],[367,768],[376,711],[385,864],[93,472],[473,706],[597,924],[694,845],[47,522],[155,184],[270,718],[213,525],[896,948],[276,673],[115,874],[485,887],[760,825],[66,95],[691,874],[62,787],[440,594],[79,356],[640,672],[527,840],[44,596],[431,762],[16,455],[682,975],[353,567],[731,748],[242,820],[55,387],[476,562],[516,906],[247,834],[652,989],[656,742],[35,962],[310,610],[431,992],[660,679],[440,915],[190,505],[87,566],[418,483],[581,881],[328,681],[83,366],[30,900],[64,432],[134,710],[200,452],[256,440],[575,893],[530,756],[71,666],[739,900],[289,566],[489,575],[196,985],[191,646],[427,697],[231,500],[185,953],[29,134],[80,236],[28,582],[330,724],[690,886],[198,898],[473,681],[439,790],[95,573],[100,942],[460,615],[182,283],[264,380],[424,606],[115,534],[352,792],[34,655],[644,902],[35,724],[400,934],[377,390],[123,257],[257,735],[447,453],[194,593],[190,256],[362,889],[192,993],[210,508],[8,437],[229,428],[2,124],[73,448],[618,763],[469,717],[487,830],[90,700],[111,878],[562,989],[233,252],[340,687],[143,536],[82,202],[145,749],[808,962],[43,405],[340,726],[526,742],[194,889],[553,656],[173,541],[158,905],[264,781],[223,418],[130,598],[93,442],[420,631],[178,556],[40,158],[415,700],[174,520],[454,981],[795,980],[687,759],[651,715],[325,598],[292,715],[175,987],[85,165],[437,807],[719,949],[184,977],[403,725],[309,771],[284,797],[6,512],[41,929],[524,660],[165,229],[741,756],[3,536],[663,752],[291,567],[482,591],[367,428],[720,721],[448,604],[459,525],[185,254],[380,918],[752,841],[64,544],[595,869],[469,559],[122,672],[271,776],[489,770],[26,786],[270,807],[740,986],[31,825],[247,754],[295,703],[13,467],[18,538],[342,609],[176,238],[298,887],[97,474],[29,568],[313,589],[196,271],[601,855],[379,648],[215,834],[258,983],[227,635],[899,944],[290,949],[551,585],[267,688],[536,762],[208,822],[260,357],[167,800],[650,866],[275,490],[94,563],[773,908],[247,612],[105,894],[311,715],[363,724],[197,553],[4,580],[757,883],[258,885],[42,732],[635,667],[72,618],[123,574],[629,988],[327,662],[67,567],[802,898],[126,413],[7,881],[144,540],[378,644],[65,445],[314,843],[0,277],[317,849],[41,406],[738,915],[48,581],[84,227],[161,803],[641,844],[738,767],[335,652],[48,486],[76,857],[363,790],[223,589],[211,681],[22,397],[683,916],[378,645],[207,455],[513,592],[475,849],[13,441],[336,880],[803,926],[32,564],[820,960],[288,931],[735,933],[295,572],[235,434],[27,300],[60,640],[347,839],[674,879],[160,305],[418,628],[59,414],[46,374],[489,930],[740,827],[89,766],[10,44],[431,603],[317,484],[307,945],[65,71],[295,873],[951,989],[477,537],[321,526],[144,830],[263,283],[319,728],[631,745],[339,643],[255,809],[402,510],[133,565],[251,257],[153,829],[32,574],[8,285],[340,350],[334,898],[467,959],[95,643],[266,788],[163,498],[270,621],[503,744],[639,672],[51,66],[553,980],[12,353],[60,626],[367,654],[673,895],[605,882],[469,739],[60,832],[170,913],[101,195],[117,304],[149,292],[92,773],[32,737],[13,885],[502,940],[147,653],[92,268],[375,628],[474,638],[310,746],[258,388],[253,705],[352,371],[11,563],[68,369],[287,599],[310,984],[250,893],[558,614],[530,608],[507,709],[375,392],[360,609],[53,304],[804,991],[608,612],[205,826],[299,582],[407,979],[539,893],[756,789],[228,556],[212,933],[122,309],[223,934],[461,919],[187,836],[728,760],[556,962],[809,884],[185,907],[770,858],[411,876],[451,794],[285,387],[326,541],[614,985],[105,440],[611,986],[283,701],[507,855],[168,731],[412,518],[132,970],[825,853],[293,357],[528,682],[534,610],[37,278],[536,662],[55,128],[158,184],[52,488],[576,648],[50,343],[242,288],[387,938],[282,905],[25,31],[568,955],[139,260],[709,976],[459,854],[47,970],[345,944],[493,838],[316,455],[280,753],[418,692],[468,691],[834,942],[381,644],[51,366],[423,744],[232,914],[24,510],[282,318],[854,895],[284,570],[650,957],[3,390],[290,723],[508,876],[234,843],[291,801],[23,395],[179,766],[142,837],[528,572],[635,984],[446,783],[332,854],[675,875],[497,933],[86,756],[679,965],[78,140],[360,869],[847,925],[197,223],[215,737],[557,709],[403,595],[22,339],[289,341],[125,848],[225,676],[350,608],[355,874],[584,868],[108,325],[615,634],[565,807],[804,981],[167,558],[98,784],[111,489],[43,174],[46,939],[180,690],[293,916],[3,291],[14,545],[74,880],[397,639],[700,962],[310,598],[333,385],[406,907],[72,348],[95,699],[224,397],[639,681],[205,331],[556,887],[78,173],[61,467],[284,464],[463,771],[114,592],[49,412],[292,888],[790,885],[694,914],[464,737],[535,551],[284,313],[92,994],[495,612],[42,378],[764,934],[716,936],[578,679],[268,520],[558,725],[66,953],[69,340],[7,61],[234,731],[128,637],[603,959],[225,886],[131,299],[74,848],[130,968],[216,360],[291,731],[150,770],[454,905],[208,733],[251,381],[218,245],[203,778],[80,226],[238,419],[388,918],[307,983],[76,524],[738,793],[825,975],[251,737],[23,440],[420,782],[791,878],[67,517],[537,689],[473,973],[597,963],[615,732],[206,670],[95,718],[495,711],[725,738],[23,240],[735,879],[70,950],[100,759],[445,617],[139,279],[219,857],[578,820],[419,789],[209,401],[465,492],[457,996],[391,490],[541,926],[623,648],[130,422],[447,945],[648,780],[569,652],[157,752],[199,570],[79,792],[952,994],[165,271],[353,802],[616,884],[261,902],[548,971],[190,696],[207,890],[299,677],[545,833],[37,97],[668,893],[249,842],[7,280],[658,915],[728,782],[773,840],[512,847],[82,142],[912,937],[129,251],[623,968],[97,135],[540,658],[198,592],[443,667],[371,664],[130,381],[35,188],[100,404],[157,436],[350,830],[238,678],[265,786],[539,602],[114,838],[479,962],[26,659],[114,305],[108,418],[50,665],[178,601],[176,861],[191,496],[146,689],[31,685],[752,915],[418,654],[230,588],[568,791],[511,643],[369,973],[5,207],[503,712],[544,976],[379,595],[162,664],[410,558],[330,986],[214,694],[203,315],[485,995],[595,773],[213,795],[50,503],[385,473],[408,428],[653,834],[2,267],[675,910],[129,697],[195,750],[772,967],[643,964],[564,658],[448,586],[926,962],[701,820],[45,409],[781,923],[11,933],[475,565],[143,755],[197,524],[0,720],[642,936],[178,988],[100,395],[458,466],[590,611],[99,232],[504,688],[973,994],[11,849],[662,741],[121,533],[934,972],[642,696],[229,616],[91,512],[314,352],[78,697],[626,980],[131,219],[356,407],[207,511],[219,788],[522,965],[540,591],[422,701],[69,857],[552,608],[493,808],[803,947],[73,836],[51,568],[51,112],[561,741],[360,598],[334,795],[419,524],[201,682],[746,832],[122,800],[629,636],[258,835],[216,248],[419,913],[315,729],[82,594],[159,953],[16,595],[670,717],[643,744],[547,749],[724,855],[836,911],[334,890],[513,993],[337,940],[249,655],[241,322],[457,810],[335,805],[549,789],[649,984],[705,783],[493,501],[409,485],[329,862],[25,412],[167,407],[543,694],[401,506],[278,613],[337,608],[490,745],[220,517],[505,883],[661,925],[194,819],[760,919],[247,495],[742,972],[760,916],[433,692],[265,942],[324,597],[387,412],[95,126],[55,880],[759,972],[887,892],[482,749],[778,916],[699,756],[465,731],[263,640],[77,362],[798,824],[175,774],[124,400],[501,797],[473,647],[101,621],[561,938],[77,437],[234,536],[244,843],[347,837],[199,299],[478,665],[849,945],[45,413],[782,820],[686,773],[83,116],[517,519],[329,852],[253,810],[406,711],[608,725],[599,963],[172,887],[465,998],[132,626],[142,767],[189,365],[91,452],[242,944],[474,747],[183,522],[344,652],[98,948],[183,684],[112,746],[401,922],[79,274],[445,842],[857,860],[90,854],[164,278],[669,706],[160,407],[711,937],[217,704],[428,677],[30,407],[384,952],[371,492],[410,519],[363,592],[159,518],[557,687],[307,677],[513,767],[811,904],[272,749],[758,863],[799,906],[169,752],[547,797],[522,572],[342,646],[8,595],[428,442],[254,772],[346,778],[67,935],[234,284],[92,778],[274,316],[452,674],[66,150],[253,477],[703,848],[869,900],[845,987],[308,359],[425,545],[780,829],[4,846],[502,842],[120,697],[86,768],[206,451],[520,939],[498,813],[495,871],[49,488],[608,797],[181,610],[33,41],[139,293],[96,514],[839,883],[229,722],[8,71],[42,326],[102,684],[618,796],[577,905],[284,734],[187,333],[310,745],[341,997],[629,630],[861,965],[617,964],[220,845],[173,481],[261,878],[335,934],[110,879],[222,266],[446,454],[119,516],[147,660],[122,771],[540,609],[13,670],[269,727]"); + succProb = + new double[] { + 0.88, 0.59, 0.67, 0.93, 0.76, 0.88, 0.9, 0.95, 0.7, 0.95, 0.69, 0.87, 0.7, 0.74, + 0.95, 0.89, 0.71, 0.87, 0.83, 0.98, 0.91, 0.75, 0.63, 0.85, 0.9, 0.7, 0.73, + 0.58, 0.56, 0.58, 0.88, 0.78, 0.98, 0.58, 0.94, 0.93, 0.91, 0.81, 0.7, 0.71, + 0.75, 0.74, 0.78, 0.58, 0.89, 0.68, 0.99, 0.93, 0.63, 0.53, 0.64, 0.57, 0.91, + 0.7, 0.99, 0.66, 0.69, 0.89, 0.83, 0.66, 0.77, 0.85, 0.53, 0.96, 0.95, 0.79, + 0.86, 0.54, 0.97, 0.61, 0.66, 0.59, 0.67, 0.55, 0.73, 0.68, 0.96, 0.99, 0.59, + 0.67, 0.81, 0.61, 0.92, 0.69, 0.93, 0.7, 0.99, 0.76, 0.81, 0.85, 1.0, 0.54, 0.8, + 0.55, 0.51, 0.89, 0.83, 0.75, 0.92, 0.75, 0.8, 0.58, 0.88, 0.73, 0.73, 0.93, + 0.52, 0.52, 0.61, 0.54, 0.88, 0.55, 0.91, 0.53, 0.63, 0.56, 0.52, 0.92, 0.54, + 0.86, 0.8, 0.77, 0.85, 0.66, 0.82, 0.94, 0.84, 0.64, 0.8, 0.52, 0.92, 0.59, + 0.97, 0.87, 0.67, 0.71, 0.81, 0.71, 0.93, 0.89, 0.77, 0.59, 0.86, 0.62, 0.64, + 0.51, 0.69, 0.93, 0.59, 0.74, 0.99, 0.8, 0.53, 0.85, 0.69, 0.92, 0.62, 0.9, + 0.83, 0.74, 0.85, 0.93, 0.87, 0.85, 0.59, 0.93, 0.56, 0.98, 0.59, 0.75, 0.89, + 0.64, 0.53, 0.65, 0.72, 0.88, 0.78, 0.76, 0.56, 0.85, 0.71, 0.81, 0.53, 0.77, + 0.91, 0.55, 0.7, 0.65, 0.62, 0.67, 0.82, 0.68, 0.72, 0.92, 0.76, 0.67, 0.62, + 0.95, 0.64, 0.92, 0.77, 0.93, 0.87, 1.0, 0.92, 0.86, 0.59, 0.62, 0.62, 0.54, + 0.65, 0.79, 0.8, 0.93, 0.92, 0.53, 0.88, 0.58, 0.67, 1.0, 0.82, 1.0, 0.7, 0.8, + 0.62, 0.68, 0.86, 0.62, 0.69, 0.52, 0.76, 0.53, 0.57, 0.52, 0.55, 0.92, 0.6, + 0.98, 0.52, 0.88, 0.89, 0.68, 0.78, 0.87, 0.92, 0.96, 0.82, 0.97, 0.54, 0.92, + 0.81, 0.53, 0.92, 0.87, 0.74, 0.68, 0.77, 0.99, 0.89, 0.84, 0.65, 0.88, 0.53, + 0.97, 0.66, 0.72, 0.97, 0.56, 0.57, 0.59, 0.76, 0.81, 0.77, 0.95, 0.82, 0.67, + 0.61, 0.86, 0.58, 0.83, 0.83, 0.51, 0.65, 0.6, 0.53, 0.61, 0.75, 0.63, 0.8, + 0.94, 0.86, 0.75, 0.52, 0.81, 0.91, 0.61, 0.57, 0.78, 0.85, 0.62, 0.56, 0.59, + 0.89, 0.56, 0.94, 0.84, 0.88, 0.7, 0.9, 0.72, 0.94, 0.94, 0.91, 0.94, 0.69, + 0.98, 0.86, 0.51, 0.69, 0.8, 0.69, 0.89, 0.61, 0.85, 0.55, 0.55, 0.92, 0.85, + 0.76, 0.74, 0.91, 0.7, 0.66, 0.54, 0.6, 0.51, 0.55, 0.83, 0.86, 0.66, 0.61, + 0.67, 0.67, 0.84, 0.85, 0.68, 0.81, 0.89, 0.73, 0.98, 0.65, 0.96, 0.53, 0.54, + 0.7, 0.89, 0.91, 0.82, 0.72, 0.65, 0.93, 1.0, 0.87, 0.92, 0.54, 0.9, 0.71, 0.69, + 0.5, 0.75, 0.5, 0.95, 0.98, 0.95, 0.64, 0.84, 0.56, 0.98, 0.9, 0.7, 0.7, 0.51, + 0.52, 0.73, 0.9, 0.86, 0.59, 0.69, 0.57, 0.72, 0.87, 0.9, 0.53, 0.79, 0.74, + 0.98, 0.83, 0.64, 0.7, 0.78, 0.62, 0.51, 0.85, 0.57, 0.95, 0.54, 0.8, 0.95, + 0.97, 0.94, 0.89, 0.53, 0.8, 0.9, 0.81, 0.72, 0.89, 0.69, 0.51, 0.87, 0.54, + 0.91, 0.99, 0.67, 0.82, 0.75, 0.84, 0.57, 0.69, 0.69, 0.89, 0.93, 0.51, 0.82, + 0.57, 0.73, 0.68, 0.8, 0.62, 0.94, 0.64, 0.6, 0.62, 0.81, 0.52, 0.72, 0.52, + 0.92, 0.97, 0.59, 0.86, 0.71, 0.67, 0.75, 0.76, 0.79, 0.88, 0.52, 0.88, 0.88, + 0.79, 0.79, 0.83, 0.71, 0.74, 0.62, 0.68, 0.68, 0.7, 0.69, 0.92, 0.98, 0.67, + 0.94, 0.7, 0.81, 0.97, 0.63, 0.68, 0.78, 0.92, 0.69, 0.64, 0.52, 0.62, 0.55, + 0.51, 0.53, 0.76, 0.71, 0.7, 0.65, 0.61, 0.51, 0.64, 0.85, 0.95, 0.95, 0.61, + 0.59, 0.54, 0.81, 0.54, 0.98, 0.7, 0.57, 0.95, 0.85, 0.72, 0.78, 0.98, 0.88, + 0.95, 0.86, 0.91, 0.52, 0.79, 0.97, 0.59, 0.69, 0.95, 0.94, 0.54, 0.62, 0.56, + 0.51, 0.87, 0.99, 0.52, 0.51, 0.69, 0.9, 0.94, 0.73, 0.79, 1.0, 0.97, 0.5, 0.84, + 0.57, 0.55, 0.88, 0.8, 0.96, 0.57, 0.68, 0.82, 0.62, 0.77, 0.73, 0.79, 0.89, + 0.54, 0.93, 0.96, 0.77, 0.68, 0.62, 0.66, 0.59, 0.98, 0.57, 0.51, 0.92, 0.59, + 0.5, 0.73, 0.62, 0.99, 0.88, 0.68, 0.58, 0.73, 0.59, 0.58, 0.87, 0.93, 0.92, + 0.51, 0.88, 0.92, 0.57, 0.55, 0.88, 0.94, 0.95, 0.84, 0.76, 0.87, 0.85, 0.61, + 0.7, 0.8, 0.69, 0.59, 0.7, 0.77, 0.91, 0.56, 0.52, 0.85, 0.89, 0.88, 0.55, 0.72, + 0.91, 0.7, 0.62, 0.54, 0.94, 0.69, 0.79, 0.64, 0.53, 0.65, 0.73, 0.92, 0.77, + 0.77, 0.55, 0.74, 0.96, 0.6, 0.58, 0.88, 0.94, 0.54, 0.58, 0.95, 0.69, 0.9, + 0.78, 0.56, 0.51, 0.9, 0.55, 0.58, 0.81, 0.67, 0.82, 0.74, 0.55, 0.8, 0.75, + 0.54, 0.7, 0.9, 0.78, 0.8, 0.81, 0.65, 0.93, 0.53, 0.73, 0.6, 0.67, 0.81, 0.62, + 0.7, 0.65, 0.72, 0.61, 0.86, 0.99, 0.87, 0.72, 0.53, 0.83, 0.91, 0.81, 0.86, + 0.86, 0.78, 0.57, 0.98, 0.56, 0.98, 0.97, 0.56, 0.91, 0.9, 0.6, 0.53, 0.51, + 0.87, 0.69, 0.98, 0.52, 0.8, 0.56, 0.57, 0.61, 0.9, 0.73, 0.8, 0.6, 0.9, 0.79, + 0.62, 0.57, 0.73, 0.76, 0.97, 0.87, 0.82, 0.76, 0.91, 0.86, 0.88, 0.51, 0.54, + 0.77, 0.62, 0.72, 0.51, 0.92, 0.52, 0.82, 0.94, 0.81, 0.59, 0.66, 0.58, 0.67, + 0.92, 0.5, 0.91, 0.97, 0.93, 0.81, 0.67, 0.68, 0.9, 0.54, 0.9, 0.84, 0.85, 0.62, + 0.95, 0.81, 0.76, 0.54, 0.62, 0.83, 0.75, 0.66, 0.8, 0.74, 0.96, 0.84, 0.6, + 0.73, 0.81, 0.55, 0.69, 0.81, 0.84, 0.74, 0.77, 0.87, 0.81, 0.82, 0.82, 0.86, + 0.51, 0.64, 0.62, 0.69, 0.53, 0.86, 0.53, 0.56, 0.55, 0.95, 0.59, 0.73, 0.62, + 0.97, 0.58, 0.68, 0.87, 0.74, 0.81, 0.54, 0.98, 0.86, 0.75, 0.87, 0.53, 0.55, + 0.6, 0.79, 0.75, 0.75, 0.55, 0.88, 0.77, 0.75, 0.53, 0.96, 0.84, 0.63, 0.67, + 0.89, 0.63, 0.97, 0.62, 0.56, 0.81, 0.61, 0.69, 0.7, 0.98, 0.65, 0.6, 0.96, + 0.82, 0.75, 0.69, 0.74, 0.82, 0.91, 0.86, 0.85, 0.89, 0.51, 0.51, 0.6, 0.81, + 0.68, 0.9, 0.74, 1.0, 0.85, 0.53, 0.72, 0.5, 0.74, 0.54, 0.69, 0.75, 0.71, 0.95, + 0.77, 0.77, 0.84, 0.55, 0.74, 0.61, 0.54, 0.65, 0.94, 0.67, 0.71, 0.65, 0.91, + 1.0, 0.7, 0.62, 0.65, 0.81, 0.78, 0.76, 0.88, 0.7, 0.88, 0.79, 0.67, 0.94, 0.98, + 0.67, 0.64, 0.63, 0.56, 0.97, 0.68, 0.89, 0.59, 0.7, 0.52, 0.61, 0.84, 0.87, + 0.75, 0.9, 0.61, 0.52, 1.0, 0.88, 0.82, 0.64, 0.72, 0.81, 0.89, 0.98, 0.63, + 0.99, 0.63, 0.8, 0.72, 0.91, 0.56, 0.98, 0.7, 0.93, 0.68, 0.7, 0.58, 0.93, 0.66, + 0.99, 0.81, 0.89, 0.82, 0.94, 0.81, 0.87, 0.57, 0.52, 0.8, 0.84, 0.5, 0.83, + 0.73, 0.84, 0.5, 0.72, 0.74, 0.82, 0.56, 0.74, 0.76, 0.83, 0.74, 0.54, 0.62, + 0.96, 0.61, 0.53, 0.59, 0.87, 0.96, 0.6, 0.67, 0.99, 0.72, 0.94, 0.57, 0.88, + 0.55, 0.77, 0.89, 0.83, 0.68, 0.86, 0.81, 0.6, 0.58, 0.56, 0.79, 0.65, 0.61, + 0.54, 0.66, 0.52, 0.61, 0.64, 0.88, 0.71, 0.52, 0.84, 0.81, 0.92, 0.64, 0.64, + 0.95, 0.53, 0.92, 0.69, 0.8, 0.81, 0.54, 0.7, 0.55, 0.81, 0.95, 0.99, 0.59, 0.9, + 0.97, 0.67, 0.69, 0.88, 0.58, 0.55, 0.58, 0.91, 0.57, 0.8, 0.59, 0.72, 0.64, + 0.95, 0.54, 0.51, 0.63, 0.89, 0.92, 0.78, 0.71, 0.66, 0.73, 0.8, 0.66, 0.95, + 0.54, 0.51, 0.78, 0.7, 0.76, 0.86, 0.59, 0.76, 0.64, 0.81, 0.58, 0.62, 0.86, + 0.89, 0.6, 0.74, 0.78, 0.9, 0.72, 0.91, 0.63, 0.69, 0.76, 0.58, 0.97, 0.9, 0.77, + 0.78, 0.5, 0.78, 0.69, 0.78, 1.0, 0.52, 0.81, 0.9, 0.56, 0.69, 0.58, 0.58, 0.6, + 0.68, 0.82, 0.99, 0.52, 0.92, 0.67, 0.61, 0.71, 0.99, 0.56, 0.6, 0.62, 0.85, + 0.84, 0.99, 0.59, 0.51, 0.78, 0.85, 0.54, 0.7, 0.9, 0.56, 0.89, 0.91, 0.52, 0.5, + 0.63, 0.6, 0.65, 0.94, 0.7, 0.93, 0.92, 0.64, 0.89, 0.74, 0.74, 0.64, 0.86, + 0.91, 0.55, 0.9, 0.51, 0.86, 0.84, 0.56, 0.98, 1.0, 0.78, 0.72, 0.71, 0.86, + 0.99, 0.64, 0.58, 0.51, 0.96, 0.68, 0.91, 0.52, 0.57, 0.79, 0.81, 0.61, 0.57, + 0.86, 0.66, 0.76, 0.61, 0.56, 0.73, 0.75, 0.83, 0.69, 0.57, 0.58, 0.59, 0.53, + 0.84, 0.8, 0.79, 0.8, 0.75, 0.97, 0.58, 0.89, 0.88, 0.54, 0.75, 0.71, 0.62, + 0.76, 0.85, 0.52, 0.94, 0.71, 0.73, 0.8, 0.67, 0.87, 0.54, 0.72, 0.72, 0.64, + 0.71, 0.66, 0.68, 0.53, 0.78, 0.65, 0.77, 0.97, 0.84, 0.57, 0.85, 0.67, 0.87, + 0.59, 0.68, 0.9, 0.79, 0.54, 0.5, 0.53, 0.97, 0.74, 0.89, 0.98, 0.96, 0.9, 0.84, + 0.8, 0.56, 0.67, 0.87, 0.8, 0.77, 0.62, 0.65, 0.74, 0.93, 0.7, 0.81, 0.77, 0.61, + 0.85, 0.9, 0.67, 0.73, 0.87, 0.77, 0.91, 0.87, 0.93, 0.61, 0.85, 0.87, 0.76, + 0.63, 0.52, 0.95, 0.84, 0.87, 0.55, 0.87, 0.76, 0.58, 0.7, 0.53, 0.93, 0.76, + 0.52, 0.79, 0.68, 0.65, 0.66, 0.53, 0.89, 0.5, 0.77, 0.6, 0.52, 0.61, 0.7, 0.63, + 0.88, 0.56, 0.68, 0.85, 0.87, 0.73, 0.84, 0.87, 0.55, 0.99, 0.53, 0.82, 0.91, + 0.91, 0.81, 0.85, 0.57, 0.58, 0.84, 0.92, 0.74, 0.52, 0.9, 0.88, 0.75, 0.61, + 0.62, 0.55, 0.56, 0.92, 0.62, 0.64, 0.56, 0.64, 0.73, 0.88, 0.98, 0.54, 0.75, + 0.8, 0.53, 0.92, 0.75, 0.72, 0.94, 0.93, 0.79, 0.95, 0.61, 0.99, 0.57, 0.74, + 0.56, 0.76, 0.53, 0.9, 0.65, 0.94, 0.89, 0.84, 0.87, 0.82, 0.67, 0.7, 0.87, + 0.92, 0.57, 0.63, 0.87, 0.66, 0.71, 0.61, 0.7, 0.73, 0.92, 0.9, 0.75, 0.84, + 0.96, 0.6, 0.58, 0.57, 0.65, 0.64, 0.63, 0.71, 0.62, 0.83, 0.58, 0.79, 0.68, + 0.59, 0.85, 0.7, 0.54, 0.63, 0.91, 0.64, 0.74, 0.66, 0.76, 0.76, 0.97, 0.96, + 0.95, 0.94, 0.89, 0.67, 0.69, 0.85, 0.82, 0.55, 0.64, 0.89, 0.64, 0.64, 0.87, + 0.53, 0.56, 0.68, 0.55, 0.78, 0.94, 0.63, 0.85, 0.61, 0.83, 0.8, 0.61, 0.84, + 0.83, 0.91, 0.76, 0.55, 0.84, 0.52, 0.96, 1.0, 0.6, 0.71, 0.97, 0.62, 0.88, + 0.52, 0.69, 0.71, 0.82, 0.66, 0.87, 0.66, 0.73, 0.6, 0.58, 0.61, 0.89, 0.84, + 0.53, 0.77, 0.83, 0.8, 0.51, 0.63, 0.75, 0.65, 0.95, 0.51, 0.93, 0.53, 0.51, + 0.54, 0.74, 0.82, 0.54, 0.56, 0.62, 0.69, 0.7, 0.64, 0.92, 0.5, 0.54, 0.87, + 0.91, 0.63, 0.9, 0.59, 0.55, 0.59, 0.6, 0.8, 0.9, 0.54, 0.89, 0.85, 0.65, 0.69, + 0.8, 0.88, 0.83, 0.62, 0.75, 0.71, 0.52, 0.71, 0.89, 0.94, 0.56, 0.93, 0.92, + 0.78, 0.55, 0.98, 0.52, 0.77, 0.83, 0.92, 0.78, 0.58, 0.66, 0.76, 0.53, 0.7, + 0.91, 0.55, 0.55, 0.56, 0.75, 0.75, 0.81, 0.91, 0.55, 0.98, 0.94, 0.64, 0.77, + 0.84, 0.93, 0.75, 0.64, 0.93, 0.87, 0.7, 0.82, 0.93, 0.66, 0.74, 0.51, 0.96, + 0.85, 0.63, 0.99, 0.59, 0.9, 0.53, 0.87, 0.74, 0.68, 0.74, 1.0, 0.54, 1.0, 0.93, + 0.99, 0.65, 0.71, 0.51, 0.99, 0.76, 0.6, 0.61, 0.91, 0.62, 0.93, 0.6, 0.69, + 0.57, 0.82, 0.85, 0.84, 0.77, 0.66, 0.77, 0.66, 0.74, 0.94, 0.72, 0.79, 0.66, + 0.94, 0.84, 0.84, 0.75, 0.52, 0.66, 0.58, 0.64, 0.52, 0.52, 0.87, 0.69, 0.75, + 0.77, 0.68, 0.82, 0.87, 0.95, 0.94, 0.71, 0.53, 0.8, 0.51, 1.0, 0.93, 0.58, + 0.65, 0.66, 0.66, 0.93, 1.0, 0.52, 0.52, 0.56, 0.69, 0.66, 0.52, 0.78, 0.54, + 0.56, 0.58, 0.82, 0.74, 0.85, 0.51, 0.51, 0.76, 0.87, 0.81, 0.81, 0.87, 0.9, + 0.85, 0.92, 0.85, 0.87, 0.97, 0.58, 0.98, 0.54, 0.81, 0.75, 0.72, 0.7, 0.56, + 0.83, 0.81, 0.95, 0.8, 0.88, 0.87, 0.55, 0.95, 0.67, 0.68, 0.93, 0.71, 0.53, + 0.74, 0.72, 0.92, 0.97, 0.84, 0.81, 0.86, 0.92, 0.56, 0.59, 0.59, 0.81, 0.61, + 0.86, 0.89, 0.53, 0.7, 0.61, 0.57, 0.6, 0.95, 0.62, 0.6, 0.94, 0.68, 0.85, 0.72, + 0.64, 0.79, 0.7, 0.82, 0.72, 0.93, 0.59, 0.7, 0.67, 0.86, 0.86, 0.77, 0.95, + 0.83, 0.82, 0.93, 0.92, 0.61, 0.53, 0.94, 0.66, 0.67, 0.78, 0.88, 0.68, 0.93, + 0.9, 0.82, 0.83, 0.73, 0.74, 0.6, 0.95, 0.8, 0.62, 0.99, 0.9, 0.81, 0.58, 0.6, + 0.59, 0.6, 0.74, 0.81, 0.69, 0.76, 0.88, 0.82, 0.5, 0.88, 0.9, 0.86, 0.72, 0.56, + 0.9, 0.84, 0.78, 0.88, 0.52, 0.83, 0.74, 0.6, 0.7, 0.99, 0.54, 0.6, 0.94, 0.79, + 0.96, 0.64, 0.51, 0.64, 0.55, 0.5, 0.92, 0.57, 0.97, 0.62, 0.57, 0.76, 0.57, + 0.81, 0.54, 0.59, 0.75, 0.6, 0.97, 0.68, 0.53, 0.6, 0.64, 0.88, 0.88, 0.97, + 0.91, 0.62, 0.7, 0.91, 0.56, 0.61, 0.82, 0.99, 0.7, 0.93, 0.93, 0.71, 0.81, + 0.64, 0.87, 0.76, 0.75, 0.97, 0.92, 0.91, 0.53, 0.68, 0.78, 0.95, 0.58, 0.72, + 0.88, 0.57, 0.61, 0.86, 0.83, 0.91, 0.6, 0.74, 0.83, 0.59, 0.69, 0.77, 0.73, + 0.76, 0.8, 0.69, 0.74, 0.85, 0.82, 0.98, 0.75, 0.67, 0.52, 0.57, 0.72, 0.73, + 0.71, 0.79, 0.86, 0.55, 0.99, 0.84, 0.97, 0.74, 0.77, 0.71, 0.8, 0.77, 0.85, + 0.73, 0.61, 0.85, 0.56, 0.91, 0.74, 0.54, 0.69, 0.84, 0.91, 0.94, 0.86, 0.53, + 0.58, 0.53, 0.6, 0.8, 0.84, 0.95, 0.96, 0.72, 0.65, 0.64, 0.84, 0.93, 0.53, + 0.63, 0.76, 0.55, 0.9, 0.63, 0.68, 0.93, 0.54, 0.5, 0.55, 0.66, 0.54, 0.81, + 0.57, 0.53, 0.64, 0.69, 0.62, 0.65, 0.51, 0.98, 0.75, 0.59, 0.57, 0.62, 0.63, + 0.86, 0.78, 0.56, 0.84, 0.82, 0.68, 0.93, 0.77, 0.98, 0.51, 0.79, 0.77, 0.64, + 0.85, 0.78, 0.66, 0.54, 0.62, 0.6, 0.93, 0.9, 0.6, 0.96, 0.93, 0.99, 0.52, 0.82, + 0.56, 0.72, 0.87, 0.61, 0.5, 0.94, 0.77, 0.63, 0.8, 0.75, 0.87, 0.56, 0.78, + 0.89, 0.86, 0.75, 0.93, 0.82, 0.78, 0.76, 0.92, 0.75, 0.58, 0.75, 0.79, 0.95, + 0.74, 0.94, 0.69, 0.51, 0.74, 0.68, 0.58, 0.53, 0.94, 0.65, 0.94, 0.72, 0.89, + 0.96, 1.0, 0.67, 0.64, 0.87, 0.89, 0.78, 0.76, 0.51, 0.81, 0.9, 0.63, 0.93 + }; assertEquals(0.344138400144, solution1.maxProbability(1000, edges, succProb, 112, 493)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1518Test.java b/src/test/java/com/fishercoder/secondthousand/_1518Test.java index 82ef036223..ae78a54ffc 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1518Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1518Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1518; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1518Test { private _1518.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(6, solution1.numWaterBottles(5, 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1523Test.java b/src/test/java/com/fishercoder/secondthousand/_1523Test.java index 8a03df8825..e8bfc3bdc6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1523Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1523Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1523; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1523Test { private _1523.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(3, solution1.countOdds(3, 7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1524Test.java b/src/test/java/com/fishercoder/secondthousand/_1524Test.java index de062dcd86..402ed9bf78 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1524Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1524Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1524; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1524Test { private _1524.Solution1 solution1; private _1524.Solution2 solution2; @@ -19,44 +19,43 @@ public void setup() { @Test public void test1() { - arr = new int[]{1, 3, 5}; + arr = new int[] {1, 3, 5}; assertEquals(4, solution1.numOfSubarrays(arr)); } @Test public void test2() { - arr = new int[]{2, 4, 6}; + arr = new int[] {2, 4, 6}; assertEquals(0, solution1.numOfSubarrays(arr)); } @Test public void test4() { - arr = new int[]{1, 3, 5}; + arr = new int[] {1, 3, 5}; assertEquals(4, solution2.numOfSubarrays(arr)); } @Test public void test5() { - arr = new int[]{2, 4, 6}; + arr = new int[] {2, 4, 6}; assertEquals(0, solution2.numOfSubarrays(arr)); } @Test public void test6() { - arr = new int[]{1, 2, 3, 4, 5, 6, 7}; + arr = new int[] {1, 2, 3, 4, 5, 6, 7}; assertEquals(16, solution2.numOfSubarrays(arr)); } @Test public void test7() { - arr = new int[]{1, 2, 3, 4, 5}; + arr = new int[] {1, 2, 3, 4, 5}; assertEquals(9, solution2.numOfSubarrays(arr)); } @Test public void test8() { - arr = new int[]{1, 2, 3, 4}; + arr = new int[] {1, 2, 3, 4}; assertEquals(6, solution2.numOfSubarrays(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1525Test.java b/src/test/java/com/fishercoder/secondthousand/_1525Test.java index 81266c6dbf..52615f43e7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1525Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1525Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1525; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1525Test { private _1525.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(4, solution1.numSplits("aaaaa")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1526Test.java b/src/test/java/com/fishercoder/secondthousand/_1526Test.java index 3657b443b2..dab1cf14e0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1526Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1526Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1526; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1526Test { private _1526.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minNumberOperations(new int[]{1, 2, 3, 2, 1})); + assertEquals(3, solution1.minNumberOperations(new int[] {1, 2, 3, 2, 1})); } @Test public void test2() { - assertEquals(4, solution1.minNumberOperations(new int[]{3, 1, 1, 2})); + assertEquals(4, solution1.minNumberOperations(new int[] {3, 1, 1, 2})); } @Test public void test3() { - assertEquals(7, solution1.minNumberOperations(new int[]{3, 1, 5, 4, 2})); + assertEquals(7, solution1.minNumberOperations(new int[] {3, 1, 5, 4, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1528Test.java b/src/test/java/com/fishercoder/secondthousand/_1528Test.java index a641ca563b..773a3518b6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1528Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1528Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1528; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1528Test { private _1528.Solution1 solution1; private static int[] indices; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - indices = new int[]{4, 5, 6, 7, 0, 2, 1, 3}; + indices = new int[] {4, 5, 6, 7, 0, 2, 1, 3}; assertEquals("leetcode", solution1.restoreString("codeleet", indices)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1530Test.java b/src/test/java/com/fishercoder/secondthousand/_1530Test.java index cef6305eb3..89c24b7748 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1530Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1530Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1530; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1530Test { private _1530.Solution1 solution1; private static TreeNode root; @@ -33,7 +32,9 @@ public void test2() { @Test public void test3() { - root = TreeUtils.constructBinaryTree(Arrays.asList(7, 1, 4, 6, null, 5, 3, null, null, null, null, null, 2)); + root = + TreeUtils.constructBinaryTree( + Arrays.asList(7, 1, 4, 6, null, 5, 3, null, null, null, null, null, 2)); assertEquals(1, solution1.countPairs(root, 3)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1534Test.java b/src/test/java/com/fishercoder/secondthousand/_1534Test.java index f42b00324e..b3b1188556 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1534Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1534Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1534; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1534Test { private _1534.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{3, 0, 1, 1, 9, 7}; + arr = new int[] {3, 0, 1, 1, 9, 7}; assertEquals(4, solution1.countGoodTriplets(arr, 7, 2, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1535Test.java b/src/test/java/com/fishercoder/secondthousand/_1535Test.java index 292b27c58a..934482edc2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1535Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1535Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1535; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1535Test { private _1535.Solution1 solution1; private static int[] arr; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - arr = new int[]{2, 1, 3, 5, 4, 6, 7}; + arr = new int[] {2, 1, 3, 5, 4, 6, 7}; assertEquals(5, solution1.getWinner(arr, 2)); } @Test public void test2() { - arr = new int[]{1, 11, 22, 33, 44, 55, 66, 77, 88, 99}; + arr = new int[] {1, 11, 22, 33, 44, 55, 66, 77, 88, 99}; assertEquals(99, solution1.getWinner(arr, 100)); } @Test public void test3() { - arr = new int[]{1, 9, 8, 2, 3, 7, 6, 4, 5}; + arr = new int[] {1, 9, 8, 2, 3, 7, 6, 4, 5}; assertEquals(9, solution1.getWinner(arr, 7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1539Test.java b/src/test/java/com/fishercoder/secondthousand/_1539Test.java index f5e60c5b8b..3b0c738552 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1539Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1539Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1539; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1539Test { private _1539.Solution1 solution1; private _1539.Solution2 solution2; @@ -21,38 +21,37 @@ public void setup() { @Test public void test1() { - arr = new int[]{2, 3, 4, 7, 11}; + arr = new int[] {2, 3, 4, 7, 11}; assertEquals(9, solution1.findKthPositive(arr, 5)); } @Test public void test2() { - arr = new int[]{1, 2, 3, 4}; + arr = new int[] {1, 2, 3, 4}; assertEquals(6, solution1.findKthPositive(arr, 2)); } @Test public void test3() { - arr = new int[]{2, 3, 4, 7, 11}; + arr = new int[] {2, 3, 4, 7, 11}; assertEquals(9, solution2.findKthPositive(arr, 5)); } @Test public void test4() { - arr = new int[]{1, 2, 3, 4}; + arr = new int[] {1, 2, 3, 4}; assertEquals(6, solution2.findKthPositive(arr, 2)); } @Test public void test5() { - arr = new int[]{2, 3, 4, 7, 11}; + arr = new int[] {2, 3, 4, 7, 11}; assertEquals(9, solution3.findKthPositive(arr, 5)); } @Test public void test6() { - arr = new int[]{1, 2, 3, 4}; + arr = new int[] {1, 2, 3, 4}; assertEquals(6, solution3.findKthPositive(arr, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1541Test.java b/src/test/java/com/fishercoder/secondthousand/_1541Test.java index 6fe923e675..e73ebac519 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1541Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1541Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1541; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1541Test { private _1541.Solution1 solution1; @@ -43,5 +43,4 @@ public void test5() { public void test6() { assertEquals(4, solution1.minInsertions("(()))(()))()())))")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1544Test.java b/src/test/java/com/fishercoder/secondthousand/_1544Test.java index 16fa35d183..2dc6c7d6d3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1544Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1544Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1544; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1544Test { private _1544.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals("s", solution1.makeGood("s")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1545Test.java b/src/test/java/com/fishercoder/secondthousand/_1545Test.java index 0f8ef609ae..332dc74f5a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1545Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1545Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1545; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1545Test { private _1545.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals('1', solution1.findKthBit(2, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1550Test.java b/src/test/java/com/fishercoder/secondthousand/_1550Test.java index f1c6deb988..5ec03af89f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1550Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1550Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1550; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1550Test { private _1550.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{2, 6, 4, 1}; + arr = new int[] {2, 6, 4, 1}; assertEquals(false, solution1.threeConsecutiveOdds(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1551Test.java b/src/test/java/com/fishercoder/secondthousand/_1551Test.java index 3551b22977..b600442f5a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1551Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1551Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1551; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1551Test { private _1551.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.minOperations(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1556Test.java b/src/test/java/com/fishercoder/secondthousand/_1556Test.java index 26102f5327..32c25acc8a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1556Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1556Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1556; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1556Test { private _1556.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals("123.456.789", solution1.thousandSeparator(123456789)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1557Test.java b/src/test/java/com/fishercoder/secondthousand/_1557Test.java index 993287e97d..c3c20fba6d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1557Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1557Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1557; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1557; import java.util.Arrays; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1557Test { private _1557.Solution1 solution1; @@ -20,14 +19,25 @@ public void setup() { @Test public void test1() { - edges = Arrays.asList(Arrays.asList(0, 1), Arrays.asList(0, 2), Arrays.asList(2, 5), Arrays.asList(3, 4), Arrays.asList(4, 2)); + edges = + Arrays.asList( + Arrays.asList(0, 1), + Arrays.asList(0, 2), + Arrays.asList(2, 5), + Arrays.asList(3, 4), + Arrays.asList(4, 2)); assertEquals(Arrays.asList(0, 3), solution1.findSmallestSetOfVertices(6, edges)); } @Test public void test2() { - edges = Arrays.asList(Arrays.asList(0, 1), Arrays.asList(2, 1), Arrays.asList(3, 1), Arrays.asList(1, 4), Arrays.asList(2, 4)); + edges = + Arrays.asList( + Arrays.asList(0, 1), + Arrays.asList(2, 1), + Arrays.asList(3, 1), + Arrays.asList(1, 4), + Arrays.asList(2, 4)); assertEquals(Arrays.asList(0, 2, 3), solution1.findSmallestSetOfVertices(5, edges)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1558Test.java b/src/test/java/com/fishercoder/secondthousand/_1558Test.java index 3c46f21ef9..d1f852130f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1558Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1558Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1558; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1558Test { private _1558.Solution1 solution1; private static int[] nums; @@ -17,32 +17,31 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 5}; + nums = new int[] {1, 5}; assertEquals(5, solution1.minOperations(nums)); } @Test public void test2() { - nums = new int[]{2, 2}; + nums = new int[] {2, 2}; assertEquals(3, solution1.minOperations(nums)); } @Test public void test3() { - nums = new int[]{4, 2, 5}; + nums = new int[] {4, 2, 5}; assertEquals(6, solution1.minOperations(nums)); } @Test public void test4() { - nums = new int[]{3, 2, 2, 4}; + nums = new int[] {3, 2, 2, 4}; assertEquals(7, solution1.minOperations(nums)); } @Test public void test5() { - nums = new int[]{2, 4, 8, 16}; + nums = new int[] {2, 4, 8, 16}; assertEquals(8, solution1.minOperations(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1560Test.java b/src/test/java/com/fishercoder/secondthousand/_1560Test.java index 5d370584de..3c93c7e7e9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1560Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1560Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1560; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1560Test { private _1560.Solution1 solution1; @@ -18,17 +17,19 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(1, 2), solution1.mostVisited(4, new int[]{1, 3, 1, 2})); + assertEquals(Arrays.asList(1, 2), solution1.mostVisited(4, new int[] {1, 3, 1, 2})); } @Test public void test2() { - assertEquals(Arrays.asList(2), solution1.mostVisited(2, new int[]{2, 1, 2, 1, 2, 1, 2, 1, 2})); + assertEquals( + Arrays.asList(2), solution1.mostVisited(2, new int[] {2, 1, 2, 1, 2, 1, 2, 1, 2})); } @Test public void test3() { - assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), solution1.mostVisited(7, new int[]{1, 3, 5, 7})); + assertEquals( + Arrays.asList(1, 2, 3, 4, 5, 6, 7), + solution1.mostVisited(7, new int[] {1, 3, 5, 7})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1561Test.java b/src/test/java/com/fishercoder/secondthousand/_1561Test.java index 1b5fb9e95a..b2edf189bf 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1561Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1561Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1561; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1561Test { private _1561.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(9, solution1.maxCoins(new int[]{2, 4, 1, 2, 7, 8})); + assertEquals(9, solution1.maxCoins(new int[] {2, 4, 1, 2, 7, 8})); } @Test public void test2() { - assertEquals(4, solution1.maxCoins(new int[]{2, 4, 5})); + assertEquals(4, solution1.maxCoins(new int[] {2, 4, 5})); } @Test public void test3() { - assertEquals(18, solution1.maxCoins(new int[]{9, 8, 7, 6, 5, 1, 2, 3, 4})); + assertEquals(18, solution1.maxCoins(new int[] {9, 8, 7, 6, 5, 1, 2, 3, 4})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1566Test.java b/src/test/java/com/fishercoder/secondthousand/_1566Test.java index 5aa1d6d131..0fa7d3ca82 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1566Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1566Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1566; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1566Test { private _1566.Solution1 solution1; @@ -14,39 +14,39 @@ public void setup() { solution1 = new _1566.Solution1(); } - @Test public void test1() { - assertEquals(true, solution1.containsPattern(new int[]{1, 2, 4, 4, 4, 4}, 1, 3)); + assertEquals(true, solution1.containsPattern(new int[] {1, 2, 4, 4, 4, 4}, 1, 3)); } @Test public void test2() { - assertEquals(true, solution1.containsPattern(new int[]{1, 2, 1, 2, 1, 1, 1, 3}, 2, 2)); + assertEquals(true, solution1.containsPattern(new int[] {1, 2, 1, 2, 1, 1, 1, 3}, 2, 2)); } @Test public void test3() { - assertEquals(false, solution1.containsPattern(new int[]{1, 2, 1, 2, 1, 3}, 2, 3)); + assertEquals(false, solution1.containsPattern(new int[] {1, 2, 1, 2, 1, 3}, 2, 3)); } @Test public void test4() { - assertEquals(false, solution1.containsPattern(new int[]{1, 2, 3, 1, 2}, 2, 2)); + assertEquals(false, solution1.containsPattern(new int[] {1, 2, 3, 1, 2}, 2, 2)); } @Test public void test5() { - assertEquals(true, solution1.containsPattern(new int[]{1, 2, 4, 4, 4, 4}, 1, 3)); + assertEquals(true, solution1.containsPattern(new int[] {1, 2, 4, 4, 4, 4}, 1, 3)); } @Test public void test6() { - assertEquals(false, solution1.containsPattern(new int[]{2, 2, 2, 2}, 2, 3)); + assertEquals(false, solution1.containsPattern(new int[] {2, 2, 2, 2}, 2, 3)); } @Test public void test7() { - assertEquals(false, solution1.containsPattern(new int[]{2, 2, 1, 2, 2, 1, 1, 1, 2, 1}, 2, 2)); + assertEquals( + false, solution1.containsPattern(new int[] {2, 2, 1, 2, 2, 1, 1, 1, 2, 1}, 2, 2)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1567Test.java b/src/test/java/com/fishercoder/secondthousand/_1567Test.java index 0246a53527..8d20267219 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1567Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1567Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1567; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1567Test { private _1567.Solution1 solution1; @@ -16,32 +16,31 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.getMaxLen(new int[]{1, -2, -3, 4})); + assertEquals(4, solution1.getMaxLen(new int[] {1, -2, -3, 4})); } @Test public void test2() { - assertEquals(3, solution1.getMaxLen(new int[]{0, 1, -2, -3, -4})); + assertEquals(3, solution1.getMaxLen(new int[] {0, 1, -2, -3, -4})); } @Test public void test3() { - assertEquals(2, solution1.getMaxLen(new int[]{-1, -2, -3, 0, 1})); + assertEquals(2, solution1.getMaxLen(new int[] {-1, -2, -3, 0, 1})); } @Test public void test4() { - assertEquals(1, solution1.getMaxLen(new int[]{-1, 2})); + assertEquals(1, solution1.getMaxLen(new int[] {-1, 2})); } @Test public void test5() { - assertEquals(4, solution1.getMaxLen(new int[]{1, 2, 3, 5, -6, 4, 0, 10})); + assertEquals(4, solution1.getMaxLen(new int[] {1, 2, 3, 5, -6, 4, 0, 10})); } @Test public void test6() { - assertEquals(0, solution1.getMaxLen(new int[]{-1})); + assertEquals(0, solution1.getMaxLen(new int[] {-1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1572Test.java b/src/test/java/com/fishercoder/secondthousand/_1572Test.java index 5923cc44c8..f55fe33d89 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1572Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1572Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1572; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1572Test { private _1572.Solution1 solution1; private static int[][] mat; @@ -17,31 +17,30 @@ public void setup() { @Test public void test1() { - mat = new int[][]{ - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9} - }; + mat = + new int[][] { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; assertEquals(25, solution1.diagonalSum(mat)); } @Test public void test2() { - mat = new int[][]{ - {5} - }; + mat = new int[][] {{5}}; assertEquals(5, solution1.diagonalSum(mat)); } @Test public void test3() { - mat = new int[][]{ - {1, 1, 1, 1}, - {1, 1, 1, 1}, - {1, 1, 1, 1}, - {1, 1, 1, 1}, - }; + mat = + new int[][] { + {1, 1, 1, 1}, + {1, 1, 1, 1}, + {1, 1, 1, 1}, + {1, 1, 1, 1}, + }; assertEquals(8, solution1.diagonalSum(mat)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1574Test.java b/src/test/java/com/fishercoder/secondthousand/_1574Test.java index 54b44e3fde..5b6e247626 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1574Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1574Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1574; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1574Test { private _1574.Solution1 solution1; private static int[] arr; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - arr = new int[]{1, 2, 3, 10, 4, 2, 3, 5}; + arr = new int[] {1, 2, 3, 10, 4, 2, 3, 5}; assertEquals(3, solution1.findLengthOfShortestSubarray(arr)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1576Test.java b/src/test/java/com/fishercoder/secondthousand/_1576Test.java index f79e6ec5cc..e08dad2e08 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1576Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1576Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1576; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1576Test { private _1576.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1577Test.java b/src/test/java/com/fishercoder/secondthousand/_1577Test.java index cdbb7e87c4..e62cd266ad 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1577Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1577Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1577; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1577Test { private _1577.Solution1 solution1; @@ -16,36 +16,48 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.numTriplets(new int[]{7, 4}, new int[]{5, 2, 8, 9})); + assertEquals(1, solution1.numTriplets(new int[] {7, 4}, new int[] {5, 2, 8, 9})); } @Test public void test2() { - assertEquals(9, solution1.numTriplets(new int[]{1, 1}, new int[]{1, 1, 1})); + assertEquals(9, solution1.numTriplets(new int[] {1, 1}, new int[] {1, 1, 1})); } @Test public void test3() { - assertEquals(2, solution1.numTriplets(new int[]{7, 7, 8, 3}, new int[]{1, 2, 9, 7})); + assertEquals(2, solution1.numTriplets(new int[] {7, 7, 8, 3}, new int[] {1, 2, 9, 7})); } @Test public void test4() { - assertEquals(0, solution1.numTriplets(new int[]{4, 7, 9, 11, 23}, new int[]{3, 5, 1024, 12, 18})); + assertEquals( + 0, + solution1.numTriplets(new int[] {4, 7, 9, 11, 23}, new int[] {3, 5, 1024, 12, 18})); } @Test public void test5() { - assertEquals(4, solution1.numTriplets(new int[]{3, 1, 2, 2}, new int[]{1, 3, 4, 4})); + assertEquals(4, solution1.numTriplets(new int[] {3, 1, 2, 2}, new int[] {1, 3, 4, 4})); } @Test public void test6() { - assertEquals(5, solution1.numTriplets(new int[]{4, 1, 4, 1, 12}, new int[]{3, 2, 5, 4})); + assertEquals(5, solution1.numTriplets(new int[] {4, 1, 4, 1, 12}, new int[] {3, 2, 5, 4})); } @Test public void test7() { - assertEquals(234, solution1.numTriplets(new int[]{14, 1, 1, 12, 7, 12, 10, 4, 11, 10, 5, 2, 5, 14, 7, 9, 10, 13, 15, 6, 9, 12, 6, 12, 4, 10, 9, 12, 11}, new int[]{3, 12, 1, 9, 1, 12, 4, 12, 4, 1, 7, 10, 7, 11, 4, 13, 4, 11, 5, 1, 14, 12, 15, 4, 2, 3, 13, 10, 3, 4})); - } -} \ No newline at end of file + assertEquals( + 234, + solution1.numTriplets( + new int[] { + 14, 1, 1, 12, 7, 12, 10, 4, 11, 10, 5, 2, 5, 14, 7, 9, 10, 13, 15, 6, 9, + 12, 6, 12, 4, 10, 9, 12, 11 + }, + new int[] { + 3, 12, 1, 9, 1, 12, 4, 12, 4, 1, 7, 10, 7, 11, 4, 13, 4, 11, 5, 1, 14, + 12, 15, 4, 2, 3, 13, 10, 3, 4 + })); + } +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1582Test.java b/src/test/java/com/fishercoder/secondthousand/_1582Test.java index 28bb872769..8c70c1d67f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1582Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1582Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1582; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1582Test { private _1582.Solution1 solution1; @@ -16,41 +16,52 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.numSpecial(new int[][]{ - {0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0}, - {0, 1, 0, 0, 0}, - {0, 0, 1, 0, 0}, - {0, 0, 0, 1, 1} - })); + assertEquals( + 3, + solution1.numSpecial( + new int[][] { + {0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0}, + {0, 1, 0, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 0, 0, 1, 1} + })); } @Test public void test2() { - assertEquals(2, solution1.numSpecial(new int[][]{ - {0, 0, 0, 1}, - {1, 0, 0, 0}, - {0, 1, 1, 0}, - {0, 0, 0, 0} - })); + assertEquals( + 2, + solution1.numSpecial( + new int[][] { + {0, 0, 0, 1}, + {1, 0, 0, 0}, + {0, 1, 1, 0}, + {0, 0, 0, 0} + })); } @Test public void test3() { - assertEquals(3, solution1.numSpecial(new int[][]{ - {1, 0, 0}, - {0, 1, 0}, - {0, 0, 1} - })); + assertEquals( + 3, + solution1.numSpecial( + new int[][] { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1} + })); } @Test public void test4() { - assertEquals(1, solution1.numSpecial(new int[][]{ - {1, 0, 0}, - {0, 0, 1}, - {1, 0, 0} - })); + assertEquals( + 1, + solution1.numSpecial( + new int[][] { + {1, 0, 0}, + {0, 0, 1}, + {1, 0, 0} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1583Test.java b/src/test/java/com/fishercoder/secondthousand/_1583Test.java index 6a5882fac5..30e01c6908 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1583Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1583Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1583; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1583Test { private _1583.Solution1 solution1; @@ -16,16 +16,19 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.unhappyFriends(4, new int[][]{ - {1, 2, 3}, - {3, 2, 0}, - {3, 1, 0}, - {1, 2, 0} - }, - new int[][]{ - {0, 1}, - {2, 3} - })); + assertEquals( + 2, + solution1.unhappyFriends( + 4, + new int[][] { + {1, 2, 3}, + {3, 2, 0}, + {3, 1, 0}, + {1, 2, 0} + }, + new int[][] { + {0, 1}, + {2, 3} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1588Test.java b/src/test/java/com/fishercoder/secondthousand/_1588Test.java index f3ab77cf40..a43106fb0f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1588Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1588Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1588; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1588Test { private _1588.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(58, solution1.sumOddLengthSubarrays(new int[]{1, 4, 2, 5, 3})); + assertEquals(58, solution1.sumOddLengthSubarrays(new int[] {1, 4, 2, 5, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1592Test.java b/src/test/java/com/fishercoder/secondthousand/_1592Test.java index 63775216de..5d8a68fda8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1592Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1592Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1592; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1592Test { private _1592.Solution1 solution1; @@ -21,12 +21,15 @@ public void test1() { @Test public void test2() { - assertEquals("this is a sentence", solution1.reorderSpaces(" this is a sentence ")); + assertEquals( + "this is a sentence", solution1.reorderSpaces(" this is a sentence ")); } @Test public void test3() { - assertEquals("practice makes perfect ", solution1.reorderSpaces(" practice makes perfect")); + assertEquals( + "practice makes perfect ", + solution1.reorderSpaces(" practice makes perfect")); } @Test @@ -36,12 +39,13 @@ public void test4() { @Test public void test5() { - assertEquals("walks udp package into bar a ", solution1.reorderSpaces(" walks udp package into bar a")); + assertEquals( + "walks udp package into bar a ", + solution1.reorderSpaces(" walks udp package into bar a")); } @Test public void test6() { assertEquals("a", solution1.reorderSpaces("a")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1600Test.java b/src/test/java/com/fishercoder/secondthousand/_1600Test.java index 20c24b0b64..61256c12af 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1600Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1600Test.java @@ -1,11 +1,10 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1600; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1600; import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1600Test { private _1600.Solution1.ThroneInheritance throneInheritance; @@ -19,9 +18,13 @@ public void test1() { throneInheritance.birth("andy", "matthew"); throneInheritance.birth("bob", "alex"); throneInheritance.birth("bob", "asha"); - assertEquals(Arrays.asList("king", "andy", "matthew", "bob", "alex", "asha", "catherine"), throneInheritance.getInheritanceOrder()); + assertEquals( + Arrays.asList("king", "andy", "matthew", "bob", "alex", "asha", "catherine"), + throneInheritance.getInheritanceOrder()); throneInheritance.death("bob"); - assertEquals(Arrays.asList("king", "andy", "matthew", "alex", "asha", "catherine"), throneInheritance.getInheritanceOrder()); + assertEquals( + Arrays.asList("king", "andy", "matthew", "alex", "asha", "catherine"), + throneInheritance.getInheritanceOrder()); } @Test @@ -32,9 +35,12 @@ public void test2() { throneInheritance.birth("clyde", "shannon"); throneInheritance.birth("shannon", "scott"); throneInheritance.birth("king", "keith"); - assertEquals(Arrays.asList("king", "clyde", "shannon", "scott", "keith"), throneInheritance.getInheritanceOrder()); + assertEquals( + Arrays.asList("king", "clyde", "shannon", "scott", "keith"), + throneInheritance.getInheritanceOrder()); throneInheritance.birth("clyde", "joseph"); - assertEquals(Arrays.asList("king", "clyde", "shannon", "scott", "joseph", "keith"), throneInheritance.getInheritanceOrder()); + assertEquals( + Arrays.asList("king", "clyde", "shannon", "scott", "joseph", "keith"), + throneInheritance.getInheritanceOrder()); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1604Test.java b/src/test/java/com/fishercoder/secondthousand/_1604Test.java index 4207e084ae..0ae28ffb92 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1604Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1604Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1604; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1604Test { private _1604.Solution1 solution1; @@ -18,22 +17,45 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("daniel"), solution1.alertNames(new String[]{"daniel", "daniel", "daniel", "luis", "luis", "luis", "luis"}, new String[]{"10:00", "10:40", "11:00", "09:00", "11:00", "13:00", "15:00"})); + assertEquals( + Arrays.asList("daniel"), + solution1.alertNames( + new String[] {"daniel", "daniel", "daniel", "luis", "luis", "luis", "luis"}, + new String[] { + "10:00", "10:40", "11:00", "09:00", "11:00", "13:00", "15:00" + })); } @Test public void test2() { - assertEquals(Arrays.asList("bob"), solution1.alertNames(new String[]{"alice", "alice", "alice", "bob", "bob", "bob", "bob"}, new String[]{"12:01", "12:00", "18:00", "21:00", "21:20", "21:30", "23:00"})); + assertEquals( + Arrays.asList("bob"), + solution1.alertNames( + new String[] {"alice", "alice", "alice", "bob", "bob", "bob", "bob"}, + new String[] { + "12:01", "12:00", "18:00", "21:00", "21:20", "21:30", "23:00" + })); } @Test public void test3() { - assertEquals(Arrays.asList(), solution1.alertNames(new String[]{"john", "john", "john"}, new String[]{"23:58", "23:59", "00:01"})); + assertEquals( + Arrays.asList(), + solution1.alertNames( + new String[] {"john", "john", "john"}, + new String[] {"23:58", "23:59", "00:01"})); } @Test public void test4() { - assertEquals(Arrays.asList("clare", "leslie"), solution1.alertNames(new String[]{"leslie", "leslie", "leslie", "clare", "clare", "clare", "clare"}, new String[]{"13:00", "13:20", "14:00", "18:00", "18:51", "19:30", "19:49"})); + assertEquals( + Arrays.asList("clare", "leslie"), + solution1.alertNames( + new String[] { + "leslie", "leslie", "leslie", "clare", "clare", "clare", "clare" + }, + new String[] { + "13:00", "13:20", "14:00", "18:00", "18:51", "19:30", "19:49" + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1605Test.java b/src/test/java/com/fishercoder/secondthousand/_1605Test.java index abef653dcf..dd0eeef619 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1605Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1605Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1605; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1605Test { private _1605.Solution1 solution1; @@ -16,10 +16,8 @@ public void setup() { @Test public void test1() { - int[][] expected = new int[][]{ - {0, 5, 0}, {0, 1, 6}, {8, 0, 2} - }; - assertArrayEquals(expected, solution1.restoreMatrix(new int[]{5, 7, 10}, new int[]{8, 6, 8})); + int[][] expected = new int[][] {{0, 5, 0}, {0, 1, 6}, {8, 0, 2}}; + assertArrayEquals( + expected, solution1.restoreMatrix(new int[] {5, 7, 10}, new int[] {8, 6, 8})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1625Test.java b/src/test/java/com/fishercoder/secondthousand/_1625Test.java index 335321280e..29de522566 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1625Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1625Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1625; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1625Test { private _1625.Solution1 solution1; @@ -33,5 +33,4 @@ public void test3() { public void test4() { assertEquals("00553311", solution1.findLexSmallestString("43987654", 7, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1626Test.java b/src/test/java/com/fishercoder/secondthousand/_1626Test.java index bf1ee7ed39..7e637770c5 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1626Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1626Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1626; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1626Test { private _1626.Solution1 solution1; @@ -16,12 +16,13 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.bestTeamScore(new int[]{1, 2, 3, 5}, new int[]{8, 9, 10, 1})); + assertEquals(6, solution1.bestTeamScore(new int[] {1, 2, 3, 5}, new int[] {8, 9, 10, 1})); } @Test public void test2() { - assertEquals(34, solution1.bestTeamScore(new int[]{1, 3, 5, 10, 15}, new int[]{1, 2, 3, 4, 5})); + assertEquals( + 34, + solution1.bestTeamScore(new int[] {1, 3, 5, 10, 15}, new int[] {1, 2, 3, 4, 5})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1628Test.java b/src/test/java/com/fishercoder/secondthousand/_1628Test.java index 4779242d0f..da2dc39471 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1628Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1628Test.java @@ -1,14 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1628; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import java.util.ArrayList; import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class _1628Test { private _1628.Solution1.TreeBuilder treeBuilderSolution1; @@ -20,7 +19,7 @@ public void setup() { @Test public void test1() { - _1628.Solution1.Node node = treeBuilderSolution1.buildTree(new String[]{"3", "4", "+"}); + _1628.Solution1.Node node = treeBuilderSolution1.buildTree(new String[] {"3", "4", "+"}); List list = node.print(node, new ArrayList<>()); CommonUtils.printList(list); assertEquals(7, node.evaluate()); @@ -28,7 +27,8 @@ public void test1() { @Test public void test2() { - _1628.Solution1.Node node = treeBuilderSolution1.buildTree(new String[]{"3", "4", "+", "2", "*", "7", "/"}); + _1628.Solution1.Node node = + treeBuilderSolution1.buildTree(new String[] {"3", "4", "+", "2", "*", "7", "/"}); List list = node.print(node, new ArrayList<>()); CommonUtils.printList(list); assertEquals(2, node.evaluate()); @@ -36,7 +36,8 @@ public void test2() { @Test public void test3() { - _1628.Solution1.Node node = treeBuilderSolution1.buildTree(new String[]{"4", "5", "2", "7", "+", "-", "*"}); + _1628.Solution1.Node node = + treeBuilderSolution1.buildTree(new String[] {"4", "5", "2", "7", "+", "-", "*"}); List list = node.print(node, new ArrayList<>()); CommonUtils.printList(list); assertEquals(-16, node.evaluate()); @@ -44,10 +45,11 @@ public void test3() { @Test public void test4() { - _1628.Solution1.Node node = treeBuilderSolution1.buildTree(new String[]{"4", "2", "+", "3", "5", "1", "-", "*", "+"}); + _1628.Solution1.Node node = + treeBuilderSolution1.buildTree( + new String[] {"4", "2", "+", "3", "5", "1", "-", "*", "+"}); List list = node.print(node, new ArrayList<>()); CommonUtils.printList(list); assertEquals(18, node.evaluate()); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1636Test.java b/src/test/java/com/fishercoder/secondthousand/_1636Test.java index d25413ee64..b9c474ee04 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1636Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1636Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1636; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1636Test { private _1636.Solution1 solution1; private _1636.Solution2 solution2; @@ -19,15 +19,27 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 1, 2, 2, 2, 3}; - assertArrayEquals(new int[]{3, 1, 1, 2, 2, 2}, solution2.frequencySort(nums)); - assertArrayEquals(new int[]{3, 1, 1, 2, 2, 2}, solution1.frequencySort(nums)); + nums = new int[] {1, 1, 2, 2, 2, 3}; + assertArrayEquals(new int[] {3, 1, 1, 2, 2, 2}, solution2.frequencySort(nums)); + assertArrayEquals(new int[] {3, 1, 1, 2, 2, 2}, solution1.frequencySort(nums)); } @Test public void test2() { - nums = new int[]{-53, -53, 52, 52, 52, 52, -53, -53, 52, -53, 52, 52, 52, -53, 52, 52, -53, 52, -53, 52, -53, 52, 52, 52, 52, 52, 52, 52, 52, 52, -53, 52, -53, 52, -53, 52, 52, 52, -53, -53, 52, -53, 52, 52, 52, 52, -53, -53, -53, -53, -53, 52, 52, -53, 52, -53, 52, 52, 52}; - assertArrayEquals(new int[]{-53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52}, solution1.frequencySort(nums)); + nums = + new int[] { + -53, -53, 52, 52, 52, 52, -53, -53, 52, -53, 52, 52, 52, -53, 52, 52, -53, 52, + -53, 52, -53, 52, 52, 52, 52, 52, 52, 52, 52, 52, -53, 52, -53, 52, -53, 52, 52, + 52, -53, -53, 52, -53, 52, 52, 52, 52, -53, -53, -53, -53, -53, 52, 52, -53, 52, + -53, 52, 52, 52 + }; + assertArrayEquals( + new int[] { + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52 + }, + solution1.frequencySort(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1640Test.java b/src/test/java/com/fishercoder/secondthousand/_1640Test.java index 0c627f36b8..bf368c7c14 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1640Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1640Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1640; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1640Test { private _1640.Solution1 solution1; private static int[] arr; @@ -18,22 +18,22 @@ public void setup() { @Test public void test1() { - arr = new int[]{85}; - pieces = new int[][]{{85}}; + arr = new int[] {85}; + pieces = new int[][] {{85}}; assertEquals(true, solution1.canFormArray(arr, pieces)); } @Test public void test2() { - arr = new int[]{91, 4, 64, 78}; - pieces = new int[][]{{78}, {4, 64}, {91}}; + arr = new int[] {91, 4, 64, 78}; + pieces = new int[][] {{78}, {4, 64}, {91}}; assertEquals(true, solution1.canFormArray(arr, pieces)); } @Test public void test3() { - arr = new int[]{49, 18, 16}; - pieces = new int[][]{{16, 18, 49}}; + arr = new int[] {49, 18, 16}; + pieces = new int[][] {{16, 18, 49}}; assertEquals(false, solution1.canFormArray(arr, pieces)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1641Test.java b/src/test/java/com/fishercoder/secondthousand/_1641Test.java index fd3ae1366c..ff7a97dd46 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1641Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1641Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1641; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1641Test { private _1641.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(66045, solution1.countVowelStrings(33)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1642Test.java b/src/test/java/com/fishercoder/secondthousand/_1642Test.java index f31d1934a3..b85e155906 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1642Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1642Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1642; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1642Test { private _1642.Solution1 solution1; @@ -16,32 +16,32 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.furthestBuilding(new int[]{4, 2, 7, 6, 9, 14, 12}, 5, 1)); + assertEquals(4, solution1.furthestBuilding(new int[] {4, 2, 7, 6, 9, 14, 12}, 5, 1)); } @Test public void test2() { - assertEquals(7, solution1.furthestBuilding(new int[]{4, 12, 2, 7, 3, 18, 20, 3, 19}, 10, 2)); + assertEquals( + 7, solution1.furthestBuilding(new int[] {4, 12, 2, 7, 3, 18, 20, 3, 19}, 10, 2)); } @Test public void test3() { - assertEquals(3, solution1.furthestBuilding(new int[]{14, 3, 19, 3}, 17, 0)); + assertEquals(3, solution1.furthestBuilding(new int[] {14, 3, 19, 3}, 17, 0)); } @Test public void test4() { - assertEquals(6, solution1.furthestBuilding(new int[]{17, 16, 5, 10, 10, 14, 7}, 74, 6)); + assertEquals(6, solution1.furthestBuilding(new int[] {17, 16, 5, 10, 10, 14, 7}, 74, 6)); } @Test public void test5() { - assertEquals(1, solution1.furthestBuilding(new int[]{7, 5, 13}, 0, 0)); + assertEquals(1, solution1.furthestBuilding(new int[] {7, 5, 13}, 0, 0)); } @Test public void test6() { - assertEquals(3, solution1.furthestBuilding(new int[]{2, 7, 9, 12}, 5, 1)); + assertEquals(3, solution1.furthestBuilding(new int[] {2, 7, 9, 12}, 5, 1)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1644Test.java b/src/test/java/com/fishercoder/secondthousand/_1644Test.java index cd86553ab6..3bbdb23b36 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1644Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1644Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1644; -import org.junit.jupiter.api.Test; - import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1644Test { private _1644.Solution1 solution1; @@ -15,7 +14,8 @@ public class _1644Test { @Test public void test1() { solution1 = new _1644.Solution1(); - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); TreeUtils.printBinaryTree(root); TreeNode p = TreeUtils.constructBinaryTree(Arrays.asList(5, 6, 2, null, null, 7, 4)); TreeUtils.printBinaryTree(p); diff --git a/src/test/java/com/fishercoder/secondthousand/_1646Test.java b/src/test/java/com/fishercoder/secondthousand/_1646Test.java index 555fed053b..ff61aa4545 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1646Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1646Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1646; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1646Test { private _1646.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(1, solution1.getMaximumGenerated(2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1652Test.java b/src/test/java/com/fishercoder/secondthousand/_1652Test.java index 0154ada449..951459d470 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1652Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1652Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1652; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1652Test { private _1652.Solution1 solution1; private static int[] code; @@ -17,26 +17,27 @@ public void setup() { @Test public void test1() { - code = new int[]{5, 7, 1, 4}; - assertArrayEquals(new int[]{12, 10, 16, 13}, solution1.decrypt(code, 3)); + code = new int[] {5, 7, 1, 4}; + assertArrayEquals(new int[] {12, 10, 16, 13}, solution1.decrypt(code, 3)); } @Test public void test2() { - code = new int[]{1, 2, 3, 4}; - assertArrayEquals(new int[]{0, 0, 0, 0}, solution1.decrypt(code, 0)); + code = new int[] {1, 2, 3, 4}; + assertArrayEquals(new int[] {0, 0, 0, 0}, solution1.decrypt(code, 0)); } @Test public void test3() { - code = new int[]{2, 4, 9, 3}; - assertArrayEquals(new int[]{12, 5, 6, 13}, solution1.decrypt(code, -2)); + code = new int[] {2, 4, 9, 3}; + assertArrayEquals(new int[] {12, 5, 6, 13}, solution1.decrypt(code, -2)); } @Test public void test4() { - code = new int[]{10, 5, 7, 7, 3, 2, 10, 3, 6, 9, 1, 6}; - assertArrayEquals(new int[]{22, 26, 22, 28, 29, 22, 19, 22, 18, 21, 28, 19}, solution1.decrypt(code, -4)); + code = new int[] {10, 5, 7, 7, 3, 2, 10, 3, 6, 9, 1, 6}; + assertArrayEquals( + new int[] {22, 26, 22, 28, 29, 22, 19, 22, 18, 21, 28, 19}, + solution1.decrypt(code, -4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1653Test.java b/src/test/java/com/fishercoder/secondthousand/_1653Test.java index 0acc114a41..439f76cbe4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1653Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1653Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1653; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1653Test { private _1653.Solution1 solution1; private _1653.Solution2 solution2; @@ -27,5 +27,4 @@ public void test2() { assertEquals(0, solution1.minimumDeletions("aaabbb")); assertEquals(0, solution2.minimumDeletions("aaabbb")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1656Test.java b/src/test/java/com/fishercoder/secondthousand/_1656Test.java index 0511db86c6..83e143e265 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1656Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1656Test.java @@ -1,13 +1,11 @@ package com.fishercoder.secondthousand; -import com.fishercoder.solutions.secondthousand._1656; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import com.fishercoder.solutions.secondthousand._1656; import java.util.Arrays; import java.util.Collections; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class _1656Test { private _1656.Solution1.OrderedStream orderedStream; @@ -21,5 +19,4 @@ public void test1() { assertEquals(Collections.emptyList(), orderedStream.insert(5, "eeeee")); assertEquals(Arrays.asList("ddddd", "eeeee"), orderedStream.insert(4, "ddddd")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1657Test.java b/src/test/java/com/fishercoder/secondthousand/_1657Test.java index d865c79db3..241b04d2bc 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1657Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1657Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1657; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1657Test { private _1657.Solution1 solution1; @@ -38,4 +38,4 @@ public void test4() { public void test5() { assertEquals(false, solution1.closeStrings("abbbzcf", "babzzcz")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1658Test.java b/src/test/java/com/fishercoder/secondthousand/_1658Test.java index ccddb9fabd..bbf9adedd1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1658Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1658Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1658; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1658Test { private _1658.Solution1 solution1; @@ -16,22 +16,28 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.minOperations(new int[]{1, 1, 4, 2, 3}, 5)); + assertEquals(2, solution1.minOperations(new int[] {1, 1, 4, 2, 3}, 5)); } @Test public void test2() { - assertEquals(-1, solution1.minOperations(new int[]{5, 6, 7, 8, 9}, 4)); + assertEquals(-1, solution1.minOperations(new int[] {5, 6, 7, 8, 9}, 4)); } @Test public void test3() { - assertEquals(5, solution1.minOperations(new int[]{3, 2, 20, 1, 1, 3}, 10)); + assertEquals(5, solution1.minOperations(new int[] {3, 2, 20, 1, 1, 3}, 10)); } @Test public void test4() { - assertEquals(16, solution1.minOperations(new int[]{8828, 9581, 49, 9818, 9974, 9869, 9991, 10000, 10000, 10000, 9999, 9993, 9904, 8819, 1231, 6309}, 134365)); + assertEquals( + 16, + solution1.minOperations( + new int[] { + 8828, 9581, 49, 9818, 9974, 9869, 9991, 10000, 10000, 10000, 9999, 9993, + 9904, 8819, 1231, 6309 + }, + 134365)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1663Test.java b/src/test/java/com/fishercoder/secondthousand/_1663Test.java index aba1cf7296..bf7c12a6cd 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1663Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1663Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1663; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1663Test { private _1663.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals("aaszz", solution1.getSmallestString(5, 73)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1669Test.java b/src/test/java/com/fishercoder/secondthousand/_1669Test.java index ff61ce82d3..e559bae654 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1669Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1669Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1669; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1669Test { private _1669.Solution1 solution1; private _1669.Solution2 solution2; @@ -28,9 +28,11 @@ public void setup() { @Test public void test1() { - list1 = LinkedListUtils.contructLinkedList(new int[]{0, 1, 2, 3, 4, 5}); - list2 = LinkedListUtils.contructLinkedList(new int[]{1000000, 1000001, 1000002}); - expected = LinkedListUtils.contructLinkedList(new int[]{0, 1, 2, 1000000, 1000001, 1000002, 5}); + list1 = LinkedListUtils.contructLinkedList(new int[] {0, 1, 2, 3, 4, 5}); + list2 = LinkedListUtils.contructLinkedList(new int[] {1000000, 1000001, 1000002}); + expected = + LinkedListUtils.contructLinkedList( + new int[] {0, 1, 2, 1000000, 1000001, 1000002, 5}); actual = solution1.mergeInBetween(list1, 3, 4, list2); LinkedListUtils.printList(actual); assertEquals(expected, actual); @@ -38,10 +40,13 @@ public void test1() { @Test public void test2() { - l1 = LinkedListUtils.contructLinkedList(new int[]{0, 1, 2, 3, 4, 5}); - l2 = LinkedListUtils.contructLinkedList(new int[]{1000000, 1000001, 1000002}); + l1 = LinkedListUtils.contructLinkedList(new int[] {0, 1, 2, 3, 4, 5}); + l2 = LinkedListUtils.contructLinkedList(new int[] {1000000, 1000001, 1000002}); a = 3; b = 4; - assertEquals(LinkedListUtils.contructLinkedList(new int[]{0, 1, 2, 1000000, 1000001, 1000002, 5}), solution2.mergeInBetween(l1, a, b, l2)); + assertEquals( + LinkedListUtils.contructLinkedList( + new int[] {0, 1, 2, 1000000, 1000001, 1000002, 5}), + solution2.mergeInBetween(l1, a, b, l2)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1670Test.java b/src/test/java/com/fishercoder/secondthousand/_1670Test.java index fad0c4a6c9..6cded39607 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1670Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1670Test.java @@ -1,10 +1,10 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1670; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1670Test { private _1670.Solution1.FrontMiddleBackQueue solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1673Test.java b/src/test/java/com/fishercoder/secondthousand/_1673Test.java index 4bac51f975..ec4584770a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1673Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1673Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1673; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1673Test { private _1673.Solution1 solution1; @@ -16,12 +16,13 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 6}, solution1.mostCompetitive(new int[]{3, 5, 2, 6}, 2)); + assertArrayEquals(new int[] {2, 6}, solution1.mostCompetitive(new int[] {3, 5, 2, 6}, 2)); } @Test public void test2() { - assertArrayEquals(new int[]{2, 3, 3, 4}, solution1.mostCompetitive(new int[]{2, 4, 3, 3, 5, 4, 9, 6}, 4)); + assertArrayEquals( + new int[] {2, 3, 3, 4}, + solution1.mostCompetitive(new int[] {2, 4, 3, 3, 5, 4, 9, 6}, 4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1675Test.java b/src/test/java/com/fishercoder/secondthousand/_1675Test.java index c437a6db8e..129fb7c44e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1675Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1675Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1675; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1675Test { private _1675.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.minimumDeviation(new int[]{1, 2, 3, 4})); + assertEquals(1, solution1.minimumDeviation(new int[] {1, 2, 3, 4})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1676Test.java b/src/test/java/com/fishercoder/secondthousand/_1676Test.java index 018307d023..5436df2355 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1676Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1676Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1676; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1676Test { private _1676.Solution1 solution1; private _1676.Solution2 solution2; @@ -22,24 +21,25 @@ public void setup() { @Test public void test1() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); TreeUtils.printBinaryTree(root); TreeNode node1 = TreeUtils.constructBinaryTree(Arrays.asList(4)); TreeNode node2 = TreeUtils.constructBinaryTree(Arrays.asList(7)); - TreeNode[] nodes = new TreeNode[]{node1, node2}; + TreeNode[] nodes = new TreeNode[] {node1, node2}; TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(2, 7, 4)); assertEquals(expected, solution1.lowestCommonAncestor(root, nodes)); } @Test public void test2() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); + TreeNode root = + TreeUtils.constructBinaryTree(Arrays.asList(3, 5, 1, 6, 2, 0, 8, null, null, 7, 4)); TreeUtils.printBinaryTree(root); TreeNode node1 = TreeUtils.constructBinaryTree(Arrays.asList(1, 0, 8)); - TreeNode[] nodes = new TreeNode[]{node1}; + TreeNode[] nodes = new TreeNode[] {node1}; TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(1, 0, 8)); - //assertEquals(expected, solution1.lowestCommonAncestor(root, nodes)); - //assertEquals(expected, solution2.lowestCommonAncestor(root, nodes)); + // assertEquals(expected, solution1.lowestCommonAncestor(root, nodes)); + // assertEquals(expected, solution2.lowestCommonAncestor(root, nodes)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1679Test.java b/src/test/java/com/fishercoder/secondthousand/_1679Test.java index 6d4d671ae1..014c9983a7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1679Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1679Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1679; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1679Test { private _1679.Solution1 solution1; private static int[] nums; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2}; + nums = new int[] {2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2}; k = 3; assertEquals(4, solution1.maxOperations(nums, k)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1685Test.java b/src/test/java/com/fishercoder/secondthousand/_1685Test.java index 28934e3bbc..643fa9cbb3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1685Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1685Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1685; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1685Test { private _1685.Solution1 solution1; private static int[] nums; @@ -17,14 +17,14 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 3, 5}; - assertArrayEquals(new int[]{4, 3, 5}, solution1.getSumAbsoluteDifferences(nums)); + nums = new int[] {2, 3, 5}; + assertArrayEquals(new int[] {4, 3, 5}, solution1.getSumAbsoluteDifferences(nums)); } @Test public void test2() { - nums = new int[]{1, 4, 6, 8, 10}; - assertArrayEquals(new int[]{24, 15, 13, 15, 21}, solution1.getSumAbsoluteDifferences(nums)); + nums = new int[] {1, 4, 6, 8, 10}; + assertArrayEquals( + new int[] {24, 15, 13, 15, 21}, solution1.getSumAbsoluteDifferences(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1686Test.java b/src/test/java/com/fishercoder/secondthousand/_1686Test.java index 392dfb8d24..a05eb59d78 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1686Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1686Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1686; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1686Test { private _1686.Solution1 solution1; @@ -16,18 +16,21 @@ public void setup() { @Test public void test1() { - assertEquals(-1, solution1.stoneGameVI(new int[]{2, 4, 3}, new int[]{1, 6, 7})); + assertEquals(-1, solution1.stoneGameVI(new int[] {2, 4, 3}, new int[] {1, 6, 7})); } @Test public void test2() { - assertEquals(1, solution1.stoneGameVI(new int[]{1, 3}, new int[]{2, 1})); + assertEquals(1, solution1.stoneGameVI(new int[] {1, 3}, new int[] {2, 1})); } @Test public void test3() { - /**in this case, Alice doesn't want to take the stone with value 2, because that'll result in her loss to Bob - * instead, she could take the stone with value 1, taking away Bob's stone with value 3, ending in a tie which is better than a loss.*/ - assertEquals(0, solution1.stoneGameVI(new int[]{1, 2}, new int[]{3, 1})); + /** + * in this case, Alice doesn't want to take the stone with value 2, because that'll result + * in her loss to Bob instead, she could take the stone with value 1, taking away Bob's + * stone with value 3, ending in a tie which is better than a loss. + */ + assertEquals(0, solution1.stoneGameVI(new int[] {1, 2}, new int[] {3, 1})); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1688Test.java b/src/test/java/com/fishercoder/secondthousand/_1688Test.java index fefdb2f6c5..7f1368177b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1688Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1688Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1688; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1688Test { private _1688.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(6, solution1.numberOfMatches(7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1690Test.java b/src/test/java/com/fishercoder/secondthousand/_1690Test.java index dbe772bbb9..83fffc09d4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1690Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1690Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1690; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1690Test { private _1690.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.stoneGameVII(new int[]{5, 3, 1, 4, 2})); + assertEquals(6, solution1.stoneGameVII(new int[] {5, 3, 1, 4, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1694Test.java b/src/test/java/com/fishercoder/secondthousand/_1694Test.java index 6ff63cd04c..dcd77ef299 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1694Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1694Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1694; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1694Test { private _1694.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals("175-229-353-94-75", solution1.reformatNumber("--17-5 229 35-39475 ")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1695Test.java b/src/test/java/com/fishercoder/secondthousand/_1695Test.java index f2fe7cb561..67c7f906e1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1695Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1695Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1695; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1695Test { private _1695.Solution1 solution1; private _1695.Solution2 solution2; @@ -20,10 +20,9 @@ public void setup() { @Test public void test1() { - nums = new int[]{4, 2, 4, 5, 6}; + nums = new int[] {4, 2, 4, 5, 6}; expected = 17; assertEquals(expected, solution1.maximumUniqueSubarray(nums)); assertEquals(expected, solution2.maximumUniqueSubarray(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1700Test.java b/src/test/java/com/fishercoder/secondthousand/_1700Test.java index be02e761fc..3272f6fa10 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1700Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1700Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1700; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1700Test { private _1700.Solution1 solution1; @@ -16,12 +16,14 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.countStudents(new int[]{1, 1, 0, 0}, new int[]{0, 1, 0, 1})); + assertEquals(0, solution1.countStudents(new int[] {1, 1, 0, 0}, new int[] {0, 1, 0, 1})); } @Test public void test2() { - assertEquals(3, solution1.countStudents(new int[]{1, 1, 1, 0, 0, 1}, new int[]{1, 0, 0, 0, 1, 1})); + assertEquals( + 3, + solution1.countStudents( + new int[] {1, 1, 1, 0, 0, 1}, new int[] {1, 0, 0, 0, 1, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1701Test.java b/src/test/java/com/fishercoder/secondthousand/_1701Test.java index d30e706ea0..72df9dffa7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1701Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1701Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1701; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1701Test { private _1701.Solution1 solution1; private static int[] A; @@ -17,15 +17,12 @@ public void setup() { @Test public void test1() { - assertEquals(5.0, solution1.averageWaitingTime(new int[][]{ - {1, 2}, {2, 5}, {4, 3} - })); + assertEquals(5.0, solution1.averageWaitingTime(new int[][] {{1, 2}, {2, 5}, {4, 3}})); } @Test public void test2() { - assertEquals(3.25, solution1.averageWaitingTime(new int[][]{ - {5, 2}, {5, 4}, {10, 3}, {20, 1} - })); + assertEquals( + 3.25, solution1.averageWaitingTime(new int[][] {{5, 2}, {5, 4}, {10, 3}, {20, 1}})); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1705Test.java b/src/test/java/com/fishercoder/secondthousand/_1705Test.java index c8929c78c3..32073599e1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1705Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1705Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1705; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1705Test { private _1705.Solution1 solution1; @@ -16,22 +16,25 @@ public void setup() { @Test public void test1() { - assertEquals(7, solution1.eatenApples(new int[]{1, 2, 3, 5, 2}, new int[]{3, 2, 1, 4, 2})); + assertEquals( + 7, solution1.eatenApples(new int[] {1, 2, 3, 5, 2}, new int[] {3, 2, 1, 4, 2})); } @Test public void test2() { - assertEquals(5, solution1.eatenApples(new int[]{3, 0, 0, 0, 0, 2}, new int[]{3, 0, 0, 0, 0, 2})); + assertEquals( + 5, + solution1.eatenApples(new int[] {3, 0, 0, 0, 0, 2}, new int[] {3, 0, 0, 0, 0, 2})); } @Test public void test3() { - assertEquals(5, solution1.eatenApples(new int[]{9, 2}, new int[]{3, 5})); + assertEquals(5, solution1.eatenApples(new int[] {9, 2}, new int[] {3, 5})); } @Test public void test4() { - assertEquals(8, solution1.eatenApples(new int[]{2, 1, 1, 4, 5}, new int[]{10, 10, 6, 4, 2})); + assertEquals( + 8, solution1.eatenApples(new int[] {2, 1, 1, 4, 5}, new int[] {10, 10, 6, 4, 2})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1708Test.java b/src/test/java/com/fishercoder/secondthousand/_1708Test.java index cdad2bdfcc..467ed2f2b1 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1708Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1708Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1708; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1708Test { private _1708.Solution1 solution1; @@ -16,12 +16,12 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{5, 2, 3}, solution1.largestSubarray(new int[]{1, 4, 5, 2, 3}, 3)); + assertArrayEquals( + new int[] {5, 2, 3}, solution1.largestSubarray(new int[] {1, 4, 5, 2, 3}, 3)); } @Test public void test2() { - assertArrayEquals(new int[]{5}, solution1.largestSubarray(new int[]{1, 4, 5, 2, 3}, 1)); + assertArrayEquals(new int[] {5}, solution1.largestSubarray(new int[] {1, 4, 5, 2, 3}, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1711Test.java b/src/test/java/com/fishercoder/secondthousand/_1711Test.java index ee722c9de7..6b6e89bfd8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1711Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1711Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1711; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1711Test { private _1711.Solution1 solution1; private static int[] deliciousness; @@ -17,20 +17,23 @@ public void setup() { @Test public void test1() { - deliciousness = new int[]{1, 3, 5, 7, 9}; + deliciousness = new int[] {1, 3, 5, 7, 9}; assertEquals(4, solution1.countPairs(deliciousness)); } @Test public void test2() { - deliciousness = new int[]{1, 1, 1, 3, 3, 3, 7}; + deliciousness = new int[] {1, 1, 1, 3, 3, 3, 7}; assertEquals(15, solution1.countPairs(deliciousness)); } @Test public void test3() { - deliciousness = new int[]{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}; + deliciousness = + new int[] { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 + }; assertEquals(528, solution1.countPairs(deliciousness)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1716Test.java b/src/test/java/com/fishercoder/secondthousand/_1716Test.java index 79eaa34871..b7afb36411 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1716Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1716Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1716; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1716Test { private _1716.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(96, solution1.totalMoney(20)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1717Test.java b/src/test/java/com/fishercoder/secondthousand/_1717Test.java index 3abd54f5d6..5d77e4048f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1717Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1717Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1717; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1717Test { private _1717.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(20, solution1.maximumGain("aabbaaxybbaabb", 5, 4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1718Test.java b/src/test/java/com/fishercoder/secondthousand/_1718Test.java index 9daf6171c4..79e7a93671 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1718Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1718Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1718; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1718Test { private _1718.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{3, 1, 2, 3, 2}, solution1.constructDistancedSequence(3)); + assertArrayEquals(new int[] {3, 1, 2, 3, 2}, solution1.constructDistancedSequence(3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1721Test.java b/src/test/java/com/fishercoder/secondthousand/_1721Test.java index 74a9dab4b8..5f6b65e09e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1721Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1721Test.java @@ -1,13 +1,13 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.ListNode; import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1721; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1721Test { private _1721.Solution1 solution1; private _1721.Solution2 solution2; @@ -43,25 +43,25 @@ public void test1() { @Test public void test2() { - node = LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 4, 5}); - expected = LinkedListUtils.contructLinkedList(new int[]{1, 4, 3, 2, 5}); + node = LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 4, 5}); + expected = LinkedListUtils.contructLinkedList(new int[] {1, 4, 3, 2, 5}); k = 2; assertEquals(expected, solution2.swapNodes(node, k)); } @Test public void test3() { - node = LinkedListUtils.contructLinkedList(new int[]{90, 100}); + node = LinkedListUtils.contructLinkedList(new int[] {90, 100}); k = 2; - expected = LinkedListUtils.contructLinkedList(new int[]{100, 90}); + expected = LinkedListUtils.contructLinkedList(new int[] {100, 90}); assertEquals(expected, solution1.swapNodes(node, k)); } @Test public void test4() { - node = LinkedListUtils.contructLinkedList(new int[]{90, 100}); + node = LinkedListUtils.contructLinkedList(new int[] {90, 100}); k = 2; - expected = LinkedListUtils.contructLinkedList(new int[]{100, 90}); + expected = LinkedListUtils.contructLinkedList(new int[] {100, 90}); assertEquals(expected, solution3.swapNodes(node, k)); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1726Test.java b/src/test/java/com/fishercoder/secondthousand/_1726Test.java index fcdc1e8598..1170c4e71c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1726Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1726Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1726; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1726Test { private _1726.Solution1 solution1; private _1726.Solution2 solution2; @@ -18,31 +18,31 @@ public void setup() { @Test public void test1() { - assertEquals(8, solution1.tupleSameProduct(new int[]{2, 3, 4, 6})); + assertEquals(8, solution1.tupleSameProduct(new int[] {2, 3, 4, 6})); } @Test public void test2() { - assertEquals(16, solution1.tupleSameProduct(new int[]{1, 2, 4, 5, 10})); + assertEquals(16, solution1.tupleSameProduct(new int[] {1, 2, 4, 5, 10})); } @Test public void test3() { - assertEquals(40, solution1.tupleSameProduct(new int[]{2, 3, 4, 6, 8, 12})); + assertEquals(40, solution1.tupleSameProduct(new int[] {2, 3, 4, 6, 8, 12})); } @Test public void test4() { - assertEquals(0, solution1.tupleSameProduct(new int[]{2, 3, 5, 7})); + assertEquals(0, solution1.tupleSameProduct(new int[] {2, 3, 5, 7})); } @Test public void test5() { - assertEquals(128, solution1.tupleSameProduct(new int[]{1, 2, 3, 4, 6, 8, 12, 24})); + assertEquals(128, solution1.tupleSameProduct(new int[] {1, 2, 3, 4, 6, 8, 12, 24})); } @Test public void test6() { - assertEquals(40, solution2.tupleSameProduct(new int[]{2, 3, 4, 6, 8, 12})); + assertEquals(40, solution2.tupleSameProduct(new int[] {2, 3, 4, 6, 8, 12})); } } diff --git a/src/test/java/com/fishercoder/secondthousand/_1727Test.java b/src/test/java/com/fishercoder/secondthousand/_1727Test.java index 21c0d47965..682b058299 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1727Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1727Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1727; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1727Test { private _1727.Solution1 solution1; @@ -18,8 +17,10 @@ public void setup() { @Test public void test1() { - assertEquals(8, solution1.largestSubmatrix( - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1,1,1,1,1,1],[1,1,0,1,1,0,1],[1,0,0,1,0,1,1]"))); + assertEquals( + 8, + solution1.largestSubmatrix( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1,1,1,1,1,1],[1,1,0,1,1,0,1],[1,0,0,1,0,1,1]"))); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1730Test.java b/src/test/java/com/fishercoder/secondthousand/_1730Test.java index df688235c6..1401b331a6 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1730Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1730Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1730; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1730Test { private _1730.Solution1 test; @@ -16,22 +16,27 @@ public void setup() { @Test public void test1() { - assertEquals(3, test.getFood(new char[][]{ - {'X', 'X', 'X', 'X', 'X', 'X'}, - {'X', '*', 'O', 'O', 'O', 'X'}, - {'X', 'O', 'O', '#', 'O', 'X'}, - {'X', 'X', 'X', 'X', 'X', 'X'}, - })); + assertEquals( + 3, + test.getFood( + new char[][] { + {'X', 'X', 'X', 'X', 'X', 'X'}, + {'X', '*', 'O', 'O', 'O', 'X'}, + {'X', 'O', 'O', '#', 'O', 'X'}, + {'X', 'X', 'X', 'X', 'X', 'X'}, + })); } @Test public void test2() { - assertEquals(-1, test.getFood(new char[][]{ - {'X', 'X', 'X', 'X', 'X'}, - {'X', '*', 'X', 'O', 'X'}, - {'X', 'O', 'X', '#', 'X'}, - {'X', 'X', 'X', 'X', 'X'}, - })); + assertEquals( + -1, + test.getFood( + new char[][] { + {'X', 'X', 'X', 'X', 'X'}, + {'X', '*', 'X', 'O', 'X'}, + {'X', 'O', 'X', '#', 'X'}, + {'X', 'X', 'X', 'X', 'X'}, + })); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1733Test.java b/src/test/java/com/fishercoder/secondthousand/_1733Test.java index 34e5b6f034..11c4d61533 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1733Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1733Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1733; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1733Test { private _1733.Solution1 solution1; @@ -16,20 +16,19 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.minimumTeachings(2, new int[][]{ - {1}, {2}, {1, 2} - }, new int[][]{ - {1, 2}, {1, 3}, {2, 3} - })); + assertEquals( + 1, + solution1.minimumTeachings( + 2, new int[][] {{1}, {2}, {1, 2}}, new int[][] {{1, 2}, {1, 3}, {2, 3}})); } @Test public void test2() { - assertEquals(2, solution1.minimumTeachings(3, new int[][]{ - {2}, {1, 3}, {1, 2}, {3} - }, new int[][]{ - {1, 4}, {1, 2}, {3, 4}, {2, 3} - })); + assertEquals( + 2, + solution1.minimumTeachings( + 3, + new int[][] {{2}, {1, 3}, {1, 2}, {3}}, + new int[][] {{1, 4}, {1, 2}, {3, 4}, {2, 3}})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1745Test.java b/src/test/java/com/fishercoder/secondthousand/_1745Test.java index 001f2d3043..79f8cacd49 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1745Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1745Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1745; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1745Test { private _1745.Solution1 solution1; @@ -31,6 +31,9 @@ public void test3() { @Test public void test4() { - assertEquals(true, solution1.checkPartitioning("gbofdldvwelqiizbievfolrujxnwjmjwsjrjeqecwssgtlteltslfzkblzihcgwjnqaiqbxohcnxulxozzkanaofgoddogfoanakzzoxluxnchoxbqiaqnjwgchizlbkzflstletltgsswceqejrjswjmjwnxjurlofveibziiqlewvdldfobgxebrcrbexv")); + assertEquals( + true, + solution1.checkPartitioning( + "gbofdldvwelqiizbievfolrujxnwjmjwsjrjeqecwssgtlteltslfzkblzihcgwjnqaiqbxohcnxulxozzkanaofgoddogfoanakzzoxluxnchoxbqiaqnjwgchizlbkzflstletltgsswceqejrjswjmjwnxjurlofveibziiqlewvdldfobgxebrcrbexv")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1746Test.java b/src/test/java/com/fishercoder/secondthousand/_1746Test.java index 3c8f412190..55844e5865 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1746Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1746Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1746; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1746Test { private _1746.Solution1 solution1; @@ -16,26 +16,30 @@ public void setup() { @Test public void test1() { - assertEquals(17, solution1.maxSumAfterOperation(new int[]{2, -1, -4, -3})); + assertEquals(17, solution1.maxSumAfterOperation(new int[] {2, -1, -4, -3})); } @Test public void test2() { - assertEquals(4, solution1.maxSumAfterOperation(new int[]{1, -1, 1, 1, -1, -1, 1})); + assertEquals(4, solution1.maxSumAfterOperation(new int[] {1, -1, 1, 1, -1, -1, 1})); } @Test public void test3() { - assertEquals(1936, solution1.maxSumAfterOperation(new int[]{-44})); + assertEquals(1936, solution1.maxSumAfterOperation(new int[] {-44})); } @Test public void test4() { - assertEquals(10954, solution1.maxSumAfterOperation(new int[]{29, 71, -52, -23, -28, 50, 27, 29, 0, 50, - -92, 22, -38, 90, 3, 6, 70, -56, -7, 40, 79, 98, 72, 88, -5, -78, 12, 69, 30, - -73, 99, -59, 33, 0, -6, 25, 87, -93, 20, -89, -22, 80, 57, 51, 48, 0, 65, -57, - -57, 28, -42, -97, 97, -49, 38, 40, -41, 3, 31, -12, 47, -10, 17, -32, 68, 40, - 55, 86, -99, -2, 100, 89, 31, -67})); + assertEquals( + 10954, + solution1.maxSumAfterOperation( + new int[] { + 29, 71, -52, -23, -28, 50, 27, 29, 0, 50, -92, 22, -38, 90, 3, 6, 70, + -56, -7, 40, 79, 98, 72, 88, -5, -78, 12, 69, 30, -73, 99, -59, 33, 0, + -6, 25, 87, -93, 20, -89, -22, 80, 57, 51, 48, 0, 65, -57, -57, 28, -42, + -97, 97, -49, 38, 40, -41, 3, 31, -12, 47, -10, 17, -32, 68, 40, 55, 86, + -99, -2, 100, 89, 31, -67 + })); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1752Test.java b/src/test/java/com/fishercoder/secondthousand/_1752Test.java index c288b8169b..45a5856fc0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1752Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1752Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1752; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1752Test { private _1752.Solution1 solution1; @@ -16,27 +16,26 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.check(new int[]{3, 4, 5, 1, 2})); + assertEquals(true, solution1.check(new int[] {3, 4, 5, 1, 2})); } @Test public void test2() { - assertEquals(false, solution1.check(new int[]{2, 1, 3, 4})); + assertEquals(false, solution1.check(new int[] {2, 1, 3, 4})); } @Test public void test3() { - assertEquals(true, solution1.check(new int[]{1, 2, 3})); + assertEquals(true, solution1.check(new int[] {1, 2, 3})); } @Test public void test4() { - assertEquals(true, solution1.check(new int[]{1, 1, 1})); + assertEquals(true, solution1.check(new int[] {1, 1, 1})); } @Test public void test5() { - assertEquals(true, solution1.check(new int[]{2, 1})); + assertEquals(true, solution1.check(new int[] {2, 1})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1753Test.java b/src/test/java/com/fishercoder/secondthousand/_1753Test.java index 50fd9a1b9a..b9d3b930e3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1753Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1753Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1753; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1753Test { private _1753.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(3, solution1.maximumScore(6, 2, 1)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1754Test.java b/src/test/java/com/fishercoder/secondthousand/_1754Test.java index 5ab0f95bd1..7f9e47bd6e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1754Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1754Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1754; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1754Test { private _1754.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("cbcabaaaaa", solution1.largestMerge("cabaa", "bcaaa")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1758Test.java b/src/test/java/com/fishercoder/secondthousand/_1758Test.java index 3221bfa208..a72eaf9d2e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1758Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1758Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1758; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1758Test { private _1758.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(1, solution1.minOperations("0100")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1759Test.java b/src/test/java/com/fishercoder/secondthousand/_1759Test.java index 0da9921f0f..f802fbc3d0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1759Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1759Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1759; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1759Test { private _1759.Solution1 solution1; @@ -26,7 +26,9 @@ public void test2() { @Test public void test3() { - assertEquals(499500, solution1.countHomogenous("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww")); + assertEquals( + 499500, + solution1.countHomogenous( + "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1762Test.java b/src/test/java/com/fishercoder/secondthousand/_1762Test.java index 1bb639442d..a656806a21 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1762Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1762Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1762; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1762Test { private _1762.Solution1 solution1; private static int[] heights; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - heights = new int[]{4, 2, 3, 1}; - expected = new int[]{0, 2, 3}; + heights = new int[] {4, 2, 3, 1}; + expected = new int[] {0, 2, 3}; assertArrayEquals(expected, solution1.findBuildings(heights)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1772Test.java b/src/test/java/com/fishercoder/secondthousand/_1772Test.java index 5b8f9d57c0..d59ca8291c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1772Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1772Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1772; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1772Test { private _1772.Solution1 solution1; @@ -16,15 +16,22 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new String[]{"touch", "cooler", "lock"}, - solution1.sortFeatures(new String[]{"cooler", "lock", "touch"}, new String[]{"i like cooler cooler", "lock touch cool", "locker like touch"})); + assertArrayEquals( + new String[] {"touch", "cooler", "lock"}, + solution1.sortFeatures( + new String[] {"cooler", "lock", "touch"}, + new String[] { + "i like cooler cooler", "lock touch cool", "locker like touch" + })); } @Test public void test2() { - assertArrayEquals(new String[]{"a", "aa", "b", "c"}, - solution1.sortFeatures(new String[]{"a", "aa", "b", "c"}, new String[]{"a", "a aa", "a a a a a", "b a"})); + assertArrayEquals( + new String[] {"a", "aa", "b", "c"}, + solution1.sortFeatures( + new String[] {"a", "aa", "b", "c"}, + new String[] {"a", "a aa", "a a a a a", "b a"})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1774Test.java b/src/test/java/com/fishercoder/secondthousand/_1774Test.java index f85515fcb5..86555359f2 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1774Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1774Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1774; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1774Test { private _1774.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(10, solution1.closestCost(new int[]{1, 7}, new int[]{3, 4}, 10)); + assertEquals(10, solution1.closestCost(new int[] {1, 7}, new int[] {3, 4}, 10)); } @Test public void test2() { - assertEquals(17, solution1.closestCost(new int[]{2, 3}, new int[]{4, 5, 100}, 18)); + assertEquals(17, solution1.closestCost(new int[] {2, 3}, new int[] {4, 5, 100}, 18)); } @Test public void test3() { - assertEquals(8, solution1.closestCost(new int[]{3, 10}, new int[]{2, 5}, 9)); + assertEquals(8, solution1.closestCost(new int[] {3, 10}, new int[] {2, 5}, 9)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1775Test.java b/src/test/java/com/fishercoder/secondthousand/_1775Test.java index 0627d65c7f..ea5a5de7d0 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1775Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1775Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1775; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1775Test { private _1775.Solution1 solution1; @@ -16,17 +16,19 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.minOperations(new int[]{1, 2, 3, 4, 5, 6}, new int[]{1, 1, 2, 2, 2, 2})); + assertEquals( + 3, + solution1.minOperations( + new int[] {1, 2, 3, 4, 5, 6}, new int[] {1, 1, 2, 2, 2, 2})); } @Test public void test2() { - assertEquals(-1, solution1.minOperations(new int[]{1, 1, 1, 1, 1, 1, 1}, new int[]{6})); + assertEquals(-1, solution1.minOperations(new int[] {1, 1, 1, 1, 1, 1, 1}, new int[] {6})); } @Test public void test3() { - assertEquals(3, solution1.minOperations(new int[]{6, 6}, new int[]{1})); + assertEquals(3, solution1.minOperations(new int[] {6, 6}, new int[] {1})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1781Test.java b/src/test/java/com/fishercoder/secondthousand/_1781Test.java index ae91f5eefb..8c584ddbd7 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1781Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1781Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1781; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1781Test { private _1781.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(5, solution1.beautySum("aabcb")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1790Test.java b/src/test/java/com/fishercoder/secondthousand/_1790Test.java index b782a9c64f..bef24cded9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1790Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1790Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1790; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1790Test { private _1790.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(true, solution1.areAlmostEqual("bank", "kanb")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1792Test.java b/src/test/java/com/fishercoder/secondthousand/_1792Test.java index ecfb50d515..4e57a0cad3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1792Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1792Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1792; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1792Test { private _1792.Solution1 solution1; @@ -17,7 +17,12 @@ public void setup() { @Test public void test1() { - assertEquals(0.78333, solution1.maxAverageRatio(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[3,5],[2,2]"), 2), 0.00001); + assertEquals( + 0.78333, + solution1.maxAverageRatio( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[3,5],[2,2]"), + 2), + 0.00001); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1804Test.java b/src/test/java/com/fishercoder/secondthousand/_1804Test.java index 96bbc42e42..8ae76ac8e8 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1804Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1804Test.java @@ -1,18 +1,16 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1804; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1804Test { private _1804.Solution1.Trie solution1; @BeforeEach - public void setup() { - - } + public void setup() {} @Test public void test1() { @@ -27,5 +25,4 @@ public void test1() { solution1.erase("apple"); assertEquals(0, solution1.countWordsStartingWith("app")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1813Test.java b/src/test/java/com/fishercoder/secondthousand/_1813Test.java index 55f09e23a1..0b5a08ac45 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1813Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1813Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1813; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1813Test { private _1813.Solution1 solution1; @@ -33,4 +33,4 @@ public void test3() { public void test4() { assertEquals(true, solution1.areSentencesSimilar("A", "a A b A")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1814Test.java b/src/test/java/com/fishercoder/secondthousand/_1814Test.java index c36ff4a7da..2d0e84609a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1814Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1814Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1814; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1814Test { private _1814.Solution1 solution1; @@ -16,22 +16,47 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.countNicePairs(new int[]{42, 11, 1, 97})); + assertEquals(2, solution1.countNicePairs(new int[] {42, 11, 1, 97})); } @Test public void test2() { - assertEquals(4, solution1.countNicePairs(new int[]{13, 10, 35, 24, 76})); + assertEquals(4, solution1.countNicePairs(new int[] {13, 10, 35, 24, 76})); } @Test public void test3() { - assertEquals(2, solution1.countNicePairs(new int[]{352171103, 442454244, 42644624, 152727101, 413370302, 293999243})); + assertEquals( + 2, + solution1.countNicePairs( + new int[] { + 352171103, 442454244, 42644624, 152727101, 413370302, 293999243 + })); } @Test public void test4() { - assertEquals(678, solution1.countNicePairs(new int[]{8047408, 192867140, 497837845, 279787822, 151999002, 168514912, 193424242, 399636844, 132424231, 476736524, 267958611, 493350382, 476382727, 232939232, 197000791, 295291645, 126313621, 374645524, 7956597, 1376731, 496463745, 234481430, 359130803, 287625836, 250572050, 42311324, 477434624, 493231448, 493231244, 150494051, 184645534, 365252413, 495764582, 335976531, 384564332, 377151623, 198736741, 335161533, 245552540, 194897341, 83911938, 220562020, 496645745, 287151782, 374635526, 372483324, 485101584, 271797172, 244949442, 254333303, 251635002, 459181805, 472392123, 241350140, 256121502, 336895621, 354635302, 358909704, 194525491, 3606063, 194150341, 63477436, 341936141, 60299206, 69811896, 369928813, 229926920, 435310522, 299542980, 463777364, 164534512, 305885501, 437181734, 74288247, 487281835, 171161022, 423966312, 496989544, 452633252, 252433101, 141565141, 315895501, 478897927, 232532230, 472451262, 160504114, 476666674, 6179716, 251483002, 474777474, 443532332, 475808424, 457514604, 400936002, 384878483, 172616122, 283292232, 165645615, 392000144, 378636873})); + assertEquals( + 678, + solution1.countNicePairs( + new int[] { + 8047408, 192867140, 497837845, 279787822, 151999002, 168514912, + 193424242, 399636844, 132424231, 476736524, 267958611, 493350382, + 476382727, 232939232, 197000791, 295291645, 126313621, 374645524, + 7956597, 1376731, 496463745, 234481430, 359130803, 287625836, 250572050, + 42311324, 477434624, 493231448, 493231244, 150494051, 184645534, + 365252413, 495764582, 335976531, 384564332, 377151623, 198736741, + 335161533, 245552540, 194897341, 83911938, 220562020, 496645745, + 287151782, 374635526, 372483324, 485101584, 271797172, 244949442, + 254333303, 251635002, 459181805, 472392123, 241350140, 256121502, + 336895621, 354635302, 358909704, 194525491, 3606063, 194150341, + 63477436, 341936141, 60299206, 69811896, 369928813, 229926920, + 435310522, 299542980, 463777364, 164534512, 305885501, 437181734, + 74288247, 487281835, 171161022, 423966312, 496989544, 452633252, + 252433101, 141565141, 315895501, 478897927, 232532230, 472451262, + 160504114, 476666674, 6179716, 251483002, 474777474, 443532332, + 475808424, 457514604, 400936002, 384878483, 172616122, 283292232, + 165645615, 392000144, 378636873 + })); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1823Test.java b/src/test/java/com/fishercoder/secondthousand/_1823Test.java index 84244a979c..461c275564 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1823Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1823Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1823; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1823Test { private _1823.Solution1 solution1; private _1823.Solution2 solution2; @@ -23,5 +23,4 @@ public void test1() { assertEquals(expected, solution1.findTheWinner(6, 5)); assertEquals(expected, solution2.findTheWinner(6, 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1826Test.java b/src/test/java/com/fishercoder/secondthousand/_1826Test.java index 5c92980e77..dde9593a9d 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1826Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1826Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1826; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1826Test { private _1826.Solution1 solution1; @@ -16,22 +16,24 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.badSensor(new int[]{2, 3, 4, 5}, new int[]{2, 1, 3, 4})); + assertEquals(1, solution1.badSensor(new int[] {2, 3, 4, 5}, new int[] {2, 1, 3, 4})); } @Test public void test2() { - assertEquals(-1, solution1.badSensor(new int[]{2, 2, 2, 2, 2}, new int[]{2, 2, 2, 2, 5})); + assertEquals(-1, solution1.badSensor(new int[] {2, 2, 2, 2, 2}, new int[] {2, 2, 2, 2, 5})); } @Test public void test3() { - assertEquals(2, solution1.badSensor(new int[]{2, 3, 2, 2, 3, 2}, new int[]{2, 3, 2, 3, 2, 7})); + assertEquals( + 2, solution1.badSensor(new int[] {2, 3, 2, 2, 3, 2}, new int[] {2, 3, 2, 3, 2, 7})); } @Test public void test4() { - assertEquals(-1, solution1.badSensor(new int[]{1, 2, 3, 2, 3, 2}, new int[]{1, 2, 3, 3, 2, 3})); + assertEquals( + -1, + solution1.badSensor(new int[] {1, 2, 3, 2, 3, 2}, new int[] {1, 2, 3, 3, 2, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1836Test.java b/src/test/java/com/fishercoder/secondthousand/_1836Test.java index f5e8ed6500..573133d3ef 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1836Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1836Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.secondthousand._1836; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1836Test { private _1836.Solution1 solution1; @@ -17,17 +17,25 @@ public void setup() { @Test public void test1() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 3}), solution1.deleteDuplicatesUnsorted(LinkedListUtils.contructLinkedList(new int[]{1, 2, 3, 2}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 3}), + solution1.deleteDuplicatesUnsorted( + LinkedListUtils.contructLinkedList(new int[] {1, 2, 3, 2}))); } @Test public void test2() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{}), solution1.deleteDuplicatesUnsorted(LinkedListUtils.contructLinkedList(new int[]{2, 1, 1, 2}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {}), + solution1.deleteDuplicatesUnsorted( + LinkedListUtils.contructLinkedList(new int[] {2, 1, 1, 2}))); } @Test public void test3() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{1, 4}), solution1.deleteDuplicatesUnsorted(LinkedListUtils.contructLinkedList(new int[]{3, 2, 2, 1, 3, 2, 4}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {1, 4}), + solution1.deleteDuplicatesUnsorted( + LinkedListUtils.contructLinkedList(new int[] {3, 2, 2, 1, 3, 2, 4}))); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1844Test.java b/src/test/java/com/fishercoder/secondthousand/_1844Test.java index 9cf74340cd..6f047401ad 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1844Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1844Test.java @@ -32,4 +32,4 @@ public void test2() { String expected = solution2.replaceDigits(s); Assertions.assertEquals(actual, expected); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1861Test.java b/src/test/java/com/fishercoder/secondthousand/_1861Test.java index 6982b0e497..817bcc30a4 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1861Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1861Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.secondthousand._1861; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1861Test { private _1861.Solution1 solution1; @@ -16,39 +16,43 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new char[][]{{'.'}, {'#'}, {'#'}}, solution1.rotateTheBox(new char[][]{ - {'#', '.', '#'} - })); + assertArrayEquals( + new char[][] {{'.'}, {'#'}, {'#'}}, + solution1.rotateTheBox(new char[][] {{'#', '.', '#'}})); } @Test public void test2() { - assertArrayEquals(new char[][]{ - {'#', '.'}, - {'#', '#'}, - {'*', '*'}, - {'.', '.'}}, - solution1.rotateTheBox(new char[][]{ - {'#', '.', '*', '.'}, - {'#', '#', '*', '.'} - })); + assertArrayEquals( + new char[][] { + {'#', '.'}, + {'#', '#'}, + {'*', '*'}, + {'.', '.'} + }, + solution1.rotateTheBox( + new char[][] { + {'#', '.', '*', '.'}, + {'#', '#', '*', '.'} + })); } @Test public void test3() { - assertArrayEquals(new char[][]{ - {'.', '#', '#'}, - {'.', '#', '#'}, - {'#', '#', '*'}, - {'#', '*', '.'}, - {'#', '.', '*'}, - {'#', '.', '.'} + assertArrayEquals( + new char[][] { + {'.', '#', '#'}, + {'.', '#', '#'}, + {'#', '#', '*'}, + {'#', '*', '.'}, + {'#', '.', '*'}, + {'#', '.', '.'} }, - solution1.rotateTheBox(new char[][]{ - {'#', '#', '*', '.', '*', '.'}, - {'#', '#', '#', '*', '.', '.'}, - {'#', '#', '#', '.', '#', '.'} - })); + solution1.rotateTheBox( + new char[][] { + {'#', '#', '*', '.', '*', '.'}, + {'#', '#', '#', '*', '.', '.'}, + {'#', '#', '#', '.', '#', '.'} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1862Test.java b/src/test/java/com/fishercoder/secondthousand/_1862Test.java index 5155d89546..0984797ddb 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1862Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1862Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1862; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1862Test { private _1862.Solution1 solution1; @@ -16,17 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(49, solution1.sumOfFlooredPairs(new int[]{7, 7, 7, 7, 7, 7, 7})); + assertEquals(49, solution1.sumOfFlooredPairs(new int[] {7, 7, 7, 7, 7, 7, 7})); } @Test public void test2() { - assertEquals(10, solution1.sumOfFlooredPairs(new int[]{2, 5, 9})); + assertEquals(10, solution1.sumOfFlooredPairs(new int[] {2, 5, 9})); } @Test public void test3() { - assertEquals(17, solution1.sumOfFlooredPairs(new int[]{4, 3, 4, 3, 5})); + assertEquals(17, solution1.sumOfFlooredPairs(new int[] {4, 3, 4, 3, 5})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1868Test.java b/src/test/java/com/fishercoder/secondthousand/_1868Test.java index 0eda298a7a..c5efa8dfb3 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1868Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1868Test.java @@ -1,13 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1868; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1868Test { private _1868.Solution1 solution1; @@ -18,7 +17,8 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList(Arrays.asList(6, 6)), solution1.findRLEArray(new int[][]{{1, 3}, {2, 3}}, new int[][]{{6, 3}, {3, 3}})); + assertEquals( + Arrays.asList(Arrays.asList(6, 6)), + solution1.findRLEArray(new int[][] {{1, 3}, {2, 3}}, new int[][] {{6, 3}, {3, 3}})); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1869Test.java b/src/test/java/com/fishercoder/secondthousand/_1869Test.java index cc7cc0d596..52fe193a5b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1869Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1869Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1869; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1869Test { private _1869.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(false, solution1.checkZeroOnes("111000")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1886Test.java b/src/test/java/com/fishercoder/secondthousand/_1886Test.java index 372c05161d..49a8e2b1f9 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1886Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1886Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1886; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1886Test { private _1886.Solution1 solution1; @@ -16,37 +16,48 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.findRotation(new int[][]{ - {0, 1}, - {1, 0} - }, new int[][]{ - {1, 0}, - {0, 1} - })); + assertEquals( + true, + solution1.findRotation( + new int[][] { + {0, 1}, + {1, 0} + }, + new int[][] { + {1, 0}, + {0, 1} + })); } @Test public void test2() { - assertEquals(false, solution1.findRotation(new int[][]{ - {0, 1}, - {1, 1} - }, new int[][]{ - {1, 0}, - {0, 1} - })); + assertEquals( + false, + solution1.findRotation( + new int[][] { + {0, 1}, + {1, 1} + }, + new int[][] { + {1, 0}, + {0, 1} + })); } @Test public void test3() { - assertEquals(true, solution1.findRotation(new int[][]{ - {0, 0, 0}, - {0, 1, 0}, - {1, 1, 1} - }, new int[][]{ - {1, 1, 1}, - {0, 1, 0}, - {0, 0, 0} - })); + assertEquals( + true, + solution1.findRotation( + new int[][] { + {0, 0, 0}, + {0, 1, 0}, + {1, 1, 1} + }, + new int[][] { + {1, 1, 1}, + {0, 1, 0}, + {0, 0, 0} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1891Test.java b/src/test/java/com/fishercoder/secondthousand/_1891Test.java index e08b31c7e3..9801415def 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1891Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1891Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1891; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1891Test { private _1891.Solution1 solution1; private static int[] ribbons; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - ribbons = new int[]{9, 7, 5}; + ribbons = new int[] {9, 7, 5}; k = 3; expected = 5; assertEquals(expected, solution1.maxLength(ribbons, k)); @@ -27,7 +27,7 @@ public void test1() { @Test public void test2() { - ribbons = new int[]{7, 5, 9}; + ribbons = new int[] {7, 5, 9}; k = 4; expected = 4; assertEquals(expected, solution1.maxLength(ribbons, k)); @@ -35,7 +35,7 @@ public void test2() { @Test public void test3() { - ribbons = new int[]{5, 7, 9}; + ribbons = new int[] {5, 7, 9}; k = 22; expected = 0; assertEquals(expected, solution1.maxLength(ribbons, k)); @@ -43,11 +43,16 @@ public void test3() { @Test public void test4() { - ribbons = new int[]{100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 1, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000}; + ribbons = + new int[] { + 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, + 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, + 1, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, + 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, + 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000 + }; k = 49; expected = 100000; assertEquals(expected, solution1.maxLength(ribbons, k)); } - - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1893Test.java b/src/test/java/com/fishercoder/secondthousand/_1893Test.java index 69914fc5ea..ee0059582c 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1893Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1893Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1893; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1893Test { private _1893.Solution1 solution1; private static int[][] ranges; @@ -17,52 +17,45 @@ public void setup() { @Test public void test1() { - ranges = new int[][]{ - {1, 10}, - {10, 20} - }; + ranges = + new int[][] { + {1, 10}, + {10, 20} + }; assertEquals(false, solution1.isCovered(ranges, 21, 21)); } @Test public void test2() { - ranges = new int[][]{ - {50, 50} - }; + ranges = new int[][] {{50, 50}}; assertEquals(false, solution1.isCovered(ranges, 1, 50)); } @Test public void test3() { - ranges = new int[][]{ - {1, 10}, - {10, 20} - }; + ranges = + new int[][] { + {1, 10}, + {10, 20} + }; assertEquals(false, solution1.isCovered(ranges, 21, 25)); } @Test public void test4() { - ranges = new int[][]{ - {1, 50} - }; + ranges = new int[][] {{1, 50}}; assertEquals(true, solution1.isCovered(ranges, 1, 50)); } @Test public void test5() { - ranges = new int[][]{ - {1, 2}, {3, 4}, {5, 6} - }; + ranges = new int[][] {{1, 2}, {3, 4}, {5, 6}}; assertEquals(true, solution1.isCovered(ranges, 2, 5)); } @Test public void test6() { - ranges = new int[][]{ - {50, 50} - }; + ranges = new int[][] {{50, 50}}; assertEquals(false, solution1.isCovered(ranges, 49, 49)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1894Test.java b/src/test/java/com/fishercoder/secondthousand/_1894Test.java index e5caf67e86..6f7f108c04 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1894Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1894Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1894; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1894Test { private _1894.Solution1 solution1; private static int[] chalk; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - chalk = new int[]{3, 4, 1, 2}; + chalk = new int[] {3, 4, 1, 2}; assertEquals(1, solution1.chalkReplacer(chalk, 25)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1903Test.java b/src/test/java/com/fishercoder/secondthousand/_1903Test.java index 98e85eea9e..6787885eda 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1903Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1903Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1903; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1903Test { private _1903.Solution1 solution1; @@ -26,7 +26,9 @@ public void test2() { @Test public void test3() { - assertEquals("", solution1.largestOddNumber("682240884028086868404428842828664608862668422848464222044808062248028626808622648468064684002662206226066026484442422688042080684686220644488204022062860680482080686642464640464808662064884824260028648606444680200422064006864880486640800648828268684608460686600424266848424006442022080400840864222486042862488644828486026242662426040828662088280044400400424020064640620248088446626800004044064806462400400808484282028844606842644222262268080240226642826480202242048684644022206008424648828488048060828220426484664062040088682460884424244242680060828686004084220646404684460668220446600022404464840226860682284864260460062842664002264620886406204262808446844460642604220688262062206042420262486060840840200204428206042808202226686442802082260602448060888208640660040042842868040226042806882022200082868802846462486282022688286468886460484864682266006842422680488062820228682402042462442020680806828680682860066248862048260424084866468262220822282466082622820044066420086022044644488868064226204280402044466444662008040804488442842204888822242848628666060006844088448804684608462068840266664428842804224226488266880408840028880666482806262486642804886804020802602826800026262682488440426248848408228828402648406066826028286866602226282202064046026606802880680206048008826400288046824246002402848264680620268826046040682460022406248462448266202008446048806644840666482206486460260068046426846804462440420428626624282804686840266280868428264024428400242244466882240660662866626886866086022082226662266622222806468088084466446686080068200882082440048686088260622260026066842422840646000440660628886482088266406406646628464060442240480080428040044408066824082600648688222682062806686862800642842822862806288886042668262448668042444244488284228664648240824048482826604426828048406062684464280468848428424866268608022804082240424842868240080248264628846842082446428266822680204242042482866848480006022286888204466242824064642008284404664042466288424202066280466668280082844028000248022448060886222420226688228806602680082482282244644446824824400226688686600200444400486880626660448806482682002004606884280846866484648620864406460224484266020486608004402240220402266646466288600022066206602280442406606288884424464682482266882484222262488000080828660462222062288424002444400442062002280066266444044622026888464280288802028020226400066288268208044406860208484000668208806268080842484620886468624240248882444848428820662224028684626264884224668866602606268644024686428028204200200204400068224664086428488064068480688424848684822246004626620806848244280066602806402208624868202848060288888804204246408228042460808868648262462226000260204424000008004260886062828822288264602206062086064662826866466266262244624008804880084688604442402482066668888868426484662244862268660860460800802424286642020884082064200080886868628088468000024204846686286064688086422240280282022828048662200600862048480486808462828640604868028064828200248060264604848282884682400682822604806266606246266468064644802824020008226026680804626420264242842468400648604842480480882426648006622660200206422004680060644440024062840640226820068422482822080224006202086844260208444646288042206820668426422060240826022864402044200486486866428022604440824408244028084860842626264224842862402888244608646642868284224660042428224068864446860648084428806068642206080066864864648884820464846040882642680248442406028440068448888242602400428248622002640626046680860200480286046822002426262260846606826020824284026200628040804862660260020004808882626646804284028842660664246282420408046088202000026460440884660620444646866084642866240284408084280242820040008468284088664204826204402868000682086406482206244620228484402088848460606202046002884664884466200420680068602862424600022466046280228802826288808662220080440820684826204846246266042446220626202468660468460426604228202200888882860464424288008462882000622860064886888226220242428644026864606406880024688408844288206400846048800828424828602442804826642484644642620228686020404482008064620202822008068284024808208800080224200280462600208402240420246484440242604000264086004402664868442660082484442868048802404680828026846066000068840820804288682606682420642202426024868662462462220682408642228408284224022264640806220826068688000862824288806286662822240026822064200608800640644808864064826204482084260208028846848800066806284622802668400688862648460266262862448662088200206848002602422484048804608264064822686024682608228400068668880848406804040822662866244200460208406444224842466084404262602468800046484208246600688024422080264040684664668020024824228826860842444862802622666826804402206846228262680406204402046462842466220602808062640022264486400482088086800426246400022622000828880828820044084680864846260222068280806206200260246242844266420400268022066840086222840688004202228808826424826244862886604640000802466204240828242646060286866266040246248680882462462600824022808626226428466622622424288660646422446282406826428888844048206226066800428446886220628220880244888604208226466604488442284246884604404860440244204422466462624626484862460800846880044888824088606644228066482448886648844840668044648448824848006042422666028800680084824068464224662842204204022608624466222088604882406022284864224686482048060664640826024200086024622640628626046460666020004000266602866282824864480284844046242066862840006242846400602828620848248288280228060822228408460068408046640400804068202682228668628262068680888822800422288240246264662660840608626006064024260086802240860628246448002804662608860060622288608842088004800086008026660808282002082880024640220466062200828628020020620884086208264488468244068848608820828208826202488400226066022286804886046420224046640044068820660222026408244862622660044800426602080666208086482606628680260842824822066846622066088846602282628808268842648244424240606628622840644084802266224406826882644842686022020220022622608024206806228882244000842866628242066600226842004806046682226604260040402480628244046806042288602206242286080222224846006020086286488826824288808460808844206824642808204664046266880442208668848080220608024064446422880602620024006242666024820844444840408006442860882682208800826280228260226802222420480008804482208606426624846204026022846286448026660684808488062864440880420222828006006204444028806046420286424488822606242226222028086662444806822802404486246464086068626646424682062400424684468600426488860226088040440662622420266604820064662846662802406426064608228442826848682064826680004882022406884640840662424442840604286200468202422082062880222686822822002080026442046660646284282842640088680642064246262802006202088662280624600262426664264828060228642246260040844068442400868284840288064000484882886608462488248846662624280480266640682424828248202602484442026420282800884282202202080064268862884680488684842062608202480282200684668460608222628826864028620660664604804848442002844244006206488080860660446400628462086846080440822682842624224648882062080080246800268044426026660408082200424646480206280288604880824888444648888462880244440868808664446668420480808484444046444086060822020068042668602268440266224880262080888240668642862644884486606088064624220204408022064048068426040888642264888642224800682624460408062828228266462028884440684802864806602042002820668622802664842088240402688868044464262806646426684404602446480868206024264248044228648086600680842440682868662808844266626628640822224826802224008822442646284088664648464848200688488602800084482226440804240200662406282082640462286060226822484628640088404244424426228082640400486244280642288264622082882004040204068488204840284226680886264048282644082488260846606262864400206006064488884068422080240048608802262442660064086280088288244628882224264286002224648268426064060284400440664642404646082228006226622280222462608000060680606842686028886668666404664284264402624224284460062602844822482266808200262828404626602804206628066806020440880686686602246282882260060284824828080622088806048846606024046866084642206446286086842442042684024800600862840626280422428004606460868606660428022466648068848884444868242040024688648486622680040004084062408686868688424446048228208266606826828402682468062620820208660442622608400226248244260624226422280286404620282620684844628022482644240046246268426068404260882280662484666466008866826404048824082860046666844426622044428646406244602882288888048428246086040668404060006862684408440006622206644868646480486684826046224460648824246880662484820420866824064268682408862686280480464462644264020000000606202002466660022204286028662226620424622864042862806048068660284402840628882404240486462486424264842424608846060066226608040484628402848442000882626600488444060800684828222860484446064846008688000808042260608686282064668226660068606666604608608200688264864448608022682466488408840262620268682006624446268246844022266026026600242220806286000228848026260008008622608084884086666648402488488262226668226886208460006408246268666446488860224624826842226886064402246066266806462204604888026422028200026420684824222880084002420642464808684246268862880428408646864088024622228866682888068202244060804820648268084068008840462208682800200240848226808484668426206882406422080482624002246464264204280404480460828882048864484020286882024420020406800460640208480228204266800846842406820084646422244444080244442262608228488248884000660046626468262086624840848264668600640866622246286804042080668860082806068600648444068228028042040800648282602802264806204626464242466044004024284228408484626806440488646206888404662022866406066008206260204820022688808826646806022088042048464608228442282286440408284668408408426064280822642408240020820040888462488444442080448880884244484800626484806860840004406404224624802000264288444826422622602640888268484062486684604008000228486820648266680022460624648608822240660824662464880608622608224280886680648606426860242202820006048006684426620864004000644806868228404060220424020288662026400644062022444008626206262064408486286262026028662428208604402640246622464848222068640282042600086664268488248408000688000482068200628884664482064484848220286042404860868622248804082640082044204602280046446688644640202626662864888422068846808404866264480202008048068646482220084406864464666280444862882466264668846408824620646008200822622206440248266668840606086286640682882666024084026408622886868604820642220808006680864860282222486268082460804288602024824222046820002200280868082648022640220824680002622026642624868484602864880660662444200062888204600808828024220420600842220200486244462486400406042462824044082462004406488666468468806240448208084882420006028826084622644484082420480864406240040226640440220008000820420008086468446824468860266662600668842668260688462206682664442088622648684668680240822400802002600468828402640840862046648088824066086466826802684064442824488042264046280226468648662284246482882686200022424424844826846846822860200680248806648808460600844440642486680828624062662266880066088820064004228260862266886080008062600424828240802820486240002204462268060604482222602808408060004844808848602620408284846064082264420440266026860884840240206226882828620446044626026602428042886608464602640402608260220066400280662020226642402426628040202246064686606024686604462288404028264646008848680022406686422480246686604268620604642686824442600402800044062404440224228642882064060406404062288442864828204206002042006428028048486028444604488240664004460664862422482288824000046266044688622066604040626822244288204006662020426284626468468624020802404062422608482280804660286802204884066464602206282288202248420800868640648084886248824406628802840424622464226648044204086864660000842808464840206042608024684248620660664048204680426064480028800684466848604668046802220420684822206664820246026480064862868428806682480866842822802224620864486806280606228008822248226882028828822044082446448688682828266024880484422422288266002680426040462406844620468246064622002644208046808048828208226062442222248268060042200446202284088280004866880624280866242202660228406066664846604822046222628026626806262006804444444226646820886024064642444082200226088200604244660660448648244602608204820224608464824808864646482660228088840460824240004888828862480646666840828002660082440822404402080442420060040268086280080620226206244262880284800028664062040484220440844688020000820868880262602606222482662828886408020842444684688062680262408864622466242042666486000466208482420448086282442648640064626822684208220260468682602262842422204662844462826086686682624888488600664462206046640880404828804620884068464800862680666882606226044828086224044460606648026808844886060444820244864882428486024448220462286800624882802408222224806600646442882060004864682846866440608002440842224486264446606080606084608446648084820022848064400822400246406248880408024008024402606626866206822482460060622860808286822268662662060260682860466226428820840864880480886068080488244244466642008208042802088660808060802688642842226086482602266684084808886480804866804648862640600682808648822046488628202486086206880468842026462868808026080680066484000640666824268024800004042028828264606202044048864686004880226666260468644204482646806466404804408226820426064406220246842884466060480462488444480246046088262808828020880244800280888022442864448466604248468246086402406842440820200842284024604266266860888044082846206684268822288868226860266488024284806648448008428848604602404284080448828608206808626620202060684204604688624268080048864484008846462286822224688006006264462820220068426862604648682686248648226206266688282880288462200646840226686880680646848600246628626642466482862082482480606026680822824466482282066828462484042886444006006288448402024826260288226422626020468066466622444846620848200220422244264020802244022224466822682608628288842486620002208044268400086846862646068042644640040424422624082626802680666202260842822640608604428660246006286244620448204086006662808404826002806204680428424664028244428244462664644006208440202044842040066842220200064222002220424404806068222828824248060820264840064288006260060222220688840062260448266406024008686446246422028424408642440688006082006048082286042008006844628406064808888642046622842022800668846482666462048620046606626222482620048682082600444004428420824864668624062080486820086862640840864262602026044808222688484066020468008400866648660086040044680464266042822642682266400804066246220080080844866648286660486286684464840240620606842462208800264008088044884862442862046600828628000266464682022686642006600824464642220802460222264660040486040282240868664244804640640460426482224442800684666604046088668826488406242022660802286688826420226206026226462224228282882484286602288048802422842886688844802242264606620226220684082604848020202888864488666800620264600886662464484868888488602868064446608648464404660086642628824046864800626862868000468648244004226666880662242866228682000402280844664224044000284068680466048284606880402268004244408444448842488648244882822826466486402248404046488448640202800400428426028466464082464840408022228084640226086460822662286468628602840444422262860268648022060442864604488824402642608640442622686020")); + assertEquals( + "", + solution1.largestOddNumber( + "682240884028086868404428842828664608862668422848464222044808062248028626808622648468064684002662206226066026484442422688042080684686220644488204022062860680482080686642464640464808662064884824260028648606444680200422064006864880486640800648828268684608460686600424266848424006442022080400840864222486042862488644828486026242662426040828662088280044400400424020064640620248088446626800004044064806462400400808484282028844606842644222262268080240226642826480202242048684644022206008424648828488048060828220426484664062040088682460884424244242680060828686004084220646404684460668220446600022404464840226860682284864260460062842664002264620886406204262808446844460642604220688262062206042420262486060840840200204428206042808202226686442802082260602448060888208640660040042842868040226042806882022200082868802846462486282022688286468886460484864682266006842422680488062820228682402042462442020680806828680682860066248862048260424084866468262220822282466082622820044066420086022044644488868064226204280402044466444662008040804488442842204888822242848628666060006844088448804684608462068840266664428842804224226488266880408840028880666482806262486642804886804020802602826800026262682488440426248848408228828402648406066826028286866602226282202064046026606802880680206048008826400288046824246002402848264680620268826046040682460022406248462448266202008446048806644840666482206486460260068046426846804462440420428626624282804686840266280868428264024428400242244466882240660662866626886866086022082226662266622222806468088084466446686080068200882082440048686088260622260026066842422840646000440660628886482088266406406646628464060442240480080428040044408066824082600648688222682062806686862800642842822862806288886042668262448668042444244488284228664648240824048482826604426828048406062684464280468848428424866268608022804082240424842868240080248264628846842082446428266822680204242042482866848480006022286888204466242824064642008284404664042466288424202066280466668280082844028000248022448060886222420226688228806602680082482282244644446824824400226688686600200444400486880626660448806482682002004606884280846866484648620864406460224484266020486608004402240220402266646466288600022066206602280442406606288884424464682482266882484222262488000080828660462222062288424002444400442062002280066266444044622026888464280288802028020226400066288268208044406860208484000668208806268080842484620886468624240248882444848428820662224028684626264884224668866602606268644024686428028204200200204400068224664086428488064068480688424848684822246004626620806848244280066602806402208624868202848060288888804204246408228042460808868648262462226000260204424000008004260886062828822288264602206062086064662826866466266262244624008804880084688604442402482066668888868426484662244862268660860460800802424286642020884082064200080886868628088468000024204846686286064688086422240280282022828048662200600862048480486808462828640604868028064828200248060264604848282884682400682822604806266606246266468064644802824020008226026680804626420264242842468400648604842480480882426648006622660200206422004680060644440024062840640226820068422482822080224006202086844260208444646288042206820668426422060240826022864402044200486486866428022604440824408244028084860842626264224842862402888244608646642868284224660042428224068864446860648084428806068642206080066864864648884820464846040882642680248442406028440068448888242602400428248622002640626046680860200480286046822002426262260846606826020824284026200628040804862660260020004808882626646804284028842660664246282420408046088202000026460440884660620444646866084642866240284408084280242820040008468284088664204826204402868000682086406482206244620228484402088848460606202046002884664884466200420680068602862424600022466046280228802826288808662220080440820684826204846246266042446220626202468660468460426604228202200888882860464424288008462882000622860064886888226220242428644026864606406880024688408844288206400846048800828424828602442804826642484644642620228686020404482008064620202822008068284024808208800080224200280462600208402240420246484440242604000264086004402664868442660082484442868048802404680828026846066000068840820804288682606682420642202426024868662462462220682408642228408284224022264640806220826068688000862824288806286662822240026822064200608800640644808864064826204482084260208028846848800066806284622802668400688862648460266262862448662088200206848002602422484048804608264064822686024682608228400068668880848406804040822662866244200460208406444224842466084404262602468800046484208246600688024422080264040684664668020024824228826860842444862802622666826804402206846228262680406204402046462842466220602808062640022264486400482088086800426246400022622000828880828820044084680864846260222068280806206200260246242844266420400268022066840086222840688004202228808826424826244862886604640000802466204240828242646060286866266040246248680882462462600824022808626226428466622622424288660646422446282406826428888844048206226066800428446886220628220880244888604208226466604488442284246884604404860440244204422466462624626484862460800846880044888824088606644228066482448886648844840668044648448824848006042422666028800680084824068464224662842204204022608624466222088604882406022284864224686482048060664640826024200086024622640628626046460666020004000266602866282824864480284844046242066862840006242846400602828620848248288280228060822228408460068408046640400804068202682228668628262068680888822800422288240246264662660840608626006064024260086802240860628246448002804662608860060622288608842088004800086008026660808282002082880024640220466062200828628020020620884086208264488468244068848608820828208826202488400226066022286804886046420224046640044068820660222026408244862622660044800426602080666208086482606628680260842824822066846622066088846602282628808268842648244424240606628622840644084802266224406826882644842686022020220022622608024206806228882244000842866628242066600226842004806046682226604260040402480628244046806042288602206242286080222224846006020086286488826824288808460808844206824642808204664046266880442208668848080220608024064446422880602620024006242666024820844444840408006442860882682208800826280228260226802222420480008804482208606426624846204026022846286448026660684808488062864440880420222828006006204444028806046420286424488822606242226222028086662444806822802404486246464086068626646424682062400424684468600426488860226088040440662622420266604820064662846662802406426064608228442826848682064826680004882022406884640840662424442840604286200468202422082062880222686822822002080026442046660646284282842640088680642064246262802006202088662280624600262426664264828060228642246260040844068442400868284840288064000484882886608462488248846662624280480266640682424828248202602484442026420282800884282202202080064268862884680488684842062608202480282200684668460608222628826864028620660664604804848442002844244006206488080860660446400628462086846080440822682842624224648882062080080246800268044426026660408082200424646480206280288604880824888444648888462880244440868808664446668420480808484444046444086060822020068042668602268440266224880262080888240668642862644884486606088064624220204408022064048068426040888642264888642224800682624460408062828228266462028884440684802864806602042002820668622802664842088240402688868044464262806646426684404602446480868206024264248044228648086600680842440682868662808844266626628640822224826802224008822442646284088664648464848200688488602800084482226440804240200662406282082640462286060226822484628640088404244424426228082640400486244280642288264622082882004040204068488204840284226680886264048282644082488260846606262864400206006064488884068422080240048608802262442660064086280088288244628882224264286002224648268426064060284400440664642404646082228006226622280222462608000060680606842686028886668666404664284264402624224284460062602844822482266808200262828404626602804206628066806020440880686686602246282882260060284824828080622088806048846606024046866084642206446286086842442042684024800600862840626280422428004606460868606660428022466648068848884444868242040024688648486622680040004084062408686868688424446048228208266606826828402682468062620820208660442622608400226248244260624226422280286404620282620684844628022482644240046246268426068404260882280662484666466008866826404048824082860046666844426622044428646406244602882288888048428246086040668404060006862684408440006622206644868646480486684826046224460648824246880662484820420866824064268682408862686280480464462644264020000000606202002466660022204286028662226620424622864042862806048068660284402840628882404240486462486424264842424608846060066226608040484628402848442000882626600488444060800684828222860484446064846008688000808042260608686282064668226660068606666604608608200688264864448608022682466488408840262620268682006624446268246844022266026026600242220806286000228848026260008008622608084884086666648402488488262226668226886208460006408246268666446488860224624826842226886064402246066266806462204604888026422028200026420684824222880084002420642464808684246268862880428408646864088024622228866682888068202244060804820648268084068008840462208682800200240848226808484668426206882406422080482624002246464264204280404480460828882048864484020286882024420020406800460640208480228204266800846842406820084646422244444080244442262608228488248884000660046626468262086624840848264668600640866622246286804042080668860082806068600648444068228028042040800648282602802264806204626464242466044004024284228408484626806440488646206888404662022866406066008206260204820022688808826646806022088042048464608228442282286440408284668408408426064280822642408240020820040888462488444442080448880884244484800626484806860840004406404224624802000264288444826422622602640888268484062486684604008000228486820648266680022460624648608822240660824662464880608622608224280886680648606426860242202820006048006684426620864004000644806868228404060220424020288662026400644062022444008626206262064408486286262026028662428208604402640246622464848222068640282042600086664268488248408000688000482068200628884664482064484848220286042404860868622248804082640082044204602280046446688644640202626662864888422068846808404866264480202008048068646482220084406864464666280444862882466264668846408824620646008200822622206440248266668840606086286640682882666024084026408622886868604820642220808006680864860282222486268082460804288602024824222046820002200280868082648022640220824680002622026642624868484602864880660662444200062888204600808828024220420600842220200486244462486400406042462824044082462004406488666468468806240448208084882420006028826084622644484082420480864406240040226640440220008000820420008086468446824468860266662600668842668260688462206682664442088622648684668680240822400802002600468828402640840862046648088824066086466826802684064442824488042264046280226468648662284246482882686200022424424844826846846822860200680248806648808460600844440642486680828624062662266880066088820064004228260862266886080008062600424828240802820486240002204462268060604482222602808408060004844808848602620408284846064082264420440266026860884840240206226882828620446044626026602428042886608464602640402608260220066400280662020226642402426628040202246064686606024686604462288404028264646008848680022406686422480246686604268620604642686824442600402800044062404440224228642882064060406404062288442864828204206002042006428028048486028444604488240664004460664862422482288824000046266044688622066604040626822244288204006662020426284626468468624020802404062422608482280804660286802204884066464602206282288202248420800868640648084886248824406628802840424622464226648044204086864660000842808464840206042608024684248620660664048204680426064480028800684466848604668046802220420684822206664820246026480064862868428806682480866842822802224620864486806280606228008822248226882028828822044082446448688682828266024880484422422288266002680426040462406844620468246064622002644208046808048828208226062442222248268060042200446202284088280004866880624280866242202660228406066664846604822046222628026626806262006804444444226646820886024064642444082200226088200604244660660448648244602608204820224608464824808864646482660228088840460824240004888828862480646666840828002660082440822404402080442420060040268086280080620226206244262880284800028664062040484220440844688020000820868880262602606222482662828886408020842444684688062680262408864622466242042666486000466208482420448086282442648640064626822684208220260468682602262842422204662844462826086686682624888488600664462206046640880404828804620884068464800862680666882606226044828086224044460606648026808844886060444820244864882428486024448220462286800624882802408222224806600646442882060004864682846866440608002440842224486264446606080606084608446648084820022848064400822400246406248880408024008024402606626866206822482460060622860808286822268662662060260682860466226428820840864880480886068080488244244466642008208042802088660808060802688642842226086482602266684084808886480804866804648862640600682808648822046488628202486086206880468842026462868808026080680066484000640666824268024800004042028828264606202044048864686004880226666260468644204482646806466404804408226820426064406220246842884466060480462488444480246046088262808828020880244800280888022442864448466604248468246086402406842440820200842284024604266266860888044082846206684268822288868226860266488024284806648448008428848604602404284080448828608206808626620202060684204604688624268080048864484008846462286822224688006006264462820220068426862604648682686248648226206266688282880288462200646840226686880680646848600246628626642466482862082482480606026680822824466482282066828462484042886444006006288448402024826260288226422626020468066466622444846620848200220422244264020802244022224466822682608628288842486620002208044268400086846862646068042644640040424422624082626802680666202260842822640608604428660246006286244620448204086006662808404826002806204680428424664028244428244462664644006208440202044842040066842220200064222002220424404806068222828824248060820264840064288006260060222220688840062260448266406024008686446246422028424408642440688006082006048082286042008006844628406064808888642046622842022800668846482666462048620046606626222482620048682082600444004428420824864668624062080486820086862640840864262602026044808222688484066020468008400866648660086040044680464266042822642682266400804066246220080080844866648286660486286684464840240620606842462208800264008088044884862442862046600828628000266464682022686642006600824464642220802460222264660040486040282240868664244804640640460426482224442800684666604046088668826488406242022660802286688826420226206026226462224228282882484286602288048802422842886688844802242264606620226220684082604848020202888864488666800620264600886662464484868888488602868064446608648464404660086642628824046864800626862868000468648244004226666880662242866228682000402280844664224044000284068680466048284606880402268004244408444448842488648244882822826466486402248404046488448640202800400428426028466464082464840408022228084640226086460822662286468628602840444422262860268648022060442864604488824402642608640442622686020")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1904Test.java b/src/test/java/com/fishercoder/secondthousand/_1904Test.java index e3849734d2..073a6fdfba 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1904Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1904Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1904; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1904Test { private _1904.Solution1 solution1; @@ -58,5 +58,4 @@ public void test7() { public void test8() { assertEquals(6, solution1.numberOfRounds("00:01", "01:57")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1933Test.java b/src/test/java/com/fishercoder/secondthousand/_1933Test.java index 5a036f258c..261261ca8b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1933Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1933Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1933; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1933Test { private _1933.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(false, solution1.isDecomposable("011100022233")); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1936Test.java b/src/test/java/com/fishercoder/secondthousand/_1936Test.java index 1f72235001..089ff0f698 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1936Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1936Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1936; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1936Test { private _1936.Solution1 solution1; @@ -16,27 +16,26 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.addRungs(new int[]{3}, 1)); + assertEquals(2, solution1.addRungs(new int[] {3}, 1)); } @Test public void test2() { - assertEquals(2, solution1.addRungs(new int[]{1, 3, 5, 10}, 2)); + assertEquals(2, solution1.addRungs(new int[] {1, 3, 5, 10}, 2)); } @Test public void test3() { - assertEquals(0, solution1.addRungs(new int[]{3, 6, 8, 10}, 3)); + assertEquals(0, solution1.addRungs(new int[] {3, 6, 8, 10}, 3)); } @Test public void test4() { - assertEquals(1, solution1.addRungs(new int[]{3, 4, 6, 7}, 2)); + assertEquals(1, solution1.addRungs(new int[] {3, 4, 6, 7}, 2)); } @Test public void test5() { - assertEquals(0, solution1.addRungs(new int[]{5}, 10)); + assertEquals(0, solution1.addRungs(new int[] {5}, 10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1945Test.java b/src/test/java/com/fishercoder/secondthousand/_1945Test.java index 9fb047f63c..12f7b3be5a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1945Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1945Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1945; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1945Test { private _1945.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(8, solution1.getLucky("fleyctuuajsr", 5)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1966Test.java b/src/test/java/com/fishercoder/secondthousand/_1966Test.java index 7033cd1876..f72734be2f 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1966Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1966Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1966; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1966Test { private _1966.Solution1 solution1; private _1966.Solution2 solution2; @@ -22,7 +22,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{7}; + nums = new int[] {7}; expected = 1; assertEquals(expected, solution1.binarySearchableNumbers(nums)); assertEquals(expected, solution2.binarySearchableNumbers(nums)); @@ -31,7 +31,7 @@ public void test1() { @Test public void test2() { - nums = new int[]{-1, 5, 2}; + nums = new int[] {-1, 5, 2}; expected = 1; assertEquals(expected, solution1.binarySearchableNumbers(nums)); assertEquals(expected, solution2.binarySearchableNumbers(nums)); @@ -40,8 +40,8 @@ public void test2() { @Test public void test3() { - /**This is to answer the follow-up question, what if duplicates are allowed in the input*/ - nums = new int[]{-1, -1, 5, 2}; + /** This is to answer the follow-up question, what if duplicates are allowed in the input */ + nums = new int[] {-1, -1, 5, 2}; expected = 2; assertEquals(expected, solution1.binarySearchableNumbers(nums)); assertEquals(expected, solution2.binarySearchableNumbers(nums)); @@ -50,8 +50,8 @@ public void test3() { @Test public void test4() { - /**This is to answer the follow-up question, what if duplicates are allowed in the input*/ - nums = new int[]{-1, -1, 5, 2, 2, 5}; + /** This is to answer the follow-up question, what if duplicates are allowed in the input */ + nums = new int[] {-1, -1, 5, 2, 2, 5}; expected = 3; assertEquals(expected, solution1.binarySearchableNumbers(nums)); assertEquals(expected, solution2.binarySearchableNumbers(nums)); diff --git a/src/test/java/com/fishercoder/secondthousand/_1968Test.java b/src/test/java/com/fishercoder/secondthousand/_1968Test.java index d13f2da10b..019601761e 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1968Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1968Test.java @@ -15,7 +15,6 @@ public void setup() { @Test public void test1() { - CommonUtils.printArray(solution1.rearrangeArray(new int[]{1, 2, 3, 4, 5})); + CommonUtils.printArray(solution1.rearrangeArray(new int[] {1, 2, 3, 4, 5})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1971Test.java b/src/test/java/com/fishercoder/secondthousand/_1971Test.java index 876410ed5b..ba7e6ee670 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1971Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1971Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1971; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1971Test { private _1971.Solution1 solution1; @@ -17,37 +17,46 @@ public void setup() { @Test public void test1() { - int[][] edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2],[2,0]"); + int[][] edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1],[1,2],[2,0]"); assertEquals(true, solution1.validPath(3, edges, 0, 2)); } @Test public void test2() { - int[][] edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[0,2],[3,5],[5,4],[4,3]"); + int[][] edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1],[0,2],[3,5],[5,4],[4,3]"); assertEquals(false, solution1.validPath(6, edges, 0, 5)); } @Test public void test3() { - int[][] edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[4,3],[1,4],[4,8],[1,7],[6,4],[4,2],[7,4],[4,0],[0,9],[5,4]"); + int[][] edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[4,3],[1,4],[4,8],[1,7],[6,4],[4,2],[7,4],[4,0],[0,9],[5,4]"); assertEquals(true, solution1.validPath(10, edges, 5, 9)); } @Test public void test4() { - int[][] edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,7],[0,8],[6,1],[2,0],[0,4],[5,8],[4,7],[1,3],[3,5],[6,5]"); + int[][] edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,7],[0,8],[6,1],[2,0],[0,4],[5,8],[4,7],[1,3],[3,5],[6,5]"); assertEquals(true, solution1.validPath(10, edges, 7, 5)); } @Test public void test5() { - assertEquals(true, solution1.validPath(1, new int[][]{}, 0, 0)); + assertEquals(true, solution1.validPath(1, new int[][] {}, 0, 0)); } @Test public void test6() { - int[][] edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[3,12],[26,84],[10,43],[68,47],[33,10],[87,35],[41,96],[70,92],[38,31],[88,59],[7,30],[89,26],[95,25],[66,28],[14,24],[86,11],[83,65],[14,4],[67,7],[89,45],[52,73],[47,85],[86,53],[68,81],[43,68],[87,78],[94,49],[70,21],[11,82],[60,93],[22,32],[69,99],[7,1],[41,46],[73,94],[98,52],[68,0],[69,89],[37,72],[25,50],[72,78],[96,60],[73,95],[7,69],[97,19],[46,75],[8,38],[19,36],[64,41],[61,78],[97,14],[54,28],[6,18],[25,32],[34,77],[58,60],[17,63],[98,87],[13,76],[58,53],[81,74],[29,6],[37,5],[65,63],[89,56],[61,18],[23,34],[76,29],[73,76],[11,63],[98,0],[54,14],[63,7],[87,32],[79,57],[72,0],[94,16],[85,16],[12,91],[14,17],[30,45],[42,41],[82,69],[24,28],[31,59],[11,88],[41,89],[48,12],[92,76],[84,64],[19,64],[21,32],[30,19],[47,43],[45,27],[31,17],[53,36],[88,3],[83,7],[27,48],[13,6],[14,40],[90,28],[80,85],[29,79],[10,50],[56,86],[82,88],[11,99],[37,55],[62,2],[55,92],[51,53],[9,40],[65,97],[25,57],[7,96],[86,1],[39,93],[45,86],[40,90],[58,75],[99,86],[82,45],[5,81],[89,91],[15,83],[93,38],[3,93],[71,28],[11,97],[74,47],[64,96],[88,96],[4,99],[88,26],[0,55],[36,75],[26,24],[84,88],[58,40],[77,72],[58,48],[50,92],[62,68],[70,49],[41,71],[68,6],[64,91],[50,81],[35,44],[91,48],[21,37],[62,98],[64,26],[63,51],[77,55],[25,13],[60,41],[87,79],[75,17],[61,95],[30,82],[47,79],[28,7],[92,95],[91,59],[94,85],[24,65],[91,31],[3,9],[59,58],[70,43],[95,13],[30,96],[51,9],[16,70],[29,94],[37,22],[35,79],[14,90],[75,9],[2,57],[81,80],[61,87],[69,88],[98,79],[18,70],[82,19],[36,27],[49,62],[67,75],[62,77],[83,96],[92,37],[95,22],[46,97],[35,0],[44,79],[82,89],[68,94],[96,31],[92,34],[25,0],[46,36],[38,84],[21,0],[0,80],[72,44],[56,97],[86,26],[94,57],[25,6],[81,13],[66,63],[57,5],[72,49],[46,86],[95,16],[95,37],[14,89],[44,22],[60,39],[37,47],[58,86],[89,96],[38,83],[51,91],[72,70],[14,82],[60,30],[58,39],[57,22],[95,70],[44,76],[5,68],[15,69],[33,61],[81,32],[21,68],[73,20],[22,72],[83,8],[15,54],[93,42],[68,95],[55,72],[33,92],[5,49],[17,96],[44,77],[24,53],[2,98],[33,81],[32,43],[20,16],[67,84],[98,35],[58,11],[72,5],[3,59],[78,79],[6,0],[26,71],[96,97],[18,92],[1,36],[78,0],[63,15],[20,43],[32,73],[37,76],[73,16],[76,23],[50,44],[68,2],[14,86],[69,65],[95,98],[53,64],[6,76],[7,11],[14,84],[62,50],[83,58],[78,92],[37,0],[13,55],[12,86],[11,59],[41,86],[27,26],[94,43],[20,78],[0,73],[58,90],[69,36],[62,34],[65,26],[32,85]"); + int[][] edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[3,12],[26,84],[10,43],[68,47],[33,10],[87,35],[41,96],[70,92],[38,31],[88,59],[7,30],[89,26],[95,25],[66,28],[14,24],[86,11],[83,65],[14,4],[67,7],[89,45],[52,73],[47,85],[86,53],[68,81],[43,68],[87,78],[94,49],[70,21],[11,82],[60,93],[22,32],[69,99],[7,1],[41,46],[73,94],[98,52],[68,0],[69,89],[37,72],[25,50],[72,78],[96,60],[73,95],[7,69],[97,19],[46,75],[8,38],[19,36],[64,41],[61,78],[97,14],[54,28],[6,18],[25,32],[34,77],[58,60],[17,63],[98,87],[13,76],[58,53],[81,74],[29,6],[37,5],[65,63],[89,56],[61,18],[23,34],[76,29],[73,76],[11,63],[98,0],[54,14],[63,7],[87,32],[79,57],[72,0],[94,16],[85,16],[12,91],[14,17],[30,45],[42,41],[82,69],[24,28],[31,59],[11,88],[41,89],[48,12],[92,76],[84,64],[19,64],[21,32],[30,19],[47,43],[45,27],[31,17],[53,36],[88,3],[83,7],[27,48],[13,6],[14,40],[90,28],[80,85],[29,79],[10,50],[56,86],[82,88],[11,99],[37,55],[62,2],[55,92],[51,53],[9,40],[65,97],[25,57],[7,96],[86,1],[39,93],[45,86],[40,90],[58,75],[99,86],[82,45],[5,81],[89,91],[15,83],[93,38],[3,93],[71,28],[11,97],[74,47],[64,96],[88,96],[4,99],[88,26],[0,55],[36,75],[26,24],[84,88],[58,40],[77,72],[58,48],[50,92],[62,68],[70,49],[41,71],[68,6],[64,91],[50,81],[35,44],[91,48],[21,37],[62,98],[64,26],[63,51],[77,55],[25,13],[60,41],[87,79],[75,17],[61,95],[30,82],[47,79],[28,7],[92,95],[91,59],[94,85],[24,65],[91,31],[3,9],[59,58],[70,43],[95,13],[30,96],[51,9],[16,70],[29,94],[37,22],[35,79],[14,90],[75,9],[2,57],[81,80],[61,87],[69,88],[98,79],[18,70],[82,19],[36,27],[49,62],[67,75],[62,77],[83,96],[92,37],[95,22],[46,97],[35,0],[44,79],[82,89],[68,94],[96,31],[92,34],[25,0],[46,36],[38,84],[21,0],[0,80],[72,44],[56,97],[86,26],[94,57],[25,6],[81,13],[66,63],[57,5],[72,49],[46,86],[95,16],[95,37],[14,89],[44,22],[60,39],[37,47],[58,86],[89,96],[38,83],[51,91],[72,70],[14,82],[60,30],[58,39],[57,22],[95,70],[44,76],[5,68],[15,69],[33,61],[81,32],[21,68],[73,20],[22,72],[83,8],[15,54],[93,42],[68,95],[55,72],[33,92],[5,49],[17,96],[44,77],[24,53],[2,98],[33,81],[32,43],[20,16],[67,84],[98,35],[58,11],[72,5],[3,59],[78,79],[6,0],[26,71],[96,97],[18,92],[1,36],[78,0],[63,15],[20,43],[32,73],[37,76],[73,16],[76,23],[50,44],[68,2],[14,86],[69,65],[95,98],[53,64],[6,76],[7,11],[14,84],[62,50],[83,58],[78,92],[37,0],[13,55],[12,86],[11,59],[41,86],[27,26],[94,43],[20,78],[0,73],[58,90],[69,36],[62,34],[65,26],[32,85]"); assertEquals(false, solution1.validPath(100, edges, 20, 53)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1973Test.java b/src/test/java/com/fishercoder/secondthousand/_1973Test.java index 6f5bc6f18a..075bcd5b58 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1973Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1973Test.java @@ -1,15 +1,14 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.secondthousand._1973; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1973Test { private _1973.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1974Test.java b/src/test/java/com/fishercoder/secondthousand/_1974Test.java index ca8119715d..a02724bd2a 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1974Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1974Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1974; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1974Test { private _1974.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/secondthousand/_1981Test.java b/src/test/java/com/fishercoder/secondthousand/_1981Test.java index 1dd5975128..f1dbcdf763 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1981Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1981Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1981; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1981Test { private _1981.Solution1 solution1; @@ -17,17 +17,31 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.minimizeTheDifference(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,3],[4,5,6],[7,8,9]"), 13)); + assertEquals( + 0, + solution1.minimizeTheDifference( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,3],[4,5,6],[7,8,9]"), + 13)); } @Test public void test2() { - assertEquals(94, solution1.minimizeTheDifference(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1],[2],[3]"), 100)); + assertEquals( + 94, + solution1.minimizeTheDifference( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1],[2],[3]"), + 100)); } @Test public void test3() { - assertEquals(1, solution1.minimizeTheDifference(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,9,8,7]"), 6)); + assertEquals( + 1, + solution1.minimizeTheDifference( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,9,8,7]"), + 6)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1984Test.java b/src/test/java/com/fishercoder/secondthousand/_1984Test.java index d09eccde5a..7a8631275b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1984Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1984Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1984; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1984Test { private _1984.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.minimumDifference(new int[]{90}, 1)); + assertEquals(0, solution1.minimumDifference(new int[] {90}, 1)); } @Test public void test2() { - assertEquals(2, solution1.minimumDifference(new int[]{9,4,1,7}, 2)); + assertEquals(2, solution1.minimumDifference(new int[] {9, 4, 1, 7}, 2)); } - } diff --git a/src/test/java/com/fishercoder/secondthousand/_1985Test.java b/src/test/java/com/fishercoder/secondthousand/_1985Test.java index 3c7d65fa77..6df02ed866 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1985Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1985Test.java @@ -15,11 +15,13 @@ public void setup() { @org.junit.jupiter.api.Test public void test1() { - Assertions.assertEquals("3", solution1.kthLargestNumber(new String[]{"3", "6", "7", "10"}, 4)); + Assertions.assertEquals( + "3", solution1.kthLargestNumber(new String[] {"3", "6", "7", "10"}, 4)); } @Test public void test2() { - Assertions.assertEquals("2", solution1.kthLargestNumber(new String[]{"2", "21", "12", "1"}, 3)); + Assertions.assertEquals( + "2", solution1.kthLargestNumber(new String[] {"2", "21", "12", "1"}, 3)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1991Test.java b/src/test/java/com/fishercoder/secondthousand/_1991Test.java index 5380d7f420..43ffcb4802 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1991Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1991Test.java @@ -1,11 +1,11 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.secondthousand._1991; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _1991Test { private _1991.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.findMiddleIndex(new int[]{2, 3, -1, 8, 4})); + assertEquals(3, solution1.findMiddleIndex(new int[] {2, 3, -1, 8, 4})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1992Test.java b/src/test/java/com/fishercoder/secondthousand/_1992Test.java index 0e1dc53c65..5e553cd18b 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1992Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1992Test.java @@ -1,12 +1,12 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.secondthousand._1992; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _1992Test { private _1992.Solution1 solution1; @@ -17,38 +17,41 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[][]{{13, 1, 28, 1}, {22, 4, 24, 39}}, solution1.findFarmland(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("" - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//0 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//1 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//2 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//3 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//4 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//5 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//6 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//7 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//8 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//9 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//10 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//11 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//12 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//13 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//14 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//15 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//16 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//17 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//18 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//19 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//20 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//21 - + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"//22 - + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"//23 - + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"//24 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//25 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//26 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//27 - + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"//28 - + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]")));//29 + assertArrayEquals( + new int[][] {{13, 1, 28, 1}, {22, 4, 24, 39}}, + solution1.findFarmland( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "" + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 0 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 1 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 2 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 3 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 4 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 5 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 6 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 7 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 8 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 9 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 10 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 11 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 12 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 13 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 14 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 15 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 16 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 17 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 18 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 19 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 20 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 21 + + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," // 22 + + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," // 23 + + "[0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]," // 24 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 25 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 26 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 27 + + "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]," // 28 + + "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"))); // 29 // 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9 } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/secondthousand/_1993Test.java b/src/test/java/com/fishercoder/secondthousand/_1993Test.java index 13fcc02c4e..ebd408bd14 100644 --- a/src/test/java/com/fishercoder/secondthousand/_1993Test.java +++ b/src/test/java/com/fishercoder/secondthousand/_1993Test.java @@ -1,22 +1,21 @@ package com.fishercoder.secondthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.secondthousand._1993; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _1993Test { private _1993.Solution1.LockingTree lockingTree; @BeforeEach - public void setup() { - } + public void setup() {} @Test public void test1() { - lockingTree = new _1993.Solution1.LockingTree(new int[]{-1, 0, 0, 1, 1, 2, 2}); + lockingTree = new _1993.Solution1.LockingTree(new int[] {-1, 0, 0, 1, 1, 2, 2}); assertTrue(lockingTree.lock(2, 2)); assertFalse(lockingTree.unlock(2, 3)); assertTrue(lockingTree.unlock(2, 2)); @@ -27,7 +26,7 @@ public void test1() { @Test public void test2() { - lockingTree = new _1993.Solution1.LockingTree(new int[]{-1, 0, 3, 1, 0}); + lockingTree = new _1993.Solution1.LockingTree(new int[] {-1, 0, 3, 1, 0}); assertFalse(lockingTree.upgrade(4, 5)); assertFalse(lockingTree.upgrade(3, 8)); assertFalse(lockingTree.unlock(0, 7)); @@ -37,7 +36,7 @@ public void test2() { @Test public void test3() { - lockingTree = new _1993.Solution1.LockingTree(new int[]{-1, 4, 9, 0, 6, 1, 0, 6, 3, 1}); + lockingTree = new _1993.Solution1.LockingTree(new int[] {-1, 4, 9, 0, 6, 1, 0, 6, 3, 1}); assertFalse(lockingTree.upgrade(9, 43)); assertFalse(lockingTree.upgrade(4, 27)); assertFalse(lockingTree.upgrade(5, 34)); @@ -59,5 +58,4 @@ public void test3() { assertFalse(lockingTree.unlock(4, 42)); assertFalse(lockingTree.upgrade(5, 27)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2001Test.java b/src/test/java/com/fishercoder/thirdthousand/_2001Test.java index fac43ec882..f1dd229998 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2001Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2001Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2001; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2001Test { private _2001.Solution1 solution1; private _2001.Solution2 solution2; @@ -19,7 +19,15 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.interchangeableRectangles(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[4,8],[3,6],[10,20],[15,30]"))); - assertEquals(6, solution2.interchangeableRectangles(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[4,8],[3,6],[10,20],[15,30]"))); + assertEquals( + 6, + solution1.interchangeableRectangles( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[4,8],[3,6],[10,20],[15,30]"))); + assertEquals( + 6, + solution2.interchangeableRectangles( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[4,8],[3,6],[10,20],[15,30]"))); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2007Test.java b/src/test/java/com/fishercoder/thirdthousand/_2007Test.java index 0e129fdeb3..81187db592 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2007Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2007Test.java @@ -15,7 +15,6 @@ public void setup() { @Test public void test1() { - CommonUtils.printArray(solution1.findOriginalArray(new int[]{1, 3, 4, 2, 6, 8})); + CommonUtils.printArray(solution1.findOriginalArray(new int[] {1, 3, 4, 2, 6, 8})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2012Test.java b/src/test/java/com/fishercoder/thirdthousand/_2012Test.java index 121f62046e..b4ebcfab1d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2012Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2012Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2012; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2012Test { private _2012.Solution1 solution1; @@ -16,22 +16,21 @@ public void setup() { @Test public void test1() { - assertEquals(1, solution1.sumOfBeauties(new int[]{2, 4, 6, 4})); + assertEquals(1, solution1.sumOfBeauties(new int[] {2, 4, 6, 4})); } @Test public void test2() { - assertEquals(14, solution1.sumOfBeauties(new int[]{1, 2, 3, 4, 5, 7, 8, 9, 10})); + assertEquals(14, solution1.sumOfBeauties(new int[] {1, 2, 3, 4, 5, 7, 8, 9, 10})); } @Test public void test3() { - assertEquals(0, solution1.sumOfBeauties(new int[]{9, 9, 3, 8, 7, 9, 6, 10})); + assertEquals(0, solution1.sumOfBeauties(new int[] {9, 9, 3, 8, 7, 9, 6, 10})); } @Test public void test4() { - assertEquals(0, solution1.sumOfBeauties(new int[]{8, 4, 6, 3, 10, 5, 8, 5, 5, 9})); + assertEquals(0, solution1.sumOfBeauties(new int[] {8, 4, 6, 3, 10, 5, 8, 5, 5, 9})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2017Test.java b/src/test/java/com/fishercoder/thirdthousand/_2017Test.java index acac66b34a..acbaafdf89 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2017Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2017Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2017; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2017Test { private _2017.Solution1 solution1; private static int[][] grid; @@ -19,26 +18,33 @@ public void setup() { @Test public void test1() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,5,4],[1,5,1]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[2,5,4],[1,5,1]"); assertEquals(4, solution1.gridGame(grid)); } @Test public void test2() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[3,3,1],[8,5,2]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[3,3,1],[8,5,2]"); assertEquals(4, solution1.gridGame(grid)); } @Test public void test3() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3,1,15],[1,3,3,1]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3,1,15],[1,3,3,1]"); assertEquals(7, solution1.gridGame(grid)); } @Test public void test4() { - grid = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[20,3,20,17,2,12,15,17,4,15],[20,10,13,14,15,5,2,3,14,3]"); + grid = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[20,3,20,17,2,12,15,17,4,15],[20,10,13,14,15,5,2,3,14,3]"); assertEquals(63, solution1.gridGame(grid)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2018Test.java b/src/test/java/com/fishercoder/thirdthousand/_2018Test.java index b7ec4ccc7c..18df30c855 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2018Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2018Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2018; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2018Test { private _2018.Solution1 solution1; @@ -17,72 +17,102 @@ public void setup() { @Test public void test1() { - assertEquals(true, solution1.placeWordInCrossword(new char[][]{ - {'#', ' ', '#'}, - {' ', ' ', '#'}, - {'#', 'c', ' '} - }, "abc")); + assertEquals( + true, + solution1.placeWordInCrossword( + new char[][] { + {'#', ' ', '#'}, + {' ', ' ', '#'}, + {'#', 'c', ' '} + }, + "abc")); } @Test public void test2() { - assertEquals(false, solution1.placeWordInCrossword(new char[][]{ - {' ', '#', 'a'}, - {' ', '#', 'c'}, - {' ', '#', 'a'} - }, "ac")); + assertEquals( + false, + solution1.placeWordInCrossword( + new char[][] { + {' ', '#', 'a'}, + {' ', '#', 'c'}, + {' ', '#', 'a'} + }, + "ac")); } @Test public void test3() { - assertEquals(true, solution1.placeWordInCrossword(new char[][]{ - {'#', ' ', '#'}, - {' ', ' ', '#'}, - {'#', ' ', 'c'} - }, "ca")); + assertEquals( + true, + solution1.placeWordInCrossword( + new char[][] { + {'#', ' ', '#'}, + {' ', ' ', '#'}, + {'#', ' ', 'c'} + }, + "ca")); } @Test public void test4() { - assertEquals(true, solution1.placeWordInCrossword(new char[][]{ - {'#', ' ', '#'}, - {' ', ' ', '#'}, - {'#', ' ', 'c'} - }, "cd")); + assertEquals( + true, + solution1.placeWordInCrossword( + new char[][] { + {'#', ' ', '#'}, + {' ', ' ', '#'}, + {'#', ' ', 'c'} + }, + "cd")); } @Test public void test5() { - assertEquals(true, solution1.placeWordInCrossword(new char[][]{ - {'#', ' ', '#'}, - {' ', '#', '#'}, - {'#', ' ', 'c'} - }, "ca")); + assertEquals( + true, + solution1.placeWordInCrossword( + new char[][] { + {'#', ' ', '#'}, + {' ', '#', '#'}, + {'#', ' ', 'c'} + }, + "ca")); } @Test public void test6() { - assertEquals(true, solution1.placeWordInCrossword(new char[][]{ - {'#', ' ', '#'}, - {'#', 'c', '#'}, - {'#', '#', 'c'} - }, "ca")); + assertEquals( + true, + solution1.placeWordInCrossword( + new char[][] { + {'#', ' ', '#'}, + {'#', 'c', '#'}, + {'#', '#', 'c'} + }, + "ca")); } @Test public void test7() { - assertEquals(false, solution1.placeWordInCrossword(new char[][]{ - {' ', 'b', '#'}, - {' ', '#', '#'}, - {' ', ' ', 'c'} - }, "ca")); + assertEquals( + false, + solution1.placeWordInCrossword( + new char[][] { + {' ', 'b', '#'}, + {' ', '#', '#'}, + {' ', ' ', 'c'} + }, + "ca")); } @Test public void test8() { - assertEquals(true, solution1.placeWordInCrossword( - CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray("[\"#\",\" \",\"#\"],[\" \",\" \",\"#\"],[\"#\",\"c\",\" \"]"), - "abc")); + assertEquals( + true, + solution1.placeWordInCrossword( + CommonUtils.convertLeetCodeRegular2DCharArrayInputIntoJavaArray( + "[\"#\",\" \",\"#\"],[\" \",\" \",\"#\"],[\"#\",\"c\",\" \"]"), + "abc")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2024Test.java b/src/test/java/com/fishercoder/thirdthousand/_2024Test.java index 04efb319a9..00b5ba760d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2024Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2024Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2024; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2024Test { private _2024.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(8, solution1.maxConsecutiveAnswers("FFFTTFTTFT", 3)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2028Test.java b/src/test/java/com/fishercoder/thirdthousand/_2028Test.java index 2f88eee190..1730477b5b 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2028Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2028Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2028; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2028Test { private _2028.Solution1 solution1; @@ -16,7 +16,14 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{}, solution1.missingRolls(new int[]{4, 2, 2, 5, 4, 5, 4, 5, 3, 3, 6, 1, 2, 4, 2, 1, 6, 5, 4, 2, 3, 4, 2, 3, 3, 5, 4, 1, 4, 4, 5, 3, 6, 1, 5, 2, 3, 3, 6, 1, 6, 4, 1, 3}, 2, 53)); + assertArrayEquals( + new int[] {}, + solution1.missingRolls( + new int[] { + 4, 2, 2, 5, 4, 5, 4, 5, 3, 3, 6, 1, 2, 4, 2, 1, 6, 5, 4, 2, 3, 4, 2, 3, + 3, 5, 4, 1, 4, 4, 5, 3, 6, 1, 5, 2, 3, 3, 6, 1, 6, 4, 1, 3 + }, + 2, + 53)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2038Test.java b/src/test/java/com/fishercoder/thirdthousand/_2038Test.java index 70a28cc0a7..19b2c87d80 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2038Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2038Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2038; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2038Test { private _2038.Solution1 solution1; private static String color; @@ -20,5 +20,4 @@ public void test1() { color = "AAABABB"; assertEquals(true, solution1.winnerOfGame(color)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2039Test.java b/src/test/java/com/fishercoder/thirdthousand/_2039Test.java index 31bdc9389d..3e70a9069f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2039Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2039Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2039; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2039Test { private _2039.Solution1 solution1; private static int[][] edges; @@ -20,37 +20,39 @@ public void setup() { @Test public void test1() { edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2]"); - patience = new int[]{0, 2, 1}; + patience = new int[] {0, 2, 1}; assertEquals(8, solution1.networkBecomesIdle(edges, patience)); } @Test public void test2() { - edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[0,2],[1,2]"); - patience = new int[]{0, 10, 10}; + edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1],[0,2],[1,2]"); + patience = new int[] {0, 10, 10}; assertEquals(3, solution1.networkBecomesIdle(edges, patience)); } @Test public void test3() { - edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( - "[3,8],[4,13],[0,7],[0,4],[1,8],[14,1],[7,2],[13,10],[9,11],[12,14],[0,6],[2,12],[11,5],[6,9],[10,3]"); - patience = new int[]{0, 3, 2, 1, 5, 1, 5, 5, 3, 1, 2, 2, 2, 2, 1}; + edges = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[3,8],[4,13],[0,7],[0,4],[1,8],[14,1],[7,2],[13,10],[9,11],[12,14],[0,6],[2,12],[11,5],[6,9],[10,3]"); + patience = new int[] {0, 3, 2, 1, 5, 1, 5, 5, 3, 1, 2, 2, 2, 2, 1}; assertEquals(20, solution1.networkBecomesIdle(edges, patience)); } @Test public void test4() { edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2]"); - patience = new int[]{0, 2, 2}; + patience = new int[] {0, 2, 2}; assertEquals(7, solution1.networkBecomesIdle(edges, patience)); } @Test public void test5() { edges = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2]"); - patience = new int[]{0, 2, 3}; + patience = new int[] {0, 2, 3}; assertEquals(8, solution1.networkBecomesIdle(edges, patience)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2049Test.java b/src/test/java/com/fishercoder/thirdthousand/_2049Test.java index 46ea5638e2..5b54505362 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2049Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2049Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2049; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2049Test { private _2049.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(3, solution1.countHighestScoreNodes(new int[]{-1, 2, 0, 2, 0})); + assertEquals(3, solution1.countHighestScoreNodes(new int[] {-1, 2, 0, 2, 0})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2050Test.java b/src/test/java/com/fishercoder/thirdthousand/_2050Test.java index 38cedc22a2..c0366a439f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2050Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2050Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2050; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2050Test { private _2050.Solution1 solution1; private static int[][] relation; @@ -22,8 +22,9 @@ public void setup() { @Test public void test1() { n = 3; - relation = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3],[2,3]"); - time = new int[]{3, 2, 5}; + relation = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3],[2,3]"); + time = new int[] {3, 2, 5}; expected = 8; assertEquals(expected, solution1.minimumTime(n, relation, time)); } @@ -31,11 +32,11 @@ public void test1() { @Test public void test2() { n = 5; - relation = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,5],[2,5],[3,5],[3,4],[4,5]"); - time = new int[]{1, 2, 3, 4, 5}; + relation = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,5],[2,5],[3,5],[3,4],[4,5]"); + time = new int[] {1, 2, 3, 4, 5}; expected = 12; assertEquals(expected, solution1.minimumTime(n, relation, time)); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2054Test.java b/src/test/java/com/fishercoder/thirdthousand/_2054Test.java index 2868729fdb..637018e129 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2054Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2054Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2054; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2054Test { private _2054.Solution1 solution1; private static int[][] events; @@ -20,24 +19,28 @@ public void setup() { @Test public void test1() { - events = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3,2],[4,5,2],[2,4,3]"); + events = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3,2],[4,5,2],[2,4,3]"); expected = 4; assertEquals(expected, solution1.maxTwoEvents(events)); } @Test public void test2() { - events = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,3,2],[4,5,2],[1,5,5]"); + events = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,3,2],[4,5,2],[1,5,5]"); expected = 5; assertEquals(expected, solution1.maxTwoEvents(events)); } @Test public void test3() { - events = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,5,3],[1,5,1],[6,6,5]"); + events = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,5,3],[1,5,1],[6,6,5]"); expected = 8; assertEquals(expected, solution1.maxTwoEvents(events)); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2063Test.java b/src/test/java/com/fishercoder/thirdthousand/_2063Test.java index 75be62873f..110b060c3a 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2063Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2063Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2063; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2063Test { private _2063.Solution1 solution1; private static String word; @@ -22,5 +22,4 @@ public void test1() { expected = 6L; assertEquals(expected, solution1.countVowels(word)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2070Test.java b/src/test/java/com/fishercoder/thirdthousand/_2070Test.java index 6a8f1f701b..1b6a8d3465 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2070Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2070Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2070; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2070Test { private _2070.Solution1 solution1; private static int[][] items; @@ -20,26 +20,29 @@ public void setup() { @Test public void test1() { - items = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[3,2],[2,4],[5,6],[3,5]"); - queries = new int[]{1, 2, 3, 4, 5, 6}; - expected = new int[]{2, 4, 5, 5, 6, 6}; + items = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[3,2],[2,4],[5,6],[3,5]"); + queries = new int[] {1, 2, 3, 4, 5, 6}; + expected = new int[] {2, 4, 5, 5, 6, 6}; assertArrayEquals(expected, solution1.maximumBeauty(items, queries)); } @Test public void test2() { - items = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[1,2],[1,3],[1,4]"); - queries = new int[]{1}; - expected = new int[]{4}; + items = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2],[1,2],[1,3],[1,4]"); + queries = new int[] {1}; + expected = new int[] {4}; assertArrayEquals(expected, solution1.maximumBeauty(items, queries)); } @Test public void test3() { items = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[10,1000]"); - queries = new int[]{5}; - expected = new int[]{0}; + queries = new int[] {5}; + expected = new int[] {0}; assertArrayEquals(expected, solution1.maximumBeauty(items, queries)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2075Test.java b/src/test/java/com/fishercoder/thirdthousand/_2075Test.java index c5bc147610..dbcf37769f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2075Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2075Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2075; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2075Test { private _2075.Solution1 solution1; private static String encodedText; @@ -48,5 +48,4 @@ public void test4() { expected = " abc"; assertEquals(expected, solution1.decodeCiphertext(encodedText, rows)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2076Test.java b/src/test/java/com/fishercoder/thirdthousand/_2076Test.java index d6e469e98b..b8f74e2972 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2076Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2076Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2076; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2076Test { private _2076.Solution1 solution1; private static int[][] restrictions; @@ -21,64 +21,86 @@ public void setup() { @Test public void test1() { - restrictions = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1]"); - requests = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,2],[2,1]"); - expected = new boolean[]{true, false}; + restrictions = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1]"); + requests = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,2],[2,1]"); + expected = new boolean[] {true, false}; n = 3; assertArrayEquals(expected, solution1.friendRequests(n, restrictions, requests)); } @Test public void test2() { - restrictions = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1]"); - requests = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[0,2]"); - expected = new boolean[]{true, false}; + restrictions = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1]"); + requests = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2],[0,2]"); + expected = new boolean[] {true, false}; n = 3; assertArrayEquals(expected, solution1.friendRequests(n, restrictions, requests)); } @Test public void test3() { - restrictions = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,1],[1,2],[2,3]"); - requests = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,4],[1,2],[3,1],[3,4]"); - expected = new boolean[]{true, false, true, false}; + restrictions = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,1],[1,2],[2,3]"); + requests = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,4],[1,2],[3,1],[3,4]"); + expected = new boolean[] {true, false, true, false}; n = 5; assertArrayEquals(expected, solution1.friendRequests(n, restrictions, requests)); } @Test public void test4() { - restrictions = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,6],[6,2]"); - requests = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,2],[2,3],[0,2],[6,4],[6,4]"); - expected = new boolean[]{true, true, true, true, true}; + restrictions = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[0,6],[6,2]"); + requests = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[0,2],[2,3],[0,2],[6,4],[6,4]"); + expected = new boolean[] {true, true, true, true, true}; n = 7; assertArrayEquals(expected, solution1.friendRequests(n, restrictions, requests)); } @Test public void test5() { - restrictions = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[14,2],[1,8],[4,5],[16,6],[10,8],[10,3],[17,14],[13,2],[5,1],[0,4]," - + "[8,12],[6,5],[7,9],[12,16],[17,16],[15,11],[5,7],[9,16],[14,7],[7,8],[2,7],[3,5],[9,13],[10,13],[2,3],[2,17],[12,3],[9,10],[15,4],[11,13]," - + "[13,7],[7,1],[13,6],[10,11],[10,17],[11,2],[7,17],[0,10],[15,1],[9,3],[1,11],[11,0],[7,6],[8,0],[6,15],[0,13],[9,15],[5,11],[6,12],[17,15]," - + "[2,12],[15,0],[4,7],[16,5],[9,5],[4,3],[12,5],[1,2],[13,5],[10,7],[12,15],[11,17],[12,0],[9,14],[17,12],[4,6],[13,15],[4,10],[11,7]," - + "[8,5],[5,17],[8,3],[15,7],[13,12],[9,0],[17,3],[11,8],[8,16],[2,16],[4,12],[3,1],[8,14],[15,3],[14,11],[6,0],[12,7],[0,2],[0,7]," - + "[5,14],[8,2],[13,17],[17,8],[4,13],[1,0],[7,16],[5,2],[9,11],[12,9],[16,3],[5,15],[2,15],[3,6],[17,9],[4,16],[4,2]"); - requests = CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[12,0],[4,7],[9,0],[4,5],[4,6],[0,16],[2,15],[1,2],[12,15]," - + "[16,6],[13,3],[2,12],[12,15],[9,15],[2,16],[1,8],[12,5],[2,16],[14,13],[9,13],[3,1],[13,16],[8,13],[9,16],[5,2],[4,14]," - + "[9,10],[6,5],[5,7],[12,3],[8,2],[12,0],[0,17],[12,16],[9,15],[4,3],[11,7],[4,13],[4,6],[10,13],[14,12],[15,0],[9,6]," - + "[4,10],[7,8],[4,3],[10,17],[4,10],[1,2],[11,12],[6,5],[5,2],[9,10],[14,7],[17,15],[2,17],[11,0],[14,0],[14,11]," - + "[15,7],[13,6],[4,14],[0,4],[17,3],[11,17],[8,12],[6,11],[3,11],[17,15],[17,16],[4,5],[12,7],[0,17],[15,11],[0,4]," - + "[10,16],[15,7],[14,12],[1,6],[11,13],[10,13],[0,5],[1,0],[10,11],[2,17],[1,11],[13,2],[0,5],[12,7],[17,14],[12,9]," - + "[0,17],[15,10],[5,2],[16,6],[0,13],[17,6],[1,11],[13,17],[11,8],[0,16],[13,17],[6,11],[0,7],[13,12],[11,16],[8,13]," - + "[17,6],[8,13],[9,8],[9,0],[17,16],[4,13]"); - expected = new boolean[]{false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, - false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, - true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, - false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, - true, false, false, false, false, false, false, false, false, false, false, false, false}; + restrictions = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[14,2],[1,8],[4,5],[16,6],[10,8],[10,3],[17,14],[13,2],[5,1],[0,4]," + + "[8,12],[6,5],[7,9],[12,16],[17,16],[15,11],[5,7],[9,16],[14,7],[7,8],[2,7],[3,5],[9,13],[10,13],[2,3],[2,17],[12,3],[9,10],[15,4],[11,13]," + + "[13,7],[7,1],[13,6],[10,11],[10,17],[11,2],[7,17],[0,10],[15,1],[9,3],[1,11],[11,0],[7,6],[8,0],[6,15],[0,13],[9,15],[5,11],[6,12],[17,15]," + + "[2,12],[15,0],[4,7],[16,5],[9,5],[4,3],[12,5],[1,2],[13,5],[10,7],[12,15],[11,17],[12,0],[9,14],[17,12],[4,6],[13,15],[4,10],[11,7]," + + "[8,5],[5,17],[8,3],[15,7],[13,12],[9,0],[17,3],[11,8],[8,16],[2,16],[4,12],[3,1],[8,14],[15,3],[14,11],[6,0],[12,7],[0,2],[0,7]," + + "[5,14],[8,2],[13,17],[17,8],[4,13],[1,0],[7,16],[5,2],[9,11],[12,9],[16,3],[5,15],[2,15],[3,6],[17,9],[4,16],[4,2]"); + requests = + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[12,0],[4,7],[9,0],[4,5],[4,6],[0,16],[2,15],[1,2],[12,15]," + + "[16,6],[13,3],[2,12],[12,15],[9,15],[2,16],[1,8],[12,5],[2,16],[14,13],[9,13],[3,1],[13,16],[8,13],[9,16],[5,2],[4,14]," + + "[9,10],[6,5],[5,7],[12,3],[8,2],[12,0],[0,17],[12,16],[9,15],[4,3],[11,7],[4,13],[4,6],[10,13],[14,12],[15,0],[9,6]," + + "[4,10],[7,8],[4,3],[10,17],[4,10],[1,2],[11,12],[6,5],[5,2],[9,10],[14,7],[17,15],[2,17],[11,0],[14,0],[14,11]," + + "[15,7],[13,6],[4,14],[0,4],[17,3],[11,17],[8,12],[6,11],[3,11],[17,15],[17,16],[4,5],[12,7],[0,17],[15,11],[0,4]," + + "[10,16],[15,7],[14,12],[1,6],[11,13],[10,13],[0,5],[1,0],[10,11],[2,17],[1,11],[13,2],[0,5],[12,7],[17,14],[12,9]," + + "[0,17],[15,10],[5,2],[16,6],[0,13],[17,6],[1,11],[13,17],[11,8],[0,16],[13,17],[6,11],[0,7],[13,12],[11,16],[8,13]," + + "[17,6],[8,13],[9,8],[9,0],[17,16],[4,13]"); + expected = + new boolean[] { + false, false, false, false, false, true, false, false, false, false, true, + false, false, false, false, false, false, false, true, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, true, false, + false, false, false, false, false, true, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, + false, true, false, false, false, false, false, false, false, false, false, + false, false, false, false, true, false, false, false, false, false, false, + false, true, false, false, false, false, false, false, false, false, false, + false, false, false + }; n = 18; assertArrayEquals(expected, solution1.friendRequests(n, restrictions, requests)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2080Test.java b/src/test/java/com/fishercoder/thirdthousand/_2080Test.java index 012ff948e4..91922268b0 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2080Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2080Test.java @@ -1,34 +1,38 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2080; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2080Test { private _2080.Solution1.RangeFreqQuery rangeFreqQuery1; private _2080.Solution2.RangeFreqQuery rangeFreqQuery2; @Test public void test1() { - rangeFreqQuery1 = new _2080.Solution1.RangeFreqQuery(new int[]{12, 33, 4, 56, 22, 2, 34, 33, 22, 12, 34, 56}); + rangeFreqQuery1 = + new _2080.Solution1.RangeFreqQuery( + new int[] {12, 33, 4, 56, 22, 2, 34, 33, 22, 12, 34, 56}); assertEquals(1, rangeFreqQuery1.query(1, 2, 4)); assertEquals(2, rangeFreqQuery1.query(0, 11, 33)); - rangeFreqQuery2 = new _2080.Solution2.RangeFreqQuery(new int[]{12, 33, 4, 56, 22, 2, 34, 33, 22, 12, 34, 56}); + rangeFreqQuery2 = + new _2080.Solution2.RangeFreqQuery( + new int[] {12, 33, 4, 56, 22, 2, 34, 33, 22, 12, 34, 56}); assertEquals(1, rangeFreqQuery2.query(1, 2, 4)); assertEquals(2, rangeFreqQuery2.query(0, 11, 33)); } @Test public void test2() { - rangeFreqQuery1 = new _2080.Solution1.RangeFreqQuery(new int[]{1, 1, 1, 2, 2}); + rangeFreqQuery1 = new _2080.Solution1.RangeFreqQuery(new int[] {1, 1, 1, 2, 2}); assertEquals(0, rangeFreqQuery1.query(0, 1, 2)); assertEquals(3, rangeFreqQuery1.query(0, 2, 1)); assertEquals(1, rangeFreqQuery1.query(3, 3, 2)); assertEquals(1, rangeFreqQuery1.query(2, 2, 1)); - rangeFreqQuery2 = new _2080.Solution2.RangeFreqQuery(new int[]{1, 1, 1, 2, 2}); + rangeFreqQuery2 = new _2080.Solution2.RangeFreqQuery(new int[] {1, 1, 1, 2, 2}); assertEquals(0, rangeFreqQuery2.query(0, 1, 2)); assertEquals(3, rangeFreqQuery2.query(0, 2, 1)); assertEquals(1, rangeFreqQuery2.query(3, 3, 2)); @@ -37,19 +41,20 @@ public void test2() { @Test public void test3() { - rangeFreqQuery1 = new _2080.Solution1.RangeFreqQuery(new int[]{3, 4, 5, 3, 3, 2, 2, 2, 5, 4}); + rangeFreqQuery1 = + new _2080.Solution1.RangeFreqQuery(new int[] {3, 4, 5, 3, 3, 2, 2, 2, 5, 4}); assertEquals(2, rangeFreqQuery1.query(2, 6, 3)); assertEquals(0, rangeFreqQuery1.query(5, 6, 5)); assertEquals(2, rangeFreqQuery1.query(1, 6, 2)); assertEquals(1, rangeFreqQuery1.query(0, 2, 3)); assertEquals(0, rangeFreqQuery1.query(5, 6, 4)); - rangeFreqQuery2 = new _2080.Solution2.RangeFreqQuery(new int[]{3, 4, 5, 3, 3, 2, 2, 2, 5, 4}); + rangeFreqQuery2 = + new _2080.Solution2.RangeFreqQuery(new int[] {3, 4, 5, 3, 3, 2, 2, 2, 5, 4}); assertEquals(2, rangeFreqQuery2.query(2, 6, 3)); assertEquals(0, rangeFreqQuery2.query(5, 6, 5)); assertEquals(2, rangeFreqQuery2.query(1, 6, 2)); assertEquals(1, rangeFreqQuery2.query(0, 2, 3)); assertEquals(0, rangeFreqQuery2.query(5, 6, 4)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2096Test.java b/src/test/java/com/fishercoder/thirdthousand/_2096Test.java index 86ceaf9e4c..77483dd305 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2096Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2096Test.java @@ -1,15 +1,14 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.thirdthousand._2096; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2096Test { private _2096.Solution1 solution1; @@ -41,9 +40,11 @@ public void test3() { @Test public void test4() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(5, 8, 3, 1, null, 4, 7, 6, null, null, null, null, null, null, 2)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 5, 8, 3, 1, null, 4, 7, 6, null, null, null, null, null, null, 2)); TreeUtils.printBinaryTree(root); assertEquals("U", solution1.getDirections(root, 4, 3)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2103Test.java b/src/test/java/com/fishercoder/thirdthousand/_2103Test.java index 3fe9f65cfd..6c920e68bc 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2103Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2103Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2103; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2103Test { private _2103.Solution1 solution1; private static int expected; @@ -20,5 +20,4 @@ public void test1() { expected = 1; assertEquals(expected, solution1.countPoints("B0B6G0R6R0R6G9")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2115Test.java b/src/test/java/com/fishercoder/thirdthousand/_2115Test.java index 66f85e77da..fb418e7938 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2115Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2115Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2115; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2115Test { private _2115.Solution1 solution1; @@ -18,18 +17,22 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("bread"), - solution1.findAllRecipes(new String[]{"bread"}, + assertEquals( + Arrays.asList("bread"), + solution1.findAllRecipes( + new String[] {"bread"}, Arrays.asList(Arrays.asList("yeast", "flour")), - new String[]{"yeast", "flour", "corn"})); + new String[] {"yeast", "flour", "corn"})); } @Test public void test2() { - assertEquals(Arrays.asList("bread", "sandwich"), - solution1.findAllRecipes(new String[]{"bread", "sandwich"}, - Arrays.asList(Arrays.asList("yeast", "flour"), Arrays.asList("bread", "meat")), - new String[]{"yeast", "flour", "corn"})); + assertEquals( + Arrays.asList("bread", "sandwich"), + solution1.findAllRecipes( + new String[] {"bread", "sandwich"}, + Arrays.asList( + Arrays.asList("yeast", "flour"), Arrays.asList("bread", "meat")), + new String[] {"yeast", "flour", "corn"})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2116Test.java b/src/test/java/com/fishercoder/thirdthousand/_2116Test.java index 20c0af1029..91be3c8e0c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2116Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2116Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2116; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2116Test { private _2116.Solution1 solution1; @@ -36,7 +36,10 @@ public void test4() { @Test public void test5() { - assertEquals(false, solution1.canBeValid("())(()(()(())()())(())((())(()())((())))))(((((((())(()))))(", "100011110110011011010111100111011101111110000101001101001111")); + assertEquals( + false, + solution1.canBeValid( + "())(()(()(())()())(())((())(()())((())))))(((((((())(()))))(", + "100011110110011011010111100111011101111110000101001101001111")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2126Test.java b/src/test/java/com/fishercoder/thirdthousand/_2126Test.java index b1359096cf..736c22cd27 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2126Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2126Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2126; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2126Test { private _2126.Solution1 solution1; private static int[] asteroids; @@ -19,7 +19,7 @@ public void setup() { @Test public void test1() { - asteroids = new int[]{3, 9, 19, 5, 21}; + asteroids = new int[] {3, 9, 19, 5, 21}; mass = 10; expected = true; assertEquals(expected, solution1.asteroidsDestroyed(mass, asteroids)); @@ -27,7 +27,7 @@ public void test1() { @Test public void test2() { - asteroids = new int[]{4, 9, 23, 4}; + asteroids = new int[] {4, 9, 23, 4}; mass = 5; expected = false; assertEquals(expected, solution1.asteroidsDestroyed(mass, asteroids)); @@ -35,10 +35,9 @@ public void test2() { @Test public void test3() { - asteroids = new int[]{156, 197, 192, 14, 97, 160, 14, 5}; + asteroids = new int[] {156, 197, 192, 14, 97, 160, 14, 5}; mass = 86; expected = true; assertEquals(expected, solution1.asteroidsDestroyed(mass, asteroids)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2134Test.java b/src/test/java/com/fishercoder/thirdthousand/_2134Test.java index 0545410c1a..97c7abc85e 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2134Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2134Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2134; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2134Test { private _2134.Solution1 solution1; private static int[] nums; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - nums = new int[]{0, 1, 0, 1, 1, 0, 0}; + nums = new int[] {0, 1, 0, 1, 1, 0, 0}; assertEquals(1, solution1.minSwaps(nums)); } @Test public void test2() { - nums = new int[]{0, 1, 1, 1, 0, 0, 1, 1, 0}; + nums = new int[] {0, 1, 1, 1, 0, 0, 1, 1, 0}; assertEquals(2, solution1.minSwaps(nums)); } @Test public void test3() { - nums = new int[]{1, 1, 0, 0, 1}; + nums = new int[] {1, 1, 0, 0, 1}; assertEquals(0, solution1.minSwaps(nums)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2135Test.java b/src/test/java/com/fishercoder/thirdthousand/_2135Test.java index 441016e2e0..52d220ad87 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2135Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2135Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2135; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2135Test { private _2135.Solution1 solution1; @@ -16,16 +16,29 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.wordCount(new String[]{"ant", "act", "tack"}, new String[]{"tack", "act", "acti"})); + assertEquals( + 2, + solution1.wordCount( + new String[] {"ant", "act", "tack"}, new String[] {"tack", "act", "acti"})); } @Test public void test2() { - assertEquals(1, solution1.wordCount(new String[]{"mox", "bj", "rsy", "jqsh"}, new String[]{"trk", "vjb", "jkr"})); + assertEquals( + 1, + solution1.wordCount( + new String[] {"mox", "bj", "rsy", "jqsh"}, + new String[] {"trk", "vjb", "jkr"})); } @Test public void test3() { - assertEquals(1, solution1.wordCount(new String[]{"uh"}, new String[]{"u", "hur", "k", "b", "u", "yse", "giqoy", "lni", "olqb", "nemc"})); + assertEquals( + 1, + solution1.wordCount( + new String[] {"uh"}, + new String[] { + "u", "hur", "k", "b", "u", "yse", "giqoy", "lni", "olqb", "nemc" + })); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2144Test.java b/src/test/java/com/fishercoder/thirdthousand/_2144Test.java index 266cdbea55..94119c4848 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2144Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2144Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2144; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2144Test { private _2144.Solution1 solution1; private static int[] cost; @@ -19,22 +19,21 @@ public void setup() { @Test public void test1() { expected = 5; - cost = new int[]{1, 2, 3}; + cost = new int[] {1, 2, 3}; assertEquals(expected, solution1.minimumCost(cost)); } @Test public void test2() { expected = 23; - cost = new int[]{6, 5, 7, 9, 2, 2}; + cost = new int[] {6, 5, 7, 9, 2, 2}; assertEquals(expected, solution1.minimumCost(cost)); } @Test public void test3() { expected = 10; - cost = new int[]{5, 5}; + cost = new int[] {5, 5}; assertEquals(expected, solution1.minimumCost(cost)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2156Test.java b/src/test/java/com/fishercoder/thirdthousand/_2156Test.java index 3f185dc483..98760fa272 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2156Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2156Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2156; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2156Test { private _2156.Solution1 solution1; private static String s; @@ -54,5 +54,4 @@ public void test3() { System.out.println(Math.pow(power, k - 1) % modulo); assertEquals(expected, solution1.subStrHash(s, power, modulo, k, hashValue)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2190Test.java b/src/test/java/com/fishercoder/thirdthousand/_2190Test.java index 0650bad0e7..5c1c6a3ccc 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2190Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2190Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2190; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2190Test { private _2190.Solution1 solution1; private static int[] nums; @@ -18,9 +18,8 @@ public void setup() { @Test public void test1() { - nums = new int[]{2, 2, 2, 2, 3}; + nums = new int[] {2, 2, 2, 2, 3}; key = 2; assertEquals(2, solution1.mostFrequent(nums, key)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2191Test.java b/src/test/java/com/fishercoder/thirdthousand/_2191Test.java index 85f58cfaa9..4454acfcf0 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2191Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2191Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2191; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2191Test { private _2191.Solution1 solution1; @@ -16,13 +16,17 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{338, 38, 991}, solution1.sortJumbled(new int[]{8, 9, 4, 0, 2, 1, 3, 5, 7, 6}, new int[]{991, 338, 38})); + assertArrayEquals( + new int[] {338, 38, 991}, + solution1.sortJumbled( + new int[] {8, 9, 4, 0, 2, 1, 3, 5, 7, 6}, new int[] {991, 338, 38})); } @Test public void test2() { - assertArrayEquals(new int[]{0, 999999999}, solution1.sortJumbled( - new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - new int[]{0, 999999999})); + assertArrayEquals( + new int[] {0, 999999999}, + solution1.sortJumbled( + new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, new int[] {0, 999999999})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2192Test.java b/src/test/java/com/fishercoder/thirdthousand/_2192Test.java index 675718ea3b..e7756bb44c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2192Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2192Test.java @@ -1,14 +1,13 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2192; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2192Test { private _2192.Solution1 solution1; @@ -19,18 +18,19 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList( - Arrays.asList(), - Arrays.asList(), - Arrays.asList(), - Arrays.asList(0, 1), - Arrays.asList(0, 2), - Arrays.asList(0, 1, 3), - Arrays.asList(0, 1, 2, 3, 4), - Arrays.asList(0, 1, 2, 3) - ), solution1.getAncestors(8, - CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( - "[0,3],[0,4],[1,3],[2,4],[2,7],[3,5],[3,6],[3,7],[4,6]"))); + assertEquals( + Arrays.asList( + Arrays.asList(), + Arrays.asList(), + Arrays.asList(), + Arrays.asList(0, 1), + Arrays.asList(0, 2), + Arrays.asList(0, 1, 3), + Arrays.asList(0, 1, 2, 3, 4), + Arrays.asList(0, 1, 2, 3)), + solution1.getAncestors( + 8, + CommonUtils.convertLeetCodeRegularRectangleArrayInputIntoJavaArray( + "[0,3],[0,4],[1,3],[2,4],[2,7],[3,5],[3,6],[3,7],[4,6]"))); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2196Test.java b/src/test/java/com/fishercoder/thirdthousand/_2196Test.java index 9c440aef78..f19c264b1c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2196Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2196Test.java @@ -1,15 +1,14 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.thirdthousand._2196; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2196Test { private _2196.Solution1 solution1; @@ -22,11 +21,12 @@ public void setup() { public void test1() { TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(50, 20, 80, 15, 17, 19)); TreeUtils.printBinaryTree(expected); - TreeNode actual = solution1.createBinaryTree(new int[][]{ - {20, 15, 1}, {20, 17, 0}, {50, 20, 1}, {50, 80, 0}, {80, 19, 1} - }); + TreeNode actual = + solution1.createBinaryTree( + new int[][] { + {20, 15, 1}, {20, 17, 0}, {50, 20, 1}, {50, 80, 0}, {80, 19, 1} + }); TreeUtils.printBinaryTree(actual); assertEquals(expected, actual); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2220Test.java b/src/test/java/com/fishercoder/thirdthousand/_2220Test.java index 55c901f6af..95cbbd2ebd 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2220Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2220Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2220; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2220Test { private _2220.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(3, solution1.minBitFlips(10, 7)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2224Test.java b/src/test/java/com/fishercoder/thirdthousand/_2224Test.java index 296aafc18a..c1f1d336cd 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2224Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2224Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2224; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2224Test { private _2224.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(1, solution1.convertTime("11:00", "11:01")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2231Test.java b/src/test/java/com/fishercoder/thirdthousand/_2231Test.java index 8bbe2eb49b..6bdfb15fdf 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2231Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2231Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2231; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2231Test { private _2231.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2265Test.java b/src/test/java/com/fishercoder/thirdthousand/_2265Test.java index 3b1e55d759..f13f123895 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2265Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2265Test.java @@ -1,15 +1,14 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.thirdthousand._2265; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2265Test { private _2265.Solution1 solution1; private static TreeNode root; @@ -25,5 +24,4 @@ public void test1() { TreeUtils.printBinaryTree(root); assertEquals(5, solution1.averageOfSubtree(root)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2273Test.java b/src/test/java/com/fishercoder/thirdthousand/_2273Test.java index 7bc3fc1062..57847bb345 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2273Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2273Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2273; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2273Test { private _2273.Solution1 solution1; @@ -18,7 +17,8 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("abba", "cd"), solution1.removeAnagrams(new String[]{"abba", "baba", "bbaa", "cd", "cd"})); + assertEquals( + Arrays.asList("abba", "cd"), + solution1.removeAnagrams(new String[] {"abba", "baba", "bbaa", "cd", "cd"})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2284Test.java b/src/test/java/com/fishercoder/thirdthousand/_2284Test.java index 50ba9ebf87..dc9143a5ad 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2284Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2284Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2284; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2284Test { private _2284.Solution1 solution1; private static String[] messages; @@ -18,23 +18,191 @@ public void setup() { @Test public void test1() { - messages = new String[]{"Hello userTwooo", "Hi userThree", "Wonderful day Alice", "Nice day userThree"}; - senders = new String[]{"Alice", "userTwo", "userThree", "Alice"}; + messages = + new String[] { + "Hello userTwooo", "Hi userThree", "Wonderful day Alice", "Nice day userThree" + }; + senders = new String[] {"Alice", "userTwo", "userThree", "Alice"}; assertEquals("Alice", solution1.largestWordCount(messages, senders)); } @Test public void test2() { - messages = new String[]{"How is leetcode for everyone", "Leetcode is useful for practice"}; - senders = new String[]{"Bob", "Charlie"}; + messages = new String[] {"How is leetcode for everyone", "Leetcode is useful for practice"}; + senders = new String[] {"Bob", "Charlie"}; assertEquals("Charlie", solution1.largestWordCount(messages, senders)); } @Test public void test3() { - messages = new String[]{"Ux i E XMm", "G Mo f q Qa q", "v qZ J m R", "z pt T yG W xq Xq G", "GS F Ug", "QDv", "I iY k pd M", "aOi", "f xV xa", "c Zu Fa ofO", "x c E R H", "pw sfU", "i aE G Aqw", "Yu S di sV sx mc AlB", "D lx g cF k", "U fw rh Ne", "I aN o Sv aE s", "ZF c Jo IA", "Y S f Ld D M fbb", "OI Mn e Q A gT", "xV f Li v h vy I S", "Q gI G vj Qd c y r W", "Q R BK VI", "K Am NZ", "wk CT", "p sQ b Se l BI We fv", "x WF fW l n px WY rz", "S rW mh", "a T og TA b Gg h", "t v WO", "Ai bO mY", "e AMh", "t nfH", "q F G ch N", "sf W iH yx M Pf YjA", "uE D", "hA F q NX", "Fm", "lI C Vl Em md d L", "az kz i bx g v dD", "Fq UR qf hh", "C r Nq u Ve i", "x tT BR Bj d a yu G", "Nm M DM h Wu", "IZ y Lo ZN Yv", "l Kh ia Rt", "VR cg C fM mL MH", "a P e Gb", "Xq UO", "U qM", "h bM mn e a", "WD w VT Tf dK G YPE", "cT T wc O VLT", "e q K e Ao V kw", "Ie dt JB a C y O rq", "ih Wu", "QP T G Zl Yx Q pSz", "Rs", "xA y D e e g", "Gik", "D o Y wyD", "mG z N a j fz P", "U q W", "Ei xr Zf", "wT X EI vz BI", "nj Fr g J P qH h gZa", "e wB XX s", "wL Md wt", "RE yd U rY J qx", "DO Q a U N", "p F gh fv", "xn LT vg rZ pF z xrf", "k", "DD r sh B", "Z Eg iJ Hq r VX h", "Xy N k Hd Lk ea", "teU", "n kp U k KZ aw", "UG uO ax S y", "q D SD", "r ns E Wv XR wv tP g"}; - senders = new String[]{"K", "kFIbpoFxn", "yErgn", "N", "wtJesr", "rusffeL", "KlpoodEd", "qGcQqIVdFr", "ztmCdK", "HFILjKln", "rusffeL", "TmmQZ", "R", "CNh", "YMQDBkOWy", "kjiSc", "cGMsZxxx", "YMQDBkOWy", "PPqsmNBewN", "gbtn", "nQNcL", "rK", "ppr", "LhSVp", "Ub", "QGRFMLY", "YMQDBkOWy", "Ub", "PPqsmNBewN", "SdDObYkD", "q", "suAakSCuHz", "QGRFMLY", "dnzhjdwrEt", "ubIEXAO", "EsBuLal", "kFIbpoFxn", "yErgn", "ubIEXAO", "TmmQZ", "TmmQZ", "xlQqQRrdTv", "mWxCG", "TmmQZ", "DmwIEmS", "gbtn", "nBQLLS", "QhF", "Ub", "ppr", "bmtYQKYv", "ppr", "EsBuLal", "PRiNk", "rusffeL", "ztmCdK", "PPqsmNBewN", "rK", "xlQqQRrdTv", "QGRFMLY", "EsBuLal", "QyYJw", "QIFauTN", "dnzhjdwrEt", "zJLcUq", "ubIEXAO", "HFILjKln", "ppr", "wtJesr", "ztmCdK", "suAakSCuHz", "zJLcUq", "TU", "HFILjKln", "lCkGjDY", "A", "zJLcUq", "SdDObYkD", "YMQDBkOWy", "R", "LhSVp"}; + messages = + new String[] { + "Ux i E XMm", + "G Mo f q Qa q", + "v qZ J m R", + "z pt T yG W xq Xq G", + "GS F Ug", + "QDv", + "I iY k pd M", + "aOi", + "f xV xa", + "c Zu Fa ofO", + "x c E R H", + "pw sfU", + "i aE G Aqw", + "Yu S di sV sx mc AlB", + "D lx g cF k", + "U fw rh Ne", + "I aN o Sv aE s", + "ZF c Jo IA", + "Y S f Ld D M fbb", + "OI Mn e Q A gT", + "xV f Li v h vy I S", + "Q gI G vj Qd c y r W", + "Q R BK VI", + "K Am NZ", + "wk CT", + "p sQ b Se l BI We fv", + "x WF fW l n px WY rz", + "S rW mh", + "a T og TA b Gg h", + "t v WO", + "Ai bO mY", + "e AMh", + "t nfH", + "q F G ch N", + "sf W iH yx M Pf YjA", + "uE D", + "hA F q NX", + "Fm", + "lI C Vl Em md d L", + "az kz i bx g v dD", + "Fq UR qf hh", + "C r Nq u Ve i", + "x tT BR Bj d a yu G", + "Nm M DM h Wu", + "IZ y Lo ZN Yv", + "l Kh ia Rt", + "VR cg C fM mL MH", + "a P e Gb", + "Xq UO", + "U qM", + "h bM mn e a", + "WD w VT Tf dK G YPE", + "cT T wc O VLT", + "e q K e Ao V kw", + "Ie dt JB a C y O rq", + "ih Wu", + "QP T G Zl Yx Q pSz", + "Rs", + "xA y D e e g", + "Gik", + "D o Y wyD", + "mG z N a j fz P", + "U q W", + "Ei xr Zf", + "wT X EI vz BI", + "nj Fr g J P qH h gZa", + "e wB XX s", + "wL Md wt", + "RE yd U rY J qx", + "DO Q a U N", + "p F gh fv", + "xn LT vg rZ pF z xrf", + "k", + "DD r sh B", + "Z Eg iJ Hq r VX h", + "Xy N k Hd Lk ea", + "teU", + "n kp U k KZ aw", + "UG uO ax S y", + "q D SD", + "r ns E Wv XR wv tP g" + }; + senders = + new String[] { + "K", + "kFIbpoFxn", + "yErgn", + "N", + "wtJesr", + "rusffeL", + "KlpoodEd", + "qGcQqIVdFr", + "ztmCdK", + "HFILjKln", + "rusffeL", + "TmmQZ", + "R", + "CNh", + "YMQDBkOWy", + "kjiSc", + "cGMsZxxx", + "YMQDBkOWy", + "PPqsmNBewN", + "gbtn", + "nQNcL", + "rK", + "ppr", + "LhSVp", + "Ub", + "QGRFMLY", + "YMQDBkOWy", + "Ub", + "PPqsmNBewN", + "SdDObYkD", + "q", + "suAakSCuHz", + "QGRFMLY", + "dnzhjdwrEt", + "ubIEXAO", + "EsBuLal", + "kFIbpoFxn", + "yErgn", + "ubIEXAO", + "TmmQZ", + "TmmQZ", + "xlQqQRrdTv", + "mWxCG", + "TmmQZ", + "DmwIEmS", + "gbtn", + "nBQLLS", + "QhF", + "Ub", + "ppr", + "bmtYQKYv", + "ppr", + "EsBuLal", + "PRiNk", + "rusffeL", + "ztmCdK", + "PPqsmNBewN", + "rK", + "xlQqQRrdTv", + "QGRFMLY", + "EsBuLal", + "QyYJw", + "QIFauTN", + "dnzhjdwrEt", + "zJLcUq", + "ubIEXAO", + "HFILjKln", + "ppr", + "wtJesr", + "ztmCdK", + "suAakSCuHz", + "zJLcUq", + "TU", + "HFILjKln", + "lCkGjDY", + "A", + "zJLcUq", + "SdDObYkD", + "YMQDBkOWy", + "R", + "LhSVp" + }; assertEquals("ubIEXAO", solution1.largestWordCount(messages, senders)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2293Test.java b/src/test/java/com/fishercoder/thirdthousand/_2293Test.java index 6a7940e9a6..e75a37356c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2293Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2293Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2293; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2293Test { private _2293.Solution1 solution1; private static int expected; @@ -20,8 +20,7 @@ public void setup() { @Test public void test1() { expected = 22; - nums = new int[]{70, 38, 21, 22}; + nums = new int[] {70, 38, 21, 22}; assertEquals(expected, solution1.minMaxGame(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2300Test.java b/src/test/java/com/fishercoder/thirdthousand/_2300Test.java index eb1aea5e0b..6b72e3591d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2300Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2300Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2300; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2300Test { private _2300.Solution1 solution1; @@ -16,17 +16,23 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{4, 0, 3}, solution1.successfulPairs(new int[]{5, 1, 3}, new int[]{1, 2, 3, 4, 5}, 7)); + assertArrayEquals( + new int[] {4, 0, 3}, + solution1.successfulPairs(new int[] {5, 1, 3}, new int[] {1, 2, 3, 4, 5}, 7)); } @Test public void test2() { - assertArrayEquals(new int[]{2, 0, 2}, solution1.successfulPairs(new int[]{3, 1, 2}, new int[]{8, 5, 8}, 16)); + assertArrayEquals( + new int[] {2, 0, 2}, + solution1.successfulPairs(new int[] {3, 1, 2}, new int[] {8, 5, 8}, 16)); } @Test public void test3() { - assertArrayEquals(new int[]{0, 0, 0, 1, 3, 3, 4}, solution1.successfulPairs(new int[]{1, 2, 3, 4, 5, 6, 7}, new int[]{1, 2, 3, 4, 5, 6, 7}, 25)); + assertArrayEquals( + new int[] {0, 0, 0, 1, 3, 3, 4}, + solution1.successfulPairs( + new int[] {1, 2, 3, 4, 5, 6, 7}, new int[] {1, 2, 3, 4, 5, 6, 7}, 25)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2309Test.java b/src/test/java/com/fishercoder/thirdthousand/_2309Test.java index bab8368410..90d42b4d83 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2309Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2309Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2309; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2309Test { private _2309.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals("R", solution1.greatestLetter("arRAzFif")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2315Test.java b/src/test/java/com/fishercoder/thirdthousand/_2315Test.java index 28c257d24b..7494165156 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2315Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2315Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2315; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2315Test { private _2315.Solution1 solution1; private static String s; @@ -20,5 +20,4 @@ public void test1() { s = "l|*e*et|c**o|*de|"; assertEquals(2, solution1.countAsterisks(s)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2316Test.java b/src/test/java/com/fishercoder/thirdthousand/_2316Test.java index 42ad5032bd..74b7c4abf4 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2316Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2316Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2316; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2316Test { private _2316.Solution1 solution1; @@ -16,12 +16,12 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.countPairs(3, new int[][]{{0, 1}, {0, 2}, {1, 2}})); + assertEquals(0, solution1.countPairs(3, new int[][] {{0, 1}, {0, 2}, {1, 2}})); } @Test public void test2() { - assertEquals(14, solution1.countPairs(7, new int[][]{{0, 2}, {0, 5}, {2, 4}, {1, 6}, {5, 4}})); + assertEquals( + 14, solution1.countPairs(7, new int[][] {{0, 2}, {0, 5}, {2, 4}, {1, 6}, {5, 4}})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2335Test.java b/src/test/java/com/fishercoder/thirdthousand/_2335Test.java index c5ee1eec76..23cfea0731 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2335Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2335Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2335; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2335Test { private _2335.Solution1 solution1; private static int[] amount; @@ -17,14 +17,13 @@ public void setup() { @Test public void test1() { - amount = new int[]{5, 4, 4}; + amount = new int[] {5, 4, 4}; assertEquals(7, solution1.fillCups(amount)); } @Test public void test2() { - amount = new int[]{0, 0, 0}; + amount = new int[] {0, 0, 0}; assertEquals(0, solution1.fillCups(amount)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2357Test.java b/src/test/java/com/fishercoder/thirdthousand/_2357Test.java index 5980a14134..dea8b9577f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2357Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2357Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2357; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2357Test { private _2357.Solution1 solution1; private static int[] nums; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - nums = new int[]{1, 5, 0, 3, 5}; + nums = new int[] {1, 5, 0, 3, 5}; assertEquals(3, solution1.minimumOperations(nums)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2373Test.java b/src/test/java/com/fishercoder/thirdthousand/_2373Test.java index bda074b75a..e4c4002e05 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2373Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2373Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2373; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2373Test { private _2373.Solution1 solution1; @@ -19,16 +19,18 @@ public void setup() { @Test public void test1() { - grid = new int[][]{ - {9, 9, 8, 1}, - {5, 6, 2, 6}, - {8, 2, 6, 4}, - {6, 2, 2, 2} - }; - expected = new int[][]{ - {9, 9}, - {8, 6} - }; + grid = + new int[][] { + {9, 9, 8, 1}, + {5, 6, 2, 6}, + {8, 2, 6, 4}, + {6, 2, 2, 2} + }; + expected = + new int[][] { + {9, 9}, + {8, 6} + }; assertArrayEquals(expected, solution1.largestLocal(grid)); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2385Test.java b/src/test/java/com/fishercoder/thirdthousand/_2385Test.java index de3e3c8eea..8871a74a88 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2385Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2385Test.java @@ -1,14 +1,13 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.thirdthousand._2385; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2385Test { private _2385.Solution1 solution1; @@ -19,12 +18,16 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.amountOfTime(TreeUtils.constructBinaryTree(Arrays.asList(1, 5, 3, null, 4, 10, 6, 9, 2)), 3)); + assertEquals( + 4, + solution1.amountOfTime( + TreeUtils.constructBinaryTree(Arrays.asList(1, 5, 3, null, 4, 10, 6, 9, 2)), + 3)); } @Test public void test2() { - assertEquals(1, solution1.amountOfTime(TreeUtils.constructBinaryTree(Arrays.asList(2, 5)), 5)); + assertEquals( + 1, solution1.amountOfTime(TreeUtils.constructBinaryTree(Arrays.asList(2, 5)), 5)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2389Test.java b/src/test/java/com/fishercoder/thirdthousand/_2389Test.java index f1051026b5..7d0606db8d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2389Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2389Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2389; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2389Test { private _2389.Solution1 solution1; @@ -16,6 +16,8 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{2, 3, 4}, solution1.answerQueries(new int[]{4, 5, 2, 1}, new int[]{3, 10, 21})); + assertArrayEquals( + new int[] {2, 3, 4}, + solution1.answerQueries(new int[] {4, 5, 2, 1}, new int[] {3, 10, 21})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2392Test.java b/src/test/java/com/fishercoder/thirdthousand/_2392Test.java index d6113f908e..281318e254 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2392Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2392Test.java @@ -15,14 +15,8 @@ public void setup() { @Test public void test1() { - CommonUtils.print2DIntArray(solution1.buildMatrix( - 3, - new int[][]{ - {1, 2}, {3, 2} - }, - new int[][]{ - {2, 1}, {3, 2} - })); + CommonUtils.print2DIntArray( + solution1.buildMatrix( + 3, new int[][] {{1, 2}, {3, 2}}, new int[][] {{2, 1}, {3, 2}})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2409Test.java b/src/test/java/com/fishercoder/thirdthousand/_2409Test.java index 975acdc159..373822078f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2409Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2409Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2409; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2409Test { private _2409.Solution1 solution1; @@ -38,5 +38,4 @@ public void test4() { public void test5() { assertEquals(27, solution1.countDaysTogether("08-06", "12-08", "02-04", "09-01")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2423Test.java b/src/test/java/com/fishercoder/thirdthousand/_2423Test.java index 612dec6488..42166fc7ea 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2423Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2423Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.thirdthousand._2423; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _2423Test { private _2423.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2433Test.java b/src/test/java/com/fishercoder/thirdthousand/_2433Test.java index b570d05419..3af647a895 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2433Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2433Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2433; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2433Test { private _2433.Solution1 solution1; private static int[] pref; @@ -17,8 +17,7 @@ public void setup() { @Test public void test1() { - pref = new int[]{5, 2, 0, 3, 1}; - assertArrayEquals(new int[]{5, 7, 2, 3, 2}, solution1.findArray(pref)); + pref = new int[] {5, 2, 0, 3, 1}; + assertArrayEquals(new int[] {5, 7, 2, 3, 2}, solution1.findArray(pref)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2437Test.java b/src/test/java/com/fishercoder/thirdthousand/_2437Test.java index e8acabceb9..43c6d2bdbc 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2437Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2437Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2437; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2437Test { private _2437.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2441Test.java b/src/test/java/com/fishercoder/thirdthousand/_2441Test.java index 2163a285d1..78f76e4e76 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2441Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2441Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2441; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2441Test { private _2441.Solution1 solution1; @@ -16,6 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(7, solution1.findMaxK(new int[]{-1, 10, 6, 7, -7, 1})); + assertEquals(7, solution1.findMaxK(new int[] {-1, 10, 6, 7, -7, 1})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2446Test.java b/src/test/java/com/fishercoder/thirdthousand/_2446Test.java index 9bee378124..13cd344692 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2446Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2446Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.thirdthousand._2446; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _2446Test { private _2446.Solution1 solution1; @@ -16,7 +16,8 @@ public void setup() { @Test public void test1() { - assertTrue(solution1.haveConflict(new String[]{"01:15", "02:00"}, new String[]{"02:00", "03:00"})); + assertTrue( + solution1.haveConflict( + new String[] {"01:15", "02:00"}, new String[] {"02:00", "03:00"})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2451Test.java b/src/test/java/com/fishercoder/thirdthousand/_2451Test.java index 63b46fab5a..b037889edf 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2451Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2451Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2451; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2451Test { private _2451.Solution1 solution1; @@ -16,17 +16,47 @@ public void setup() { @Test public void test1() { - assertEquals("abc", solution1.oddString(new String[]{"adc", "wzy", "abc"})); + assertEquals("abc", solution1.oddString(new String[] {"adc", "wzy", "abc"})); } @Test public void test2() { - assertEquals("aaaabbbbbbaaabaaaabb", solution1.oddString(new String[]{"nnnmmmnnmmmmmmmmmmnm", "iiihhhiihhhhhhhhhhih", "aaaabbbbbbaaabaaaabb", "qqqpppqqppppppppppqp", "eeedddeedddddddddded", "eeedddeedddddddddded", "iiihhhiihhhhhhhhhhih", "lllkkkllkkkkkkkkkklk", "sssrrrssrrrrrrrrrrsr", "sssrrrssrrrrrrrrrrsr", "jjjiiijjiiiiiiiiiiji", "nnnmmmnnmmmmmmmmmmnm", "xxxwwwxxwwwwwwwwwwxw", "eeedddeedddddddddded", "zzzyyyzzyyyyyyyyyyzy", "wwwvvvwwvvvvvvvvvvwv", "cccbbbccbbbbbbbbbbcb", "xxxwwwxxwwwwwwwwwwxw", "cccbbbccbbbbbbbbbbcb", "yyyxxxyyxxxxxxxxxxyx", "hhhggghhgggggggggghg"})); + assertEquals( + "aaaabbbbbbaaabaaaabb", + solution1.oddString( + new String[] { + "nnnmmmnnmmmmmmmmmmnm", + "iiihhhiihhhhhhhhhhih", + "aaaabbbbbbaaabaaaabb", + "qqqpppqqppppppppppqp", + "eeedddeedddddddddded", + "eeedddeedddddddddded", + "iiihhhiihhhhhhhhhhih", + "lllkkkllkkkkkkkkkklk", + "sssrrrssrrrrrrrrrrsr", + "sssrrrssrrrrrrrrrrsr", + "jjjiiijjiiiiiiiiiiji", + "nnnmmmnnmmmmmmmmmmnm", + "xxxwwwxxwwwwwwwwwwxw", + "eeedddeedddddddddded", + "zzzyyyzzyyyyyyyyyyzy", + "wwwvvvwwvvvvvvvvvvwv", + "cccbbbccbbbbbbbbbbcb", + "xxxwwwxxwwwwwwwwwwxw", + "cccbbbccbbbbbbbbbbcb", + "yyyxxxyyxxxxxxxxxxyx", + "hhhggghhgggggggggghg" + })); } @Test public void test3() { - assertEquals("abb", solution1.oddString(new String[]{"mll", "abb", "edd", "jii", "tss", "fee", "dcc", "nmm", "utt", "zyy", "xww", "tss", "wvv", "xww", "utt"})); + assertEquals( + "abb", + solution1.oddString( + new String[] { + "mll", "abb", "edd", "jii", "tss", "fee", "dcc", "nmm", "utt", "zyy", + "xww", "tss", "wvv", "xww", "utt" + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2460Test.java b/src/test/java/com/fishercoder/thirdthousand/_2460Test.java index a5c2347af7..6e36d15713 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2460Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2460Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2460; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2460Test { private _2460.Solution1 solution1; @@ -16,12 +16,13 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{1, 4, 2, 0, 0, 0}, solution1.applyOperations(new int[]{1, 2, 2, 1, 1, 0})); + assertArrayEquals( + new int[] {1, 4, 2, 0, 0, 0}, + solution1.applyOperations(new int[] {1, 2, 2, 1, 1, 0})); } @Test public void test2() { - assertArrayEquals(new int[]{1, 0}, solution1.applyOperations(new int[]{0, 1})); + assertArrayEquals(new int[] {1, 0}, solution1.applyOperations(new int[] {0, 1})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2473Test.java b/src/test/java/com/fishercoder/thirdthousand/_2473Test.java index 5087b90c8e..c37eb5c6ea 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2473Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2473Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2473; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2473Test { private _2473.Solution1 solution1; @@ -17,16 +17,25 @@ public void setup() { @Test public void test1() { - long[] actual = solution1.minCost(4, - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,4],[2,3,2],[2,4,5],[3,4,1],[1,3,4]"), - new int[]{56, 42, 102, 301}, 2); - assertArrayEquals(new long[]{54, 42, 48, 51}, actual); + long[] actual = + solution1.minCost( + 4, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,4],[2,3,2],[2,4,5],[3,4,1],[1,3,4]"), + new int[] {56, 42, 102, 301}, + 2); + assertArrayEquals(new long[] {54, 42, 48, 51}, actual); } @Test public void test2() { - assertArrayEquals(new long[]{49117, 67662, 34318, 89780, 2747, 39709, 38302, 21966}, solution1.minCost(8, - CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[8,3,193],[4,1,890],[8,2,714],[7,2,654],[6,1,147]"), - new int[]{87310, 86029, 37141, 89780, 2747, 39709, 38302, 21966}, 63)); + assertArrayEquals( + new long[] {49117, 67662, 34318, 89780, 2747, 39709, 38302, 21966}, + solution1.minCost( + 8, + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[8,3,193],[4,1,890],[8,2,714],[7,2,654],[6,1,147]"), + new int[] {87310, 86029, 37141, 89780, 2747, 39709, 38302, 21966}, + 63)); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2485Test.java b/src/test/java/com/fishercoder/thirdthousand/_2485Test.java index f2831a19f6..0de5a17b8c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2485Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2485Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2485; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2485Test { private _2485.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2487Test.java b/src/test/java/com/fishercoder/thirdthousand/_2487Test.java index b6cf141e49..697396918d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2487Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2487Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.LinkedListUtils; import com.fishercoder.solutions.thirdthousand._2487; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2487Test { private _2487.Solution1 solution1; @@ -17,14 +17,38 @@ public void setup() { @Test public void test1() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{13, 8}), solution1.removeNodes(LinkedListUtils.contructLinkedList(new int[]{5, 2, 13, 3, 8}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {13, 8}), + solution1.removeNodes( + LinkedListUtils.contructLinkedList(new int[] {5, 2, 13, 3, 8}))); } @Test public void test2() { - assertEquals(LinkedListUtils.contructLinkedList(new int[]{998, 961, 943, 920, 698}), - solution1.removeNodes(LinkedListUtils.contructLinkedList( - new int[]{138, 466, 216, 67, 642, 978, 264, 136, 463, 331, 60, 600, 223, 275, 856, 809, 167, 101, 846, 165, 575, 276, 409, 590, 733, 200, 839, 515, 852, 615, 8, 584, 250, 337, 537, 63, 797, 900, 670, 636, 112, 701, 334, 422, 780, 552, 912, 506, 313, 474, 183, 792, 822, 661, 37, 164, 601, 271, 902, 792, 501, 184, 559, 140, 506, 94, 161, 167, 622, 288, 457, 953, 700, 464, 785, 203, 729, 725, 422, 76, 191, 195, 157, 854, 730, 577, 503, 401, 517, 692, 42, 135, 823, 883, 255, 111, 334, 365, 513, 338, 65, 600, 926, 607, 193, 763, 366, 674, 145, 229, 700, 11, 984, 36, 185, 475, 204, 604, 191, 898, 876, 762, 654, 770, 774, 575, 276, 165, 610, 649, 235, 749, 440, 607, 962, 747, 891, 943, 839, 403, 655, 22, 705, 416, 904, 765, 905, 574, 214, 471, 451, 774, 41, 365, 703, 895, 327, 879, 414, 821, 363, 30, 130, 14, 754, 41, 494, 548, 76, 825, 899, 499, 188, 982, 8, 890, 563, 438, 363, 32, 482, 623, 864, 161, 962, 678, 414, 659, 612, 332, 164, 580, 14, 633, 842, 969, 792, 777, 705, 436, 750, 501, 395, 342, 838, 493, 998, 112, 660, 961, 943, 721, 480, 522, 133, 129, 276, 362, 616, 52, 117, 300, 274, 862, 487, 715, 272, 232, 543, 275, 68, 144, 656, 623, 317, 63, 908, 565, 880, 12, 920, 467, 559, 91, 698}))); + assertEquals( + LinkedListUtils.contructLinkedList(new int[] {998, 961, 943, 920, 698}), + solution1.removeNodes( + LinkedListUtils.contructLinkedList( + new int[] { + 138, 466, 216, 67, 642, 978, 264, 136, 463, 331, 60, 600, 223, + 275, 856, 809, 167, 101, 846, 165, 575, 276, 409, 590, 733, 200, + 839, 515, 852, 615, 8, 584, 250, 337, 537, 63, 797, 900, 670, + 636, 112, 701, 334, 422, 780, 552, 912, 506, 313, 474, 183, 792, + 822, 661, 37, 164, 601, 271, 902, 792, 501, 184, 559, 140, 506, + 94, 161, 167, 622, 288, 457, 953, 700, 464, 785, 203, 729, 725, + 422, 76, 191, 195, 157, 854, 730, 577, 503, 401, 517, 692, 42, + 135, 823, 883, 255, 111, 334, 365, 513, 338, 65, 600, 926, 607, + 193, 763, 366, 674, 145, 229, 700, 11, 984, 36, 185, 475, 204, + 604, 191, 898, 876, 762, 654, 770, 774, 575, 276, 165, 610, 649, + 235, 749, 440, 607, 962, 747, 891, 943, 839, 403, 655, 22, 705, + 416, 904, 765, 905, 574, 214, 471, 451, 774, 41, 365, 703, 895, + 327, 879, 414, 821, 363, 30, 130, 14, 754, 41, 494, 548, 76, + 825, 899, 499, 188, 982, 8, 890, 563, 438, 363, 32, 482, 623, + 864, 161, 962, 678, 414, 659, 612, 332, 164, 580, 14, 633, 842, + 969, 792, 777, 705, 436, 750, 501, 395, 342, 838, 493, 998, 112, + 660, 961, 943, 721, 480, 522, 133, 129, 276, 362, 616, 52, 117, + 300, 274, 862, 487, 715, 272, 232, 543, 275, 68, 144, 656, 623, + 317, 63, 908, 565, 880, 12, 920, 467, 559, 91, 698 + }))); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2492Test.java b/src/test/java/com/fishercoder/thirdthousand/_2492Test.java index 311c3d9ef3..96c14c0c22 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2492Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2492Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2492; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2492Test { private _2492.Solution1 solution1; @@ -16,12 +16,27 @@ public void setup() { @Test public void test1() { - assertEquals(5, solution1.minScore(4, new int[][]{{1, 2, 9}, {2, 3, 6}, {2, 4, 5}, {1, 4, 7}})); + assertEquals( + 5, solution1.minScore(4, new int[][] {{1, 2, 9}, {2, 3, 6}, {2, 4, 5}, {1, 4, 7}})); } @Test public void test2() { - assertEquals(1885, solution1.minScore(6, new int[][]{{4, 5, 7468}, {6, 2, 7173}, {6, 3, 8365}, {2, 3, 7674}, {5, 6, 7852}, {1, 2, 8547}, {2, 4, 1885}, {2, 5, 5192}, {1, 3, 4065}, {1, 4, 7357}})); + assertEquals( + 1885, + solution1.minScore( + 6, + new int[][] { + {4, 5, 7468}, + {6, 2, 7173}, + {6, 3, 8365}, + {2, 3, 7674}, + {5, 6, 7852}, + {1, 2, 8547}, + {2, 4, 1885}, + {2, 5, 5192}, + {1, 3, 4065}, + {1, 4, 7357} + })); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2500Test.java b/src/test/java/com/fishercoder/thirdthousand/_2500Test.java index e1741ab0b8..b8d5865f79 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2500Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2500Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2500; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2500Test { private _2500.Solution1 solution1; @@ -17,8 +17,10 @@ public void setup() { @Test public void test1() { - assertEquals(8, solution1.deleteGreatestValue(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,4],[3,3,1]"))); + assertEquals( + 8, + solution1.deleteGreatestValue( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,4],[3,3,1]"))); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2511Test.java b/src/test/java/com/fishercoder/thirdthousand/_2511Test.java index 7f0452d797..e2ecc3f0f5 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2511Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2511Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2511; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2511Test { private _2511.Solution1 solution1; @@ -16,6 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.captureForts(new int[]{1, 0, 0, -1, 0, 0, 0, 0, 1})); + assertEquals(4, solution1.captureForts(new int[] {1, 0, 0, -1, 0, 0, 0, 0, 1})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2515Test.java b/src/test/java/com/fishercoder/thirdthousand/_2515Test.java index bc60231538..cf8e826575 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2515Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2515Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2515; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2515Test { private _2515.Solution1 solution1; private static String[] words; @@ -17,20 +17,19 @@ public void setup() { @Test public void test1() { - words = new String[]{"hello", "i", "am", "leetcode", "hello"}; + words = new String[] {"hello", "i", "am", "leetcode", "hello"}; assertEquals(1, solution1.closetTarget(words, "hello", 1)); } @Test public void test2() { - words = new String[]{"a", "b", "leetcode"}; + words = new String[] {"a", "b", "leetcode"}; assertEquals(1, solution1.closetTarget(words, "leetcode", 0)); } @Test public void test3() { - words = new String[]{"i", "eat", "leetcode"}; + words = new String[] {"i", "eat", "leetcode"}; assertEquals(-1, solution1.closetTarget(words, "ate", 0)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2525Test.java b/src/test/java/com/fishercoder/thirdthousand/_2525Test.java index 096b0e9b62..486c227127 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2525Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2525Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2525; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2525Test { private _2525.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("Both", solution1.categorizeBox(2909, 3968, 3272, 727)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2544Test.java b/src/test/java/com/fishercoder/thirdthousand/_2544Test.java index 7f893b8313..0aaf3475b4 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2544Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2544Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2544; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2544Test { private _2544.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(1, solution1.alternateDigitSum(10)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2566Test.java b/src/test/java/com/fishercoder/thirdthousand/_2566Test.java index 8c40d3f820..3a55bd2836 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2566Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2566Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2566; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2566Test { private _2566.Solution1 solution1; @@ -28,5 +28,4 @@ public void test2() { public void test3() { assertEquals(99, solution1.minMaxDifference(90)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2574Test.java b/src/test/java/com/fishercoder/thirdthousand/_2574Test.java index d4ec3c168c..5c5f32337d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2574Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2574Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2574; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2574Test { private _2574.Solution1 solution1; @@ -16,7 +16,7 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{15, 1, 11, 22}, solution1.leftRightDifference(new int[]{10, 4, 8, 3})); + assertArrayEquals( + new int[] {15, 1, 11, 22}, solution1.leftRightDifference(new int[] {10, 4, 8, 3})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2578Test.java b/src/test/java/com/fishercoder/thirdthousand/_2578Test.java index b45c2ec407..e63afb9f5f 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2578Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2578Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2578; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2578Test { private _2578.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(59, solution1.splitNum(4325)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2591Test.java b/src/test/java/com/fishercoder/thirdthousand/_2591Test.java index 96f4d09c36..a5e97bf79d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2591Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2591Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2591; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2591Test { private _2591.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2600Test.java b/src/test/java/com/fishercoder/thirdthousand/_2600Test.java index 4b8b1f7624..3721066458 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2600Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2600Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2600; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2600Test { private _2600.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(3, solution1.kItemsWithMaximumSum(4, 2, 3, 7)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2609Test.java b/src/test/java/com/fishercoder/thirdthousand/_2609Test.java index d657704d0d..6bbfddd3b0 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2609Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2609Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2609; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2609Test { private _2609.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(2, solution1.findTheLongestBalancedSubstring("001")); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2641Test.java b/src/test/java/com/fishercoder/thirdthousand/_2641Test.java index eb62b652be..e1d03407ac 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2641Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2641Test.java @@ -1,15 +1,14 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.common.classes.TreeNode; import com.fishercoder.common.utils.TreeUtils; import com.fishercoder.solutions.thirdthousand._2641; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2641Test { private _2641.Solution1 solution1; @@ -31,9 +30,17 @@ public void test1() { @Test public void test2() { - TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(49, 40, 35, 42, 7, null, null, 50, null, null, 44, null, null, null, 27, 21)); + TreeNode root = + TreeUtils.constructBinaryTree( + Arrays.asList( + 49, 40, 35, 42, 7, null, null, 50, null, null, 44, null, null, null, + 27, 21)); TreeUtils.printBinaryTree(root); - TreeNode expected = TreeUtils.constructBinaryTree(Arrays.asList(0, 0, 0, 0, 0, null, null, 44, null, null, 50, null, null, null, 0, 0)); + TreeNode expected = + TreeUtils.constructBinaryTree( + Arrays.asList( + 0, 0, 0, 0, 0, null, null, 44, null, null, 50, null, null, null, 0, + 0)); TreeUtils.printBinaryTree(expected); TreeNode actual = solution1.replaceValueInTree(root); TreeUtils.printBinaryTree(actual); diff --git a/src/test/java/com/fishercoder/thirdthousand/_2644Test.java b/src/test/java/com/fishercoder/thirdthousand/_2644Test.java index a2bfd1d8a2..5a63634d43 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2644Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2644Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2644; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2644Test { private _2644.Solution1 solution1; @@ -16,8 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.maxDivScore(new int[]{2, 9, 15, 50}, new int[]{5, 3, 7, 2})); + assertEquals(2, solution1.maxDivScore(new int[] {2, 9, 15, 50}, new int[] {5, 3, 7, 2})); } - - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2670Test.java b/src/test/java/com/fishercoder/thirdthousand/_2670Test.java index 485f188461..b49d115896 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2670Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2670Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2670; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2670Test { private _2670.Solution1 solution1; @@ -16,7 +16,8 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{-2, -1, 0, 2, 3}, solution1.distinctDifferenceArray(new int[]{3, 2, 3, 4, 2})); + assertArrayEquals( + new int[] {-2, -1, 0, 2, 3}, + solution1.distinctDifferenceArray(new int[] {3, 2, 3, 4, 2})); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2673Test.java b/src/test/java/com/fishercoder/thirdthousand/_2673Test.java index ce9787922c..ed5139e451 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2673Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2673Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2673; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2673Test { private _2673.Solution1 solution1; @@ -16,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.minIncrements(7, new int[]{1, 5, 2, 2, 3, 3, 1})); + assertEquals(6, solution1.minIncrements(7, new int[] {1, 5, 2, 2, 3, 3, 1})); } @Test public void test2() { - assertEquals(0, solution1.minIncrements(3, new int[]{5, 3, 3})); + assertEquals(0, solution1.minIncrements(3, new int[] {5, 3, 3})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2682Test.java b/src/test/java/com/fishercoder/thirdthousand/_2682Test.java index ede5c35aa5..7c6dc30e5d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2682Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2682Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + import com.fishercoder.solutions.thirdthousand._2682; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - public class _2682Test { private _2682.Solution1 solution1; @@ -16,26 +16,26 @@ public void setup() { @Test public void test1() { - assertArrayEquals(new int[]{4, 5}, solution1.circularGameLosers(5, 2)); + assertArrayEquals(new int[] {4, 5}, solution1.circularGameLosers(5, 2)); } @Test public void test2() { - assertArrayEquals(new int[]{}, solution1.circularGameLosers(2, 1)); + assertArrayEquals(new int[] {}, solution1.circularGameLosers(2, 1)); } @Test public void test3() { - assertArrayEquals(new int[]{3}, solution1.circularGameLosers(3, 1)); + assertArrayEquals(new int[] {3}, solution1.circularGameLosers(3, 1)); } @Test public void test4() { - assertArrayEquals(new int[]{2}, solution1.circularGameLosers(3, 2)); + assertArrayEquals(new int[] {2}, solution1.circularGameLosers(3, 2)); } @Test public void test5() { - assertArrayEquals(new int[]{2, 3}, solution1.circularGameLosers(5, 3)); + assertArrayEquals(new int[] {2, 3}, solution1.circularGameLosers(5, 3)); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2689Test.java b/src/test/java/com/fishercoder/thirdthousand/_2689Test.java index 18a46bfa5c..323ea1772d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2689Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2689Test.java @@ -1,12 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2689; -import com.fishercoder.solutions.thirdthousand._2976; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2689Test { private _2689.Solution1 solution1; @@ -51,7 +50,6 @@ public void test1() { rootRightRight.val = "klm"; rootRight.right = rootRightRight; - assertEquals('c', solution1.getKthCharacter(root, 3)); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2696Test.java b/src/test/java/com/fishercoder/thirdthousand/_2696Test.java index f8fa5bc14e..4d6c115b14 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2696Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2696Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2696; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2696Test { private _2696.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.minLength("ABFCACDB")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2710Test.java b/src/test/java/com/fishercoder/thirdthousand/_2710Test.java index ba46bd2860..029b9a66f5 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2710Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2710Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2710; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2710Test { private _2710.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals("512301", solution1.removeTrailingZeros("51230100")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2716Test.java b/src/test/java/com/fishercoder/thirdthousand/_2716Test.java index 5f3128742c..154c2267b5 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2716Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2716Test.java @@ -1,12 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2716; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - - public class _2716Test { private _2716.Solution1 solution1; @@ -19,5 +18,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.minimizedStringLength("ipi")); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2717Test.java b/src/test/java/com/fishercoder/thirdthousand/_2717Test.java index f325e865f4..d83a03e194 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2717Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2717Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2717; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2717Test { private _2717.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.semiOrderedPermutation(new int[]{2, 1, 4, 3})); + assertEquals(2, solution1.semiOrderedPermutation(new int[] {2, 1, 4, 3})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2729Test.java b/src/test/java/com/fishercoder/thirdthousand/_2729Test.java index 47aaeb78d9..eeb63724a5 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2729Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2729Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.thirdthousand._2729; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _2729Test { private _2729.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertTrue(solution1.isFascinating(192)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2739Test.java b/src/test/java/com/fishercoder/thirdthousand/_2739Test.java index 1625c56431..e38ed1de51 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2739Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2739Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2739; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2739Test { private _2739.Solution1 solution1; @@ -18,5 +18,4 @@ public void setup() { public void test1() { assertEquals(20, solution1.distanceTraveled(2, 1)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2744Test.java b/src/test/java/com/fishercoder/thirdthousand/_2744Test.java index f61b5511ed..8395a7855b 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2744Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2744Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2744; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2744Test { private _2744.Solution1 solution1; @@ -16,7 +16,8 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.maximumNumberOfStringPairs(new String[]{"cd", "ac", "dc", "ca", "zz"})); + assertEquals( + 2, + solution1.maximumNumberOfStringPairs(new String[] {"cd", "ac", "dc", "ca", "zz"})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2748Test.java b/src/test/java/com/fishercoder/thirdthousand/_2748Test.java index 31ba208377..d7f46fa5b9 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2748Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2748Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2748; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2748Test { private _2748.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(2, solution1.countBeautifulPairs(new int[]{11, 21, 12})); + assertEquals(2, solution1.countBeautifulPairs(new int[] {11, 21, 12})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2751Test.java b/src/test/java/com/fishercoder/thirdthousand/_2751Test.java index 11a97e4599..b71da8bf34 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2751Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2751Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2751; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2751Test { private _2751.Solution1 solution1; @@ -18,43 +17,68 @@ public void setup() { @Test public void test2() { - assertEquals(Arrays.asList(2, 17, 9, 15, 10), solution1.survivedRobotsHealths(new int[]{5, 4, 3, 2, 1}, new int[]{2, 17, 9, 15, 10}, "RRRRR")); + assertEquals( + Arrays.asList(2, 17, 9, 15, 10), + solution1.survivedRobotsHealths( + new int[] {5, 4, 3, 2, 1}, new int[] {2, 17, 9, 15, 10}, "RRRRR")); } @Test public void test1() { - assertEquals(Arrays.asList(10), solution1.survivedRobotsHealths(new int[]{1, 40}, new int[]{10, 11}, "RL")); + assertEquals( + Arrays.asList(10), + solution1.survivedRobotsHealths(new int[] {1, 40}, new int[] {10, 11}, "RL")); } @Test public void test3() { - assertEquals(Arrays.asList(1, 38), solution1.survivedRobotsHealths(new int[]{17, 24, 18}, new int[]{1, 39, 30}, "LLR")); + assertEquals( + Arrays.asList(1, 38), + solution1.survivedRobotsHealths( + new int[] {17, 24, 18}, new int[] {1, 39, 30}, "LLR")); } @Test public void test4() { - assertEquals(Arrays.asList(36), solution1.survivedRobotsHealths(new int[]{34, 50, 42, 2}, new int[]{6, 27, 17, 38}, "LLRR")); + assertEquals( + Arrays.asList(36), + solution1.survivedRobotsHealths( + new int[] {34, 50, 42, 2}, new int[] {6, 27, 17, 38}, "LLRR")); } @Test public void test5() { - assertEquals(Arrays.asList(18), solution1.survivedRobotsHealths(new int[]{11, 44, 16}, new int[]{1, 20, 17}, "RLR")); + assertEquals( + Arrays.asList(18), + solution1.survivedRobotsHealths( + new int[] {11, 44, 16}, new int[] {1, 20, 17}, "RLR")); } @Test public void test6() { - assertEquals(Arrays.asList(20, 16, 50), solution1.survivedRobotsHealths(new int[]{31, 24, 30, 19, 33}, new int[]{22, 6, 18, 16, 50}, "LRRLR")); + assertEquals( + Arrays.asList(20, 16, 50), + solution1.survivedRobotsHealths( + new int[] {31, 24, 30, 19, 33}, new int[] {22, 6, 18, 16, 50}, "LRRLR")); } @Test public void test7() { - assertEquals(Arrays.asList(1, 37, 24), solution1.survivedRobotsHealths(new int[]{31, 27, 15, 28, 14, 8, 9, 49, 25}, new int[]{8, 19, 1, 6, 38, 24, 13, 38, 37}, "LRLRLLRLR")); + assertEquals( + Arrays.asList(1, 37, 24), + solution1.survivedRobotsHealths( + new int[] {31, 27, 15, 28, 14, 8, 9, 49, 25}, + new int[] {8, 19, 1, 6, 38, 24, 13, 38, 37}, + "LRLRLLRLR")); } @Test public void test8() { - assertEquals(Arrays.asList(35), solution1.survivedRobotsHealths(new int[]{22, 19, 2, 43, 15, 34, 42, 1, 23, 31, 37, 35, 16, 36, 10}, new int[]{8, 26, 44, 35, 6, 33, 46, 42, 21, 34, 13, 31, 30, 12, 39}, "RRRRLLLRLRRLLLL")); + assertEquals( + Arrays.asList(35), + solution1.survivedRobotsHealths( + new int[] {22, 19, 2, 43, 15, 34, 42, 1, 23, 31, 37, 35, 16, 36, 10}, + new int[] {8, 26, 44, 35, 6, 33, 46, 42, 21, 34, 13, 31, 30, 12, 39}, + "RRRRLLLRLRRLLLL")); } - - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2760Test.java b/src/test/java/com/fishercoder/thirdthousand/_2760Test.java index 8a0e40530c..a0527dca1c 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2760Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2760Test.java @@ -1,12 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2760; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - - public class _2760Test { private _2760.Solution1 solution1; @@ -17,12 +16,11 @@ public void setup() { @Test public void test1() { - assertEquals(0, solution1.longestAlternatingSubarray(new int[]{4}, 1)); + assertEquals(0, solution1.longestAlternatingSubarray(new int[] {4}, 1)); } @Test public void test2() { - assertEquals(1, solution1.longestAlternatingSubarray(new int[]{1, 2}, 2)); + assertEquals(1, solution1.longestAlternatingSubarray(new int[] {1, 2}, 2)); } - -} \ No newline at end of file +} diff --git a/src/test/java/com/fishercoder/thirdthousand/_2765Test.java b/src/test/java/com/fishercoder/thirdthousand/_2765Test.java index 497af209d6..d043f75c36 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2765Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2765Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2765; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2765Test { private _2765.Solution1 solution1; @@ -16,21 +16,21 @@ public void setup() { @Test public void test1() { - assertEquals(4, solution1.alternatingSubarray(new int[]{2, 3, 4, 3, 4})); + assertEquals(4, solution1.alternatingSubarray(new int[] {2, 3, 4, 3, 4})); } @Test public void test2() { - assertEquals(2, solution1.alternatingSubarray(new int[]{4, 5, 6})); + assertEquals(2, solution1.alternatingSubarray(new int[] {4, 5, 6})); } @Test public void test3() { - assertEquals(4, solution1.alternatingSubarray(new int[]{31, 32, 31, 32, 33})); + assertEquals(4, solution1.alternatingSubarray(new int[] {31, 32, 31, 32, 33})); } @Test public void test4() { - assertEquals(3, solution1.alternatingSubarray(new int[]{13, 14, 15, 14})); + assertEquals(3, solution1.alternatingSubarray(new int[] {13, 14, 15, 14})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2788Test.java b/src/test/java/com/fishercoder/thirdthousand/_2788Test.java index 28c172085a..c0bd547ff7 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2788Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2788Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2788; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2788Test { private _2788.Solution1 solution1; @@ -18,6 +17,9 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("one", "two", "three", "four", "five", "six"), solution1.splitWordsBySeparator(Arrays.asList("one.two.three", "four.five", "six"), '.')); + assertEquals( + Arrays.asList("one", "two", "three", "four", "five", "six"), + solution1.splitWordsBySeparator( + Arrays.asList("one.two.three", "four.five", "six"), '.')); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2839Test.java b/src/test/java/com/fishercoder/thirdthousand/_2839Test.java index 799b6c4895..e7e8d4d68d 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2839Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2839Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.solutions.thirdthousand._2839; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _2839Test { private _2839.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2843Test.java b/src/test/java/com/fishercoder/thirdthousand/_2843Test.java index 6d923a5b43..65332de126 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2843Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2843Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2843; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2843Test { private _2843.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(9, solution1.countSymmetricIntegers(10, 100)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2848Test.java b/src/test/java/com/fishercoder/thirdthousand/_2848Test.java index d77862904a..50b8ece8b5 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2848Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2848Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2848; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2848Test { private _2848.Solution1 solution1; @@ -18,9 +17,10 @@ public void setup() { @Test public void test1() { - assertEquals(7, solution1.numberOfPoints(Arrays.asList(Arrays.asList(3, 6), - Arrays.asList(1, 5), - Arrays.asList(4, 7)))); + assertEquals( + 7, + solution1.numberOfPoints( + Arrays.asList( + Arrays.asList(3, 6), Arrays.asList(1, 5), Arrays.asList(4, 7)))); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2855Test.java b/src/test/java/com/fishercoder/thirdthousand/_2855Test.java index d9a956900a..cc7dda34dd 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2855Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2855Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2855; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2855Test { private _2855.Solution1 solution1; @@ -20,5 +19,4 @@ public void setup() { public void test1() { assertEquals(2, solution1.minimumRightShifts(Arrays.asList(3, 4, 5, 1, 2))); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2900Test.java b/src/test/java/com/fishercoder/thirdthousand/_2900Test.java index 9cc9df63a6..5b9553bf79 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2900Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2900Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2900; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2900Test { private _2900.Solution1 solution1; @@ -18,10 +17,13 @@ public void setup() { @Test public void test1() { - assertEquals(Arrays.asList("s", "l", "r", "ypp", "ev", "fv", "qzk", "xlr", "w", "v"), + assertEquals( + Arrays.asList("s", "l", "r", "ypp", "ev", "fv", "qzk", "xlr", "w", "v"), solution1.getLongestSubsequence( - new String[]{"s", "l", "djl", "euy", "r", "lur", "u", "ypp", "ev", "fv", "we", "qzk", "q", "xlr", "w", "wc", "a", "sd", "o", "x", "v"}, - new int[]{0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1})); + new String[] { + "s", "l", "djl", "euy", "r", "lur", "u", "ypp", "ev", "fv", "we", "qzk", + "q", "xlr", "w", "wc", "a", "sd", "o", "x", "v" + }, + new int[] {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1})); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2913Test.java b/src/test/java/com/fishercoder/thirdthousand/_2913Test.java index c37bc67837..5fb8f6fd46 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2913Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2913Test.java @@ -1,13 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2913; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2913Test { private _2913.Solution1 solution1; @@ -20,5 +19,4 @@ public void setup() { public void test1() { assertEquals(15, solution1.sumCounts(Arrays.asList(1, 2, 1))); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2917Test.java b/src/test/java/com/fishercoder/thirdthousand/_2917Test.java index 7381ab1be6..8d2047091e 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2917Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2917Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2917; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2917Test { private _2917.Solution1 solution1; @@ -16,7 +16,6 @@ public void setup() { @Test public void test1() { - assertEquals(9, solution1.findKOr(new int[]{7, 12, 9, 8, 9, 15}, 4)); + assertEquals(9, solution1.findKOr(new int[] {7, 12, 9, 8, 9, 15}, 4)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2928Test.java b/src/test/java/com/fishercoder/thirdthousand/_2928Test.java index b21b85425f..93f24d4e8e 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2928Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2928Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2928; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2928Test { private _2928.Solution1 solution1; @@ -23,5 +23,4 @@ public void test1() { public void test2() { assertEquals(10, solution1.distributeCandies(3, 3)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2937Test.java b/src/test/java/com/fishercoder/thirdthousand/_2937Test.java index 36a534c458..67f671c8b9 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2937Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2937Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2937; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2937Test { private _2937.Solution1 solution1; diff --git a/src/test/java/com/fishercoder/thirdthousand/_2946Test.java b/src/test/java/com/fishercoder/thirdthousand/_2946Test.java index fec790fef3..99121af38e 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2946Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2946Test.java @@ -1,12 +1,12 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertTrue; + import com.fishercoder.common.utils.CommonUtils; import com.fishercoder.solutions.thirdthousand._2946; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class _2946Test { private _2946.Solution1 solution1; @@ -17,22 +17,37 @@ public void setup() { @Test public void test1() { - assertTrue(solution1.areSimilar(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,1,2],[5,5,5,5],[6,3,6,3]"), 2)); + assertTrue( + solution1.areSimilar( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[1,2,1,2],[5,5,5,5],[6,3,6,3]"), + 2)); } @Test public void test2() { - assertTrue(solution1.areSimilar(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[3,10,3,10,3,10,3,10],[5,8,5,8,5,8,5,8],[3,9,3,9,3,9,3,9],[3,8,3,8,3,8,3,8],[2,3,2,3,2,3,2,3]"), 2)); + assertTrue( + solution1.areSimilar( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[3,10,3,10,3,10,3,10],[5,8,5,8,5,8,5,8],[3,9,3,9,3,9,3,9],[3,8,3,8,3,8,3,8],[2,3,2,3,2,3,2,3]"), + 2)); } @Test public void test3() { - assertTrue(solution1.areSimilar(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[9,5,3,10],[4,7,10,7],[1,7,9,4],[8,8,1,6],[6,7,6,1],[3,1,1,8],[9,2,8,3],[1,9,7,6]"), 4)); + assertTrue( + solution1.areSimilar( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[9,5,3,10],[4,7,10,7],[1,7,9,4],[8,8,1,6],[6,7,6,1],[3,1,1,8],[9,2,8,3],[1,9,7,6]"), + 4)); } @Test public void test4() { - assertTrue(solution1.areSimilar(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[9,1,8,9,2,9,1,8,9,2],[10,2,7,8,9,10,2,7,8,9],[7,6,6,9,5,7,6,6,9,5]"), 5)); + assertTrue( + solution1.areSimilar( + CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray( + "[9,1,8,9,2,9,1,8,9,2],[10,2,7,8,9,10,2,7,8,9],[7,6,6,9,5,7,6,6,9,5]"), + 5)); } - } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2970Test.java b/src/test/java/com/fishercoder/thirdthousand/_2970Test.java index f144f70460..c4090e68a1 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2970Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2970Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2970; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2970Test { private _2970.Solution1 solution1; @@ -16,16 +16,16 @@ public void setup() { @Test public void test1() { - assertEquals(7, solution1.incremovableSubarrayCount(new int[]{6, 5, 7, 8})); + assertEquals(7, solution1.incremovableSubarrayCount(new int[] {6, 5, 7, 8})); } @Test public void test2() { - assertEquals(3, solution1.incremovableSubarrayCount(new int[]{8, 7, 6, 6})); + assertEquals(3, solution1.incremovableSubarrayCount(new int[] {8, 7, 6, 6})); } @Test public void test3() { - assertEquals(3, solution1.incremovableSubarrayCount(new int[]{8, 7, 6, 6})); + assertEquals(3, solution1.incremovableSubarrayCount(new int[] {8, 7, 6, 6})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2976Test.java b/src/test/java/com/fishercoder/thirdthousand/_2976Test.java index 4c5cad040d..db693cb5ce 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2976Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2976Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2976; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2976Test { private _2976.Solution1 solution1; @@ -16,25 +16,33 @@ public void setup() { @Test public void test1() { - assertEquals(28, solution1.minimumCost("abcd", "acbe", - new char[]{'a', 'b', 'c', 'c', 'e', 'd'}, - new char[]{'b', 'c', 'b', 'e', 'b', 'e'}, - new int[]{2, 5, 5, 1, 2, 20})); + assertEquals( + 28, + solution1.minimumCost( + "abcd", + "acbe", + new char[] {'a', 'b', 'c', 'c', 'e', 'd'}, + new char[] {'b', 'c', 'b', 'e', 'b', 'e'}, + new int[] {2, 5, 5, 1, 2, 20})); } @Test public void test2() { - assertEquals(12, solution1.minimumCost("aaaa", "bbbb", - new char[]{'a', 'c'}, - new char[]{'c', 'b'}, - new int[]{1, 2})); + assertEquals( + 12, + solution1.minimumCost( + "aaaa", + "bbbb", + new char[] {'a', 'c'}, + new char[] {'c', 'b'}, + new int[] {1, 2})); } @Test public void test3() { - assertEquals(-1, solution1.minimumCost("abcd", "abce", - new char[]{'a'}, - new char[]{'e'}, - new int[]{10000})); + assertEquals( + -1, + solution1.minimumCost( + "abcd", "abce", new char[] {'a'}, new char[] {'e'}, new int[] {10000})); } } diff --git a/src/test/java/com/fishercoder/thirdthousand/_2996Test.java b/src/test/java/com/fishercoder/thirdthousand/_2996Test.java index c01827aed1..f453bb34b4 100644 --- a/src/test/java/com/fishercoder/thirdthousand/_2996Test.java +++ b/src/test/java/com/fishercoder/thirdthousand/_2996Test.java @@ -1,11 +1,11 @@ package com.fishercoder.thirdthousand; +import static org.junit.jupiter.api.Assertions.assertEquals; + import com.fishercoder.solutions.thirdthousand._2996; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class _2996Test { private _2996.Solution1 solution1; @@ -16,22 +16,22 @@ public void setup() { @Test public void test1() { - assertEquals(6, solution1.missingInteger(new int[]{1, 2, 3, 2, 5})); + assertEquals(6, solution1.missingInteger(new int[] {1, 2, 3, 2, 5})); } @Test public void test2() { - assertEquals(15, solution1.missingInteger(new int[]{3, 4, 5, 1, 12, 14, 13})); + assertEquals(15, solution1.missingInteger(new int[] {3, 4, 5, 1, 12, 14, 13})); } @Test public void test3() { - assertEquals(38, solution1.missingInteger(new int[]{37, 1, 2, 9, 5, 8, 5, 2, 9, 4})); + assertEquals(38, solution1.missingInteger(new int[] {37, 1, 2, 9, 5, 8, 5, 2, 9, 4})); } @Test public void test4() { - assertEquals(95, solution1.missingInteger(new int[]{47, 48, 2, 6, 9, 5, 10, 5, 6, 7, 6, 9, 8})); + assertEquals( + 95, solution1.missingInteger(new int[] {47, 48, 2, 6, 9, 5, 10, 5, 6, 7, 6, 9, 8})); } - }