From a76e4f87aff081fbf4e364c2069e69e5d80dd80e Mon Sep 17 00:00:00 2001 From: shashwatregmi Date: Thu, 11 Jun 2020 00:04:03 -0700 Subject: [PATCH 1/5] Solution to Question 1 --- ques-1/.idea/$CACHE_FILE$ | 23 + ques-1/.idea/$PRODUCT_WORKSPACE_FILE$ | 53 +++ ques-1/.idea/.gitignore | 2 + ques-1/.idea/codeStyles/Project.xml | 28 ++ ques-1/.idea/codeStyles/codeStyleConfig.xml | 5 + ques-1/.idea/dbnavigator.xml | 454 ++++++++++++++++++++ ques-1/.idea/misc.xml | 19 + ques-1/.idea/modules.xml | 8 + ques-1/.idea/vcs.xml | 6 + ques-1/out/production/ques-1/Main.class | Bin 0 -> 1551 bytes ques-1/ques-1.iml | 11 + ques-1/src/Main.java | 27 ++ 12 files changed, 636 insertions(+) create mode 100644 ques-1/.idea/$CACHE_FILE$ create mode 100644 ques-1/.idea/$PRODUCT_WORKSPACE_FILE$ create mode 100644 ques-1/.idea/.gitignore create mode 100644 ques-1/.idea/codeStyles/Project.xml create mode 100644 ques-1/.idea/codeStyles/codeStyleConfig.xml create mode 100644 ques-1/.idea/dbnavigator.xml create mode 100644 ques-1/.idea/misc.xml create mode 100644 ques-1/.idea/modules.xml create mode 100644 ques-1/.idea/vcs.xml create mode 100644 ques-1/out/production/ques-1/Main.class create mode 100644 ques-1/ques-1.iml create mode 100644 ques-1/src/Main.java diff --git a/ques-1/.idea/$CACHE_FILE$ b/ques-1/.idea/$CACHE_FILE$ new file mode 100644 index 0000000..242175e --- /dev/null +++ b/ques-1/.idea/$CACHE_FILE$ @@ -0,0 +1,23 @@ + + + + + + + + + Shell Script + + + Version control + + + + + Ant + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/$PRODUCT_WORKSPACE_FILE$ b/ques-1/.idea/$PRODUCT_WORKSPACE_FILE$ new file mode 100644 index 0000000..7d625f7 --- /dev/null +++ b/ques-1/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + 1.8 + + + + + + + + 1.8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/.gitignore b/ques-1/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/ques-1/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/ques-1/.idea/codeStyles/Project.xml b/ques-1/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..3cdc6ae --- /dev/null +++ b/ques-1/.idea/codeStyles/Project.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/codeStyles/codeStyleConfig.xml b/ques-1/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/ques-1/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ques-1/.idea/dbnavigator.xml b/ques-1/.idea/dbnavigator.xml new file mode 100644 index 0000000..fa07a9e --- /dev/null +++ b/ques-1/.idea/dbnavigator.xml @@ -0,0 +1,454 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/misc.xml b/ques-1/.idea/misc.xml new file mode 100644 index 0000000..a3bd71a --- /dev/null +++ b/ques-1/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/modules.xml b/ques-1/.idea/modules.xml new file mode 100644 index 0000000..15613b1 --- /dev/null +++ b/ques-1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ques-1/.idea/vcs.xml b/ques-1/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ques-1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ques-1/out/production/ques-1/Main.class b/ques-1/out/production/ques-1/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..cec3e995597acb9f4878e65dd556099eea2f3026 GIT binary patch literal 1551 zcmZuxO?T5q6uo21lB_7fIC0XJq)h_^+X->nrj+847HBCh4hk5OnyeICB%-$LBg;7_ z`~Hb;y6A>=yD*&6!w=vmar$*fvJY~@LNjl!-rRTJosnMu^T#Uy8>kzY!McV|3?#5_ z;8T1iqm48^#}y4<7|^h;nKn;7rx^oO}KDf#W~44_ZXB)lS21?b^O8*F#VVj@%wOs@t~fl?BpI zT(7xfyS@bT`<05Moai~W-#FT}TYd6~3LlrLfzu0a_`ZE2kk}`f4s8F>32ObefF3yQ zZq@At0@Kx}_OV^+2X3o$$L<|%+g%o#9anSG9VsfGPT!26mhByuDqi3mI{q+g4B8^? zWG%28Ke9yFAKj)QZMMdO`TZD8E%06MupAmj)$Dfq9j^t9TBq+foZGH+FfC15liire zVOHSmsm?TfYvMM(GjRtM4d0u%i>km}m>8;!D&Oq8t)}DC$-Iee+>?VvA6FL%6-?~l zzJ>=TYItbk5q3@N;Rh4*SYSg^hCt>mr*-huY0&COPuvs%?N}b0^+Y;QDa0%oImz>F zbi9C^y}J(2GMA4fMa<>G^(zvm5Jn72zk!#{gf2X{{2Pj zR6?E0NHf-;bIwrP9Mzu3Bro|C9uskici6h@V}n}f@Bkm;BknffV3AQ$>Zd(RoMm*L z7=J4`!UbHU8_Ptc0}*nGNS??vl)qtUD2TuKIlaNu8WXI7Q@T}G6|1hPR$XVDQ8lZYQLnGezd-h_`&n)VwJx#8i_~7E_p*b + + + + + + + + + + \ No newline at end of file diff --git a/ques-1/src/Main.java b/ques-1/src/Main.java new file mode 100644 index 0000000..40264a2 --- /dev/null +++ b/ques-1/src/Main.java @@ -0,0 +1,27 @@ +import java.util.ArrayList; +import java.util.HashMap; + +public class Main { + + private static void findPairs(int[] testArray, int targetSum) { + HashMap tempList = new HashMap<>(); + + for (int i = 0; i < testArray.length; i++){ + int searchValue = targetSum - testArray[i]; + + if (tempList.containsKey(searchValue)){ + System.out.println("(" + testArray[i] + ", " + searchValue + ")"); + tempList.remove(searchValue); + } else { + tempList.put(testArray[i], i); + } + } + } + + + public static void main (String args[]){ +// int[] testArray = {2, 4, 5, 1, 3, 5, 4}; +// int targetSum = 6; +// findPairs(testArray, targetSum); + } +} From d529f292aa7d2c71f285ee04c1952b99a3d13daa Mon Sep 17 00:00:00 2001 From: shashwatregmi Date: Thu, 11 Jun 2020 00:15:35 -0700 Subject: [PATCH 2/5] Solution to Question 2 --- ques-2/.idea/$CACHE_FILE$ | 23 + ques-2/.idea/$PRODUCT_WORKSPACE_FILE$ | 53 +++ ques-2/.idea/.gitignore | 2 + ques-2/.idea/codeStyles/Project.xml | 28 ++ ques-2/.idea/codeStyles/codeStyleConfig.xml | 5 + ques-2/.idea/dbnavigator.xml | 454 ++++++++++++++++++++ ques-2/.idea/misc.xml | 19 + ques-2/.idea/modules.xml | 8 + ques-2/.idea/vcs.xml | 6 + ques-2/out/production/ques-2/Main.class | Bin 0 -> 1531 bytes ques-2/ques-2.iml | 11 + ques-2/src/Main.java | 25 ++ 12 files changed, 634 insertions(+) create mode 100644 ques-2/.idea/$CACHE_FILE$ create mode 100644 ques-2/.idea/$PRODUCT_WORKSPACE_FILE$ create mode 100644 ques-2/.idea/.gitignore create mode 100644 ques-2/.idea/codeStyles/Project.xml create mode 100644 ques-2/.idea/codeStyles/codeStyleConfig.xml create mode 100644 ques-2/.idea/dbnavigator.xml create mode 100644 ques-2/.idea/misc.xml create mode 100644 ques-2/.idea/modules.xml create mode 100644 ques-2/.idea/vcs.xml create mode 100644 ques-2/out/production/ques-2/Main.class create mode 100644 ques-2/ques-2.iml create mode 100644 ques-2/src/Main.java diff --git a/ques-2/.idea/$CACHE_FILE$ b/ques-2/.idea/$CACHE_FILE$ new file mode 100644 index 0000000..242175e --- /dev/null +++ b/ques-2/.idea/$CACHE_FILE$ @@ -0,0 +1,23 @@ + + + + + + + + + Shell Script + + + Version control + + + + + Ant + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/$PRODUCT_WORKSPACE_FILE$ b/ques-2/.idea/$PRODUCT_WORKSPACE_FILE$ new file mode 100644 index 0000000..7d625f7 --- /dev/null +++ b/ques-2/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + 1.8 + + + + + + + + 1.8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/.gitignore b/ques-2/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/ques-2/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/ques-2/.idea/codeStyles/Project.xml b/ques-2/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..3cdc6ae --- /dev/null +++ b/ques-2/.idea/codeStyles/Project.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/codeStyles/codeStyleConfig.xml b/ques-2/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/ques-2/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ques-2/.idea/dbnavigator.xml b/ques-2/.idea/dbnavigator.xml new file mode 100644 index 0000000..fa07a9e --- /dev/null +++ b/ques-2/.idea/dbnavigator.xml @@ -0,0 +1,454 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/misc.xml b/ques-2/.idea/misc.xml new file mode 100644 index 0000000..a3bd71a --- /dev/null +++ b/ques-2/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/modules.xml b/ques-2/.idea/modules.xml new file mode 100644 index 0000000..f7d14ca --- /dev/null +++ b/ques-2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ques-2/.idea/vcs.xml b/ques-2/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ques-2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ques-2/out/production/ques-2/Main.class b/ques-2/out/production/ques-2/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..93bd57325194d7afef70b5b048826ed6e2297da6 GIT binary patch literal 1531 zcm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+ + + + + \ No newline at end of file diff --git a/ques-2/src/Main.java b/ques-2/src/Main.java new file mode 100644 index 0000000..4adcd4a --- /dev/null +++ b/ques-2/src/Main.java @@ -0,0 +1,25 @@ +import java.util.LinkedList; +import java.util.Stack; + +public class Main { + + private static boolean isPalindrome(String testString) { + Stack stack = new Stack<>(); + String temp = ""; + + for (int i = 0; i < testString.length(); i++){ + stack.push(testString.charAt(i)); + } + while (!stack.empty()){ + temp = temp + String.valueOf(stack.pop()); + } + + return temp.equals(testString); + } + + public static void main (String args[]){ +// if (!isPalindrome("radar")){ +// System.out.println("Mistake"); +// } + } +} From e219679c36e6819f286b029dbbc2c1170c894cca Mon Sep 17 00:00:00 2001 From: shashwatregmi Date: Thu, 11 Jun 2020 10:53:48 -0700 Subject: [PATCH 3/5] Update to ques-1 solution --- ques-1/.idea/codeStyles/Project.xml | 24 ++++++++++++++++++++++++ ques-1/out/production/ques-1/Main.class | Bin 1551 -> 1436 bytes ques-1/src/Main.java | 12 ++++++------ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ques-1/.idea/codeStyles/Project.xml b/ques-1/.idea/codeStyles/Project.xml index 3cdc6ae..49f7b87 100644 --- a/ques-1/.idea/codeStyles/Project.xml +++ b/ques-1/.idea/codeStyles/Project.xml @@ -24,5 +24,29 @@