diff --git a/src/test/java/com/ossez/lang/tutorial/tests/BitOperationTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/BitOperationTest.java
similarity index 90%
rename from src/test/java/com/ossez/lang/tutorial/tests/BitOperationTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/BitOperationTest.java
index eb570df0dd..257c6a3a68 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/BitOperationTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/BitOperationTest.java
@@ -1,36 +1,36 @@
-package com.ossez.lang.tutorial.tests;
-
-import org.apache.commons.math3.util.FastMath;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author YuCheng
- *
- */
-public class BitOperationTest {
-
- private final static Logger logger = LoggerFactory.getLogger(BitOperationTest.class);
-
- /**
- * 35 https://www.lintcode.com/problem/reverse-linked-list/description
- */
- @Test
- public void testInt2Bit() {
- logger.debug("BEGIN");
- System.out.println(Integer.toBinaryString(5));
- System.out.println(Integer.toBinaryString(2));
-
- System.out.println(Integer.toBinaryString(2 << 2));
-
- System.out.println(Integer.parseInt(Integer.toBinaryString(2 << 2), 2));
-
- System.out.println(5 / 3);
- System.out.println(5 % 3);
- FastMath.pow(2, 3);
-
- }
-
-}
+package com.ossez.codebank.algorithm.tests;
+
+import org.apache.commons.math3.util.FastMath;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author YuCheng
+ *
+ */
+public class BitOperationTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(BitOperationTest.class);
+
+ /**
+ * 35 https://www.lintcode.com/problem/reverse-linked-list/description
+ */
+ @Test
+ public void testInt2Bit() {
+ logger.debug("BEGIN");
+ System.out.println(Integer.toBinaryString(5));
+ System.out.println(Integer.toBinaryString(2));
+
+ System.out.println(Integer.toBinaryString(2 << 2));
+
+ System.out.println(Integer.parseInt(Integer.toBinaryString(2 << 2), 2));
+
+ System.out.println(5 / 3);
+ System.out.println(5 % 3);
+ FastMath.pow(2, 3);
+
+ }
+
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/LintcodeTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/LintcodeTest.java
similarity index 94%
rename from src/test/java/com/ossez/lang/tutorial/tests/LintcodeTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/LintcodeTest.java
index 7cf699092d..566fee90ea 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/LintcodeTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/LintcodeTest.java
@@ -1,293 +1,293 @@
-package com.ossez.lang.tutorial.tests;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.management.ListenerNotFoundException;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.ListNode;
-
-/**
- *
- * @author YuCheng
- *
- */
-public class LintcodeTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintcodeTest.class);
-
- /**
- * 35 https://www.lintcode.com/problem/reverse-linked-list/description
- */
- @Test
- public void test0035Reverse() {
- // INIT LINKED LIST
- ListNode head = new ListNode(1);
- head.next = new ListNode(2);
- head.next.next = new ListNode(3);
-
- // CHECK BEFORE
- System.out.println(head.val);
- System.out.println(head.next.val);
- System.out.println(head.next.next.val);
-
- // REVERSE
- ListNode prev = null;
- while (head != null) {
- ListNode temp = head.next;
- head.next = prev;
- prev = head;
- head = temp;
- }
-
- // CHECK AFTER
- System.out.println(prev.val);
- System.out.println(prev.next.val);
- System.out.println(prev.next.next.val);
- }
-
- /**
- * 1480 https://www.lintcode.com/problem/dot-product/description
- */
- @Test
- public void test0044minSubArray() {
-
- List nums = new ArrayList();
- nums.add(1);
- nums.add(1);
-
- int min_ending_here = 0;
- int retStatus = 0;
-
- for (int i = 0; i < nums.size(); i++) {
- if (min_ending_here > 0) {
- min_ending_here = nums.get(i);
- } else {
- min_ending_here += nums.get(i);
- }
- retStatus = Math.min(retStatus, min_ending_here);
- }
-
- System.out.println(retStatus);
-
- }
-
- /**
- * 53 https://www.lintcode.com/problem/reverse-words-in-a-string/description
- */
- @Test
- public void test0053ReverseWords() {
-
- String s = " Life doesn't always give us the joys we want.";
-
- String retStr = "";
- String[] inStr = s.split(" ");
-
- for (int i = inStr.length - 1; i >= 0; i--) {
- String cStr = inStr[i].trim();
- if (!cStr.isEmpty()) {
- retStr = retStr + " " + cStr;
- }
- }
- retStr = retStr.trim();
- System.out.println(retStr);
- // return retStr;
- }
-
- /**
- * 56 https://www.lintcode.com/problem/two-sum/description
- */
- @Test
- public void test0056TwoSum() {
- int[] numbers = { 2, 7, 11, 15 };
- int target = 9;
-
- int[] retArray = new int[2];
-
- for (int i = 0; i < numbers.length; i++) {
- int intA = numbers[i];
- int intB = 0;
-
- for (int j = 1 + i; j < numbers.length; j++) {
- intB = numbers[j];
- // SUM CHECK
- if (target == intA + intB && i < j) {
- retArray[0] = i;
- retArray[1] = j;
- break;
- }
- }
- }
-
- System.out.println(Arrays.toString(retArray));
- }
-
- /**
- * 209 https://www.lintcode.com/problem/first-unique-character-in-a-string
- */
- @Test
- public void test0209FirstUniqChar() {
- String str = "ddjdz";
-
- char retStatus = 0;
-
- // LOOP CHECK
- for (int i = 0; i < 30; i++) {
- char c = str.charAt(0);
- if (str.indexOf(Character.toString(c)) == str.lastIndexOf(Character.toString(c))) {
- retStatus = c;
- break;
- }
- str = str.replaceAll(Character.toString(c), "");
- }
-
- System.out.println("" + retStatus);
- }
-
- /**
- * 411
- *
- *
- *
- *
- *
- */
- @Test
- public void test0411GrayCode() {
- int n = 2;
-
- List retArray = new ArrayList<>();
-
- if (n == 0) {
- retArray.add(0);
- }
-
- for (int i = 0; i < (2 << (n - 1)); i++) {
- int g = i ^ (i / 2);
- retArray.add(g);
- }
-
- System.out.println(retArray);
- }
-
- /**
- * 1480 https://www.lintcode.com/problem/dot-product/description
- */
- @Test
- public void test0423IsValidParentheses() {
- String s = "([)]";
-
- boolean retStatus = false;
- for (int i = 0; i < 3; i++) {
- s = s.replace("()", "");
- s = s.replace("{}", "");
- s = s.replace("[]", "");
-
- if (s.length() == 0) {
- retStatus = true;
- break;
- }
- }
-
- System.out.println(retStatus);
-
- }
-
- /**
- * 646 https://www.lintcode.com/problem/first-position-unique-character/description
- */
- @Test
- public void test0646FirstUniqChar() {
- String s = "saau";
-
- int retStatus = -1;
- boolean breakLoop = false;
-
- int[] iArray = new int[256];
-
- // NULL CHECK
- if (s == null || s.length() == 0) {
- retStatus = -1;
- }
-
- // LOOP CHECK
- for (char c : s.toCharArray()) {
- iArray[c]++;
- }
- for (int i = 0; i < s.length(); i++) {
- if (iArray[s.charAt(i)] == 1) {
- retStatus = i;
- breakLoop = true;
- break;
- }
- }
-
- // LOOP BREAK CHECK
- if (!breakLoop) {
- retStatus = -1;
- }
-
- System.out.println(retStatus);
- }
-
- /**
- * 767 https://www.lintcode.com/problem/reverse-array/description
- */
- @Test
- public void test0767ReverseArray() {
- int[] nums = { 1, 2, 3, 4, 5, 6, 7 };
-
- for (int i = 0; i < nums.length / 2; i++) {
- int tmp = nums[i];
- nums[i] = nums[nums.length - 1 - i];
- nums[nums.length - 1 - i] = tmp;
- }
-
- System.out.println(Arrays.toString(nums));
-
- }
-
- /**
- * 1480 https://www.lintcode.com/problem/dot-product/description
- */
- @Test
- public void test1377findSubstring() {
- String str = "";
- int k = 5;
-
- HashSet strSet = new HashSet();
-
- for (int i = 0; i <= str.length() - k; i++) {
- String subStr = str.substring(i, i + k);
-
- String pattern = ".*(.).*\\1.*";
-
- Pattern r = Pattern.compile(pattern);
-
- Matcher m = r.matcher(subStr);
- if (!m.find()) {
- strSet.add(subStr);
- }
-
- }
-
- System.out.println(strSet.size());
- }
-
-}
+package com.ossez.codebank.algorithm.tests;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.management.ListenerNotFoundException;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.ListNode;
+
+/**
+ *
+ * @author YuCheng
+ *
+ */
+public class LintcodeTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintcodeTest.class);
+
+ /**
+ * 35 https://www.lintcode.com/problem/reverse-linked-list/description
+ */
+ @Test
+ public void test0035Reverse() {
+ // INIT LINKED LIST
+ ListNode head = new ListNode(1);
+ head.next = new ListNode(2);
+ head.next.next = new ListNode(3);
+
+ // CHECK BEFORE
+ System.out.println(head.val);
+ System.out.println(head.next.val);
+ System.out.println(head.next.next.val);
+
+ // REVERSE
+ ListNode prev = null;
+ while (head != null) {
+ ListNode temp = head.next;
+ head.next = prev;
+ prev = head;
+ head = temp;
+ }
+
+ // CHECK AFTER
+ System.out.println(prev.val);
+ System.out.println(prev.next.val);
+ System.out.println(prev.next.next.val);
+ }
+
+ /**
+ * 1480 https://www.lintcode.com/problem/dot-product/description
+ */
+ @Test
+ public void test0044minSubArray() {
+
+ List nums = new ArrayList();
+ nums.add(1);
+ nums.add(1);
+
+ int min_ending_here = 0;
+ int retStatus = 0;
+
+ for (int i = 0; i < nums.size(); i++) {
+ if (min_ending_here > 0) {
+ min_ending_here = nums.get(i);
+ } else {
+ min_ending_here += nums.get(i);
+ }
+ retStatus = Math.min(retStatus, min_ending_here);
+ }
+
+ System.out.println(retStatus);
+
+ }
+
+ /**
+ * 53 https://www.lintcode.com/problem/reverse-words-in-a-string/description
+ */
+ @Test
+ public void test0053ReverseWords() {
+
+ String s = " Life doesn't always give us the joys we want.";
+
+ String retStr = "";
+ String[] inStr = s.split(" ");
+
+ for (int i = inStr.length - 1; i >= 0; i--) {
+ String cStr = inStr[i].trim();
+ if (!cStr.isEmpty()) {
+ retStr = retStr + " " + cStr;
+ }
+ }
+ retStr = retStr.trim();
+ System.out.println(retStr);
+ // return retStr;
+ }
+
+ /**
+ * 56 https://www.lintcode.com/problem/two-sum/description
+ */
+ @Test
+ public void test0056TwoSum() {
+ int[] numbers = { 2, 7, 11, 15 };
+ int target = 9;
+
+ int[] retArray = new int[2];
+
+ for (int i = 0; i < numbers.length; i++) {
+ int intA = numbers[i];
+ int intB = 0;
+
+ for (int j = 1 + i; j < numbers.length; j++) {
+ intB = numbers[j];
+ // SUM CHECK
+ if (target == intA + intB && i < j) {
+ retArray[0] = i;
+ retArray[1] = j;
+ break;
+ }
+ }
+ }
+
+ System.out.println(Arrays.toString(retArray));
+ }
+
+ /**
+ * 209 https://www.lintcode.com/problem/first-unique-character-in-a-string
+ */
+ @Test
+ public void test0209FirstUniqChar() {
+ String str = "ddjdz";
+
+ char retStatus = 0;
+
+ // LOOP CHECK
+ for (int i = 0; i < 30; i++) {
+ char c = str.charAt(0);
+ if (str.indexOf(Character.toString(c)) == str.lastIndexOf(Character.toString(c))) {
+ retStatus = c;
+ break;
+ }
+ str = str.replaceAll(Character.toString(c), "");
+ }
+
+ System.out.println("" + retStatus);
+ }
+
+ /**
+ * 411
+ *
+ *
+ *
+ *
+ *
+ */
+ @Test
+ public void test0411GrayCode() {
+ int n = 2;
+
+ List retArray = new ArrayList<>();
+
+ if (n == 0) {
+ retArray.add(0);
+ }
+
+ for (int i = 0; i < (2 << (n - 1)); i++) {
+ int g = i ^ (i / 2);
+ retArray.add(g);
+ }
+
+ System.out.println(retArray);
+ }
+
+ /**
+ * 1480 https://www.lintcode.com/problem/dot-product/description
+ */
+ @Test
+ public void test0423IsValidParentheses() {
+ String s = "([)]";
+
+ boolean retStatus = false;
+ for (int i = 0; i < 3; i++) {
+ s = s.replace("()", "");
+ s = s.replace("{}", "");
+ s = s.replace("[]", "");
+
+ if (s.length() == 0) {
+ retStatus = true;
+ break;
+ }
+ }
+
+ System.out.println(retStatus);
+
+ }
+
+ /**
+ * 646 https://www.lintcode.com/problem/first-position-unique-character/description
+ */
+ @Test
+ public void test0646FirstUniqChar() {
+ String s = "saau";
+
+ int retStatus = -1;
+ boolean breakLoop = false;
+
+ int[] iArray = new int[256];
+
+ // NULL CHECK
+ if (s == null || s.length() == 0) {
+ retStatus = -1;
+ }
+
+ // LOOP CHECK
+ for (char c : s.toCharArray()) {
+ iArray[c]++;
+ }
+ for (int i = 0; i < s.length(); i++) {
+ if (iArray[s.charAt(i)] == 1) {
+ retStatus = i;
+ breakLoop = true;
+ break;
+ }
+ }
+
+ // LOOP BREAK CHECK
+ if (!breakLoop) {
+ retStatus = -1;
+ }
+
+ System.out.println(retStatus);
+ }
+
+ /**
+ * 767 https://www.lintcode.com/problem/reverse-array/description
+ */
+ @Test
+ public void test0767ReverseArray() {
+ int[] nums = { 1, 2, 3, 4, 5, 6, 7 };
+
+ for (int i = 0; i < nums.length / 2; i++) {
+ int tmp = nums[i];
+ nums[i] = nums[nums.length - 1 - i];
+ nums[nums.length - 1 - i] = tmp;
+ }
+
+ System.out.println(Arrays.toString(nums));
+
+ }
+
+ /**
+ * 1480 https://www.lintcode.com/problem/dot-product/description
+ */
+ @Test
+ public void test1377findSubstring() {
+ String str = "";
+ int k = 5;
+
+ HashSet strSet = new HashSet();
+
+ for (int i = 0; i <= str.length() - k; i++) {
+ String subStr = str.substring(i, i + k);
+
+ String pattern = ".*(.).*\\1.*";
+
+ Pattern r = Pattern.compile(pattern);
+
+ Matcher m = r.matcher(subStr);
+ if (!m.find()) {
+ strSet.add(subStr);
+ }
+
+ }
+
+ System.out.println(strSet.size());
+ }
+
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/SingletonTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/SingletonTest.java
similarity index 91%
rename from src/test/java/com/ossez/lang/tutorial/tests/SingletonTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/SingletonTest.java
index a6cd888777..041a9b840c 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/SingletonTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/SingletonTest.java
@@ -1,4 +1,4 @@
-package com.ossez.lang.tutorial.tests;
+package com.ossez.codebank.algorithm.tests;
import org.junit.Test;
import org.slf4j.Logger;
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/TreeTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/TreeTest.java
similarity index 92%
rename from src/test/java/com/ossez/lang/tutorial/tests/TreeTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/TreeTest.java
index ee67e07c05..6f88cd156e 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/TreeTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/TreeTest.java
@@ -1,85 +1,85 @@
-package com.ossez.lang.tutorial.tests;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.TreeNode;
-import com.ossez.lang.tutorial.utils.TreeUtils;
-
-/**
- *
- * @author YuCheng
- *
- */
-public class TreeTest {
- private final static Logger logger = LoggerFactory.getLogger(TreeTest.class);
- private static List loopList = new ArrayList();
-
- @Test
- public void testMain() {
- logger.debug("TREE TEST");
- String data = "{1,2,3,4,5,#,6,#,#,7,8,#,#}";
- TreeNode treeNode = TreeUtils.initTree(data);
-
- // PRE
- loopList = new ArrayList();
- preOrderTraverselRecursion(treeNode);
- System.out.println(loopList);
-
- // IN
- loopList = new ArrayList();
- inOrderTraverselRecursion(treeNode);
- System.out.println(loopList);
-
- // POST
- loopList = new ArrayList();
- postOrderTraversalRecursion(treeNode);
- System.out.println(loopList);
- }
-
-
-
-
- /**
- *
- * @param root
- */
- public void preOrderTraverselRecursion(TreeNode root) {
- if (root != null) {
- loopList.add(root.val);
- preOrderTraverselRecursion(root.left);
- preOrderTraverselRecursion(root.right);
- }
- }
-
- /**
- *
- * @param root
- */
- public void inOrderTraverselRecursion(TreeNode root) {
- if (root != null) {
- inOrderTraverselRecursion(root.left);
- loopList.add(root.val);
- inOrderTraverselRecursion(root.right);
- }
-
- }
-
- /**
- *
- * @param root
- */
- public void postOrderTraversalRecursion(TreeNode root) {
- if (root != null) {
- postOrderTraversalRecursion(root.left);
- postOrderTraversalRecursion(root.right);
- loopList.add(root.val);
- }
-
- }
-
-}
+package com.ossez.codebank.algorithm.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.TreeNode;
+import com.ossez.lang.tutorial.utils.TreeUtils;
+
+/**
+ *
+ * @author YuCheng
+ *
+ */
+public class TreeTest {
+ private final static Logger logger = LoggerFactory.getLogger(TreeTest.class);
+ private static List loopList = new ArrayList();
+
+ @Test
+ public void testMain() {
+ logger.debug("TREE TEST");
+ String data = "{1,2,3,4,5,#,6,#,#,7,8,#,#}";
+ TreeNode treeNode = TreeUtils.initTree(data);
+
+ // PRE
+ loopList = new ArrayList();
+ preOrderTraverselRecursion(treeNode);
+ System.out.println(loopList);
+
+ // IN
+ loopList = new ArrayList();
+ inOrderTraverselRecursion(treeNode);
+ System.out.println(loopList);
+
+ // POST
+ loopList = new ArrayList();
+ postOrderTraversalRecursion(treeNode);
+ System.out.println(loopList);
+ }
+
+
+
+
+ /**
+ *
+ * @param root
+ */
+ public void preOrderTraverselRecursion(TreeNode root) {
+ if (root != null) {
+ loopList.add(root.val);
+ preOrderTraverselRecursion(root.left);
+ preOrderTraverselRecursion(root.right);
+ }
+ }
+
+ /**
+ *
+ * @param root
+ */
+ public void inOrderTraverselRecursion(TreeNode root) {
+ if (root != null) {
+ inOrderTraverselRecursion(root.left);
+ loopList.add(root.val);
+ inOrderTraverselRecursion(root.right);
+ }
+
+ }
+
+ /**
+ *
+ * @param root
+ */
+ public void postOrderTraversalRecursion(TreeNode root) {
+ if (root != null) {
+ postOrderTraversalRecursion(root.left);
+ postOrderTraversalRecursion(root.right);
+ loopList.add(root.val);
+ }
+
+ }
+
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/VariableTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/VariableTest.java
similarity index 90%
rename from src/test/java/com/ossez/lang/tutorial/tests/VariableTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/VariableTest.java
index a7112e3aea..16388db179 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/VariableTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/VariableTest.java
@@ -1,4 +1,4 @@
-package com.ossez.lang.tutorial.tests;
+package com.ossez.codebank.algorithm.tests;
import org.junit.Test;
import org.slf4j.Logger;
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/codility/CodilityBinaryGapTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/codility/CodilityBinaryGapTest.java
similarity index 91%
rename from src/test/java/com/ossez/lang/tutorial/tests/codility/CodilityBinaryGapTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/codility/CodilityBinaryGapTest.java
index f430a4f5d0..9a017bb488 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/codility/CodilityBinaryGapTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/codility/CodilityBinaryGapTest.java
@@ -1,56 +1,56 @@
-package com.ossez.lang.tutorial.tests.codility;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * More details about question see link below
- *
- *
- *
- * @author YuCheng
- *
- */
-public class CodilityBinaryGapTest {
-
- private final static Logger logger = LoggerFactory.getLogger(CodilityBinaryGapTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
-
- int N = 529;
- String intStr = Integer.toBinaryString(N);
-
- intStr = intStr.replace("1", "#1#");
-
- String[] strArray = intStr.split("1");
-
- int maxCount = 0;
- for (int i = 0; i < strArray.length; i++) {
- String checkStr = strArray[i];
- int countLength = 0;
-
- if (checkStr.length() > 2 && checkStr.startsWith("#") && checkStr.endsWith("#")) {
- checkStr = checkStr.replace("#", "");
- countLength = checkStr.length();
-
- if (maxCount < countLength) {
- maxCount = countLength;
- }
-
- }
- }
-
- logger.debug("MAX COUNT: [{}]", maxCount);
- }
-
-}
+package com.ossez.codebank.algorithm.tests.codility;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * More details about question see link below
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class CodilityBinaryGapTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(CodilityBinaryGapTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+
+ int N = 529;
+ String intStr = Integer.toBinaryString(N);
+
+ intStr = intStr.replace("1", "#1#");
+
+ String[] strArray = intStr.split("1");
+
+ int maxCount = 0;
+ for (int i = 0; i < strArray.length; i++) {
+ String checkStr = strArray[i];
+ int countLength = 0;
+
+ if (checkStr.length() > 2 && checkStr.startsWith("#") && checkStr.endsWith("#")) {
+ checkStr = checkStr.replace("#", "");
+ countLength = checkStr.length();
+
+ if (maxCount < countLength) {
+ maxCount = countLength;
+ }
+
+ }
+ }
+
+ logger.debug("MAX COUNT: [{}]", maxCount);
+ }
+
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java
similarity index 93%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java
index cb900c3f37..ad21270072 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0007SerializeAndDeserializeTest.java
@@ -1,131 +1,131 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.TreeNode;
-
-/**
- *
- * 7
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0007SerializeAndDeserializeTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0007SerializeAndDeserializeTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- String data = "{3,9,20,#,#,15,7}";
-
- System.out.println(serialize(deserialize(data)));
-
- }
-
- /**
- * Deserialize from array to tree
- *
- * @param data
- * @return
- */
- private TreeNode deserialize(String data) {
- // NULL CHECK
- if (data.equals("{}")) {
- return null;
- }
-
- ArrayList treeList = new ArrayList();
-
- data = data.replace("{", "");
- data = data.replace("}", "");
- String[] vals = data.split(",");
-
- // INSERT ROOT
- TreeNode root = new TreeNode(Integer.parseInt(vals[0]));
- treeList.add(root);
-
- int index = 0;
- boolean isLeftChild = true;
- for (int i = 1; i < vals.length; i++) {
- if (!vals[i].equals("#")) {
- TreeNode node = new TreeNode(Integer.parseInt(vals[i]));
- if (isLeftChild) {
- treeList.get(index).left = node;
- } else {
- treeList.get(index).right = node;
- }
- treeList.add(node);
- }
-
- // LEVEL
- if (!isLeftChild) {
- index++;
- }
-
- // MOVE TO RIGHT OR NEXT LEVEL
- isLeftChild = !isLeftChild;
- }
-
- return root;
-
- }
-
- /**
- *
- * @param root
- * @return
- */
- public String serialize(TreeNode root) {
- // write your code here
- if (root == null) {
- return "{}";
- }
-
- ArrayList queue = new ArrayList();
- queue.add(root);
-
- for (int i = 0; i < queue.size(); i++) {
- TreeNode node = queue.get(i);
- if (node == null) {
- continue;
- }
- queue.add(node.left);
- queue.add(node.right);
- }
-
- while (queue.get(queue.size() - 1) == null) {
- queue.remove(queue.size() - 1);
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append("{");
- sb.append(queue.get(0).val);
- for (int i = 1; i < queue.size(); i++) {
- if (queue.get(i) == null) {
- sb.append(",#");
- } else {
- sb.append(",");
- sb.append(queue.get(i).val);
- }
- }
- sb.append("}");
- return sb.toString();
- }
-
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.TreeNode;
+
+/**
+ *
+ * 7
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0007SerializeAndDeserializeTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0007SerializeAndDeserializeTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ String data = "{3,9,20,#,#,15,7}";
+
+ System.out.println(serialize(deserialize(data)));
+
+ }
+
+ /**
+ * Deserialize from array to tree
+ *
+ * @param data
+ * @return
+ */
+ private TreeNode deserialize(String data) {
+ // NULL CHECK
+ if (data.equals("{}")) {
+ return null;
+ }
+
+ ArrayList treeList = new ArrayList();
+
+ data = data.replace("{", "");
+ data = data.replace("}", "");
+ String[] vals = data.split(",");
+
+ // INSERT ROOT
+ TreeNode root = new TreeNode(Integer.parseInt(vals[0]));
+ treeList.add(root);
+
+ int index = 0;
+ boolean isLeftChild = true;
+ for (int i = 1; i < vals.length; i++) {
+ if (!vals[i].equals("#")) {
+ TreeNode node = new TreeNode(Integer.parseInt(vals[i]));
+ if (isLeftChild) {
+ treeList.get(index).left = node;
+ } else {
+ treeList.get(index).right = node;
+ }
+ treeList.add(node);
+ }
+
+ // LEVEL
+ if (!isLeftChild) {
+ index++;
+ }
+
+ // MOVE TO RIGHT OR NEXT LEVEL
+ isLeftChild = !isLeftChild;
+ }
+
+ return root;
+
+ }
+
+ /**
+ *
+ * @param root
+ * @return
+ */
+ public String serialize(TreeNode root) {
+ // write your code here
+ if (root == null) {
+ return "{}";
+ }
+
+ ArrayList queue = new ArrayList();
+ queue.add(root);
+
+ for (int i = 0; i < queue.size(); i++) {
+ TreeNode node = queue.get(i);
+ if (node == null) {
+ continue;
+ }
+ queue.add(node.left);
+ queue.add(node.right);
+ }
+
+ while (queue.get(queue.size() - 1) == null) {
+ queue.remove(queue.size() - 1);
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ sb.append(queue.get(0).val);
+ for (int i = 1; i < queue.size(); i++) {
+ if (queue.get(i) == null) {
+ sb.append(",#");
+ } else {
+ sb.append(",");
+ sb.append(queue.get(i).val);
+ }
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0069LevelOrderTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0069LevelOrderTest.java
similarity index 93%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0069LevelOrderTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0069LevelOrderTest.java
index f0f661947a..5a35ff7b73 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0069LevelOrderTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0069LevelOrderTest.java
@@ -1,124 +1,124 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.TreeNode;
-
-/**
- *
- * 69
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0069LevelOrderTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0069LevelOrderTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- String data = "{3,9,20,#,#,15,7}";
-
- TreeNode tn = deserialize(data);
- System.out.println(levelOrder(tn));
-
- }
-
- /**
- * Deserialize from array to tree
- *
- * @param data
- * @return
- */
- private TreeNode deserialize(String data) {
- // NULL CHECK
- if (data.equals("{}")) {
- return null;
- }
-
- ArrayList treeList = new ArrayList();
-
- data = data.replace("{", "");
- data = data.replace("}", "");
- String[] vals = data.split(",");
-
- // INSERT ROOT
- TreeNode root = new TreeNode(Integer.parseInt(vals[0]));
- treeList.add(root);
-
- int index = 0;
- boolean isLeftChild = true;
- for (int i = 1; i < vals.length; i++) {
- if (!vals[i].equals("#")) {
- TreeNode node = new TreeNode(Integer.parseInt(vals[i]));
- if (isLeftChild) {
- treeList.get(index).left = node;
- } else {
- treeList.get(index).right = node;
- }
- treeList.add(node);
- }
-
- // LEVEL
- if (!isLeftChild) {
- index++;
- }
-
- // MOVE TO RIGHT OR NEXT LEVEL
- isLeftChild = !isLeftChild;
- }
-
- return root;
-
- }
-
- private List> levelOrder(TreeNode root) {
- Queue queue = new LinkedList();
- List> rs = new ArrayList>();
-
- // NULL CHECK
- if (root == null) {
- return rs;
- }
-
- queue.offer(root);
-
- while (!queue.isEmpty()) {
- int length = queue.size();
- List list = new ArrayList();
-
- for (int i = 0; i < length; i++) {
- TreeNode curTN = queue.poll();
- list.add(curTN.val);
- if (curTN.left != null) {
- queue.offer(curTN.left);
- }
- if (curTN.right != null) {
- queue.offer(curTN.right);
- }
- }
-
- rs.add(list);
- }
-
- return rs;
- }
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.TreeNode;
+
+/**
+ *
+ * 69
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0069LevelOrderTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0069LevelOrderTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ String data = "{3,9,20,#,#,15,7}";
+
+ TreeNode tn = deserialize(data);
+ System.out.println(levelOrder(tn));
+
+ }
+
+ /**
+ * Deserialize from array to tree
+ *
+ * @param data
+ * @return
+ */
+ private TreeNode deserialize(String data) {
+ // NULL CHECK
+ if (data.equals("{}")) {
+ return null;
+ }
+
+ ArrayList treeList = new ArrayList();
+
+ data = data.replace("{", "");
+ data = data.replace("}", "");
+ String[] vals = data.split(",");
+
+ // INSERT ROOT
+ TreeNode root = new TreeNode(Integer.parseInt(vals[0]));
+ treeList.add(root);
+
+ int index = 0;
+ boolean isLeftChild = true;
+ for (int i = 1; i < vals.length; i++) {
+ if (!vals[i].equals("#")) {
+ TreeNode node = new TreeNode(Integer.parseInt(vals[i]));
+ if (isLeftChild) {
+ treeList.get(index).left = node;
+ } else {
+ treeList.get(index).right = node;
+ }
+ treeList.add(node);
+ }
+
+ // LEVEL
+ if (!isLeftChild) {
+ index++;
+ }
+
+ // MOVE TO RIGHT OR NEXT LEVEL
+ isLeftChild = !isLeftChild;
+ }
+
+ return root;
+
+ }
+
+ private List> levelOrder(TreeNode root) {
+ Queue queue = new LinkedList();
+ List> rs = new ArrayList>();
+
+ // NULL CHECK
+ if (root == null) {
+ return rs;
+ }
+
+ queue.offer(root);
+
+ while (!queue.isEmpty()) {
+ int length = queue.size();
+ List list = new ArrayList();
+
+ for (int i = 0; i < length; i++) {
+ TreeNode curTN = queue.poll();
+ list.add(curTN.val);
+ if (curTN.left != null) {
+ queue.offer(curTN.left);
+ }
+ if (curTN.right != null) {
+ queue.offer(curTN.right);
+ }
+ }
+
+ rs.add(list);
+ }
+
+ return rs;
+ }
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0102HasCycleTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0102HasCycleTest.java
similarity index 91%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0102HasCycleTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0102HasCycleTest.java
index 7ded09697e..e20e2d6b72 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0102HasCycleTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0102HasCycleTest.java
@@ -1,63 +1,63 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.ListNode;
-
-/**
- *
- * 102
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0102HasCycleTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0102HasCycleTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- // INIT LINKED LIST
- ListNode head = new ListNode(1);
- head.next = new ListNode(2);
- head.next.next = new ListNode(3);
- head.next.next.next = new ListNode(4);
-
- // CREATE A LOOP
- head.next.next.next.next = head.next.next.next;
-
- boolean retResult = false;
-
- // LIKED LIST MAY NULL:
- if (!(head == null || head.next == null)) {
- ListNode s = head;
- ListNode f = head.next;
-
- while (f.next != null && f.next.next != null) {
-
- s = s.next;
- f = f.next.next;
-
- if (f == s) {
- retResult = true;
- break;
- }
- }
- }
-
- System.out.println(retResult);
-
- }
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.ListNode;
+
+/**
+ *
+ * 102
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0102HasCycleTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0102HasCycleTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ // INIT LINKED LIST
+ ListNode head = new ListNode(1);
+ head.next = new ListNode(2);
+ head.next.next = new ListNode(3);
+ head.next.next.next = new ListNode(4);
+
+ // CREATE A LOOP
+ head.next.next.next.next = head.next.next.next;
+
+ boolean retResult = false;
+
+ // LIKED LIST MAY NULL:
+ if (!(head == null || head.next == null)) {
+ ListNode s = head;
+ ListNode f = head.next;
+
+ while (f.next != null && f.next.next != null) {
+
+ s = s.next;
+ f = f.next.next;
+
+ if (f == s) {
+ retResult = true;
+ break;
+ }
+ }
+ }
+
+ System.out.println(retResult);
+
+ }
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0165MergeTwoListsTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0165MergeTwoListsTest.java
similarity index 92%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0165MergeTwoListsTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0165MergeTwoListsTest.java
index 5bfac549d6..6591addbbb 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0165MergeTwoListsTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0165MergeTwoListsTest.java
@@ -1,89 +1,89 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ossez.lang.tutorial.models.ListNode;
-
-/**
- *
- * 102
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0165MergeTwoListsTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0165MergeTwoListsTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- // INIT LINKED LIST l1
- ListNode l1 = new ListNode(1);
- l1.next = new ListNode(3);
- l1.next.next = new ListNode(8);
- l1.next.next.next = new ListNode(11);
- l1.next.next.next.next = new ListNode(15);
-
- // INIT LINKED LIST l2
- ListNode l2 = new ListNode(2);
-
- // RETURN RESULT
- ListNode retResult = new ListNode(0);
-
- // NULL CHECK
- // if (l1 == null && l2 == null) {
- // retResult = null;
- // }
- //
- // if (l1 == null) {
- // retResult = l2;
- // }
- //
- // if (l2 == null) {
- // retResult = l1;
- // }
-
- // MERGE
- retResult = new ListNode(0);
- ListNode tmpNode = new ListNode(0);
- retResult = tmpNode;
- while (l1 != null & l2 != null) {
- if (l1.val <= l2.val) {
- tmpNode.next = l1;
- l1 = l1.next;
- } else {
- tmpNode.next = l2;
- l2 = l2.next;
- }
-
- tmpNode = tmpNode.next;
- }
-
- if (l1 == null) {
- tmpNode.next = l2;
- }
-
- if (l2 == null) {
- tmpNode.next = l1;
- }
-
- retResult = retResult.next;
-
- System.out.println(retResult.val);
- System.out.println(retResult.next.val);
- System.out.println(retResult.next.next.val);
-
- }
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.ossez.lang.tutorial.models.ListNode;
+
+/**
+ *
+ * 102
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0165MergeTwoListsTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0165MergeTwoListsTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ // INIT LINKED LIST l1
+ ListNode l1 = new ListNode(1);
+ l1.next = new ListNode(3);
+ l1.next.next = new ListNode(8);
+ l1.next.next.next = new ListNode(11);
+ l1.next.next.next.next = new ListNode(15);
+
+ // INIT LINKED LIST l2
+ ListNode l2 = new ListNode(2);
+
+ // RETURN RESULT
+ ListNode retResult = new ListNode(0);
+
+ // NULL CHECK
+ // if (l1 == null && l2 == null) {
+ // retResult = null;
+ // }
+ //
+ // if (l1 == null) {
+ // retResult = l2;
+ // }
+ //
+ // if (l2 == null) {
+ // retResult = l1;
+ // }
+
+ // MERGE
+ retResult = new ListNode(0);
+ ListNode tmpNode = new ListNode(0);
+ retResult = tmpNode;
+ while (l1 != null & l2 != null) {
+ if (l1.val <= l2.val) {
+ tmpNode.next = l1;
+ l1 = l1.next;
+ } else {
+ tmpNode.next = l2;
+ l2 = l2.next;
+ }
+
+ tmpNode = tmpNode.next;
+ }
+
+ if (l1 == null) {
+ tmpNode.next = l2;
+ }
+
+ if (l2 == null) {
+ tmpNode.next = l1;
+ }
+
+ retResult = retResult.next;
+
+ System.out.println(retResult.val);
+ System.out.println(retResult.next.val);
+ System.out.println(retResult.next.next.val);
+
+ }
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0425LetterCombinationsTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0425LetterCombinationsTest.java
similarity index 93%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0425LetterCombinationsTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0425LetterCombinationsTest.java
index 7312cbb993..888cdd22de 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0425LetterCombinationsTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0425LetterCombinationsTest.java
@@ -1,78 +1,78 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * 425
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0425LetterCombinationsTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0425LetterCombinationsTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("LetterCombinationsTest");
- String digits = "23";
-
- HashMap phoneKeyMap = new HashMap();
- phoneKeyMap.put("0", "");
- phoneKeyMap.put("1", "");
- phoneKeyMap.put("2", "abc");
- phoneKeyMap.put("3", "def");
- phoneKeyMap.put("4", "ghi");
- phoneKeyMap.put("5", "jkl");
- phoneKeyMap.put("6", "mno");
- phoneKeyMap.put("7", "pqrs");
- phoneKeyMap.put("8", "tuv");
- phoneKeyMap.put("9", "wxyz");
-
- List retStatus = new ArrayList<>();
-
- if (digits != null && digits.length() != 0) {
- phoneRecursive(digits, retStatus, phoneKeyMap, "", 0);
- }
-
- System.out.println(retStatus);
- }
-
- /**
- * phoneRecursive
- *
- * @param digits
- * @param retStatus
- * @param phoneKeyMap
- * @param comb
- * @param index
- */
- private void phoneRecursive(String digits, List retStatus, HashMap phoneKeyMap, String comb, int index) {
- if (index == digits.length()) {
- retStatus.add(comb);
- return;
- }
-
- char pos = digits.charAt(index);
- for (char c : ((String) phoneKeyMap.get(String.valueOf(pos))).toCharArray()) {
- phoneRecursive(digits, retStatus, phoneKeyMap, comb + c, index + 1);
- }
- }
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * 425
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0425LetterCombinationsTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0425LetterCombinationsTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("LetterCombinationsTest");
+ String digits = "23";
+
+ HashMap phoneKeyMap = new HashMap();
+ phoneKeyMap.put("0", "");
+ phoneKeyMap.put("1", "");
+ phoneKeyMap.put("2", "abc");
+ phoneKeyMap.put("3", "def");
+ phoneKeyMap.put("4", "ghi");
+ phoneKeyMap.put("5", "jkl");
+ phoneKeyMap.put("6", "mno");
+ phoneKeyMap.put("7", "pqrs");
+ phoneKeyMap.put("8", "tuv");
+ phoneKeyMap.put("9", "wxyz");
+
+ List retStatus = new ArrayList<>();
+
+ if (digits != null && digits.length() != 0) {
+ phoneRecursive(digits, retStatus, phoneKeyMap, "", 0);
+ }
+
+ System.out.println(retStatus);
+ }
+
+ /**
+ * phoneRecursive
+ *
+ * @param digits
+ * @param retStatus
+ * @param phoneKeyMap
+ * @param comb
+ * @param index
+ */
+ private void phoneRecursive(String digits, List retStatus, HashMap phoneKeyMap, String comb, int index) {
+ if (index == digits.length()) {
+ retStatus.add(comb);
+ return;
+ }
+
+ char pos = digits.charAt(index);
+ for (char c : ((String) phoneKeyMap.get(String.valueOf(pos))).toCharArray()) {
+ phoneRecursive(digits, retStatus, phoneKeyMap, comb + c, index + 1);
+ }
+ }
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0433NumIslandsTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0433NumIslandsTest.java
similarity index 92%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0433NumIslandsTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0433NumIslandsTest.java
index 534bc9f4d6..2b7b048250 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode0433NumIslandsTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0433NumIslandsTest.java
@@ -1,94 +1,94 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * 433
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode0433NumIslandsTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode0433NumIslandsTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- // INIT GRID
- boolean[][] grid = { { true, true, false, false, false }, { false, true, false, false, true }, { false, false, false, true, true },
- { false, false, false, false, false }, { false, false, false, false, true }
-
- };
-
- // NULL CHECK
- if (grid.length == 0 || grid[0].length == 0) {
- System.out.println("NULL");
- // return 0;
- }
-
- // GET SIZE
- int n = grid.length;
- int m = grid[0].length;
-
- // ARRAY FOR VISITED LOG
- boolean[][] visited = new boolean[n][m];
-
- int count = 0;
-
- // LOOP FOR GRID
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- if (grid[i][j] && !visited[i][j]) {
- numIslandsDFS(grid, visited, i, j);
- count++;
- }
- }
- }
-
- System.out.println(count);
-
- }
-
- /**
- *
- * @param grid
- * @param visited
- * @param x
- * @param y
- */
- public void numIslandsDFS(boolean[][] grid, boolean[][] visited, int x, int y) {
- if (x < 0 || x >= grid.length) {
- return;
- }
-
- if (y < 0 || y >= grid[0].length) {
- return;
- }
-
- if (grid[x][y] != true || visited[x][y]) {
- return;
- }
-
- visited[x][y] = true;
-
- // Recursive call
- numIslandsDFS(grid, visited, x - 1, y);
- numIslandsDFS(grid, visited, x + 1, y);
- numIslandsDFS(grid, visited, x, y - 1);
- numIslandsDFS(grid, visited, x, y + 1);
-
- }
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * 433
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode0433NumIslandsTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode0433NumIslandsTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ // INIT GRID
+ boolean[][] grid = { { true, true, false, false, false }, { false, true, false, false, true }, { false, false, false, true, true },
+ { false, false, false, false, false }, { false, false, false, false, true }
+
+ };
+
+ // NULL CHECK
+ if (grid.length == 0 || grid[0].length == 0) {
+ System.out.println("NULL");
+ // return 0;
+ }
+
+ // GET SIZE
+ int n = grid.length;
+ int m = grid[0].length;
+
+ // ARRAY FOR VISITED LOG
+ boolean[][] visited = new boolean[n][m];
+
+ int count = 0;
+
+ // LOOP FOR GRID
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < m; j++) {
+ if (grid[i][j] && !visited[i][j]) {
+ numIslandsDFS(grid, visited, i, j);
+ count++;
+ }
+ }
+ }
+
+ System.out.println(count);
+
+ }
+
+ /**
+ *
+ * @param grid
+ * @param visited
+ * @param x
+ * @param y
+ */
+ public void numIslandsDFS(boolean[][] grid, boolean[][] visited, int x, int y) {
+ if (x < 0 || x >= grid.length) {
+ return;
+ }
+
+ if (y < 0 || y >= grid[0].length) {
+ return;
+ }
+
+ if (grid[x][y] != true || visited[x][y]) {
+ return;
+ }
+
+ visited[x][y] = true;
+
+ // Recursive call
+ numIslandsDFS(grid, visited, x - 1, y);
+ numIslandsDFS(grid, visited, x + 1, y);
+ numIslandsDFS(grid, visited, x, y - 1);
+ numIslandsDFS(grid, visited, x, y + 1);
+
+ }
+}
diff --git a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode1480DotProductTest.java b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode1480DotProductTest.java
similarity index 89%
rename from src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode1480DotProductTest.java
rename to src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode1480DotProductTest.java
index fb62a811a0..f153218e37 100644
--- a/src/test/java/com/ossez/lang/tutorial/tests/lintcode/LintCode1480DotProductTest.java
+++ b/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode1480DotProductTest.java
@@ -1,35 +1,35 @@
-package com.ossez.lang.tutorial.tests.lintcode;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * 1480
- *
- *
- *
- * @author YuCheng
- *
- */
-public class LintCode1480DotProductTest {
-
- private final static Logger logger = LoggerFactory.getLogger(LintCode1480DotProductTest.class);
-
- /**
- *
- */
- @Test
- public void testMain() {
- logger.debug("BEGIN");
- int t = 87;
- int[] dur = { 20, 25, 19, 37 };
- // Write your code here
- }
-
-}
+package com.ossez.codebank.algorithm.tests.lintcode;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * 1480
+ *
+ *
+ *
+ * @author YuCheng
+ *
+ */
+public class LintCode1480DotProductTest {
+
+ private final static Logger logger = LoggerFactory.getLogger(LintCode1480DotProductTest.class);
+
+ /**
+ *
+ */
+ @Test
+ public void testMain() {
+ logger.debug("BEGIN");
+ int t = 87;
+ int[] dur = { 20, 25, 19, 37 };
+ // Write your code here
+ }
+
+}