├── .DS_Store ├── .gitignore ├── .idea ├── $CACHE_FILE$ ├── $PRODUCT_WORKSPACE_FILE$ ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── dictionaries │ └── neeraj.xml ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── modules.xml ├── sonarlint │ └── securityhotspotstore │ │ ├── 0 │ │ ├── 3 │ │ │ └── 0365ac3d7f9862663fba44e119a4212d0923b514 │ │ ├── 4 │ │ │ ├── 0469a6ca14b476630f27e417377c5e3d2b0c2131 │ │ │ └── 04c80311e89383b7fad31a8e77d9f17a715ddc7a │ │ ├── 5 │ │ │ └── 0515ee178ffd24487b83b5e3fbbc9cd9a536dd61 │ │ ├── b │ │ │ └── 0b0c924fb4eacad2fea1e1cdd6ad6ab65d33e146 │ │ ├── d │ │ │ ├── 0d84f25028fa7cd4bfb456b9e8c8e19b082606c3 │ │ │ └── 0dc81f2d23f23f59f35e99eed86807fa142fac47 │ │ ├── e │ │ │ └── 0e1719e8798ca5fdc6f479b752b644dcf6fc5e51 │ │ └── f │ │ │ └── 0fa57503214fdf2617f0e01fa012fe7e30178233 │ │ ├── 1 │ │ ├── 0 │ │ │ └── 1041b354b617348477365f7534c48e912b44cfda │ │ ├── 2 │ │ │ └── 12e7b156bec53c789f03a5a51afccf1c4adb142e │ │ ├── 3 │ │ │ └── 13942c6cc5cd9a51a7a391aad2fb397f52734d17 │ │ ├── 4 │ │ │ └── 1422b3eea0afb60c212dff58f0f9dadfbfdf835d │ │ ├── 5 │ │ │ └── 152aaca6f24ad3b8ca4f49d899788249c08f1a29 │ │ ├── 6 │ │ │ └── 16c695b0f8df9f8fc161ecb0d92d8cdfa946034d │ │ ├── 8 │ │ │ └── 18cfb598bade92bf4f8e5f986f7ab767942e46fb │ │ ├── b │ │ │ ├── 1b0bfe9b454f292087b0ea3daa616c34177c1443 │ │ │ └── 1ba3542173272014d34e04a49215ec5f67366866 │ │ ├── c │ │ │ ├── 1c0c967f865f75c03948fb841aa3f9d73d177436 │ │ │ └── 1c4571cdd1b79642bf82a7c253270d5c62a732f9 │ │ └── e │ │ │ └── 1eae734b9ff03f82550af5f37dca4b51197aa53e │ │ ├── 2 │ │ ├── 4 │ │ │ ├── 240d8d8de15972747d9c9f8cf40ad167802daf1f │ │ │ ├── 243551ed2dbe317c9c3b2878fa6c0c4a5ce6df2b │ │ │ └── 245e6d8d42f75477f4765c0ab4c805ac9cbcd883 │ │ ├── 8 │ │ │ ├── 287f96e1a204a41102f88acab31487c60b464e2e │ │ │ └── 28b1eb9a8137fef411655fbf5a5b78b3240f98f6 │ │ ├── 9 │ │ │ ├── 29098f46debe5fa8e0f08f8834ca8d9c48b3aa35 │ │ │ ├── 292ad351c59417ea518ff9b01d10167281b82dbd │ │ │ ├── 293006e63d2126839990cd1a6d3ce5fd7f2d32f2 │ │ │ ├── 296cab2a2f4ee67a245aba40824fc3b2edd46aa5 │ │ │ └── 29ac99214dc746d81f45d6c577a4e07c254277c0 │ │ ├── b │ │ │ └── 2bca228ca15756675d10a7ba6dcb0d7e066c9e55 │ │ ├── c │ │ │ └── 2cd4575b83b651958f2be26659328c3d663f1b3f │ │ └── f │ │ │ ├── 2fc1d1c47dc652209681c8c91141adb385149dcf │ │ │ └── 2ff7ab8ea7d0ada2a66f7c47a957145303b9f205 │ │ ├── 3 │ │ ├── 0 │ │ │ ├── 30737f23b738b1241dfa71e12a756f5271a3c1b9 │ │ │ └── 30cabcad22c7f5865179edc5e45f5dd7778a7eed │ │ ├── 1 │ │ │ └── 31e575b080bb851f3621cb3f3305e4b203e6287b │ │ ├── 2 │ │ │ └── 3245bf6625358af7eb6360771bf2bd5f512825bd │ │ ├── 7 │ │ │ └── 3724b029773a08cf894be9dca4e5d40a1d46b569 │ │ ├── a │ │ │ └── 3ad3ea39da3d7d0e489e535162bc42dc8e47673d │ │ ├── d │ │ │ └── 3dd065ec14e460d67c9b20f1a9f4101f28a37d9a │ │ ├── e │ │ │ └── 3e95cd1c8ee367614986c78aa047a283b4b2c814 │ │ └── f │ │ │ └── 3f956219d97d4df55ea959e772d05fd940e5f4b6 │ │ ├── 4 │ │ ├── 0 │ │ │ └── 4047cbb8a658b4a9660ac07eb63550aa4b1121a9 │ │ ├── 2 │ │ │ └── 42922770200d8f638dd3f919f8ce9ac6d4960132 │ │ ├── 3 │ │ │ └── 43a0ccbb4c08815882338f006932f9432a15f91b │ │ ├── 8 │ │ │ └── 484528874d4e2d1dbb4fddea11a748a67dd0b782 │ │ ├── 9 │ │ │ ├── 4981bd8315bd0c3bb14f1f5d93cd0b5dec52e598 │ │ │ └── 49b83f5cc20c7d1f398f63846f40e56234c10480 │ │ ├── b │ │ │ └── 4bfbf71b69c73768469b8d25e614a9c8694b224d │ │ ├── c │ │ │ └── 4cbdc07e9bc683b9d3bc454cdf0a12ff80ed05ca │ │ └── e │ │ │ ├── 4e1af42cc3b8beac410404c9848ce0f4c0f01603 │ │ │ └── 4ed86a7e8a5bc629e27de5b99ac22aec02a1e91c │ │ ├── 5 │ │ ├── 0 │ │ │ └── 5020524bf14398707da6bf517feea38d52530332 │ │ ├── 3 │ │ │ └── 537d2655d4c0be2860ecad15f6c2e0f57a8b22d1 │ │ ├── 4 │ │ │ ├── 54a597757fec4e5a255fd18c3c697629e72bc82c │ │ │ └── 54fb5c957a03e98f57c545c322d68f4de669840f │ │ ├── 7 │ │ │ └── 5782080b5ce62dff12506f862017e18622c22080 │ │ ├── a │ │ │ └── 5a49839e89345da179226f48072f6cd15297c8fc │ │ ├── b │ │ │ ├── 5b22f02bcc196eb59e6e241595fffdc7bc17f2c3 │ │ │ ├── 5b8187baca6ed5db49b55b2d48275f7ce644c858 │ │ │ └── 5bad06b056383567e8d2911b6f5f0afde6f76ae9 │ │ ├── c │ │ │ └── 5c7e53b293ba772bc655afe480c25221d2a8a9b4 │ │ └── d │ │ │ ├── 5d6efc9a0cdefc4d188cf5dbd9d25e56912a4104 │ │ │ └── 5dc5d0a7299a1333f31c2f693675f3b124723cb5 │ │ ├── 6 │ │ ├── 1 │ │ │ ├── 6137b1dc89471b6ab84774ee8ac4e80236a6f3e8 │ │ │ └── 61acbcf0483a671756ce9aa47508e6f121c45f99 │ │ ├── 2 │ │ │ ├── 62281ca91a5b4781383f26dd37f334edb68f634d │ │ │ ├── 626798a1aafe2f5db8c9fb50692e911f0f4cb57d │ │ │ └── 629304b7937b4ea80a5645db596aee463e53e2ba │ │ ├── 4 │ │ │ └── 641856166614a7e5abca10b06e2e9fba7cffe555 │ │ └── 8 │ │ │ └── 68ad29d5455c6423df1236c955ef1a65ce161b21 │ │ ├── 7 │ │ ├── 3 │ │ │ └── 73a76d5d317fa07e8c411e66fd4b3b90c916c2d3 │ │ ├── 4 │ │ │ └── 740431f73c77cbde3a53b351321dc0f707837661 │ │ ├── 5 │ │ │ └── 7517c9c65e2cce5eba62e480c0e1709329f9b63e │ │ ├── 7 │ │ │ ├── 7705eb3f4e8767b8e66bf4a6a11c0c9a03b15b28 │ │ │ ├── 7746d4446298d49eed67f85028b043b00f20c75b │ │ │ └── 775521b9f4af2999f3123195bcbcdef8dfea4b2a │ │ ├── 9 │ │ │ └── 79442ff30dc86c44cf010d76906791a0a6df68cd │ │ ├── a │ │ │ └── 7aa488f56a9a64d7e8618b8ff622cb42be10f620 │ │ ├── b │ │ │ └── 7bbdf0c7452bf1b331cf3714ccac37372c6646bd │ │ ├── d │ │ │ └── 7d088dc72e01c057db42052d86f21e62488696a4 │ │ ├── e │ │ │ └── 7eb8b7306014865bc3470a7002a52d61b90a3906 │ │ └── f │ │ │ ├── 7f8f4b6d3985ac7263dac9a829d65ae96d51e3c5 │ │ │ └── 7f9a03c1ad0adabbcd980641b61c9eba23d400bc │ │ ├── 8 │ │ ├── 0 │ │ │ └── 80d9ab7cb8bbcf9011b9124bf66e94190ae441d0 │ │ ├── 2 │ │ │ └── 823de290d7aa8f3b032a62e01fb82bbdbd3bf91c │ │ ├── 3 │ │ │ └── 837eacd5246b5ce085cafde184cdad621d5a7df9 │ │ ├── 4 │ │ │ ├── 8417fe7e9857b33c2be5d0a3516bb837fe4a9ad8 │ │ │ ├── 842b339082b4e7ca9eb01c833e9e26bd0910f921 │ │ │ └── 84d662dc7bc0855475911927540c094f154151f8 │ │ ├── 5 │ │ │ ├── 85088b855d49d73dc4742572b7bf9d8e373cc633 │ │ │ └── 85cd56255ffe9443577f49f008e9217db813d6a4 │ │ ├── 8 │ │ │ ├── 880f1a9cd157e0ef67223d4e3f3c4c708d5e545c │ │ │ └── 88a51629d0e9c1e55ade102b61e3ee7013905ffb │ │ ├── a │ │ │ └── 8a635e1d7ebc4b388e1f6a0acec192e510eaf8bc │ │ ├── b │ │ │ ├── 8b4bbada528cadc21d61c18e6ad6b487b0f5db07 │ │ │ └── 8bf5ab550ea3ad55b70208c99aa84a1ef6966e61 │ │ └── f │ │ │ ├── 8f1db205e267df937586fcb486646a00e85b177c │ │ │ └── 8fd621cfbc258e90b95adc3aa661baa7e652327e │ │ ├── 9 │ │ ├── 3 │ │ │ └── 93cbbe310e80d95e42195175e7ed5f279f59d624 │ │ ├── 4 │ │ │ └── 9459d30d1d37bb9a689bf953a036f2fde9a0704e │ │ ├── 8 │ │ │ ├── 988cd766217075bd21d71158e4dcad4cdb968de0 │ │ │ └── 98e3af8b3ecfd2d0fd1a992d937a5c220aa91490 │ │ ├── 9 │ │ │ └── 9910a0463fe71c2ec9a0b87dd8d36015602945f5 │ │ ├── a │ │ │ └── 9a1be5d3cc320a2e2e5894364c20ad109702704f │ │ ├── c │ │ │ └── 9c8795e5bb3bbf5782282e1dc5865612f91b8aa5 │ │ ├── d │ │ │ ├── 9d7ba72ab8b65caa9c30bc626ce8d58e1673fe1c │ │ │ └── 9dcb91e9fd85e16ca208e07c21f48034a6bc0607 │ │ ├── e │ │ │ ├── 9e061d0c42ee81752786355062d8354642218f9b │ │ │ └── 9edc2fc5b43f762c490bd33023222e49930280ef │ │ └── f │ │ │ └── 9ffbc3978b2553558f50ed0b96776f6c3a6a5fc4 │ │ ├── a │ │ ├── 0 │ │ │ └── a0ea511d91dad158be72e642b908fdc537c2faae │ │ ├── 1 │ │ │ └── a1b6174dd99489d383a0014861e71ca7d1d9cdf3 │ │ ├── 2 │ │ │ └── a20ebe159ca45eaef83eedc86d9b70f11cbede21 │ │ ├── 3 │ │ │ └── a360ef451bf77a192979c2857819c068ce37c68c │ │ ├── 4 │ │ │ ├── a4a0277e5699ebcfa712673cb97011b957de115d │ │ │ └── a4c5bee28bd4f44af63d0d0f4788bc72d2044f60 │ │ ├── 5 │ │ │ └── a5e8fa0e90979690627ca3b1ca4f3f0ff7c7f133 │ │ ├── 8 │ │ │ └── a8512e2009db5577d3d859e7095643309b8bd812 │ │ ├── 9 │ │ │ ├── a95ae4896b9c36fb1f44b9f99345b3526717c534 │ │ │ └── a9691986d5e8d68f4be10b23ca30dacfdb56212a │ │ ├── d │ │ │ └── ad752d633dabf59c62297be5903f4c781ca2784c │ │ └── e │ │ │ ├── ae5f181474892ccdf2c74c966aa18984f0536ce1 │ │ │ └── ae68464d87ff98434f58e9606a9b1b3e948b6fa6 │ │ ├── b │ │ ├── 1 │ │ │ ├── b122c31eb9d3956bccadb1c6ed695148e4edf04d │ │ │ └── b146f34b32d8b30ca21d39c00a1a8f2a1e951d20 │ │ ├── 2 │ │ │ └── b2502889bd85639bcfbc6a8c84299bc26409ea0a │ │ ├── 3 │ │ │ └── b3936db179884306aa7fbd937b76f003a48e5d16 │ │ ├── 4 │ │ │ └── b44fc91d95917fb152c09b013b8a8cc2f8bfb41c │ │ ├── 7 │ │ │ └── b7385308cb9985b8149a93f8a80204ed01183f50 │ │ └── a │ │ │ ├── baa9157ab2373cf99ac76964e645c17d1cf55c7a │ │ │ ├── babc169747be7771ef9d6b891ab62d662667322a │ │ │ └── babddd82270bb0a0e41a6f5537062ddf71532892 │ │ ├── c │ │ ├── 0 │ │ │ ├── c01937c8b57ab4a79cbafe2adc72f718becb81ca │ │ │ └── c062fa0db9696e90f7675102613ecf2d80b0cc86 │ │ ├── 2 │ │ │ └── c26892a108b6be66683717e7f268fc256866eee3 │ │ ├── 4 │ │ │ └── c46579e3e465e1968b98c0a10f10e3e6c24e2fa2 │ │ ├── 6 │ │ │ └── c60708931b9d6225fdf39c99f1abd0b4bbd5935a │ │ ├── 9 │ │ │ └── c913ba4af87aa6d17018ea577bb281abe654c24b │ │ ├── d │ │ │ ├── cdab25f1e12d2773e75ba193b1f57c405886a60f │ │ │ └── cde3c81a353ab7174d45371b4a2d96e4626664fd │ │ └── e │ │ │ └── cece693346382cd96b0fbe7774d4f9d2da4b4d2e │ │ ├── d │ │ ├── 0 │ │ │ └── d0b5c20ecb879dbd3844cab46d1509dc5e6491fc │ │ ├── 1 │ │ │ ├── d15895f49923ea462ccfabf970b4fe36822307b9 │ │ │ └── d1613a63887f5eb7545f1ecc490e5db10d4d9255 │ │ ├── 4 │ │ │ ├── d4df8bcc4a53a4e92921c808d6081cf98824f157 │ │ │ └── d4f3edba4edc0fb9e0bc66f7843843b6231122b1 │ │ ├── 7 │ │ │ └── d76fbdb705dd646103b69f1f50feced5beec971c │ │ ├── 8 │ │ │ └── d8aef22f6b19e114439bb8fb0df448a10c0af13c │ │ ├── d │ │ │ └── dd52aafe666368428a0c03b552628fd973190f60 │ │ └── e │ │ │ └── de43641ccff9090a46ece98571da06151598226e │ │ ├── e │ │ ├── 1 │ │ │ ├── e10bf1ceb482359ce93b3a12bad448e6d209c607 │ │ │ └── e1b6cfba94234e5a5a1edd6e371e5ad5e8114e38 │ │ ├── 4 │ │ │ ├── e4a421483dde35ca88decbae536a3b8954994ac2 │ │ │ └── e4e9b5f71348b3a9c0a19846e0ae25ab7b029518 │ │ ├── 5 │ │ │ └── e5bb90d13a9023ed45834dfbaf922543b5769a24 │ │ ├── 6 │ │ │ └── e688b6f5bf16a20ef577d0fdbb26a1d1e0f94d20 │ │ ├── 7 │ │ │ └── e70f4451ccdbbe05dbb77c681ba8acc84121be28 │ │ ├── 9 │ │ │ ├── e949761c3d035376994fa023e5d943fca8f4303d │ │ │ └── e99e1a584851c40caee2e6e83f9b996e29345e7f │ │ ├── c │ │ │ └── ecef41f70fcef12a5320d0da668ec1f6d14bce6b │ │ ├── d │ │ │ └── ed1afecd996311a3fa841f8bef9ea4c101a0ca07 │ │ └── f │ │ │ ├── efed32705a5621a88ca14275a62b7098c2dc63c1 │ │ │ └── eff6284356c79c1e388a37af050953012c4a9ef4 │ │ ├── f │ │ ├── 1 │ │ │ └── f1bf67ba56a3da73fac9a0121696a1d81c9693bc │ │ ├── 4 │ │ │ └── f46151162ee1a5ccadd24004d1f5e4199d1a0116 │ │ ├── 5 │ │ │ └── f513a7c9b050e5f34b2932618200209cf1df1e91 │ │ ├── 8 │ │ │ ├── f8af6a68142b16bd6ea5994b2e1a519e7e8c5751 │ │ │ └── f8bc835c52ebff55c42e58a89446603d8e4ab042 │ │ ├── b │ │ │ └── fb4722b54c19c327ac06865e664687ecf557e99b │ │ └── d │ │ │ └── fde0db80a46ec2575da52e56e372218c8f5b7bb6 │ │ └── index.pb ├── uiDesigner.xml ├── vcs.xml └── workspace.xml ├── README.md ├── data-structures.iml └── src ├── .DS_Store ├── Encryptor.java ├── FibonaciPractical.java ├── Hypotenuse.java ├── Main.java ├── Sample.java └── com ├── algoexpert ├── CountOfSmallerNumbersAfterSelf.java ├── LongestStringChain.java ├── ProductSum.java └── UnderscorifyStrings.java ├── career_cup └── ClosestValueInAnArray.java ├── company ├── amazon │ ├── AllAnagrams.java │ ├── AllPossibleStringsUsingSpaces.java │ ├── AmazonFreshDeliveryService.java │ ├── AmazonPrimeOrdersSorting.java │ ├── AngleBetweenHourHandAndMinuteHand.java │ ├── BinaryTree.java │ ├── BinaryTreeIsHeap.java │ ├── BoundryTraversalOfBinaryTree.java │ ├── BuildLowestNumberByRemovingNDigits.java │ ├── CheckIfPointFormSquare.java │ ├── ConstructBSTFromPreOrder.java │ ├── ConvertArrayIntoZigZagFashion.java │ ├── ConvertTreeIntoSumTree.java │ ├── CountNumberOfTriangles.java │ ├── CountTripletsWithSumSmallerThenGivenNumber.java │ ├── DeleteNodeInBinarySearchTree.java │ ├── DiameterOfBinaryTree.java │ ├── DistanceBetween2NodesInBinaryTree.java │ ├── EqualPointsInArrayOfBrackets.java │ ├── Equilibrium.java │ ├── EvaluationOfExpression.java │ ├── ExcelColumnNameFromNumber.java │ ├── ExtractLeavesFromBinaryTreeToDoublyLinkedList.java │ ├── ExtractMaximumValueInString.java │ ├── Fibonaci.java │ ├── FindNumberOfIteration.java │ ├── Heap.java │ ├── InorderSuccessorAndPredecessor.java │ ├── IntegerToBinary.java │ ├── IsBinaryTreeASumTree.java │ ├── JumpingNumbersSmallerThanOrEqualToGivenValue.java │ ├── KnightsTourProblem.java │ ├── LinkedListUtil.java │ ├── LongestConsecutiveSequenceInBinaryTree.java │ ├── LongestPalindromicParenthesesSubstring.java │ ├── LongestPalindromicSubstring.java │ ├── LookNSaySequence.java │ ├── LowestCommonAncestor.java │ ├── MajorityElementInArray.java │ ├── MaximumSumPathInTwoArrays.java │ ├── MaximumSumSuchThatNo2ElementsAreAdjacent.java │ ├── MedianOfTwoSortedArrays.java │ ├── MinimumElementInSortedRotatedArray.java │ ├── MinimumSumOfSquaresOfCharacterCount.java │ ├── NextGreaterPalindrome.java │ ├── NumberOfOccurrencesInArray.java │ ├── PrintAllNodesInBinaryTreeHavingKLeafNodes.java │ ├── PrintAllNodesThatDontHaveSibling.java │ ├── PrintAllRootToLeafPaths.java │ ├── PrintLongestLeafToLeafPathInBinaryTree.java │ ├── PrintPostOrderFromPreorderAndInorder.java │ ├── ProductArrayPuzzle.java │ ├── RatNdMazeProblem.java │ ├── RearrangeCharactersInStringSuchThatNoTwoAdjacentCharactersAreSame.java │ ├── RearrangeOddEvenDataLinkedListNodes.java │ ├── RearrangeOddEvenIndexedLinkedListNodesTogether.java │ ├── ReverseLevelOrderTraversal.java │ ├── RomanToDecimal.java │ ├── RootToLeafPathSumEqualToGivenNumber.java │ ├── RunLengthEncoding.java │ ├── SerializeAndDeserializeTree.java │ ├── SieveOfErastothenes.java │ ├── SlidingWindowMaximum.java │ ├── SmallestWindowInAStringContainingAllCharactersOfOtherString.java │ ├── SnakeNdLadder.java │ ├── SolveNQueensProblem.java │ ├── SortStackUsingRecursion.java │ ├── SortZeroOneAndTwo.java │ ├── SpiralMatrix.java │ ├── Splitwise_MinimizeCashFlowInFriends.java │ ├── TotalNumberOfPathsToReachFromTopLeftToBottomRightWithExactlyKCoins.java │ ├── TotalNumberOfWaysToReachFromTopLeftToBottomRightOfArray.java │ ├── TrappingRainWaterProblem.java │ ├── TypeOfArrayAndMax.java │ ├── XpowerY.java │ ├── dynamicProgramming │ │ ├── CuttingTheRod.java │ │ └── LongestBitonicSubsequence.java │ └── isRobotMovesCircular.java ├── facebook │ ├── AboveAverageSubarrays.java │ ├── AnswerAQuery.java │ ├── ContiguousSubarray.java │ ├── FractionToRecurringDecimal.java │ ├── RandomPickIndex.java │ └── RotationalCipher.java ├── google │ ├── FindMinimumRowInAssembly.java │ ├── LineWrap.java │ ├── RandomStateNameGeneratorBasedOnProportionateToProbabilityOfTotalPopulation.java │ └── WildCards.java └── nearbuy │ ├── CountDuplicates.java │ ├── MaximumDifferenceInAnArray.java │ └── UserNameDisparity.java ├── competitive └── coding │ ├── JDA │ └── JobScheduler.java │ ├── amazon │ ├── SimpleQueries.java │ ├── Source.java │ └── TransformingWords.java │ ├── hackerearth │ ├── MarbleGame.java │ └── ModifyArray.java │ ├── hackerrank │ ├── PatternCount.java │ ├── PrimeNumberOfAppearences.java │ └── TwinArrays.java │ └── spoj │ ├── AggresiveCowProblem.java │ ├── BytelandianGoldCoin.java │ ├── InversionCount.java │ ├── NextPalindromeStackOverflow.java │ └── TheNextPalindrome.java ├── datastructures ├── algorithms │ └── BinarySearch.java ├── array │ ├── ArrayUtil.java │ ├── CurrencyWordConverter.java │ ├── LargestSumContiguousSubArray.java │ ├── MaxIncreasingDecreasing.java │ └── SnakeAndLadder.java ├── graph │ ├── BreadthFirstTraversal.java │ ├── ConnectedComponentsInUndirectedGraph.java │ ├── DetectCycleInADirectedGraph.java │ └── NumberOfIsland.java ├── heap │ ├── HeapSort.java │ └── MinHeap.java ├── linkedlist │ ├── DoublyCircularLinkedList.java │ ├── InsertNodeInList.java │ ├── IntersectionOfLinkedList.java │ ├── LinkedListUtil.java │ ├── LinkedListUtilUser.java │ └── SwapNodesWithoutSwappingData.java ├── mustDoInterviewQuestions │ ├── DP │ │ ├── CuttingTheRod.java │ │ ├── JumpTheArray.java │ │ ├── LongestCommonSubsequence.java │ │ ├── LongestIncreasingSubsequence.java │ │ ├── SubsetSumProblem.java │ │ └── ZeroOneKnapSack.java │ ├── array │ │ ├── EquilibriumPoint.java │ │ ├── KadanesAlgo.java │ │ ├── LeaderIntheArray.java │ │ ├── MaximizeSumOfConsecutiveDifferenceInCircularArray.java │ │ ├── MaximumBitonicSubArray.java │ │ ├── MaximumDifferenceTwoElements.java │ │ ├── MaximumOfAllSubArraysOfSizeK.java │ │ ├── MinimumNumberOfPlatForm.java │ │ ├── PetrolStationCircularTour.java │ │ ├── RearrangeMaximumMinimum.java │ │ ├── RottenOrange.java │ │ ├── SegregateZeroAndOnes.java │ │ ├── SlidingWindowMaximum.java │ │ ├── SortZeroOneAndTwo.java │ │ ├── SpiralMatrix.java │ │ ├── StockBuyAndSell.java │ │ └── SubArraySum.java │ ├── string │ │ ├── Anagram.java │ │ ├── LongestCommonSubstring.java │ │ ├── MinimumNumberOfInsertionForPalindrome.java │ │ └── WordSubsets.java │ └── tree │ │ ├── ConnectNodesAtSameLevel.java │ │ ├── DiagonalOrderTraversal.java │ │ ├── LeftViewOfBinaryTree.java │ │ ├── TopViewOfBinaryTree.java │ │ └── VerticalOrderTraversal.java ├── queue │ ├── QueueUtil.java │ ├── ReverseFirstKElementsInQueue.java │ ├── ReverseQueue.java │ └── SortQueue.java ├── recursion │ ├── AllPossibleBinaryNumbersOfLength_N_WithEqualSumInBothHalves.java │ ├── CombinationInAStringOfDigits.java │ ├── DeleteMiddleElement.java │ ├── GameOfDeathInACircle.java │ ├── GenerateAllBinaryStringWithoutConsecutiveOnes.java │ ├── GenerateAllPossible_PowerSets.java │ ├── GenerateBalancedParenthesis.java │ ├── KthSymbolInGrammar.java │ ├── LetterCasePermutation.java │ ├── PermutationWithCaseChange.java │ ├── PermutationWithSpaces.java │ ├── Print1_To_N.java │ ├── PrintAllPalindromicPartition.java │ ├── PrintAllSubsequenceOfString.java │ ├── PrintN_To_1.java │ ├── PrintSubsetOfAlphabets.java │ ├── PrintSumsOfAllSubsetsOfAGivenSet.java │ ├── Print_N_BinaryNumbers_HavingOneGreaterThanOrEqualToZero.java │ ├── RecursivelyRemoveAllAdjacentDuplicates.java │ ├── ReverseAStack.java │ ├── ReverseString.java │ ├── SortAnArray.java │ ├── SortStackUsingRecursion.java │ └── TowerOfHanoi.java ├── stack │ └── StackUtil.java ├── tree │ └── binaryTree │ │ ├── BinaryTreeUtil.java │ │ └── BinaryTreeUtilUser.java └── tries │ └── TrieImplementation.java ├── geeksforgeeks ├── array │ ├── ArrayRotation.java │ ├── CountNegativeIntegersInRowColumnSortedMatrix.java │ ├── FindDuplicateInO_N_Time_O_1_Space.java │ ├── FindElementThatOccursOnlyOnce.java │ ├── FindMissingNumberInIncreasingSequence.java │ ├── FindPairWithProduct.java │ ├── FindSmallestPositiveNumberMissingFromUnsortedArray.java │ ├── FindTopKNumbersInStream.java │ ├── LeaderInArray.java │ ├── LongestIncreasingSubsequence.java │ ├── MaxSumContiguousSubArray.java │ ├── MaximumSumWithArrayRotation.java │ ├── Median__Of_Two_Sorted_Arrays_With_Explanation.java │ ├── MergeSort.java │ ├── NextGreaterNumber.java │ ├── PairInSortedRotatedArray.java │ ├── PrintAllPossibleWordsFromMobileDigits.java │ ├── QuickSort.java │ ├── RearrangeMaximumAndMinimumWithoutExtraSpace.java │ ├── Rotate2DMatrix.java │ ├── RowWithMaximumOnes.java │ ├── SearchInRotatedSortedArray.java │ ├── SegregateOddAndEven.java │ ├── SegregatePositiveAndNegativeNumbers.java │ ├── SegregateZeroAndOnes.java │ ├── SortArrayAbsoluteDifference.java │ ├── SortedSubsequenceOfLengthThreeInLinearTime.java │ ├── SubSetOfArray.java │ ├── ThreeWayPartitioning.java │ ├── TurnImageBy90Degree.java │ ├── WaveSort.java │ ├── sliding_window │ │ ├── FindMinimumLengthSubArrayWithSumK.java │ │ ├── FindZerosToBeFlipped_Sliding_Window.java │ │ ├── LengthOfLongestSubStringWithoutRepeatingCharacters.java │ │ ├── MaximumNoOfZerosByFlippingOne.java │ │ └── MinimumWindowSubstring.java │ └── sub_array_problem │ │ ├── LargestSubArrayWithEqualNumberOfZeroAndOne.java │ │ ├── LargestSubArrayWithZeroSum.java │ │ ├── MaximumProductSubArray.java │ │ ├── SubArrayWithGivenSum.java │ │ └── SubArrayWithZeroSum.java ├── dynamicProgramming │ ├── BinomialCoefficient.java │ ├── BuySellStockWithKTransactions.java │ ├── CoinChangeMinimumNoOfCoinsRequired.java │ ├── CoinChangingNoOfWays.java │ ├── CuttingTheRodProblem.java │ ├── EditDistance.java │ ├── EggDroppingProblem.java │ ├── KnapSackProblem.java │ ├── LongestBitonicSubsequence.java │ ├── LongestCommonSubsequence.java │ ├── LongestPalindromicSubsequence.java │ ├── LongestPalindromicSubsequenceWithONSpace.java │ ├── MatrixChainMultiplication.java │ ├── MaximumSumInLongestIncreasingSubsequence.java │ ├── MinimumCostPath.java │ ├── MinimumEditDistance.java │ ├── PartitionProblem.java │ ├── PartitionProblemWithMinimumDifference.java │ ├── RangeSumQuery.java │ ├── SubsetSumProblem.java │ ├── TotalWaysToDecodeAString.java │ ├── UniqueBinarySearchTree_CatalanNumber.java │ └── WeightedJobScheduling.java ├── graph │ ├── DisjointSet.java │ ├── Edge.java │ ├── EdgeComparator.java │ ├── GraphUsingDisjointSetDataStructures.java │ ├── GraphUtil.java │ ├── ReGraphUtilPractice.java │ └── Vertex.java ├── heap │ ├── MaxHeap.java │ └── MinHeap.java ├── linkedlist │ ├── DoublyLinkedList.java │ └── LinkedListUtil.java ├── stack │ ├── BalancedParentheses.java │ ├── CelebrityProblem.java │ ├── InfixToPostfix.java │ ├── LongestValidParenthesisSubstring.java │ ├── MinimumNoOfBracketReversals.java │ ├── NextGreaterElement.java │ ├── ReverseStack.java │ ├── SortStack.java │ ├── SpecialMinStack.java │ ├── SpecialMinStackO_1_SpaceComplexity.java │ ├── StackUtil.java │ ├── StackWithFindMiddle.java │ ├── StockSpanProblem.java │ ├── TowerOfHanoi.java │ └── TwoStacks.java ├── string │ ├── Anagram.java │ ├── FilterStringFromHTMLTags.java │ ├── LongestPalindromicSubstring.java │ ├── MinimumNoOfInsertionsToMakePalindrome.java │ ├── PrintAllAnagramsTogether.java │ ├── PrintAllSubString.java │ ├── PrintAllSubsequences.java │ ├── ReverseWordInString.java │ └── StringPermutation.java └── tree │ ├── BinarySearchTreeUtil.java │ └── BinaryTreeUtil.java ├── hackerearth ├── BSequenceProblem.java ├── code_the_next_2k18 │ └── BobAndEditor.java ├── goldmansachs │ ├── CountTheBacteria.java │ └── NonRepeatingDigitInProduct.java └── samsung │ └── OddSumProblem_Mos_Algo_Variant.java ├── interviewbit ├── array │ ├── ConvertNumberToWords.java │ ├── FindDuplicateInArray.java │ ├── MaxNonNegativeSubArray.java │ ├── MaxSProd.java │ ├── MergeOverlappingIntervals.java │ ├── NextPermutation.java │ └── WaveArray.java ├── binary_search │ ├── AggressiveCows.java │ ├── CountElementOccurence.java │ ├── FindMinimumElementInRotatedArray.java │ ├── MatrixSearch.java │ ├── MedianOfArray.java │ ├── MedianOfTwoSortedArrayOfDifferentSizes.java │ ├── RotatedSortedArraySearch.java │ ├── SortedInsertPosition.java │ └── SquareRootOfInteger.java ├── linked_list │ ├── AddTwoNumbersInList.java │ ├── LinkedNodeUtil.java │ ├── ListCycle.java │ ├── MergeTwoSortedList.java │ ├── PalindromeList.java │ ├── PartitionList.java │ ├── ReOrderList.java │ ├── RemoveDuplicatesFromSortedList.java │ ├── RemoveNthNodeFromListEnd.java │ ├── ReverseListInPlace.java │ └── RotateList.java ├── math │ ├── AllFactors.java │ ├── ExcelColumnNumbers.java │ ├── ExcelColumnTitle.java │ ├── FizzBuzz.java │ ├── GreatestCommonDivisor.java │ ├── GridUniquePaths.java │ ├── NumbersOfLengthNAndValueLessThanK.java │ ├── PalindromeInteger.java │ ├── PowerOfTwoIntegers.java │ └── RearrangeArray.java ├── string_parsing │ ├── AmazingSubArrays.java │ ├── CountAndSay.java │ ├── LengthOfLastWord.java │ ├── LongestCommonPrefix.java │ ├── MinimumCharactersRequiredToMakeAStringPalindromic.java │ ├── NumeralToRoman.java │ ├── PalindromeString.java │ ├── RomanToNumeral.java │ └── ZigZagString.java └── two_pointers │ ├── CircularArrayLoop.java │ ├── ContainerWithMostWaters.java │ ├── FourSum.java │ ├── Intersection_of_SortedArrays.java │ ├── MaximumContinuousSeriesOfOnes.java │ ├── Merge2SortedList.java │ ├── MinimizeTheAbsoluteDifference.java │ ├── RemoveDuplicatesFromSortedArray.java │ ├── RemoveElementFromArray.java │ └── ThreeSum.java ├── leetcode ├── NextPermutationOfNumericSequence.java ├── array │ ├── DutchNationalFlag.java │ ├── FindSmallestPositiveNumberMissingFromUnsortedArray.java │ ├── GetSubSet.java │ ├── IncrementNumberRepresentedByArray.java │ └── PrintAllPermutations.java ├── backtracking │ ├── AllMneMonicsOfPhoneNumber.java │ ├── ComputeAllValidIPAddressFromRawIPString.java │ ├── MaximumScoreWordsFormedByLetters.java │ ├── NQueensProblem.java │ ├── Partition_To_K_EqualSum_SubSets.java │ └── SudokuSolver.java ├── covid19 │ ├── HappyNumber.java │ ├── SingleNumber.java │ └── SingleNumber_2.java ├── heap │ ├── ClosestBinarySearchTree2.java │ └── MergeKSortedArrays.java ├── linkedlist │ └── LinkedListUtil.java ├── practive │ └── NQueen.java ├── problems │ ├── FruitsIntoBasket_904.java │ ├── ValidMountainArray_941.java │ ├── easy │ │ ├── BackspaceStringCompare_844.java │ │ ├── ClimbStairs_70.java │ │ ├── FindTheDifference_389.java │ │ ├── MostCommonWord_819.java │ │ ├── PlusOne_66.java │ │ ├── RemoveElement_27.java │ │ ├── RobotReturnToOrigin_657.java │ │ ├── SingleNumber_136.java │ │ └── SortedLinkedListToBalancedBST.java │ ├── hard │ │ ├── FrogJump_403.java │ │ └── MinimumWindowSubstring.java │ └── medium │ │ ├── BattleshipInABoard_419.java │ │ ├── BinarySearchTreeToGreaterSumTree.java │ │ ├── BinaryTreeRightSideView_199.java │ │ ├── BoatsToSavePeople.java │ │ ├── BuyAndSellStockWithTransactionFee.java │ │ ├── CoinChange_322.java │ │ ├── CombinationSum_II_40.java │ │ ├── ConstructBinaryTreefromPreorderandInorderTraversal.java │ │ ├── ContainerWithMostWater_11.java │ │ ├── FindPeakElement_162.java │ │ ├── FindTheDuplicateNumber_287.java │ │ ├── FlattenNestedListIterator_341.java │ │ ├── FlipGames_II.java │ │ ├── FloodFill_733.java │ │ ├── GameOfLife_289.java │ │ ├── GroupAnagrams_49.java │ │ ├── IncreasingTripletSequence.java │ │ ├── InsertDeleteGetRandomWithDuplicateValues.java │ │ ├── InsertDeleteGetRandom_o_1.java │ │ ├── IsValidSudoku_36.java │ │ ├── KClosestPointToOrigin_973.java │ │ ├── KeysAndRooms_841.java │ │ ├── KthLargestElementInArray_215.java │ │ ├── KthSmallestElementInSortedMatrix.java │ │ ├── LetterCombinationPhoneNumber_17.java │ │ ├── LetterTilePossibilities.java │ │ ├── MaxIncreaseToKeepCitySkyline.java │ │ ├── MaximumBinaryTree.java │ │ ├── MaximumProductSubArray.java │ │ ├── MeetingRoom2_253.java │ │ ├── MinimumNumbersOfArrowsToBurstBallons_452.java │ │ ├── NextClosestTime.java │ │ ├── OddEvenList.java │ │ ├── PerfectSquares_279.java │ │ ├── RepeatedDNASequence.java │ │ ├── RobotBoundedInCircle.java │ │ ├── RotateImage.java │ │ ├── SpiralMatrixPrint.java │ │ ├── SubSet_Permutations_CombinationSum.java │ │ ├── Subsets_78.java │ │ ├── TaskScheduler_621.java │ │ ├── TopKFreqElements.java │ │ ├── TreeNode.java │ │ ├── UniquePath_62.java │ │ ├── WallsAndGates_286.java │ │ ├── WordSearch_79.java │ │ └── ZigZagLevelOrderTraversal.java ├── queue │ └── FirstNegativeIntegerEveryWindowSizeK.java ├── tree │ ├── BinarySearchTreeUtil.java │ ├── BinaryTreeUtil.java │ ├── LongestZigZagPathInBinaryTree.java │ ├── PathSum.java │ ├── PathSum3.java │ └── RecoverBinarySearchTree.java └── year_2020 │ ├── AddTwoNumbersRepresentedByList.java │ ├── AssignCookies.java │ ├── AsteroidCollision.java │ ├── BSTFromPreOrderTraversal.java │ ├── BestTimeToBuyAndSellStockWithCoolDown.java │ ├── BinaryTreeLongestConsecutiveSequence.java │ ├── CanPlaceFlowers.java │ ├── Candy.java │ ├── CheckIfaStringIsaValidSequencefromRoottoLeavesPathinaBinaryTree.java │ ├── CloneALinkedListWithRandomPointers.java │ ├── ConstructTreeFromLevelOrderTraversal.java │ ├── CountPrimes.java │ ├── CountingSort.java │ ├── DP │ ├── CountVowelPermutations.java │ ├── DecodeWaysCountNumberOfWays.java │ ├── HouseRobber.java │ ├── HouseRobberCircular.java │ ├── HouseRobber_3.java │ ├── JumpGame.java │ ├── JumpGame3.java │ ├── JumpGame_2.java │ ├── KnightDialer.java │ ├── MaximumSumSuchThatNoTwoElementsAreAdjacent.java │ ├── MinimumDifficultyOfJobSchedule.java │ ├── NumbersInPI_AlgoExpert.java │ ├── OptimalStrategyForGame.java │ ├── PaintHouse.java │ ├── PaintHouse2.java │ ├── RemoveBoxes.java │ ├── RussianDollEnvelopes.java │ ├── StudentAttendence.java │ ├── WordBreak.java │ ├── WordBreak_2.java │ ├── combinatorics │ │ ├── NumberOfWaysToRearrangeSticksWithKSticksVisible.java │ │ └── PaintFencingAlgorithm.java │ ├── distinct_ways_pattern │ │ └── KnightProbabilityInChessboard.java │ ├── dynamic_programming_on_trees │ │ ├── BinaryTreeMaximumPathSum.java │ │ ├── BinaryTreeMaximumPathSumBetweenAnyTwoLeaf.java │ │ ├── BinaryTreePostOrderTraversal.java │ │ ├── BinaryTreePreorderTraversal.java │ │ ├── DiameterOfBinaryTree.java │ │ └── DiameterOfNArrayTree.java │ ├── interview_prep │ │ ├── AssemblyLineScheduling.java │ │ ├── BoxStacking.java │ │ ├── MaximizeTheSegmentsOfLength_P_Q_R.java │ │ ├── MaximumSubsequenceSumSuchThatNoThreeAreConsecutive.java │ │ ├── MinimumTimeToWriteCharactersUsingInsertDeleteAndCopyOperation.java │ │ └── TileStacking.java │ ├── kadanes │ │ ├── MaxSumOfRectangleNoLargerThanK.java │ │ └── MaximumSumRectangle.java │ ├── longest_common_subsequence │ │ ├── BuildingBridges.java │ │ ├── InterleavingString.java │ │ ├── LengthOfLongestCommonSubsequence.java │ │ ├── LengthofLongestCommonSubstring.java │ │ ├── LongestPalindromicSubsequence.java │ │ ├── LongestRepeatingSubsequence.java │ │ ├── LongestRepeatingSubsequenceNonOverlapping.java │ │ ├── MinimumNumberOfDeletionInStringToMakeItPalindrome.java │ │ ├── MinimumNumberOfInsertionInStringToMakeItPalindrome.java │ │ ├── MinimumNumberOfInsertionsAndDeletionToTransformOneStringToAnother.java │ │ ├── PrintLongestCommonSubSequence.java │ │ ├── PrintShortestCommonSuperSequence.java │ │ ├── SequencePatternMatching.java │ │ └── ShortestCommonSuperSequence.java │ ├── longest_increasing_subsequence │ │ ├── ArithmeticSlices_1_Subarrays.java │ │ ├── ArithmeticSlices_2_Subsequence.java │ │ ├── CountNumberOfTeams.java │ │ ├── LongestArithmeticSequence.java │ │ └── NumberOfLongestIncreasingSubsequence.java │ ├── matrix_chain_multiplication │ │ ├── BooleanParenthesization.java │ │ ├── BurstBalloons.java │ │ ├── EggDropping.java │ │ ├── MatrixChainMultiplication.java │ │ ├── PalindromicPartitioningMinimumCuts.java │ │ ├── ParsingABooleanExpression.java │ │ └── ScrambleStrings.java │ ├── minimum_maximum_path_to_reach_to_target │ │ ├── MinCostClimbingStairs.java │ │ ├── MinimumCostForTickets.java │ │ ├── MinimumFallingPathSum.java │ │ ├── MinimumPathSum_64.java │ │ ├── MinimumWeightPathToTriangle.java │ │ ├── OnesAndZeros.java │ │ ├── PerfectSquares.java │ │ └── TwoKeysKeyboard.java │ ├── must_do_geeks_for_geeks │ │ └── MinimumCostToReachPointNFrom0.java │ ├── unbounded_knapsack │ │ ├── CoinChange_MinCoins.java │ │ ├── CoinChange_NumberOfWays.java │ │ ├── CombinationSum_NumberOfWays.java │ │ ├── NumberofDiceRollsWithTargetSum.java │ │ └── RodCuttingProblem.java │ └── zero_one_knapsack │ │ ├── CountAllSubSequenceHavingProductLessThanK.java │ │ ├── CountOfSubsetSumWithAGivenSum.java │ │ ├── CountTheNumberOfSubsetWithGivenDifference.java │ │ ├── MaximumNumberOfConsecutiveValuesYouCanMake.java │ │ ├── MaximumProfitInJobScheduling.java │ │ ├── MinimumSubsetDifference.java │ │ ├── PartitionEqualSubsetSum.java │ │ ├── PartitionToKEqualSumSubset.java │ │ ├── SubSetSumProblem.java │ │ ├── TargetSum.java │ │ └── ZeroOneKnapSackRecursively.java │ ├── DiagonalTraverseOf2DArray.java │ ├── FindMedianfromDataStream.java │ ├── FindPeakElement.java │ ├── FirstUniqueNumber.java │ ├── Flatten_Multilevel_Doubly_Linked_List.java │ ├── FooBarGoogleChallenge.java │ ├── Greedy │ ├── BrokenCalculator.java │ ├── DivideArrayInKConsecitiveIntegers.java │ ├── GasStation.java │ ├── LemonadeChange.java │ ├── LongestHappyString.java │ ├── MinimumMovesToReachTargetScore.java │ ├── MyCalendar_1_729.java │ ├── NonDecreasingArray.java │ ├── PancakeSorting.java │ ├── PatchingArrayHard.java │ ├── QueensThatCanAttacktheKing.java │ ├── QueueReconstructionByHeightGreedy.java │ ├── ReducedTheArraySizeToHalf.java │ ├── TaskScheduler.java │ ├── coding_with_mik │ │ ├── BagOfTokens.java │ │ ├── BoatsToSavePeople.java │ │ ├── BreakAPalindrome.java │ │ ├── BrokenCalculator.java │ │ ├── Candy.java │ │ ├── DotaToSenate.java │ │ ├── EarliestFullBloom.java │ │ ├── EliminateMaximumNumberofMonsters.java │ │ ├── FindPolygonWithTheLargestPerimeter.java │ │ ├── FurthestBuildingYouCanReach.java │ │ ├── JobSequencingProblem.java │ │ ├── JumpGame2.java │ │ ├── LeastNumberOfUniqueIntegersAfterKRemovals.java │ │ ├── LongestPalindromeByConcatenatingTwoLetterWord.java │ │ ├── Maximum69Number.java │ │ ├── MaximumBagsWithFullCapacityOfRocks.java │ │ ├── MaximumElementAfterDecreasingAndRearranging.java │ │ ├── MaximumIceCreamBars.java │ │ ├── MaximumNumberofCoinsYouCanGet.java │ │ ├── MaximumScoreofAGoodSubarray.java │ │ ├── MinimumDeletionstoMakeCharacterFrequenciesUnique.java │ │ ├── MinimumNumberOfOperationsToMakeArrayEmpty.java │ │ ├── MinimumNumberOfTapsToOpenToWaterAGarden.java │ │ ├── MinimumReplacementToSortTheArray.java │ │ ├── MinimumRoundsToCompleteAllTask.java │ │ ├── MinimumSprinklersToWaterThePlant.java │ │ ├── MinimumTimeToMakeRopeColorful.java │ │ ├── OptimalPartitionOfString.java │ │ └── RemoveColoredPiecesIfBothNeighboursAreOfSameColor.java │ └── interval_scheduling │ │ ├── FacebookScheduleTask.java │ │ ├── HandOfStraights.java │ │ ├── MeetingRoom.java │ │ ├── MeetingRoom2.java │ │ ├── MeetingRoom3.java │ │ ├── MergeIntervals.java │ │ ├── MinimumNumberOfArrowsToBurstBalloons.java │ │ ├── MyCalendar_1.java │ │ ├── MyCalendar_2.java │ │ ├── MyCalendar_3.java │ │ └── NonOverLappingIntervals.java │ ├── ImplementAHashTable.java │ ├── ImplementLFUCache.java │ ├── IntegerToRomans.java │ ├── IslandPerimeter.java │ ├── KLargestElementsInAnImmutableMaxHeap.java │ ├── KMP_Pattern_Matching_Algorithm.java │ ├── KthSmallestElementInBST.java │ ├── LRUCache.java │ ├── LargestRectangleInHistogram.java │ ├── LargestValueFromLabels.java │ ├── LeftmostColumnWithAtLeastAOne.java │ ├── ListNode.java │ ├── LongestCommonSubstring.java │ ├── LongestPalindromicSubsequence.java │ ├── MaximalSquare.java │ ├── MaximumLengthofRepeatedSubarray.java │ ├── MaximumPathSumInBinaryTree.java │ ├── MaximumWidthOfBinaryTree.java │ ├── MinPathSum.java │ ├── MinimumDominoRotationsForEqualRow.java │ ├── MinimumInSortedRotatedArray.java │ ├── MyCircularQueue.java │ ├── PalindromePairs.java │ ├── PalindromicSubstrings.java │ ├── PartitionEqualSubsetSum.java │ ├── PatternMatching.java │ ├── PerformStringShifts.java │ ├── PopulatingNextRightPointersInEachNode.java │ ├── PopulatingNextRightPointersInEachNode_2.java │ ├── ProductofArrayExceptSelf.java │ ├── RabinKarpSubstringSearchPattern.java │ ├── RandomListNode.java │ ├── RemovekthToLastElement.java │ ├── ReorganizeString.java │ ├── RightShiftASinglyLinkedList.java │ ├── RomanToIntegers.java │ ├── RotOranges.java │ ├── SecondMinimumNodeInBinaryTree.java │ ├── SerializeAndDeserializeBinaryTree.java │ ├── ShortestPalindrome.java │ ├── ShortestWayToFormString.java │ ├── SplitAStringInBalancedStrings.java │ ├── SubarraySumEqualsK.java │ ├── SublistReversal.java │ ├── SudokuSolver.java │ ├── SumRootToLeafNumbers.java │ ├── SwapListInGroup.java │ ├── TaskScheduler.java │ ├── TestIfABinaryTreeIsHeightBalanced.java │ ├── TreeNode.java │ ├── UglyNumbers.java │ ├── ValidateBinarySearchTree.java │ ├── VerifyingAnAlienDictionary.java │ ├── ZigZagConversion.java │ ├── all_premium │ └── tags │ │ ├── amazon │ │ └── PairOfSongsDivisibleBy60.java │ │ └── google │ │ ├── map │ │ └── AlphabetBoardPath.java │ │ ├── sliding_window │ │ └── KEmptySlots.java │ │ └── sort │ │ ├── WiggleSort.java │ │ └── WiggleSort_2.java │ ├── array │ ├── CountInversions.java │ ├── FindAllNumbersDisappearedInAnArray.java │ ├── FindPermutation.java │ ├── LargestNumber.java │ ├── MajorityElement2.java │ ├── MaximumSumTriplet.java │ ├── MinimizeMaximumDifferenceBetweenHeights.java │ ├── MinimumLightsToActivate.java │ ├── NextPermutation.java │ ├── PerfectPeak.java │ ├── PushDominoes.java │ ├── RearrangeArrayInAlternatingPositiveAndNegativeItems.java │ ├── SortArrayWithSquares.java │ ├── SpiralOrderMatrix_2.java │ ├── ValidNumber.java │ └── ValidSquare.java │ ├── backtracking │ ├── AdditiveNumber.java │ ├── AndroidUnlockPattern.java │ ├── ArrayPermutations.java │ ├── CombinationSum.java │ ├── CustomSortString.java │ ├── DecodeWaysPrintDecoding.java │ ├── GenerateAllSubsetsofSizeK.java │ ├── LargestNumberWithKSwaps.java │ ├── LongestPossibleRouteInMatrix.java │ ├── MatchAPatternAndStringWithoutRegularExpression.java │ ├── MaximumLengthOfConcatenatedStringWithUniqueCharacters.java │ ├── NDigitNumberWithIncreasingDigit.java │ ├── PalindromePermutation_2.java │ ├── PalindromicPartitioning.java │ ├── PermutationOfString.java │ ├── PermutationSequence.java │ ├── Permutations.java │ ├── Readme.MD │ ├── RemoveInvalidParentheses.java │ ├── StickersToSpellWords.java │ ├── Subsets.java │ ├── WordSearch_2.java │ ├── WordSquares.java │ └── codeStoryWithMik │ │ ├── FairDistributionOfCookies.java │ │ ├── FindTheMinimumCostArrayPermutation.java │ │ ├── MaximumNumberOfAchievableTransferRequests.java │ │ ├── NonDecreasingSubsequences.java │ │ ├── PathWithMaximumGold.java │ │ ├── TheNumberOfBeautifulSubsets.java │ │ └── UniquePaths3.java │ ├── binary_search │ ├── AggressiveCow.java │ ├── AllocateMinimumNumberOfPages.java │ ├── FindKClosestElements.java │ ├── KthMissingPositiveNumber.java │ ├── MedianOfTwoSortedArrays.java │ ├── MinimumNumberDaysMakeMBouquets.java │ ├── Search2DMatrix_First.java │ ├── Search2DMatrix_II.java │ ├── SearchInRotatedSortedArray.java │ ├── SearchInRotatedSortedArrayII.java │ ├── SingleElementInSortedArray.java │ └── TaxBracketFacebookProblem.java │ ├── category_unknown │ └── GroupedShiftedStrings.java │ ├── challenges │ └── October_challenge │ │ ├── CloneGraph.java │ │ ├── ComplementOfBase10Integer.java │ │ ├── KDiffPairsInAnArray.java │ │ ├── NumberofRecentCalls.java │ │ ├── RemoveDuplicateLetters.java │ │ ├── RotateList.java │ │ └── SortList.java │ ├── difference_array │ └── ArrayManipulation.java │ ├── graph │ ├── CheapestFlightsWithinKStops.java │ ├── CloneAGraph.java │ ├── CourseSchedule.java │ ├── Graph.java │ ├── GraphUser.java │ ├── IsGraphBipartite.java │ ├── MinimumSwapsRequiredToSortArray.java │ ├── bellmen_ford │ │ └── DistanceFromSource.java │ ├── bfs │ │ ├── BishopShortestMoves.java │ │ ├── PathWithMinimumEffort.java │ │ ├── ShortestBridge.java │ │ ├── SnakeAndLadder.java │ │ ├── WordLadder1.java │ │ ├── WordLadder2.java │ │ └── nearest_path │ │ │ ├── AsFarfromLandasPossible.java │ │ │ ├── RottingOranges.java │ │ │ ├── ShortestPathInABinaryMaze.java │ │ │ ├── ShortestPathInAGridWithObstaclesElimination.java │ │ │ ├── ShortestPathinBinaryMatrix.java │ │ │ ├── UpdateDistanceOfRoomsFromGates.java │ │ │ └── ZeroOneMatrix.java │ ├── cycle_detection │ │ ├── DetectADirectedGraphHasACycle.java │ │ ├── DetectCycleInUndirectedGraph.java │ │ └── FindEventualSafeStates.java │ ├── depth_first_search_from_boundary │ │ ├── NumberOfEnclaves.java │ │ ├── NumberofClosedIslands.java │ │ └── SurroundedRegions.java │ ├── dfs │ │ ├── EvaluateDivision.java │ │ ├── LongestPathInBinaryMatrix.java │ │ ├── MakingALargeIsland.java │ │ ├── NumberOfDistinctIsland.java │ │ ├── RobotRoomCleaner.java │ │ ├── SumOfDistanceInTrees.java │ │ ├── ThreeEqualParts.java │ │ └── TimeNeededtoInformAllEmployees.java │ ├── disjoint_set_union_find │ │ ├── AccountsMerge.java │ │ ├── DisjointSetImplementation.java │ │ ├── FriendCircles.java │ │ ├── MakingALargeIsland.java │ │ ├── MostStonesRemovedWithSameRowOrColumn.java │ │ ├── NumberOfIslands_2.java │ │ ├── NumberOfProvince.java │ │ ├── NumberofOperationstoMakeNetworkConnected.java │ │ ├── OptimizeWaterDistribution.java │ │ ├── RedundantConnection.java │ │ └── SatisfiabilityofEqualityEquations.java │ ├── djkastra │ │ ├── DijkastraAlgorithmUsingPriorityQueue.java │ │ ├── NumberOfWaysToArriveDestinationDijkastra.java │ │ └── SmallestNeighbourAtThresholdDistance.java │ ├── eulerian_path_circuit │ │ └── FindEulerianPathInDirectedGraph.java │ ├── minimum_spanning_tree │ │ └── PrimsAlgorithm.java │ ├── shortest_path │ │ ├── FloydAllVertexShortestPath.java │ │ └── NetworkDelayTime.java │ ├── strongly_connected_components │ │ └── TestingStrongConnectivity.java │ └── topologicalSort │ │ ├── AlienDictionary.java │ │ ├── CourseScheduleII.java │ │ └── ShortestPathInDirectedAcyclicGraph.java │ ├── heap │ └── coding_with_mik │ │ ├── ChooseKElementsWithMaximumSum.java │ │ ├── FindKPairWithSmallestSum.java │ │ ├── FindMedianfromDataStream.java │ │ ├── IPO.java │ │ ├── KthLargestElementInArray.java │ │ ├── KthSmallestPrimeFraction.java │ │ ├── Leetcode621_TaskScheduler_Leetcode621.java │ │ ├── LexicographicallyMinimumStringAfterRemovingStars.java │ │ ├── LongestHappyString.java │ │ ├── MaximumSubsequenceScore.java │ │ ├── MinimumCostToHireKWorkers.java │ │ ├── MinimumOperationsToExceedThresholdValueII.java │ │ ├── RangeSumOfSortedSubArraySum.java │ │ ├── SingleThreadedCPU.java │ │ ├── SmallestRangeCoveringElementsfromKLists.java │ │ ├── TopKFrequentElements.java │ │ ├── TotalCosToHireKWorkers.java │ │ └── TrappingRainWater_2.java │ ├── list │ ├── DeleteEveryAlternativeNodeInCircularList.java │ ├── FlattenMultiLevelLinkedList.java │ ├── RemoveDuplicatesFromSortedList.java │ └── ReverseNodesInKGroup.java │ ├── prefix_sum_technique │ ├── ContiguousArray.java │ ├── ContinuousSubarraySum.java │ ├── FlipStringToMonotonicallyIncreasing.java │ ├── LargestSubArrayWithEqualNumberOfZerosAndOnes.java │ ├── LargestSubArrayWithZeroSum.java │ ├── RandomPickIndex.java │ ├── RandomPickWithWeights.java │ ├── RangeAddition.java │ ├── SubArraySumDivisibleByK.java │ ├── SubArraySumEqualsK_UsingPrefixSum.java │ └── SubmatrixSumQueries.java │ ├── probability │ └── RandomPickWithBlackList.java │ ├── sliding_window │ ├── CountDistinctElementsInEveryWindowOfSizeK.java │ ├── FindAllAnagramsInAString.java │ ├── FindZerosToBeFlipped_Sliding_Window.java │ ├── FruitsIntoBasket.java │ ├── LongestContinuousSubarrayWithAbsoluteDiffLessThanOrEqualtoLimit.java │ ├── LongestRepeatingCharacterReplacement.java │ ├── LongestSubStringWithAtMostTwoDistinctCharacters.java │ ├── LongestSubStringWithMUniqueCharacters.java │ ├── LongestSubstringWithoutRepeatingCharacters.java │ ├── MaximumOfAllSubArraysOfSizeK.java │ ├── MaximumSumSubArrayOfSizeK.java │ ├── MinimumWindowSequence.java │ ├── MinimumWindowSubstring.java │ ├── NumberofSubstringsContainingAllThreeCharacters.java │ ├── README.md │ ├── SmallestSubArrayWithGivenSum.java │ ├── SubArrayWithKDifferentIntegers.java │ ├── SubstringWithConcatenationOfAllWords.java │ ├── TotalSubStringWithKUniqueCharacters.java │ └── codestorywithmik │ │ ├── BinarySubarraysWithSum.java │ │ ├── CountCompleteSubstrings.java │ │ ├── CountSubarraysWithFixedBounds.java │ │ ├── FrequencyoftheMostFrequentElement.java │ │ ├── KRadiusSubarrayAverages.java │ │ ├── LengthofLongestSubarrayWithAtMostKFrequency.java │ │ ├── LongestSubarrayOnesAfterDeletingOneElement.java │ │ ├── MaximizetheConfusionofanExam.java │ │ ├── MaximumNumberVowelsInSubstringofGivenLength.java │ │ ├── MaximumSizeSubarraySumEqualsK.java │ │ ├── NumberofSubmatricesThatSumToTarget.java │ │ ├── SlidingWindowMaximum.java │ │ └── SubArrayWithKDifferentIntegers.java │ ├── stack │ ├── BasicCalulator.java │ ├── ImplementTextEditorUndoRedo.java │ ├── MaximumAreaOfHistogram.java │ ├── MaximumAreaRectangleInBinaryMatrix.java │ ├── MinStack.java │ ├── MinimumNumberOfReversalsToMakeExpressionBalanced.java │ ├── MinimumRemoveToMakeValidParentheses.java │ ├── NearestGreaterElementToTheLeft.java │ ├── NearestGreaterElementToTheRight.java │ ├── NearestSmallestElementInTheLeft.java │ ├── NearestSmallestElementInTheRight.java │ ├── RainWaterTrapping.java │ ├── RemoveBracketsFromAnAlgebricStringContainingPlusAndMinus.java │ ├── SimplifyPath.java │ ├── SimplifyPath2.java │ ├── SortQueueIntoAnotherQueueUsingStack.java │ ├── StackWithFindMiddle.java │ ├── StockSpanProblem.java │ ├── TextEditorUndoRedo.java │ ├── ValidParentheses.java │ ├── ValidParenthesisString.java │ └── codingWithMIK │ │ ├── AsteroidCollision.java │ │ ├── BasicCalculator.java │ │ ├── BuildAnArrayWithStackOperations.java │ │ ├── CheckIfAParenthesesStringCanBeValid.java │ │ ├── DailyTemperatures.java │ │ ├── EvaluateReversePolishNotation.java │ │ ├── MaximumScoreFromRemovingSubstrings.java │ │ ├── MinimumDeletionsToMakeStringBalanced.java │ │ ├── MinimumNumberofSwapstoMaketheStringBalanced.java │ │ ├── MinimumRemoveToMakeValidParentheses_3Approaches.java │ │ ├── NumberOfAtoms.java │ │ ├── ParsingABooleanExpression.java │ │ ├── Pattern_132.java │ │ ├── RemoveAllOccurrencesofaSubstring.java │ │ ├── RemoveKDigits.java │ │ ├── ReverseSubstringsBetweenEachPairofParentheses.java │ │ ├── RobotCollision.java │ │ └── SumofSubarrayMinimums.java │ ├── string │ ├── MultiplyStrings.java │ ├── ReverseWordInString.java │ └── SwapAdjacentInLRString.java │ ├── tree │ ├── AllNodesDistance_K_inBinaryTree.java │ ├── AllPathsCountWithSumBinaryTree.java │ ├── BinaryTreeLongestConsecutiveSequence_1.java │ ├── BinaryTreeLongestConsecutiveSequence_2.java │ ├── CheckForIdenticalBSTWithoutBuildingTheTree.java │ ├── ConstructBinaryTreeUsingPreOrderAndInorderTraversal.java │ ├── ConvertSortedArrayToBinarySearchTree.java │ ├── DeleteNodeInBinaryTree.java │ ├── EqualTreePartition.java │ ├── FindLeavesOfBinaryTree.java │ ├── FlattenBinaryTreeToLinkedList.java │ ├── LargestBSTBinaryTreeNew.java │ ├── LargestBSTInBinaryTree.java │ ├── MaximumProductOfSplittedBinaryTree.java │ ├── MaximumSumBSTInBinaryTree.java │ ├── VerticalOrderTraversal.java │ ├── avltree │ │ ├── AVLTree.java │ │ ├── MainApp.java │ │ ├── Node.java │ │ └── Tree.java │ └── codestorywithmik │ │ ├── AmountOfTimeForBinaryTreeToBeInfected.java │ │ ├── DistributeCoinsInBinaryTree.java │ │ ├── FindDuplicateSubtrees.java │ │ ├── MaximumDifferenceBetweenNodeAndAncestor.java │ │ └── MaximumProductOfSplittedBinaryTree.java │ ├── trie │ ├── AddAndSearchWordDataStructureDesign.java │ ├── FaultyKeyBoard.java │ ├── ImplementAMagicDictionary.java │ ├── ImplementATrie.java │ ├── MapSumPairs.java │ └── coding_with_mik │ │ ├── ConstructTheLexicographicallyLargestValidSequence.java │ │ ├── FindLengthofLongestCommonPrefix.java │ │ ├── LongestCommonSuffixQueries.java │ │ ├── MaximumXOROfTwoNumbersInArray.java │ │ ├── ReplaceWords.java │ │ ├── SumOfPrefixScoresOfStrings.java │ │ └── WordSearch2.java │ ├── two_pass_algo │ ├── LongestMountainInArray.java │ ├── MaxChunksToMakeSorted.java │ ├── MaximumProductSubArray.java │ ├── PartitionLabels_763.java │ └── ShortestDistanceToCharacter.java │ └── two_pointers │ └── BuildingsWithOceanView.java ├── multithreading ├── BlockingQueue.java ├── CountDownLatchExample.java ├── CreatingStartingThread.java ├── CriticalSectionRaceCondition.java ├── JoinExample.java ├── MultithreadingExample.java ├── ReadWriteLockExample.java ├── ReentrantLockExample.java ├── SafeCheckThenAct.java ├── ThreadSafetyForObjectMemberVariables.java ├── UnsafeCheckThenAct.java ├── UnsafeReadModifyWrite.java └── UnsafeReadModifyWriteWithLatch.java ├── serialization ├── SerializationWithInheritance.java └── SerializedChildWithoutParentBeingSerializable.java ├── stackoverflow ├── CharCount.java ├── ChildException.java ├── CountOccurrences.java ├── DateHelper.java ├── FileSearch.java ├── GFG.java ├── GetIP.java ├── HashSetExample.java ├── Ideone.java ├── MaxLengthZeroSumSub.java ├── MyList.java ├── ParentException.java ├── Pattern.java ├── RegularExpressionTest.java ├── RemoveSpace.java ├── Sagar.java ├── StringCountAndChange.java ├── StringReverse.java └── file_search_test │ └── neeraj_java_developer_3_yrs_.pdf └── util └── LogUtil.java /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.DS_Store -------------------------------------------------------------------------------- /.idea/$CACHE_FILE$: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Android 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/dictionaries/neeraj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | eulerian 5 | indegree 6 | nums 7 | outdegree 8 | preorder 9 | sudoku 10 | sweeeeeet 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/3/0365ac3d7f9862663fba44e119a4212d0923b514: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/3/0365ac3d7f9862663fba44e119a4212d0923b514 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/4/0469a6ca14b476630f27e417377c5e3d2b0c2131: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/4/0469a6ca14b476630f27e417377c5e3d2b0c2131 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/4/04c80311e89383b7fad31a8e77d9f17a715ddc7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/4/04c80311e89383b7fad31a8e77d9f17a715ddc7a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/5/0515ee178ffd24487b83b5e3fbbc9cd9a536dd61: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/5/0515ee178ffd24487b83b5e3fbbc9cd9a536dd61 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/b/0b0c924fb4eacad2fea1e1cdd6ad6ab65d33e146: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/b/0b0c924fb4eacad2fea1e1cdd6ad6ab65d33e146 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/d/0d84f25028fa7cd4bfb456b9e8c8e19b082606c3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/d/0d84f25028fa7cd4bfb456b9e8c8e19b082606c3 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/d/0dc81f2d23f23f59f35e99eed86807fa142fac47: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/d/0dc81f2d23f23f59f35e99eed86807fa142fac47 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/e/0e1719e8798ca5fdc6f479b752b644dcf6fc5e51: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/e/0e1719e8798ca5fdc6f479b752b644dcf6fc5e51 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/0/f/0fa57503214fdf2617f0e01fa012fe7e30178233: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/0/f/0fa57503214fdf2617f0e01fa012fe7e30178233 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/0/1041b354b617348477365f7534c48e912b44cfda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/0/1041b354b617348477365f7534c48e912b44cfda -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/2/12e7b156bec53c789f03a5a51afccf1c4adb142e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/2/12e7b156bec53c789f03a5a51afccf1c4adb142e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/3/13942c6cc5cd9a51a7a391aad2fb397f52734d17: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/3/13942c6cc5cd9a51a7a391aad2fb397f52734d17 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/4/1422b3eea0afb60c212dff58f0f9dadfbfdf835d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/4/1422b3eea0afb60c212dff58f0f9dadfbfdf835d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/5/152aaca6f24ad3b8ca4f49d899788249c08f1a29: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/5/152aaca6f24ad3b8ca4f49d899788249c08f1a29 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/6/16c695b0f8df9f8fc161ecb0d92d8cdfa946034d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/6/16c695b0f8df9f8fc161ecb0d92d8cdfa946034d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/8/18cfb598bade92bf4f8e5f986f7ab767942e46fb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/8/18cfb598bade92bf4f8e5f986f7ab767942e46fb -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/b/1b0bfe9b454f292087b0ea3daa616c34177c1443: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/b/1b0bfe9b454f292087b0ea3daa616c34177c1443 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/b/1ba3542173272014d34e04a49215ec5f67366866: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/b/1ba3542173272014d34e04a49215ec5f67366866 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/c/1c0c967f865f75c03948fb841aa3f9d73d177436: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/c/1c0c967f865f75c03948fb841aa3f9d73d177436 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/c/1c4571cdd1b79642bf82a7c253270d5c62a732f9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/c/1c4571cdd1b79642bf82a7c253270d5c62a732f9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/1/e/1eae734b9ff03f82550af5f37dca4b51197aa53e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/1/e/1eae734b9ff03f82550af5f37dca4b51197aa53e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/4/240d8d8de15972747d9c9f8cf40ad167802daf1f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/4/240d8d8de15972747d9c9f8cf40ad167802daf1f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/4/243551ed2dbe317c9c3b2878fa6c0c4a5ce6df2b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/4/243551ed2dbe317c9c3b2878fa6c0c4a5ce6df2b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/4/245e6d8d42f75477f4765c0ab4c805ac9cbcd883: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/4/245e6d8d42f75477f4765c0ab4c805ac9cbcd883 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/8/287f96e1a204a41102f88acab31487c60b464e2e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/8/287f96e1a204a41102f88acab31487c60b464e2e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/8/28b1eb9a8137fef411655fbf5a5b78b3240f98f6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/8/28b1eb9a8137fef411655fbf5a5b78b3240f98f6 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/9/29098f46debe5fa8e0f08f8834ca8d9c48b3aa35: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/9/29098f46debe5fa8e0f08f8834ca8d9c48b3aa35 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/9/292ad351c59417ea518ff9b01d10167281b82dbd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/9/292ad351c59417ea518ff9b01d10167281b82dbd -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/9/293006e63d2126839990cd1a6d3ce5fd7f2d32f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/9/293006e63d2126839990cd1a6d3ce5fd7f2d32f2 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/9/296cab2a2f4ee67a245aba40824fc3b2edd46aa5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/9/296cab2a2f4ee67a245aba40824fc3b2edd46aa5 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/9/29ac99214dc746d81f45d6c577a4e07c254277c0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/9/29ac99214dc746d81f45d6c577a4e07c254277c0 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/b/2bca228ca15756675d10a7ba6dcb0d7e066c9e55: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/b/2bca228ca15756675d10a7ba6dcb0d7e066c9e55 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/c/2cd4575b83b651958f2be26659328c3d663f1b3f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/c/2cd4575b83b651958f2be26659328c3d663f1b3f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/f/2fc1d1c47dc652209681c8c91141adb385149dcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/f/2fc1d1c47dc652209681c8c91141adb385149dcf -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/2/f/2ff7ab8ea7d0ada2a66f7c47a957145303b9f205: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/2/f/2ff7ab8ea7d0ada2a66f7c47a957145303b9f205 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/0/30737f23b738b1241dfa71e12a756f5271a3c1b9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/0/30737f23b738b1241dfa71e12a756f5271a3c1b9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/0/30cabcad22c7f5865179edc5e45f5dd7778a7eed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/0/30cabcad22c7f5865179edc5e45f5dd7778a7eed -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/1/31e575b080bb851f3621cb3f3305e4b203e6287b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/1/31e575b080bb851f3621cb3f3305e4b203e6287b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/2/3245bf6625358af7eb6360771bf2bd5f512825bd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/2/3245bf6625358af7eb6360771bf2bd5f512825bd -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/7/3724b029773a08cf894be9dca4e5d40a1d46b569: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/7/3724b029773a08cf894be9dca4e5d40a1d46b569 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/a/3ad3ea39da3d7d0e489e535162bc42dc8e47673d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/a/3ad3ea39da3d7d0e489e535162bc42dc8e47673d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/d/3dd065ec14e460d67c9b20f1a9f4101f28a37d9a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/d/3dd065ec14e460d67c9b20f1a9f4101f28a37d9a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/e/3e95cd1c8ee367614986c78aa047a283b4b2c814: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/e/3e95cd1c8ee367614986c78aa047a283b4b2c814 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/3/f/3f956219d97d4df55ea959e772d05fd940e5f4b6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/3/f/3f956219d97d4df55ea959e772d05fd940e5f4b6 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/0/4047cbb8a658b4a9660ac07eb63550aa4b1121a9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/0/4047cbb8a658b4a9660ac07eb63550aa4b1121a9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/2/42922770200d8f638dd3f919f8ce9ac6d4960132: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/2/42922770200d8f638dd3f919f8ce9ac6d4960132 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/3/43a0ccbb4c08815882338f006932f9432a15f91b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/3/43a0ccbb4c08815882338f006932f9432a15f91b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/8/484528874d4e2d1dbb4fddea11a748a67dd0b782: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/8/484528874d4e2d1dbb4fddea11a748a67dd0b782 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/9/4981bd8315bd0c3bb14f1f5d93cd0b5dec52e598: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/9/4981bd8315bd0c3bb14f1f5d93cd0b5dec52e598 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/9/49b83f5cc20c7d1f398f63846f40e56234c10480: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/9/49b83f5cc20c7d1f398f63846f40e56234c10480 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/b/4bfbf71b69c73768469b8d25e614a9c8694b224d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/b/4bfbf71b69c73768469b8d25e614a9c8694b224d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/c/4cbdc07e9bc683b9d3bc454cdf0a12ff80ed05ca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/c/4cbdc07e9bc683b9d3bc454cdf0a12ff80ed05ca -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/e/4e1af42cc3b8beac410404c9848ce0f4c0f01603: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/e/4e1af42cc3b8beac410404c9848ce0f4c0f01603 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/4/e/4ed86a7e8a5bc629e27de5b99ac22aec02a1e91c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/4/e/4ed86a7e8a5bc629e27de5b99ac22aec02a1e91c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/0/5020524bf14398707da6bf517feea38d52530332: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/0/5020524bf14398707da6bf517feea38d52530332 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/3/537d2655d4c0be2860ecad15f6c2e0f57a8b22d1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/3/537d2655d4c0be2860ecad15f6c2e0f57a8b22d1 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/4/54a597757fec4e5a255fd18c3c697629e72bc82c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/4/54a597757fec4e5a255fd18c3c697629e72bc82c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/4/54fb5c957a03e98f57c545c322d68f4de669840f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/4/54fb5c957a03e98f57c545c322d68f4de669840f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/7/5782080b5ce62dff12506f862017e18622c22080: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/7/5782080b5ce62dff12506f862017e18622c22080 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/a/5a49839e89345da179226f48072f6cd15297c8fc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/a/5a49839e89345da179226f48072f6cd15297c8fc -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/b/5b22f02bcc196eb59e6e241595fffdc7bc17f2c3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/b/5b22f02bcc196eb59e6e241595fffdc7bc17f2c3 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/b/5b8187baca6ed5db49b55b2d48275f7ce644c858: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/b/5b8187baca6ed5db49b55b2d48275f7ce644c858 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/b/5bad06b056383567e8d2911b6f5f0afde6f76ae9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/b/5bad06b056383567e8d2911b6f5f0afde6f76ae9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/c/5c7e53b293ba772bc655afe480c25221d2a8a9b4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/c/5c7e53b293ba772bc655afe480c25221d2a8a9b4 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/d/5d6efc9a0cdefc4d188cf5dbd9d25e56912a4104: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/d/5d6efc9a0cdefc4d188cf5dbd9d25e56912a4104 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/5/d/5dc5d0a7299a1333f31c2f693675f3b124723cb5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/5/d/5dc5d0a7299a1333f31c2f693675f3b124723cb5 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/1/6137b1dc89471b6ab84774ee8ac4e80236a6f3e8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/1/6137b1dc89471b6ab84774ee8ac4e80236a6f3e8 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/1/61acbcf0483a671756ce9aa47508e6f121c45f99: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/1/61acbcf0483a671756ce9aa47508e6f121c45f99 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/2/62281ca91a5b4781383f26dd37f334edb68f634d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/2/62281ca91a5b4781383f26dd37f334edb68f634d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/2/626798a1aafe2f5db8c9fb50692e911f0f4cb57d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/2/626798a1aafe2f5db8c9fb50692e911f0f4cb57d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/2/629304b7937b4ea80a5645db596aee463e53e2ba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/2/629304b7937b4ea80a5645db596aee463e53e2ba -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/4/641856166614a7e5abca10b06e2e9fba7cffe555: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/4/641856166614a7e5abca10b06e2e9fba7cffe555 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/6/8/68ad29d5455c6423df1236c955ef1a65ce161b21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/6/8/68ad29d5455c6423df1236c955ef1a65ce161b21 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/3/73a76d5d317fa07e8c411e66fd4b3b90c916c2d3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/3/73a76d5d317fa07e8c411e66fd4b3b90c916c2d3 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/4/740431f73c77cbde3a53b351321dc0f707837661: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/4/740431f73c77cbde3a53b351321dc0f707837661 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/5/7517c9c65e2cce5eba62e480c0e1709329f9b63e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/5/7517c9c65e2cce5eba62e480c0e1709329f9b63e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/7/7705eb3f4e8767b8e66bf4a6a11c0c9a03b15b28: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/7/7705eb3f4e8767b8e66bf4a6a11c0c9a03b15b28 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/7/7746d4446298d49eed67f85028b043b00f20c75b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/7/7746d4446298d49eed67f85028b043b00f20c75b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/7/775521b9f4af2999f3123195bcbcdef8dfea4b2a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/7/775521b9f4af2999f3123195bcbcdef8dfea4b2a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/9/79442ff30dc86c44cf010d76906791a0a6df68cd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/9/79442ff30dc86c44cf010d76906791a0a6df68cd -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/a/7aa488f56a9a64d7e8618b8ff622cb42be10f620: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/a/7aa488f56a9a64d7e8618b8ff622cb42be10f620 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/b/7bbdf0c7452bf1b331cf3714ccac37372c6646bd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/b/7bbdf0c7452bf1b331cf3714ccac37372c6646bd -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/d/7d088dc72e01c057db42052d86f21e62488696a4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/d/7d088dc72e01c057db42052d86f21e62488696a4 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/e/7eb8b7306014865bc3470a7002a52d61b90a3906: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/e/7eb8b7306014865bc3470a7002a52d61b90a3906 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/f/7f8f4b6d3985ac7263dac9a829d65ae96d51e3c5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/f/7f8f4b6d3985ac7263dac9a829d65ae96d51e3c5 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/7/f/7f9a03c1ad0adabbcd980641b61c9eba23d400bc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/7/f/7f9a03c1ad0adabbcd980641b61c9eba23d400bc -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/0/80d9ab7cb8bbcf9011b9124bf66e94190ae441d0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/0/80d9ab7cb8bbcf9011b9124bf66e94190ae441d0 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/2/823de290d7aa8f3b032a62e01fb82bbdbd3bf91c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/2/823de290d7aa8f3b032a62e01fb82bbdbd3bf91c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/3/837eacd5246b5ce085cafde184cdad621d5a7df9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/3/837eacd5246b5ce085cafde184cdad621d5a7df9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/4/8417fe7e9857b33c2be5d0a3516bb837fe4a9ad8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/4/8417fe7e9857b33c2be5d0a3516bb837fe4a9ad8 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/4/842b339082b4e7ca9eb01c833e9e26bd0910f921: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/4/842b339082b4e7ca9eb01c833e9e26bd0910f921 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/4/84d662dc7bc0855475911927540c094f154151f8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/4/84d662dc7bc0855475911927540c094f154151f8 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/5/85088b855d49d73dc4742572b7bf9d8e373cc633: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/5/85088b855d49d73dc4742572b7bf9d8e373cc633 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/5/85cd56255ffe9443577f49f008e9217db813d6a4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/5/85cd56255ffe9443577f49f008e9217db813d6a4 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/8/880f1a9cd157e0ef67223d4e3f3c4c708d5e545c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/8/880f1a9cd157e0ef67223d4e3f3c4c708d5e545c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/8/88a51629d0e9c1e55ade102b61e3ee7013905ffb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/8/88a51629d0e9c1e55ade102b61e3ee7013905ffb -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/a/8a635e1d7ebc4b388e1f6a0acec192e510eaf8bc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/a/8a635e1d7ebc4b388e1f6a0acec192e510eaf8bc -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/b/8b4bbada528cadc21d61c18e6ad6b487b0f5db07: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/b/8b4bbada528cadc21d61c18e6ad6b487b0f5db07 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/b/8bf5ab550ea3ad55b70208c99aa84a1ef6966e61: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/b/8bf5ab550ea3ad55b70208c99aa84a1ef6966e61 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/f/8f1db205e267df937586fcb486646a00e85b177c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/f/8f1db205e267df937586fcb486646a00e85b177c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/8/f/8fd621cfbc258e90b95adc3aa661baa7e652327e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/8/f/8fd621cfbc258e90b95adc3aa661baa7e652327e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/3/93cbbe310e80d95e42195175e7ed5f279f59d624: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/3/93cbbe310e80d95e42195175e7ed5f279f59d624 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/4/9459d30d1d37bb9a689bf953a036f2fde9a0704e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/4/9459d30d1d37bb9a689bf953a036f2fde9a0704e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/8/988cd766217075bd21d71158e4dcad4cdb968de0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/8/988cd766217075bd21d71158e4dcad4cdb968de0 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/8/98e3af8b3ecfd2d0fd1a992d937a5c220aa91490: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/8/98e3af8b3ecfd2d0fd1a992d937a5c220aa91490 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/9/9910a0463fe71c2ec9a0b87dd8d36015602945f5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/9/9910a0463fe71c2ec9a0b87dd8d36015602945f5 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/a/9a1be5d3cc320a2e2e5894364c20ad109702704f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/a/9a1be5d3cc320a2e2e5894364c20ad109702704f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/c/9c8795e5bb3bbf5782282e1dc5865612f91b8aa5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/c/9c8795e5bb3bbf5782282e1dc5865612f91b8aa5 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/d/9d7ba72ab8b65caa9c30bc626ce8d58e1673fe1c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/d/9d7ba72ab8b65caa9c30bc626ce8d58e1673fe1c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/d/9dcb91e9fd85e16ca208e07c21f48034a6bc0607: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/d/9dcb91e9fd85e16ca208e07c21f48034a6bc0607 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/e/9e061d0c42ee81752786355062d8354642218f9b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/e/9e061d0c42ee81752786355062d8354642218f9b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/e/9edc2fc5b43f762c490bd33023222e49930280ef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/e/9edc2fc5b43f762c490bd33023222e49930280ef -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/9/f/9ffbc3978b2553558f50ed0b96776f6c3a6a5fc4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/9/f/9ffbc3978b2553558f50ed0b96776f6c3a6a5fc4 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/0/a0ea511d91dad158be72e642b908fdc537c2faae: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/0/a0ea511d91dad158be72e642b908fdc537c2faae -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/1/a1b6174dd99489d383a0014861e71ca7d1d9cdf3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/1/a1b6174dd99489d383a0014861e71ca7d1d9cdf3 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/2/a20ebe159ca45eaef83eedc86d9b70f11cbede21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/2/a20ebe159ca45eaef83eedc86d9b70f11cbede21 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/3/a360ef451bf77a192979c2857819c068ce37c68c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/3/a360ef451bf77a192979c2857819c068ce37c68c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/4/a4a0277e5699ebcfa712673cb97011b957de115d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/4/a4a0277e5699ebcfa712673cb97011b957de115d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/4/a4c5bee28bd4f44af63d0d0f4788bc72d2044f60: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/4/a4c5bee28bd4f44af63d0d0f4788bc72d2044f60 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/5/a5e8fa0e90979690627ca3b1ca4f3f0ff7c7f133: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/5/a5e8fa0e90979690627ca3b1ca4f3f0ff7c7f133 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/8/a8512e2009db5577d3d859e7095643309b8bd812: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/8/a8512e2009db5577d3d859e7095643309b8bd812 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/9/a95ae4896b9c36fb1f44b9f99345b3526717c534: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/9/a95ae4896b9c36fb1f44b9f99345b3526717c534 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/9/a9691986d5e8d68f4be10b23ca30dacfdb56212a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/9/a9691986d5e8d68f4be10b23ca30dacfdb56212a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/d/ad752d633dabf59c62297be5903f4c781ca2784c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/d/ad752d633dabf59c62297be5903f4c781ca2784c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/e/ae5f181474892ccdf2c74c966aa18984f0536ce1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/e/ae5f181474892ccdf2c74c966aa18984f0536ce1 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/a/e/ae68464d87ff98434f58e9606a9b1b3e948b6fa6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/a/e/ae68464d87ff98434f58e9606a9b1b3e948b6fa6 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/1/b122c31eb9d3956bccadb1c6ed695148e4edf04d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/1/b122c31eb9d3956bccadb1c6ed695148e4edf04d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/1/b146f34b32d8b30ca21d39c00a1a8f2a1e951d20: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/1/b146f34b32d8b30ca21d39c00a1a8f2a1e951d20 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/2/b2502889bd85639bcfbc6a8c84299bc26409ea0a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/2/b2502889bd85639bcfbc6a8c84299bc26409ea0a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/3/b3936db179884306aa7fbd937b76f003a48e5d16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/3/b3936db179884306aa7fbd937b76f003a48e5d16 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/4/b44fc91d95917fb152c09b013b8a8cc2f8bfb41c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/4/b44fc91d95917fb152c09b013b8a8cc2f8bfb41c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/7/b7385308cb9985b8149a93f8a80204ed01183f50: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/7/b7385308cb9985b8149a93f8a80204ed01183f50 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/a/baa9157ab2373cf99ac76964e645c17d1cf55c7a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/a/baa9157ab2373cf99ac76964e645c17d1cf55c7a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/a/babc169747be7771ef9d6b891ab62d662667322a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/a/babc169747be7771ef9d6b891ab62d662667322a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/b/a/babddd82270bb0a0e41a6f5537062ddf71532892: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/b/a/babddd82270bb0a0e41a6f5537062ddf71532892 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/0/c01937c8b57ab4a79cbafe2adc72f718becb81ca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/0/c01937c8b57ab4a79cbafe2adc72f718becb81ca -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/0/c062fa0db9696e90f7675102613ecf2d80b0cc86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/0/c062fa0db9696e90f7675102613ecf2d80b0cc86 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/2/c26892a108b6be66683717e7f268fc256866eee3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/2/c26892a108b6be66683717e7f268fc256866eee3 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/4/c46579e3e465e1968b98c0a10f10e3e6c24e2fa2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/4/c46579e3e465e1968b98c0a10f10e3e6c24e2fa2 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/6/c60708931b9d6225fdf39c99f1abd0b4bbd5935a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/6/c60708931b9d6225fdf39c99f1abd0b4bbd5935a -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/9/c913ba4af87aa6d17018ea577bb281abe654c24b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/9/c913ba4af87aa6d17018ea577bb281abe654c24b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/d/cdab25f1e12d2773e75ba193b1f57c405886a60f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/d/cdab25f1e12d2773e75ba193b1f57c405886a60f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/d/cde3c81a353ab7174d45371b4a2d96e4626664fd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/d/cde3c81a353ab7174d45371b4a2d96e4626664fd -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/c/e/cece693346382cd96b0fbe7774d4f9d2da4b4d2e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/c/e/cece693346382cd96b0fbe7774d4f9d2da4b4d2e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/0/d0b5c20ecb879dbd3844cab46d1509dc5e6491fc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/0/d0b5c20ecb879dbd3844cab46d1509dc5e6491fc -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/1/d15895f49923ea462ccfabf970b4fe36822307b9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/1/d15895f49923ea462ccfabf970b4fe36822307b9 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/1/d1613a63887f5eb7545f1ecc490e5db10d4d9255: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/1/d1613a63887f5eb7545f1ecc490e5db10d4d9255 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/4/d4df8bcc4a53a4e92921c808d6081cf98824f157: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/4/d4df8bcc4a53a4e92921c808d6081cf98824f157 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/4/d4f3edba4edc0fb9e0bc66f7843843b6231122b1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/4/d4f3edba4edc0fb9e0bc66f7843843b6231122b1 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/7/d76fbdb705dd646103b69f1f50feced5beec971c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/7/d76fbdb705dd646103b69f1f50feced5beec971c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/8/d8aef22f6b19e114439bb8fb0df448a10c0af13c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/8/d8aef22f6b19e114439bb8fb0df448a10c0af13c -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/d/dd52aafe666368428a0c03b552628fd973190f60: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/d/dd52aafe666368428a0c03b552628fd973190f60 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/d/e/de43641ccff9090a46ece98571da06151598226e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/d/e/de43641ccff9090a46ece98571da06151598226e -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/1/e10bf1ceb482359ce93b3a12bad448e6d209c607: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/1/e10bf1ceb482359ce93b3a12bad448e6d209c607 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/1/e1b6cfba94234e5a5a1edd6e371e5ad5e8114e38: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/1/e1b6cfba94234e5a5a1edd6e371e5ad5e8114e38 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/4/e4a421483dde35ca88decbae536a3b8954994ac2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/4/e4a421483dde35ca88decbae536a3b8954994ac2 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/4/e4e9b5f71348b3a9c0a19846e0ae25ab7b029518: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/4/e4e9b5f71348b3a9c0a19846e0ae25ab7b029518 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/5/e5bb90d13a9023ed45834dfbaf922543b5769a24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/5/e5bb90d13a9023ed45834dfbaf922543b5769a24 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/6/e688b6f5bf16a20ef577d0fdbb26a1d1e0f94d20: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/6/e688b6f5bf16a20ef577d0fdbb26a1d1e0f94d20 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/7/e70f4451ccdbbe05dbb77c681ba8acc84121be28: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/7/e70f4451ccdbbe05dbb77c681ba8acc84121be28 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/9/e949761c3d035376994fa023e5d943fca8f4303d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/9/e949761c3d035376994fa023e5d943fca8f4303d -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/9/e99e1a584851c40caee2e6e83f9b996e29345e7f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/9/e99e1a584851c40caee2e6e83f9b996e29345e7f -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/c/ecef41f70fcef12a5320d0da668ec1f6d14bce6b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/c/ecef41f70fcef12a5320d0da668ec1f6d14bce6b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/d/ed1afecd996311a3fa841f8bef9ea4c101a0ca07: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/d/ed1afecd996311a3fa841f8bef9ea4c101a0ca07 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/f/efed32705a5621a88ca14275a62b7098c2dc63c1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/f/efed32705a5621a88ca14275a62b7098c2dc63c1 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/e/f/eff6284356c79c1e388a37af050953012c4a9ef4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/e/f/eff6284356c79c1e388a37af050953012c4a9ef4 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/1/f1bf67ba56a3da73fac9a0121696a1d81c9693bc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/1/f1bf67ba56a3da73fac9a0121696a1d81c9693bc -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/4/f46151162ee1a5ccadd24004d1f5e4199d1a0116: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/4/f46151162ee1a5ccadd24004d1f5e4199d1a0116 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/5/f513a7c9b050e5f34b2932618200209cf1df1e91: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/5/f513a7c9b050e5f34b2932618200209cf1df1e91 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/8/f8af6a68142b16bd6ea5994b2e1a519e7e8c5751: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/8/f8af6a68142b16bd6ea5994b2e1a519e7e8c5751 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/8/f8bc835c52ebff55c42e58a89446603d8e4ab042: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/8/f8bc835c52ebff55c42e58a89446603d8e4ab042 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/b/fb4722b54c19c327ac06865e664687ecf557e99b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/b/fb4722b54c19c327ac06865e664687ecf557e99b -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/f/d/fde0db80a46ec2575da52e56e372218c8f5b7bb6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/f/d/fde0db80a46ec2575da52e56e372218c8f5b7bb6 -------------------------------------------------------------------------------- /.idea/sonarlint/securityhotspotstore/index.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/.idea/sonarlint/securityhotspotstore/index.pb -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/src/.DS_Store -------------------------------------------------------------------------------- /src/Hypotenuse.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | /** 4 | * @author neeraj on 26/10/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class Hypotenuse { 9 | 10 | public static void main(String[] args) { 11 | /** 12 | * We will use pythagoras theorem for this. 13 | * a^2+b^2 = c^2; 14 | */ 15 | Scanner scanner = new Scanner(System.in); 16 | System.out.println("Enter base and height of the triangle in next 2 lines"); 17 | int base = scanner.nextInt(); 18 | int height = scanner.nextInt(); 19 | 20 | System.out.println("Hypotenuse of the triangle is " + calculateHypotenuse(base, height) + "cm"); 21 | } 22 | 23 | private static double calculateHypotenuse(int base, int height) { 24 | return Math.sqrt(Math.pow(base, 2) + Math.pow(height, 2)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Sample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author neeraj on 08/09/20 3 | * Copyright (c) 2019, data-structures. 4 | * All rights reserved. 5 | */ 6 | public class Sample { 7 | 8 | public static void main(String[] args) { 9 | System.out.println("Is My Number Palindrome " + isPalindrome(123)); 10 | System.out.println("Is My Number Palindrome " + isPalindrome(1221)); 11 | System.out.println("Is My Number Palindrome " + isPalindrome(1234)); 12 | System.out.println("Is My Number Palindrome " + isPalindrome(5555)); 13 | } 14 | 15 | private static Boolean isPalindrome(int number) { 16 | int reverseNumber = reverse(number); 17 | return number == reverseNumber; 18 | } 19 | 20 | public static int reverse(int num) { 21 | int remainder = 0; 22 | int reverseNumber = 0; 23 | while (num > 0) { 24 | remainder = num % 10; // Remainder 25 | num = num / 10; // Quotient 26 | 27 | reverseNumber = reverseNumber * 10 + remainder; 28 | 29 | } 30 | return reverseNumber; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/algoexpert/ProductSum.java: -------------------------------------------------------------------------------- 1 | package com.algoexpert; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | /** 8 | * @author neeraj on 10/06/20 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class ProductSum { 13 | 14 | public static void main(String[] args) { 15 | List input = Arrays.asList( 16 | 5, 2, Arrays.asList(7, -1), 3, Arrays.asList(6, Arrays.asList(-13, 8), 4) 17 | ); 18 | System.out.println(getProductSum(input, 1)); 19 | } 20 | 21 | public static int getProductSum(List input, int multiple) { 22 | int sum = 0; 23 | for (Object item : input) { 24 | if (item instanceof List) { 25 | int tempSum = getProductSum((List) item, multiple + 1); 26 | sum += tempSum; 27 | } else { 28 | sum += (Integer) item; 29 | } 30 | } 31 | return sum * multiple; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/career_cup/ClosestValueInAnArray.java: -------------------------------------------------------------------------------- 1 | package com.career_cup; 2 | 3 | /** 4 | * Given an array of sorted integers and find the closest value to the given number. Array may contain duplicate values and negative numbers. 5 | *

6 | * Example : Array : 2,5,6,7,8,8,9 7 | * Target number : 5 8 | * Output : 5 9 | *

10 | * Target number : 11 11 | * Output : 9 12 | *

13 | * Target Number : 4 14 | * Output : 5 15 | */ 16 | public class ClosestValueInAnArray { 17 | 18 | public static void main(String[] args) { 19 | System.out.println("Closest Element to the target "+5+" is ::" + findClosestValueToTheTargetValue(new int[]{2, 5, 6, 7, 8, 8, 9}, 5)); 20 | System.out.println("Closest Element to the target "+4+" is ::" + findClosestValueToTheTargetValue(new int[]{2, 5, 6, 7, 8, 8, 9}, 4)); 21 | } 22 | 23 | public static int findClosestValueToTheTargetValue(int[] arr, int target) { 24 | int closestDifference = Integer.MAX_VALUE; 25 | int closestElement = 0; 26 | 27 | for (int i : arr) { 28 | if (Math.abs(target - i) < closestDifference) { 29 | closestDifference = Math.abs(target - i); 30 | closestElement = i; 31 | } 32 | } 33 | return closestElement; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/company/amazon/AllPossibleStringsUsingSpaces.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class AllPossibleStringsUsingSpaces { 4 | 5 | public static void main(String[] args) { 6 | // combination("ABC", 1); 7 | printPermutations("", "ABC"); 8 | } 9 | 10 | public static void printPermutations(String soFar, String rest) { 11 | if(rest.length() <= 0) { 12 | System.out.println(soFar); 13 | return; 14 | } 15 | 16 | for(int i=0;i arr[k])) { 24 | ++k; 25 | } 26 | // reducing 1 from k because k already reached to a state where sum of 2 elements is not greater than k from while loop 27 | count += k - j - 1; 28 | } 29 | } 30 | return count; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/company/amazon/CountTripletsWithSumSmallerThenGivenNumber.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | public class CountTripletsWithSumSmallerThenGivenNumber { 8 | 9 | public static void main(String[] args) { 10 | // int[] arr = {5, 1, 3, 4, 7}; 11 | int[] arr = {-2, 0, 1, 3}; 12 | System.out.println(getTripletsCount(arr, 2)); 13 | } 14 | 15 | public static int getTripletsCount(int[] arr, int sum) { 16 | Arrays.sort(arr); 17 | List> triplets = new ArrayList<>(); 18 | int answer = 0; 19 | for (int i = 0; i < arr.length - 2; i++) { // (Num-2) because we are finding triplet 20 | // Pointers to help us find triplet like finding a pair for a particular sum 21 | int left = i + 1, right = arr.length - 1; 22 | 23 | // Meet in the middle technique 24 | while (left < right) { 25 | if ((arr[i] + arr[left] + arr[right]) >= sum) { 26 | right--; 27 | } else { 28 | answer += (right - left); 29 | left++; 30 | } 31 | } 32 | } 33 | return answer; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/company/amazon/EqualPointsInArrayOfBrackets.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class EqualPointsInArrayOfBrackets { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(getEqualPoint("(())))(".toCharArray())); 7 | System.out.println(getEqualPoint("))".toCharArray())); 8 | System.out.println(getEqualPoint("(()))(()()())))".toCharArray())); 9 | System.out.println(getEqualPoint("((".toCharArray())); 10 | } 11 | 12 | public static int getEqualPoint(char[] arr) { 13 | int openingBrackets = 0; 14 | int index = 0; 15 | 16 | for (char c : arr) { 17 | if (c == '(') { 18 | openingBrackets++; 19 | } 20 | } 21 | 22 | for (int i = arr.length-1; i >= 0; i--) { 23 | if(openingBrackets == 0) { 24 | index = i; 25 | break; 26 | } 27 | openingBrackets--; 28 | // if(arr[c] == ')') { 29 | // openingBrackets--; 30 | // } else if(arr[c] == '(') { 31 | // openingBrackets--; 32 | // } 33 | } 34 | return index; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/company/amazon/Equilibrium.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import java.util.Collections; 4 | import java.util.stream.IntStream; 5 | 6 | public class Equilibrium { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(getEquilibriumIndexPart2(new int[]{-7, 1, 5, 2, -4, 3, 0})); 10 | System.out.println(getEquilibriumIndexPart2(new int[]{5, 2, 5})); 11 | } 12 | 13 | public static int getEquilibriumIndexPart2(int[] arr) { 14 | int totalSum = IntStream.of(arr).sum(); 15 | int leftSum = 0; 16 | 17 | for (int i = 0; i < arr.length; i++) { 18 | totalSum -= arr[i]; // Removing current item from the total sum to get the right sum 19 | if (leftSum == totalSum) { 20 | return i; 21 | } 22 | leftSum += arr[i]; 23 | } 24 | return -1; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/company/amazon/ExtractMaximumValueInString.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class ExtractMaximumValueInString { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(getMaximumValue("100klh564abc365bg")); 7 | System.out.println(getMaximumValue("abchsd0sdhs")); 8 | } 9 | 10 | public static int getMaximumValue(String str) { 11 | char[] input = str.toCharArray(); 12 | int MAX_VALUE = Integer.MIN_VALUE; 13 | StringBuffer val = new StringBuffer(); 14 | 15 | for (int i = 0; i < input.length; i++) { 16 | int asciiVal = input[i]; 17 | if (asciiVal >= 48 && asciiVal <= 57) { 18 | val.append(input[i]); 19 | } else { 20 | int parsedVal = 0; 21 | try { 22 | parsedVal = Integer.parseInt(val.toString()); 23 | } catch (Exception e) { 24 | 25 | } 26 | if (parsedVal > MAX_VALUE) { 27 | MAX_VALUE = parsedVal; 28 | } 29 | val = new StringBuffer(); 30 | } 31 | } 32 | return MAX_VALUE; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/company/amazon/Fibonaci.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class Fibonaci { 4 | 5 | public static void main(String[] args) { 6 | for(int i=0;i<10;i++) { 7 | System.out.print(fibonaci(i)+"\t"); 8 | } 9 | } 10 | 11 | public static int fibonaci(int n) { 12 | int a = 0, b = 1, c, i; 13 | if (n == 0) 14 | return a; 15 | 16 | for (i = 2; i <= n; i++) { 17 | c = a + b; 18 | a = b; 19 | b = c; 20 | } 21 | return b; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/com/company/amazon/IntegerToBinary.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class IntegerToBinary { 7 | 8 | public static void main(String[] args) { 9 | printBinary(7); 10 | printBinary(14); 11 | } 12 | 13 | public static void printBinary(int number) { 14 | List list = new ArrayList<>(); 15 | 16 | while (number > 0) { 17 | list.add(number%2); 18 | number = number/2; 19 | } 20 | System.out.println(list); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/company/amazon/MaximumSumSuchThatNo2ElementsAreAdjacent.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import com.geeksforgeeks.array.ArrayRotation; 4 | 5 | /** 6 | * Problem : 146 Amazon Interview Question 7 | */ 8 | public class MaximumSumSuchThatNo2ElementsAreAdjacent { 9 | public static void main(String[] args) { 10 | findMaxSumUsingDP(new int[]{1, 4, 1, 1, 7}, 5); 11 | findMaxSumUsingDP(new int[]{5, 5, 10, 100, 10, 5}, 6); 12 | 13 | } 14 | 15 | // Correct Solution 16 | public static void findMaxSumUsingDP(int[] arr, int n) { 17 | if (n == 1) 18 | System.out.println("Find Max Sum Using DP .........:::===>" + arr[0]); 19 | if (n == 2) 20 | System.out.println("Find Max Sum Using DP .........:::===>" + Math.max(arr[0], arr[1])); 21 | 22 | int[] DP = new int[n]; 23 | DP[0] = arr[0]; 24 | DP[1] = arr[1]; 25 | 26 | for (int i = 2; i < arr.length; i++) { 27 | DP[i] = Math.max((arr[i] + DP[i - 2]), DP[i - 1]); 28 | } 29 | ArrayRotation.printArray(DP); 30 | System.out.println("Find Max Sum Using DP .........:::===>" + DP[n - 1]); 31 | } 32 | } -------------------------------------------------------------------------------- /src/com/company/amazon/ProductArrayPuzzle.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import com.geeksforgeeks.array.ArrayRotation; 4 | 5 | public class ProductArrayPuzzle { 6 | 7 | public static void main(String[] args) { 8 | productArrayPuzzle(new int[]{10, 3, 5, 6, 2}); 9 | } 10 | 11 | public static void productArrayPuzzle(int[] arr) { 12 | int n = arr.length; 13 | int[] left = new int[n]; 14 | int[] right = new int[n]; 15 | int[] product = new int[n]; 16 | left[0] = 1; // 1st element of left array will be 1 always bcoz on array index 1 we want the sum of array till index 0; 17 | right[n - 1] = 1; // Same reason as above but for the sum of right side element excluding the current element 18 | 19 | // Left side sum we start with 1 as on 0th index left side sum is 1 as we assumed 20 | for (int i = 1; i < n; i++) { 21 | left[i] = left[i - 1] * arr[i - 1]; 22 | } 23 | 24 | // Right Side sum 25 | for (int j = n - 2; j >= 0; j--) { 26 | right[j] = right[j + 1] * arr[j + 1]; 27 | } 28 | 29 | // Finally Product Array 30 | for (int k = 0; k < n; k++) { 31 | product[k] = left[k] * right[k]; 32 | } 33 | 34 | ArrayRotation.printArray(product); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/company/amazon/RearrangeOddEvenIndexedLinkedListNodesTogether.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import com.company.amazon.LinkedListUtil.Node; 4 | 5 | public class RearrangeOddEvenIndexedLinkedListNodesTogether { 6 | 7 | public static void main(String[] args) { 8 | LinkedListUtil util = new LinkedListUtil(); 9 | util.append(1); 10 | util.append(2); 11 | util.append(3); 12 | util.append(4); 13 | util.append(5); 14 | util.append(6); 15 | 16 | rearrange(util.head); 17 | } 18 | 19 | public static void rearrange(Node head) { 20 | if (head == null) // Empty List 21 | return; 22 | if (head.next == null) // List with only 1 node 23 | return; 24 | 25 | Node currEven = head; 26 | Node currOdd = head.next; 27 | Node prevOdd = head.next; 28 | 29 | // First Group All Even Nodes 30 | while (currEven.next != null && currOdd.next != null) { 31 | currEven.next = currEven.next.next; 32 | currEven = currEven.next; 33 | 34 | currOdd.next = currOdd.next.next; 35 | currOdd = currOdd.next; 36 | } 37 | currEven.next = prevOdd; 38 | LinkedListUtil.printList(head); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/company/amazon/RunLengthEncoding.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class RunLengthEncoding { 4 | 5 | public static void main(String[] args) throws java.lang.Exception { 6 | encode("wwwwaaadexxxxxx"); 7 | } 8 | 9 | public static void encode(String str) { 10 | StringBuffer result = new StringBuffer(); 11 | char[] word = str.toCharArray(); 12 | char traversedWord = word[0]; 13 | int count = 0; 14 | for (int i = 0; i < word.length; i++) { 15 | if (word[i] == traversedWord) { 16 | count++; 17 | if (i + 1 >= word.length) { 18 | result.append(traversedWord).append(count); 19 | } 20 | } else { 21 | result.append(traversedWord).append(count); 22 | count = 1; 23 | traversedWord = word[i]; 24 | } 25 | } 26 | System.out.println(result); 27 | } 28 | } -------------------------------------------------------------------------------- /src/com/company/amazon/SieveOfErastothenes.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | public class SieveOfErastothenes { 4 | 5 | public static void main(String[] args) { 6 | Boolean[] primeStatus = getAllPrimeNumbersBelow(74); 7 | printAllPrimeNumbers(primeStatus); 8 | } 9 | 10 | public static void printAllPrimeNumbers(Boolean[] primeStatus) { 11 | for (int i = 2; i < primeStatus.length; i++) { 12 | if (primeStatus[i]) { 13 | System.out.print(i + ","); 14 | } 15 | } 16 | } 17 | 18 | public static Boolean[] getAllPrimeNumbersBelow(int number) { 19 | Boolean[] primeNumbers = new Boolean[number]; 20 | //Assuming all numbers are prime numbers 21 | for (int i = 0; i < number; i++) { 22 | primeNumbers[i] = true; 23 | } 24 | 25 | for (int i = 2; i < Math.sqrt(number); i++) { 26 | if (primeNumbers[i]) { 27 | // Update all multiples of this prime number as non-prime 28 | for (int k = i * 2; k < number; k += i) { 29 | primeNumbers[k] = false; 30 | } 31 | } 32 | } 33 | return primeNumbers; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/company/amazon/SortStackUsingRecursion.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import java.util.Stack; 4 | 5 | public class SortStackUsingRecursion { 6 | 7 | public static void main(String[] args) { 8 | Stack stack = new Stack<>(); 9 | stack.add(30); 10 | stack.add(-5); 11 | stack.add(18); 12 | stack.add(14); 13 | stack.add(-3); 14 | 15 | System.out.println(stack); 16 | sortStack(stack); 17 | System.out.println(stack); 18 | } 19 | 20 | public static void sortStack(Stack stack) { 21 | if (stack.isEmpty()) 22 | return; 23 | int item = stack.pop(); 24 | sortStack(stack); 25 | insertAtBottom(stack, item); 26 | } 27 | 28 | public static void insertAtBottom(Stack stack, int item) { 29 | if (stack.isEmpty() || stack.peek() < item) { 30 | stack.add(item); 31 | return; 32 | } 33 | int temp = stack.pop(); 34 | insertAtBottom(stack, item); 35 | stack.push(temp); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/company/amazon/SortZeroOneAndTwo.java: -------------------------------------------------------------------------------- 1 | package com.company.amazon; 2 | 3 | import com.geeksforgeeks.array.ArrayRotation; 4 | import com.geeksforgeeks.array.QuickSort; 5 | 6 | public class SortZeroOneAndTwo { 7 | 8 | public static void main(String[] args) { 9 | sortZeroOneAndTwo(new int[] {0, 1, 2, 0, 1, 2}); 10 | sortZeroOneAndTwo(new int[] {0, 1, 1, 0, 1, 2, 1, 2, 0, 0, 0, 1}); 11 | } 12 | 13 | public static void sortZeroOneAndTwo(int[] arr) { 14 | int low = 0; 15 | int mid = 0; 16 | int high = arr.length - 1; 17 | 18 | while (mid <= high) { 19 | switch (arr[mid]) { 20 | case 0: { 21 | QuickSort.swap(arr, low, mid); 22 | low++; 23 | mid++; 24 | break; 25 | } 26 | case 1: { 27 | mid++; 28 | break; 29 | } 30 | case 2: { 31 | QuickSort.swap(arr, mid, high); 32 | high--; 33 | break; 34 | } 35 | 36 | } 37 | } 38 | ArrayRotation.printArray(arr); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/company/facebook/ContiguousSubarray.java: -------------------------------------------------------------------------------- 1 | package com.company.facebook; 2 | 3 | import com.util.LogUtil; 4 | 5 | import java.util.Arrays; 6 | 7 | public class ContiguousSubarray { 8 | 9 | public static void main(String[] args) { 10 | LogUtil.printArray(countSubarrays(new int[]{2, 4, 7, 1, 5, 3})); 11 | LogUtil.printArray(countSubarrays(new int[]{3, 4, 1, 6, 2})); 12 | } 13 | 14 | static int[] countSubarrays(int[] arr) { 15 | // Now sweep in left and sweep in right for every item 16 | int[] result = new int[arr.length]; 17 | Arrays.fill(result, 1); // atleast 1 length long 18 | for (int i = 0; i < arr.length; i++) { 19 | 20 | // Left Sweep 21 | int left = i - 1; 22 | while (left >= 0 && arr[left] <= arr[i]) { 23 | result[i]++; 24 | left--; 25 | } 26 | 27 | // Right Sweep 28 | int right = i + 1; 29 | while (right <= arr.length - 1 && arr[right] <= arr[i]) { 30 | result[i]++; 31 | right++; 32 | } 33 | } 34 | return result; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/company/facebook/RotationalCipher.java: -------------------------------------------------------------------------------- 1 | package com.company.facebook; 2 | 3 | public class RotationalCipher { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(rotationalCipher("Zebra-493", 3)); 7 | System.out.println(rotationalCipher("abcdefghijklmNOPQRSTUVWXYZ0123456789", 39)); 8 | } 9 | 10 | static String rotationalCipher(String input, int rotationFactor) { 11 | // Write your code here 12 | StringBuilder res = new StringBuilder(); 13 | for (char ch : input.toCharArray()) { 14 | 15 | if (ch >= 65 && ch <= 90) { 16 | res.append((char)(((ch+rotationFactor-'A') % 26) + 'A')); 17 | } else if (ch >= 97 && ch <= 122) { 18 | res.append((char)(((ch+rotationFactor-'a') % 26) + 'a')); 19 | } else if (ch >= 48 && ch <= 57) { 20 | int digit = ch - '0'; 21 | digit = (digit + rotationFactor) % 10; 22 | res.append(digit); 23 | } else { 24 | // Non-AlphaNumeric 25 | res.append(ch); 26 | } 27 | } 28 | return res.toString(); 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/com/company/nearbuy/MaximumDifferenceInAnArray.java: -------------------------------------------------------------------------------- 1 | package com.company.nearbuy; 2 | 3 | /** 4 | * Calculate the Maximum Difference b/w the values at i and the values left to it 5 | *

6 | * arr[i] represent the maximum difference b/w the val of arr[i] and the minimum value in the left 7 | */ 8 | public class MaximumDifferenceInAnArray { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(maxDifference(new int[]{2, 3, 10, 2, 4, 8, 1})); 12 | } 13 | 14 | // Complete the maxDifference function below. 15 | public static int maxDifference(int[] a) { 16 | 17 | int MIN_VAL = a[0]; 18 | int MAX_DIFF = -1; 19 | int diff = 0; 20 | 21 | for (int i = 1; i < a.length; i++) { 22 | if (a[i] > MIN_VAL) { 23 | diff = a[i] - MIN_VAL; 24 | if (diff > MAX_DIFF) { 25 | MAX_DIFF = diff; 26 | } 27 | } else { 28 | MIN_VAL = a[i]; 29 | } 30 | } 31 | return MAX_DIFF; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/com/competitive/coding/hackerrank/PatternCount.java: -------------------------------------------------------------------------------- 1 | package com.competitive.coding.hackerrank; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Created by jaine03 on 17/06/17. 10 | * 11 | * https://www.hackerrank.com/contests/w33/challenges/pattern-count 12 | * 13 | * 14 | */ 15 | public class PatternCount { 16 | 17 | public static void main(String[] args) throws Exception { 18 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 19 | Integer totalTestCases = Integer.parseInt(br.readLine()); 20 | 21 | for(int i=0;i data){ 28 | high = mid; 29 | } 30 | else if(arr[mid] < data) { 31 | low = mid+1; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/DP/JumpTheArray.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.DP; 2 | 3 | /** 4 | * http://www.geeksforgeeks.org/minimum-number-of-jumps-to-reach-end-of-a-given-array/ 5 | */ 6 | public class JumpTheArray { 7 | 8 | public static void main(String[] args) { 9 | int [] input = {1, 3, 6, 1, 0, 9}; 10 | System.out.println(getMinimumNumberOfJumps(input)); 11 | } 12 | 13 | public static int getMinimumNumberOfJumps (int [] input){ 14 | int [] T = new int[6]; 15 | 16 | for(int i=0;i j + input[i]){ 24 | T[i] = Math.min(T[i], T[j] + 1); 25 | } 26 | } 27 | } 28 | return T[5]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/array/EquilibriumPoint.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.array; 2 | 3 | /** 4 | * Created by jaine03 on 22/07/17. 5 | */ 6 | public class EquilibriumPoint { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(getEquibiliriumPoint(new int[]{-7, 1, 5, 2, -4, 3, 0})); 10 | } 11 | 12 | public static int getEquibiliriumPoint(int[] array) { 13 | int totalSum = getSum(array); 14 | int leftSum = 0; 15 | 16 | for(int i=0;i=0; i--){ 17 | if(array[i] > maxTillNow){ 18 | System.out.print(array[i]+","); 19 | maxTillNow = array[i]; 20 | } 21 | } 22 | System.out.println(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/array/MaximumDifferenceTwoElements.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.array; 2 | 3 | /** 4 | * http://www.geeksforgeeks.org/maximum-difference-between-two-elements/ 5 | * Created by jaine03 on 23/07/17. 6 | */ 7 | public class MaximumDifferenceTwoElements { 8 | 9 | public static void main(String[] args) { 10 | System.out.println(getMaximumDifference(new int[]{2, 3, 10, 6, 4, 8, 1})); 11 | } 12 | 13 | /** 14 | * Traverse from the right and keep maintaining MAX_RIGHT_VALUE with MAX_DIFF till now. 15 | * @param array 16 | * @return 17 | */ 18 | public static int getMaximumDifference(int []array){ 19 | int len = array.length-1; 20 | int MAX_RIGHT_VALUE = array[len]; 21 | int MAX_DIFF = -1; 22 | 23 | for(int i=len;i>=0;i--){ 24 | if(array[i] > MAX_RIGHT_VALUE){ 25 | MAX_RIGHT_VALUE = array[i]; 26 | } else { 27 | int diff = MAX_RIGHT_VALUE - array[i]; 28 | if(MAX_DIFF < diff) 29 | MAX_DIFF = diff; 30 | } 31 | } 32 | return MAX_DIFF; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/array/MaximumOfAllSubArraysOfSizeK.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.array; 2 | 3 | /** 4 | * Created by jaine03 on 31/08/17. 5 | */ 6 | public class MaximumOfAllSubArraysOfSizeK { 7 | 8 | public static void main(String[] args) { 9 | printMaxOfAllSubArrays(new int[]{1, 3, 2, 1, 5, 4, 2, 3, 6,1},3); 10 | } 11 | 12 | public static void printMaxOfAllSubArrays(int []arr,int k){ 13 | Integer MAX_VALUE = Integer.MIN_VALUE; 14 | Boolean allValuesPrinted = false; 15 | for(int i=0,counter = 1;i MAX_VALUE){ 18 | MAX_VALUE = arr[i]; 19 | } 20 | if(counter == k){ 21 | System.out.println(MAX_VALUE); 22 | counter = 0; 23 | MAX_VALUE = Integer.MIN_VALUE; 24 | allValuesPrinted = true; 25 | } 26 | } 27 | 28 | if(!allValuesPrinted){ 29 | System.out.println(MAX_VALUE); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/array/SegregateZeroAndOnes.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.array; 2 | 3 | /** 4 | * Created by jaine03 on 22/07/17. 5 | */ 6 | public class SegregateZeroAndOnes { 7 | 8 | public static void main(String[] args) { 9 | int []arr = new int[]{0,1,0,0,1,1,1,0,1,1,0,1,0,1}; 10 | printArray(arr); 11 | segregate0And1(arr); 12 | System.out.println("After segregation"); 13 | printArray(arr); 14 | 15 | } 16 | 17 | public static void printArray(int []arr){ 18 | for(int i:arr){ 19 | System.out.print(i+"\t"); 20 | } 21 | System.out.println(); 22 | } 23 | 24 | public static void segregate0And1(int []arr){ 25 | int left = 0; 26 | int right = arr.length-1; 27 | 28 | while (left < right){ 29 | while (arr[left] == 0 && left < right) 30 | left++; 31 | while (arr[right] == 1 && left < right) 32 | right--; 33 | 34 | if(left < right){ 35 | arr[left] = 0; 36 | arr[right] = 1; 37 | left++; 38 | right--; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/array/SlidingWindowMaximum.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.array; 2 | 3 | /** 4 | * Created by jaine03 on 22/07/17. 5 | */ 6 | public class SlidingWindowMaximum { 7 | 8 | public static void main(String[] args) { 9 | int []arr = new int[]{1, 2, 3, 1, 4, 5, 2, 3, 6}; 10 | int k = 3; 11 | for(int i=0;i<=(arr.length- (k+1));i++){ 12 | System.out.println(getMax(arr,i,i+k-1)); 13 | } 14 | } 15 | 16 | public static int getMax(int []arr,int start,int end){ 17 | int maxValue = 0; 18 | for(int i=start;i<=end;i++){ 19 | if(arr[i]>maxValue){ 20 | maxValue = arr[i]; 21 | } 22 | } 23 | return maxValue; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/datastructures/mustDoInterviewQuestions/string/LongestCommonSubstring.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.mustDoInterviewQuestions.string; 2 | 3 | /** 4 | * Created by jaine03 on 24/07/17. 5 | */ 6 | public class LongestCommonSubstring { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(getLongestCommonSubString("GEEKSFORGEEKS","QUIZGFORES")); 10 | } 11 | 12 | public static String getLongestCommonSubString(String first,String second){ 13 | String LCS = ""; 14 | for(int i=0,j=0;i queue = new LinkedList<>(); 10 | queue.add(5); 11 | queue.add(1); 12 | queue.add(4); 13 | queue.add(2); 14 | queue.add(3); 15 | 16 | System.out.println("Before Sorting"); 17 | ReverseQueue.printQueue(queue); 18 | System.out.println("After Sorting"); 19 | sortQueue(queue); 20 | ReverseQueue.printQueue(queue); 21 | } 22 | 23 | public static void sortQueue(Queue queue) { 24 | if (!queue.isEmpty()) { 25 | int temp = queue.poll(); 26 | sortQueue(queue); 27 | insertAtBottom(queue, temp); 28 | } 29 | } 30 | 31 | private static void insertAtBottom(Queue queue, int temp) { 32 | if (queue.isEmpty() || temp > queue.peek()) { 33 | queue.add(temp); 34 | return; 35 | } 36 | int polled = queue.poll(); 37 | insertAtBottom(queue, temp); 38 | queue.add(polled); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/CombinationInAStringOfDigits.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * https://www.geeksforgeeks.org/combinations-string-digits/ 5 | * 6 | * @author neeraj on 10/07/20 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | *

10 | * Exactly similar to {@link PermutationWithSpaces} 11 | */ 12 | public class CombinationInAStringOfDigits { 13 | 14 | public static void main(String[] args) { 15 | printCombination("123", ""); 16 | printCombination("1234", ""); 17 | printCombination("ABCD", ""); 18 | } 19 | 20 | private static void printCombination(String input, String output) { 21 | if (input.equals("")) { 22 | System.out.println(output); 23 | return; 24 | } 25 | 26 | // Initially we can't add any whitespace 27 | printCombination(input.substring(1), output + input.charAt(0)); 28 | if (!output.isEmpty()) { 29 | // Only when some alphabet is present in the output, then use Space, 30 | // because space is not allowed in the extreme left or right 31 | printCombination(input.substring(1), output + " " + input.charAt(0)); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/DeleteMiddleElement.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | import java.util.Stack; 4 | 5 | import static com.datastructures.recursion.SortStackUsingRecursion.printStack; 6 | 7 | /** 8 | * @author neeraj on 27/06/20 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class DeleteMiddleElement { 13 | 14 | public static void main(String[] args) { 15 | Stack stack = new Stack<>(); 16 | stack.push(1); 17 | stack.push(2); 18 | stack.push(3); 19 | stack.push(4); 20 | stack.push(5); 21 | stack.push(6); 22 | 23 | deleteMiddleElement(stack, stack.size() / 2 + 1); 24 | 25 | printStack(stack); 26 | 27 | stack.clear(); 28 | stack.push(1); 29 | deleteMiddleElement(stack, (stack.size() / 2) + 1); 30 | printStack(stack); 31 | } 32 | 33 | private static void deleteMiddleElement(Stack stack, int k) { 34 | if (k == 0 || stack.isEmpty()) return; 35 | if (k == 1) stack.pop(); 36 | 37 | if (!stack.isEmpty()) { 38 | int popped = stack.pop(); 39 | deleteMiddleElement(stack, k - 1); 40 | stack.push(popped); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/GenerateAllBinaryStringWithoutConsecutiveOnes.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * @author neeraj on 10/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class GenerateAllBinaryStringWithoutConsecutiveOnes { 9 | 10 | public static void main(String[] args) { 11 | permute(3, ""); 12 | permute(4, ""); 13 | } 14 | 15 | private static void permute(int n, String output) { 16 | if (n == 0) { 17 | System.out.println(output); 18 | return; 19 | } 20 | permute(n - 1, output + "0"); 21 | if (output.length() == 0 || output.charAt(output.length() - 1) == '0') { 22 | permute(n - 1, output + "1"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/KthSymbolInGrammar.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * https://leetcode.com/problems/k-th-symbol-in-grammar/description/ 5 | */ 6 | public class KthSymbolInGrammar { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(kthGrammar(1, 1)); 10 | System.out.println(kthGrammar(2, 1)); 11 | System.out.println(kthGrammar(2, 2)); 12 | System.out.println(kthGrammar(30, 434991989)); 13 | } 14 | 15 | private static int kthGrammar(int n, int k) { 16 | if (n == 1 && k == 1) { 17 | return 0; 18 | } 19 | 20 | // Since nth Row is like this 21 | // 0 22 | // 0 MID 1 23 | // 01 MID 10 24 | // 0110 MID 1001 25 | 26 | // Check nth Row with the previous row 27 | // before mid it's exactly same as the previous row 28 | // after mid it's the complement of previous row 1==> 0 and 0 ==> 1 29 | int mid = ((int) (Math.pow(2, n - 1))) / 2; 30 | int answer; 31 | if (k <= mid) { 32 | return kthGrammar(n - 1, k); 33 | } else { 34 | answer = kthGrammar(n - 1, k - mid); 35 | return answer == 0 ? 1 : 0; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/PermutationWithCaseChange.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * In this only small-case input is mandatory. 5 | * 6 | * @author neeraj on 02/07/20 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class PermutationWithCaseChange { 11 | 12 | public static void main(String[] args) { 13 | permuteWithCase("", "ab"); 14 | permuteWithCase("", "abc"); 15 | permuteWithCase("", "abcd"); 16 | } 17 | 18 | public static void permuteWithCase(String output, String input) { 19 | if (input.isEmpty()) { 20 | System.out.println(output); 21 | return; 22 | } 23 | 24 | // Taking just small 25 | permuteWithCase(output + input.charAt(0), input.substring(1)); 26 | 27 | // Taking capital 28 | permuteWithCase(output + (char) (input.charAt(0) - 32), input.substring(1)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/PermutationWithSpaces.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * @author neeraj on 01/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class PermutationWithSpaces { 9 | 10 | public static void main(String[] args) { 11 | permuteWithSpace("", "ABC"); 12 | } 13 | 14 | public static void permuteWithSpace(String output, String input) { 15 | if (input.isEmpty()) { 16 | System.out.println(output); 17 | return; 18 | } 19 | 20 | // Not taking the space. 21 | permuteWithSpace(output + input.charAt(0), input.substring(1)); 22 | 23 | if (!output.isEmpty()) { 24 | // Choosing the Space 25 | permuteWithSpace(output + "_" + input.charAt(0), input.substring(1)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/Print1_To_N.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * @author neeraj on 25/06/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class Print1_To_N { 9 | 10 | public static void main(String[] args) { 11 | print(10); 12 | } 13 | 14 | public static void print(int N) { 15 | if(N == 0) return; 16 | print(N-1); 17 | System.out.println(N); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/PrintAllSubsequenceOfString.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * https://www.geeksforgeeks.org/print-subsequences-string/ 5 | *

6 | * Input : abc 7 | * Output : a, b, c, ab, bc, ac, abc 8 | *

9 | * Input : aaa 10 | * Output : a, aa, aaa 11 | * 12 | * @author neeraj on 2019-05-04 13 | * Copyright (c) 2019, data-structures. 14 | * All rights reserved. 15 | */ 16 | public class PrintAllSubsequenceOfString { 17 | public static void main(String[] args) { 18 | // printAllSubsequenceNew("abc", ""); 19 | printAllSubsequenceNew("aab", ""); 20 | printAllSubsequenceNew("123", ""); 21 | printAllSubsequenceNew("Geeks", ""); 22 | } 23 | 24 | private static void printAllSubsequenceNew(String input, String output) { 25 | if (input.isEmpty()) { 26 | if (!output.isEmpty()) { 27 | System.out.println(output); 28 | } 29 | return; 30 | } 31 | // Not Choose 32 | printAllSubsequenceNew(input.substring(1), output); 33 | // Choose 34 | printAllSubsequenceNew(input.substring(1), output + input.charAt(0)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/PrintN_To_1.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * @author neeraj on 26/06/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class PrintN_To_1 { 9 | 10 | public static void main(String[] args) { 11 | print(10); 12 | } 13 | 14 | public static void print(int N) { 15 | if (N == 0) return; 16 | System.out.println(N); 17 | print(N - 1); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/PrintSubsetOfAlphabets.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | /** 7 | * @author neeraj on 28/06/20 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class PrintSubsetOfAlphabets { 12 | 13 | public static void main(String[] args) { 14 | subset("AB", "", new HashSet<>()); 15 | subset("ABC", "", new HashSet<>()); 16 | subset("AAB", "", new HashSet<>()); 17 | subset("AABBCC", "", new HashSet<>()); 18 | } 19 | 20 | public static void subset(String input, String output, Set allSubsets) { 21 | if (input.isEmpty()) { 22 | if (allSubsets.add(output)) { // To avoid duplicate. 23 | System.out.println(output); 24 | } 25 | return; 26 | } 27 | 28 | subset(input.substring(1), output, allSubsets); // Not Choosing 1st Character 29 | subset(input.substring(1), output + input.charAt(0), allSubsets); // Choosing the 1st Character 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/Print_N_BinaryNumbers_HavingOneGreaterThanOrEqualToZero.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | import com.util.LogUtil; 4 | 5 | /** 6 | * https://www.geeksforgeeks.org/print-n-bit-binary-numbers-1s-0s-prefixes/ 7 | * 8 | * @author neeraj on 27/07/20 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class Print_N_BinaryNumbers_HavingOneGreaterThanOrEqualToZero { 13 | 14 | public static void main(String[] args) { 15 | printNBinaryNumbers(2); 16 | printNBinaryNumbers(3); 17 | printNBinaryNumbers(4); 18 | } 19 | 20 | public static void printNBinaryNumbers(int n) { 21 | LogUtil.logIt("All Binary Numbers for n =====> " + n + " is "); 22 | print("", 0, 0, n); 23 | } 24 | 25 | private static void print(String output, int noOfOnesUsed, int noOfZerosUsed, int n) { 26 | if (n == 0) { 27 | System.out.println(output); 28 | return; 29 | } 30 | 31 | print(output + "1", noOfOnesUsed + 1, noOfZerosUsed, n - 1); 32 | if (noOfZerosUsed < noOfOnesUsed) { 33 | print(output + "0", noOfOnesUsed, noOfZerosUsed + 1, n - 1); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/datastructures/recursion/ReverseString.java: -------------------------------------------------------------------------------- 1 | package com.datastructures.recursion; 2 | 3 | /** 4 | * @author neeraj on 08/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class ReverseString { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(reverse("POLYGLOT")); 12 | } 13 | 14 | public static String reverse(String str) { 15 | if (str == null || str.equals("")) { 16 | return str; 17 | } 18 | char firstChar = str.charAt(0); 19 | String reversed = reverse(str.substring(1)); 20 | return reversed + firstChar; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/FindDuplicateInO_N_Time_O_1_Space.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | import static java.lang.Math.abs; 4 | 5 | /** 6 | * Find duplicates in O(n) time and O(1) extra space | Set 1 7 | */ 8 | public class FindDuplicateInO_N_Time_O_1_Space { 9 | 10 | public static void main(String[] args) { 11 | findDuplicates(new int[]{1, 2, 3, 1, 3, 6, 6}); 12 | } 13 | 14 | public static void findDuplicates(int[] arr) { 15 | 16 | for (int i = 0; i < arr.length; i++) { 17 | if (arr[abs(arr[i])] >= 0) { 18 | arr[abs(arr[i])] = -arr[abs(arr[i])]; 19 | } else { 20 | System.out.print(abs(arr[i]) + ","); 21 | } 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/LeaderInArray.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | /** 4 | * {16, 17, 4, 3, 5, 2}, leaders are 17, 5 and 2. 5 | */ 6 | public class LeaderInArray { 7 | 8 | public static void main(String[] arg) { 9 | printLeaders(new int[]{16, 17, 4, 3, 5, 2}); 10 | } 11 | 12 | public static void printLeaders(int[] arr) { 13 | int MAX_FROM_RIGHT = arr[arr.length - 1]; 14 | 15 | System.out.println(MAX_FROM_RIGHT); // Rightmost element will always be the leader 16 | for (int i = arr.length - 2; i >= 0; i--) { 17 | if (MAX_FROM_RIGHT < arr[i]) { 18 | MAX_FROM_RIGHT = arr[i]; 19 | System.out.println(MAX_FROM_RIGHT); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/RearrangeMaximumAndMinimumWithoutExtraSpace.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | public class RearrangeMaximumAndMinimumWithoutExtraSpace { 4 | 5 | public static void main(String[] args) { 6 | rearrangeMaxAndMinWithoutExtraSpace(new int[]{1, 2, 3, 4, 5, 6, 7}); 7 | } 8 | 9 | public static void rearrangeMaxAndMinWithoutExtraSpace(int[] sortedArr) { 10 | 11 | int leftIndex = 0; 12 | int rightIndex = sortedArr.length - 1; 13 | int maxElement = sortedArr[rightIndex] + 1; 14 | 15 | for (int i = 0; i < sortedArr.length; i++) { 16 | 17 | if (i % 2 == 0) { // Maximum at Even Position 18 | sortedArr[i] += (sortedArr[rightIndex--] % maxElement) * maxElement; 19 | } else { // Minimum at Odd Position 20 | sortedArr[i] += (sortedArr[leftIndex++] % maxElement) * maxElement; 21 | } 22 | } 23 | for (int i = 0; i < sortedArr.length; i++) { 24 | sortedArr[i] = sortedArr[i] / maxElement; 25 | } 26 | ArrayRotation.printArray(sortedArr); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/SearchInRotatedSortedArray.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | public class SearchInRotatedSortedArray { 4 | 5 | public static void main(String[] args) { 6 | search(new int[]{3, 4, 5, 1, 2, 6}, 0, 5, 6); 7 | } 8 | 9 | public static void search(int[] arr, int low, int high, int data) { 10 | if (low > high) 11 | return; 12 | 13 | int mid = (low + high) / 2; 14 | 15 | if (arr[mid] == data) { 16 | System.out.println("Data Found at position " + mid); 17 | return; 18 | } else if (arr[low] <= arr[mid]) { 19 | if (arr[low] <= data && arr[mid] >= data) { 20 | search(arr, low, mid, data); 21 | } else { 22 | search(arr, mid + 1, high, data); 23 | } 24 | } else { 25 | if (arr[mid] <= data && arr[high] >= data) { 26 | search(arr, mid + 1, high, data); 27 | } else { 28 | search(arr, low, mid, data); 29 | } 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/SegregateOddAndEven.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | public class SegregateOddAndEven { 4 | 5 | public static void main(String[] args) { 6 | int [] arr = {12, 34, 45, 9, 8, 90, 3}; 7 | rearrangeInGeeksForGeeksWay(arr); 8 | ArrayRotation.printArray(arr); 9 | } 10 | 11 | public static void rearrange(int []arr) { 12 | int low = 0; 13 | int high = 0; 14 | 15 | for(int i=0;ilow && arr[high] % 2 == 1) 33 | high--; 34 | 35 | QuickSort.swap(arr,low,high); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/SegregateZeroAndOnes.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array; 2 | 3 | public class SegregateZeroAndOnes { 4 | 5 | public static void main(String[] args) { 6 | int [] arr = {0, 1, 0, 1, 0, 0, 1, 1, 1, 0}; 7 | rearrange(arr); 8 | ArrayRotation.printArray(arr); 9 | } 10 | 11 | public static void rearrange(int []arr) { 12 | int low = 0; 13 | int high = 0; 14 | 15 | for(int i=0;i sample[j + 1]) { 26 | int temp = sample[j]; 27 | sample[j] = sample[j + 1]; 28 | sample[j + 1] = temp; 29 | } 30 | upTrend = !upTrend; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/array/sub_array_problem/SubArrayWithGivenSum.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.array.sub_array_problem; 2 | 3 | public class SubArrayWithGivenSum { 4 | 5 | public static void main(String[] args) { 6 | findSubArrayWithGivenSum(new int[]{1, 4, 20, 3, 10, 5}, 33); 7 | findSubArrayWithGivenSum(new int[]{1, 4, 0, 0, 3, 10, 5}, 4); 8 | findSubArrayWithGivenSum(new int[]{2, 4}, 1); 9 | } 10 | 11 | private static void findSubArrayWithGivenSum(int[] arr, int SUM) { 12 | int start = 0, end = 0, CURR_SUM = 0; 13 | int counter = 0; 14 | while (start < arr.length) { 15 | if (CURR_SUM < SUM) { 16 | CURR_SUM += arr[end++]; 17 | } else if (SUM != 0 && CURR_SUM == SUM) { 18 | System.out.println("Found SubArray "); 19 | printSubArray(arr, start, end - 1); 20 | break; 21 | } else { 22 | CURR_SUM -= arr[start++]; 23 | } 24 | } 25 | } 26 | 27 | private static void printSubArray(int[] arr, int start, int end) { 28 | for (int i = start; i <= end; i++) { 29 | System.out.print(arr[i] + ","); 30 | } 31 | System.out.println(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/dynamicProgramming/LongestPalindromicSubsequenceWithONSpace.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.dynamicProgramming; 2 | 3 | public class LongestPalindromicSubsequenceWithONSpace { 4 | 5 | public static void main(String[] args) { 6 | System.out.println(getLengthOfLPS("GEEKSFORGEEKS".toCharArray())); 7 | } 8 | 9 | public static int getLengthOfLPS(char[] str) { 10 | int[] LPS = new int[str.length]; 11 | 12 | for (int i = str.length - 1; i >= 0; i--) { 13 | int back_up = 0; 14 | 15 | //Picking up ending points to see if str[i] increases length of LPS ending with str[j]; 16 | for (int j = i; j < str.length; j++) { 17 | 18 | // For Length one, LPS will always be 1 19 | if (i == j) 20 | LPS[j] = 1; 21 | else if (str[i] == str[j]) { // When character matches 22 | int temp = LPS[j]; 23 | LPS[j] = back_up + 2; 24 | back_up = temp; 25 | } else { 26 | back_up = LPS[j]; 27 | LPS[j] = Math.max(LPS[j - 1], LPS[j]); 28 | } 29 | } 30 | } 31 | return LPS[str.length - 1]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/dynamicProgramming/MaximumSumInLongestIncreasingSubsequence.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.dynamicProgramming; 2 | 3 | import com.geeksforgeeks.array.ArrayRotation; 4 | 5 | import java.util.Arrays; 6 | 7 | public class MaximumSumInLongestIncreasingSubsequence { 8 | 9 | public static void main(String[] args) { 10 | System.out.println(getMaximumSum(new int[]{1, 101, 2, 3, 100, 4, 5})); 11 | System.out.println(getMaximumSum(new int[]{3, 4, 5, 10})); 12 | } 13 | 14 | public static int getMaximumSum(int[] input) { 15 | int[] sumMatrix = new int[input.length]; 16 | sumMatrix[0] = input[0]; 17 | int i = 0; 18 | for (int j = 1; j < input.length; ) { 19 | if (input[j] > input[i]) { 20 | if (sumMatrix[j] < sumMatrix[i] + input[j]) { 21 | sumMatrix[j] = sumMatrix[i] + input[j]; 22 | } else { 23 | sumMatrix[j] = input[j]; 24 | } 25 | } 26 | i++; 27 | if (i == j) { 28 | j++; 29 | i = 0; 30 | } 31 | } 32 | ArrayRotation.printArray(sumMatrix); 33 | Arrays.sort(sumMatrix); 34 | return sumMatrix[input.length - 1]; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/graph/EdgeComparator.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.graph; 2 | 3 | import java.util.Comparator; 4 | 5 | public class EdgeComparator implements Comparator> { 6 | @Override 7 | public int compare(Edge o1, Edge o2) { 8 | if (o1.getWeight() <= o2.getWeight()) { 9 | return -1; 10 | } else { 11 | return 1; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/graph/Vertex.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.graph; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Vertex { 7 | long id; 8 | int data; 9 | List> edges = new ArrayList<>(); 10 | List> adjacentVertex = new ArrayList<>(); 11 | 12 | public Vertex(long id) { 13 | this.id = id; 14 | } 15 | 16 | public long getId() { 17 | return id; 18 | } 19 | 20 | public void setId(long id) { 21 | this.id = id; 22 | } 23 | 24 | public int getData() { 25 | return data; 26 | } 27 | 28 | public void setData(int data) { 29 | this.data = data; 30 | } 31 | 32 | public List> getEdges() { 33 | return edges; 34 | } 35 | 36 | public void setEdges(List> edges) { 37 | this.edges = edges; 38 | } 39 | 40 | public List> getAdjacentVertex() { 41 | return adjacentVertex; 42 | } 43 | 44 | public void addAdjacentVertex(Edge e, Vertex v) { 45 | edges.add(e); 46 | adjacentVertex.add(v); 47 | } 48 | 49 | public int getDegree() { 50 | return edges.size(); 51 | } 52 | 53 | public String toString(){ 54 | return String.valueOf(id); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/stack/NextGreaterElement.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.stack; 2 | 3 | import java.util.Stack; 4 | 5 | public class NextGreaterElement { 6 | 7 | public static void main(String[] args) { 8 | printNextGreaterElement(new int[]{4, 5, 2, 25}); 9 | } 10 | 11 | public static void printNextGreaterElement(int[] input) { 12 | Stack stack = new Stack<>(); 13 | stack.push(input[0]); 14 | 15 | for (int i = 1; i < input.length; i++) { 16 | while (!stack.isEmpty() && stack.peek() < input[i]) { 17 | System.out.println(stack.pop() + " ::-->" + input[i]); 18 | } 19 | stack.push(input[i]); 20 | } 21 | while (!stack.isEmpty()) { 22 | System.out.println(stack.pop() + " ::-->" + -1); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/stack/ReverseStack.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.stack; 2 | 3 | import java.util.Stack; 4 | 5 | public class ReverseStack { 6 | 7 | public static void main(String[] args) { 8 | Stack stack = new Stack<>(); 9 | stack.push(1); 10 | stack.push(2); 11 | stack.push(3); 12 | stack.push(4); 13 | stack.push(5); 14 | System.out.println("Before Reversing " + stack); 15 | reverseStack(stack); 16 | System.out.println("After Reversing " + stack); 17 | 18 | } 19 | 20 | public static void reverseStack(Stack stack) { 21 | if (!stack.isEmpty()) { 22 | Integer popped = stack.pop(); 23 | reverseStack(stack); 24 | insertAtBottom(stack, popped); 25 | } 26 | } 27 | 28 | private static void insertAtBottom(Stack stack, Integer item) { 29 | if (stack.isEmpty()) { 30 | stack.push(item); 31 | } else { 32 | Integer popped = stack.pop(); 33 | insertAtBottom(stack, item); 34 | stack.push(popped); 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/stack/SpecialMinStack.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.stack; 2 | 3 | import java.util.Stack; 4 | 5 | public class SpecialMinStack extends Stack { 6 | 7 | Stack minStack = new Stack<>(); 8 | 9 | public void push(int item) { 10 | if (isEmpty()) { 11 | super.push(item); 12 | minStack.push(item); 13 | } else { 14 | super.push(item); 15 | if (minStack.peek() > item) { 16 | minStack.push(item); 17 | } else { 18 | minStack.push(minStack.peek()); 19 | } 20 | } 21 | } 22 | 23 | public Integer pop() { 24 | minStack.pop(); 25 | return super.pop(); 26 | } 27 | 28 | public Integer getMin() { 29 | return minStack.peek(); 30 | } 31 | 32 | public static void main(String[] args) { 33 | SpecialMinStack specialMinStack = new SpecialMinStack(); 34 | 35 | specialMinStack.push(10); 36 | specialMinStack.push(20); 37 | specialMinStack.push(30); 38 | 39 | System.out.println("Minimum Element in the Stack is "+specialMinStack.getMin()); 40 | specialMinStack.push(5); 41 | System.out.println("Minimum Element in the Stack is "+specialMinStack.getMin()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/stack/TowerOfHanoi.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.stack; 2 | 3 | public class TowerOfHanoi { 4 | 5 | public static void main(String[] args) { 6 | int disks = 1500; 7 | towerOfHanoi(disks, 'A', 'C', 'B'); 8 | } 9 | 10 | public static void towerOfHanoi(int disk, char fromRod, char toRod, char usingRod) { 11 | if (disk > 0) { 12 | towerOfHanoi(disk - 1, fromRod, usingRod, toRod); 13 | System.out.println("Moving disk from :" + fromRod + " ====> " + toRod + " using " + usingRod); 14 | towerOfHanoi(disk - 1, usingRod, toRod, fromRod); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/string/Anagram.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.string; 2 | 3 | public class Anagram { 4 | } 5 | -------------------------------------------------------------------------------- /src/com/geeksforgeeks/string/PrintAllSubString.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.string; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | import java.util.List; 7 | 8 | public class PrintAllSubString { 9 | 10 | public static void main(String[] args) { 11 | printAllSubString("ABCD"); 12 | } 13 | 14 | public static void printAllSubString(String str) { 15 | List sortedList = new ArrayList<>(); 16 | for (int i = 0; i < str.length(); i++) { 17 | for (int j = i + 1; j <= str.length(); j++) { 18 | sortedList.add(str.substring(i, j)); 19 | } 20 | } 21 | sortedList.sort(Comparator.comparingInt(String::length)); 22 | System.out.println(sortedList); 23 | } 24 | } -------------------------------------------------------------------------------- /src/com/geeksforgeeks/string/PrintAllSubsequences.java: -------------------------------------------------------------------------------- 1 | package com.geeksforgeeks.string; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Comparator; 5 | import java.util.List; 6 | 7 | public class PrintAllSubsequences { 8 | 9 | public static void main(String[] args) { 10 | // combinations("", "ABCD"); 11 | combinations("", "AAB"); 12 | 13 | // subsequences.sort(Comparator.comparingInt(String::length)); 14 | System.out.println(subsequences); 15 | } 16 | 17 | private static List subsequences = new ArrayList<>(); 18 | 19 | public static void combinations(String suffix, String prefix) { 20 | if (prefix.length() < 0) { 21 | return; 22 | } 23 | // System.out.println(suffix); 24 | subsequences.add(suffix); 25 | for (int i = 0; i < prefix.length(); i++) { 26 | combinations(suffix + prefix.charAt(i), prefix.substring(i + 1)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/interviewbit/math/PalindromeInteger.java: -------------------------------------------------------------------------------- 1 | package com.interviewbit.math; 2 | 3 | /** 4 | * @author neeraj on 2019-07-27 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class PalindromeInteger { 9 | public static void main(String[] args) { 10 | System.out.println(isPalindrome(12121)); 11 | System.out.println(isPalindrome(1234)); 12 | System.out.println(isPalindrome(121)); 13 | System.out.println(isPalindrome(909090)); 14 | } 15 | 16 | public static int isPalindrome(int A) { 17 | int temp = A; 18 | int reverse = 0; 19 | while (temp >0) { 20 | reverse = reverse * 10 + temp % 10; 21 | temp = temp/10; 22 | } 23 | System.out.println("Reverse of "+ A + " is "+ reverse); 24 | return A == reverse ? 1 : 0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/interviewbit/string_parsing/PalindromeString.java: -------------------------------------------------------------------------------- 1 | package com.interviewbit.string_parsing; 2 | 3 | import java.util.stream.Collectors; 4 | 5 | /** 6 | * @author neeraj on 2019-07-31 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class PalindromeString { 11 | 12 | public static void main(String[] args) { 13 | System.out.println(isPalindrome("A man, a plan, a canal: Panama")); 14 | System.out.println(isPalindrome("race a car")); 15 | System.out.println(isPalindrome("123ABCCBA321")); 16 | } 17 | 18 | public static boolean isPalindrome(String A) { 19 | A = A.toLowerCase(); 20 | String filteredData = A.chars() 21 | .mapToObj(i -> (char) i) 22 | .filter(str -> String.valueOf(str).matches("[a-z0-9]+")) 23 | .map(Object::toString) 24 | .collect(Collectors.joining()); 25 | 26 | System.out.println("Original String ==> "+ A); 27 | System.out.println("Filtered Data ==> "+ filteredData); 28 | return new StringBuffer(filteredData).reverse().toString().equalsIgnoreCase(filteredData); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/easy/FindTheDifference_389.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.easy; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * @author neeraj on 18/09/19 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class FindTheDifference_389 { 11 | 12 | public static void main(String[] args) { 13 | System.out.println(findTheDifference("abcd", "abcde")); 14 | } 15 | 16 | public static char findTheDifference(String s, String t) { 17 | char [] small = s.toCharArray(); 18 | char [] big = t.toCharArray(); 19 | Arrays.sort(small); 20 | Arrays.sort(big); 21 | 22 | for(int i=0;i= small.length) { 24 | return big[i]; 25 | } 26 | if(small[i] != big[i]) { 27 | return big[i]; 28 | } 29 | } 30 | return Character.MIN_VALUE; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/easy/PlusOne_66.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.easy; 2 | 3 | import com.geeksforgeeks.array.Rotate2DMatrix; 4 | import com.util.LogUtil; 5 | 6 | /** 7 | * @author neeraj on 15/09/19 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class PlusOne_66 { 12 | 13 | public static void main(String[] args) { 14 | // LogUtil.printArray(plusOne(new int[]{1,2,3})); 15 | // LogUtil.printArray(plusOne(new int[]{1,0,0,9})); 16 | LogUtil.printArray(plusOne(new int[]{9,9,9})); 17 | // LogUtil.printArray(plusOne(new int[]{9,0,1,9})); 18 | } 19 | public static int[] plusOne(int[] digits) { 20 | for(int i=digits.length-1; i>=0; i--) { 21 | if(digits[i] < 9) { 22 | digits[i] = digits[i] + 1; 23 | return digits; 24 | } 25 | digits[i] = 0; 26 | } 27 | 28 | int [] result = new int[digits.length + 1 ]; 29 | result[0] = 1; 30 | return result; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/easy/SingleNumber_136.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.easy; 2 | 3 | /** 4 | * @author neeraj on 01/09/19 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class SingleNumber_136 { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(singleNumber(new int[]{2,2,1})); 12 | System.out.println(singleNumber(new int[]{1,2,3,3,1,4,5,4,5})); 13 | System.out.println(singleNumber(new int[]{4,1,2,1,2})); 14 | System.out.println(singleNumber(new int[]{4,5,3,4,5,3,2})); 15 | } 16 | 17 | public static int singleNumber(int[] nums) { 18 | int result = 0; 19 | for(int i:nums) { 20 | result ^= i; 21 | } 22 | return result; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/BoatsToSavePeople.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import com.util.LogUtil; 4 | 5 | import java.util.Arrays; 6 | 7 | /** 8 | * @author neeraj on 12/09/19 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class BoatsToSavePeople { 13 | 14 | public static void main(String[] args) { 15 | solve(new int[]{1, 2}, 3); 16 | solve(new int[]{3, 2, 2, 1}, 3); 17 | solve(new int[]{3, 5, 3, 4}, 5); 18 | solve(new int[]{1, 2, 4, 5}, 6); 19 | } 20 | 21 | private static void solve(int[] people, int limit) { 22 | System.out.println("Minimum Number of Rescue Boats required for people of weight " + 23 | LogUtil.getArrayAsString(people) + " is " + numRescueBoats(people, limit)); 24 | } 25 | 26 | public static int numRescueBoats(int[] people, int limit) { 27 | Arrays.sort(people); 28 | int minBoats = 0; 29 | int L = 0; 30 | int R = people.length - 1; 31 | while (L <= R) { 32 | if (people[L] + people[R] <= limit) { 33 | L++; 34 | R--; 35 | } else { 36 | R--; 37 | } 38 | minBoats++; 39 | } 40 | return minBoats; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/CoinChange_322.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | /** 4 | * @author neeraj on 15/09/19 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class CoinChange_322 { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(coinChange(new int[]{1, 2, 5}, 11)); 12 | System.out.println(coinChange(new int[]{2}, 3)); 13 | } 14 | 15 | public static int coinChange(int[] coins, int amount) { 16 | int[] minimumCoins = new int[amount + 1]; 17 | 18 | // For Amount as 0, we don't need any coin 19 | minimumCoins[0] = 0; 20 | 21 | for (int i = 1; i <= amount; i++) { 22 | minimumCoins[i] = amount + 1; 23 | } 24 | 25 | for (int coin = 0; coin < coins.length; coin++) { 26 | for (int currentAmount = 0; currentAmount <= amount; currentAmount++) { 27 | if (coins[coin] <= currentAmount) { 28 | minimumCoins[currentAmount] = Math.min(1 + minimumCoins[currentAmount - coins[coin]], minimumCoins[currentAmount]); 29 | } 30 | } 31 | } 32 | return minimumCoins[minimumCoins.length - 1] == (amount + 1) ? -1 : minimumCoins[minimumCoins.length - 1]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/ContainerWithMostWater_11.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | /** 4 | * @author neeraj on 01/09/19 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class ContainerWithMostWater_11 { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(maxArea(new int[]{1,8,6,2,5,4,8,3,7})); 12 | System.out.println(maxArea(new int[]{0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1})); 13 | System.out.println(maxArea(new int[]{3, 0, 0, 2, 0, 4})); 14 | } 15 | 16 | public static int maxArea(int[] height) { 17 | int left = 0; 18 | int right = height.length - 1; 19 | int minVal = Integer.MAX_VALUE; 20 | int total = Integer.MIN_VALUE; 21 | while(left < right) { 22 | minVal = Math.min(height[left], height[right]); 23 | total = Math.max(total, minVal * (right - left)); 24 | if(height[left] <= height[right]) { 25 | left++; 26 | } else { 27 | right--; 28 | } 29 | } 30 | return total; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/FlattenNestedListIterator_341.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import java.util.Iterator; 4 | 5 | /** 6 | * @author neeraj on 11/10/19 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class FlattenNestedListIterator_341 implements Iterator { 11 | 12 | public static void main(String[] args) { 13 | 14 | } 15 | 16 | @Override 17 | public boolean hasNext() { 18 | return false; 19 | } 20 | 21 | @Override 22 | public Integer next() { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/FlipGames_II.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | /** 4 | * @author neeraj on 12/09/19 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class FlipGames_II { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(canWin("++++")); 12 | } 13 | 14 | public static boolean canWin(String s) { 15 | if (s == null || s.length() < 2) { 16 | return false; 17 | } 18 | 19 | for (int i = 0; i < s.length() - 1; i++) { 20 | if (s.charAt(i) == '+' && s.charAt(i + 1) == '+') { 21 | String nextState = s.substring(0, i) + "--" + s.substring(i + 2); 22 | if (!canWin(nextState)) { 23 | return true; 24 | } 25 | } 26 | } 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/KthLargestElementInArray_215.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import java.util.Arrays; 4 | import java.util.PriorityQueue; 5 | 6 | /** 7 | * @author neeraj on 08/09/19 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class KthLargestElementInArray_215 { 12 | 13 | public static void main(String[] args) { 14 | System.out.println(findKthLargestOptimized(new int[]{3, 2, 1, 5, 6, 4}, 2)); 15 | System.out.println(findKthLargest(new int[]{3, 2, 1, 5, 6, 4}, 2)); 16 | } 17 | public static int findKthLargest(int[] nums, int k) { 18 | PriorityQueue maxHeap = new PriorityQueue<>(); 19 | for (int i : nums) { 20 | maxHeap.add(i); 21 | if (maxHeap.size() > k) { 22 | maxHeap.poll(); 23 | } 24 | } 25 | return maxHeap.poll(); 26 | } 27 | 28 | public static int findKthLargestOptimized(int[] nums, int k) { 29 | Arrays.sort(nums); 30 | return nums[nums.length - k]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/LetterTilePossibilities.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | /** 4 | * @author neeraj on 05/10/19 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class LetterTilePossibilities { 9 | 10 | public static void main(String[] args) { 11 | numTilePossibilities("AAB"); 12 | } 13 | 14 | static int totalPossibilities = 0; 15 | 16 | public static int numTilePossibilities(String tiles) { 17 | totalPossibilities = 0; 18 | permuteUtil(tiles, ""); 19 | return totalPossibilities; 20 | } 21 | 22 | private static void permuteUtil(String prefix, String suffix) { 23 | if (suffix != "") { 24 | System.out.println(suffix); 25 | totalPossibilities++; 26 | } 27 | for (int i = 0; i < prefix.length(); i++) { 28 | char chatAtI = prefix.charAt(i); 29 | permuteUtil(prefix.substring(i+1), suffix + chatAtI); 30 | } 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/PerfectSquares_279.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import com.util.LogUtil; 4 | 5 | /** 6 | * @author neeraj on 13/10/19 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class PerfectSquares_279 { 11 | 12 | public static void main(String[] args) { 13 | solvePerfectSquares(12); 14 | solvePerfectSquares(13); 15 | solvePerfectSquares(43); 16 | solvePerfectSquares(3); 17 | solvePerfectSquares(4); 18 | } 19 | 20 | public static void solvePerfectSquares(int n) { 21 | LogUtil.logIt("Least number of perfect square numbers for " + n + " is " + numSquares(n)); 22 | } 23 | 24 | /** 25 | * Dynamic Programming, Memorization 26 | */ 27 | public static int numSquares(int n) { 28 | 29 | // We know that for n=0, the least number of perfect squares is 0; 30 | int[] dp = new int[n + 1]; 31 | dp[0] = 0; 32 | 33 | for (int i = 0; i <= n; i++) { 34 | dp[i] = i; 35 | for (int j = 1; j * j <= i; j++) { 36 | dp[i] = Math.min(dp[i], 1 + dp[i - (j * j)]); 37 | } 38 | } 39 | return dp[n]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/RepeatedDNASequence.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | /** 9 | * https://leetcode.com/problems/repeated-dna-sequences/ 10 | * 11 | * @author neeraj on 08/10/19 12 | * Copyright (c) 2019, data-structures. 13 | * All rights reserved. 14 | */ 15 | public class RepeatedDNASequence { 16 | 17 | public static void main(String[] args) { 18 | System.out.println(findRepeatedDnaSequences("AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT")); 19 | System.out.println(findRepeatedDnaSequences("AAAAAAAAAAAA")); 20 | } 21 | 22 | public static List findRepeatedDnaSequences(String s) { 23 | Set result = new HashSet<>(); 24 | Set seen = new HashSet<>(); 25 | String substr; 26 | for (int i = 0; i <= s.length() - 10; i++) { 27 | substr = s.substring(i, i + 10); 28 | if (!seen.add(substr)) { 29 | result.add(substr); 30 | } 31 | } 32 | return new ArrayList<>(result); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/TopKFreqElements.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * @author neeraj on 06/10/19 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class TopKFreqElements { 11 | 12 | public static void main(String[] args) { 13 | System.out.println(topKFrequent(new int[]{1, 1, 1, 2, 2, 3}, 2)); 14 | System.out.println(topKFrequent(new int[]{1}, 1)); 15 | } 16 | 17 | public static List topKFrequent(int[] nums, int k) { 18 | Map freq = new HashMap<>(); 19 | for (int i : nums) { 20 | freq.put(i, freq.getOrDefault(i, 0) + 1); 21 | } 22 | List keys = new ArrayList<>(freq.keySet()); 23 | Collections.sort(keys, (a, b) -> freq.get(b) - freq.get(a)); 24 | List result = new ArrayList<>(); 25 | for (int i = 0; i < k; i++) { 26 | result.add(keys.get(i)); 27 | } 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/leetcode/problems/medium/TreeNode.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.problems.medium; 2 | 3 | public class TreeNode { 4 | public int val; 5 | public TreeNode left; 6 | public TreeNode right; 7 | 8 | public TreeNode(int x) { 9 | val = x; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/AssignCookies.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * @author neeraj on 26/03/20 7 | * Copyright (c) 2019, data-structures. 8 | * All rights reserved. 9 | */ 10 | public class AssignCookies { 11 | 12 | public static void main(String[] args) { 13 | testIt(new int[]{1, 2, 3}, new int[]{1, 1}); 14 | testIt(new int[]{1, 2}, new int[]{1, 2, 3}); 15 | } 16 | 17 | public static void testIt(int[] greed, int[] size) { 18 | System.out.println(findContentChildren(greed, size)); 19 | } 20 | 21 | public static int findContentChildren(int[] greed, int[] size) { 22 | 23 | // Sort Children Greed Factor 24 | Arrays.sort(greed); 25 | // Sort Cookie Size 26 | Arrays.sort(size); 27 | int i = 0; 28 | 29 | for (int j = 0; j < size.length && i < greed.length; j++) { 30 | if (greed[i] <= size[j]) i++; 31 | } 32 | return i; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/DP/interview_prep/TileStacking.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.DP.interview_prep; 2 | 3 | /** 4 | * @author neeraj on 08/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class TileStacking { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(findWaysWeCanStackTile(3, 3, 1)); 12 | System.out.println(findWaysWeCanStackTile(3, 3, 2)); 13 | } 14 | 15 | public static int findWaysWeCanStackTile(int heightOfTower, int tiles, int maxAllowedTileOfParticularHeight) { 16 | if (heightOfTower < 0 || tiles < 0) { 17 | return 0; 18 | } 19 | 20 | if (heightOfTower == 0) { 21 | return 1; // we just have 1 way, but not choosing any more tile 22 | } 23 | 24 | // We will try for each tile upto maxAllowedTileOfParticularHeight times 25 | // either by choosing it or not choosing it. 26 | int totalWays = 0; 27 | for (int i = 0; i <= maxAllowedTileOfParticularHeight; i++) { 28 | totalWays += findWaysWeCanStackTile(heightOfTower - i, tiles - 1, maxAllowedTileOfParticularHeight); 29 | } 30 | return totalWays; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/DP/longest_common_subsequence/SequencePatternMatching.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.DP.longest_common_subsequence; 2 | 3 | /** 4 | * @author neeraj on 09/05/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class SequencePatternMatching { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(isSequencePatternMatching("AXY", "ADXCPY")); 12 | } 13 | 14 | public static boolean isSequencePatternMatching(String X, String Y) { 15 | /** 16 | * X = A X Y 17 | * Y = A D X C Y; 18 | * 19 | * What we have to tell is whether X is present in Y. 20 | * this is a simple problem of LCS(X, Y).... if Length of LCS is == X 21 | * we are good, X is definitely present in Y, reason being self explanatory 22 | */ 23 | // Ensuring Always keep X smaller 24 | if (X.length() > Y.length()) { 25 | return isSequencePatternMatching(Y, X); 26 | } 27 | int lengthOfLCS = LengthOfLongestCommonSubsequence.findLengthOfLCS(X, Y); 28 | return X.length() == lengthOfLCS; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/DP/zero_one_knapsack/CountAllSubSequenceHavingProductLessThanK.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.DP.zero_one_knapsack; 2 | 3 | /** 4 | * @author neeraj on 19/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class CountAllSubSequenceHavingProductLessThanK { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(countOfAllSubsequence(new int[]{1, 2, 3, 4}, 10)); 12 | System.out.println(countOfAllSubsequence(new int[]{4, 8, 7, 2}, 50)); 13 | System.out.println(countOfAllSubsequence(new int[]{10, 5, 2, 6}, 100)); 14 | } 15 | 16 | public static int countOfAllSubsequence(int[] arr, int k) { 17 | return solve(arr, arr.length - 1, k); 18 | } 19 | 20 | private static int solve(int[] arr, int N, int k) { 21 | if (N < 0) return 0; 22 | 23 | if (arr[N] <= k) { 24 | // Choose it 25 | return 1 + solve(arr, N - 1, k / arr[N]) 26 | + solve(arr, N - 1, k); // Or not choose it 27 | } else { 28 | return solve(arr, N - 1, k); // definitely not choosing it. 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/FindPeakElement.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 11/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class FindPeakElement { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(findPeakElement(new int[]{1, 2, 3, 1})); 12 | } 13 | 14 | public static int findPeakElement(int[] nums) { 15 | return findPeakElement(nums, 0, nums.length - 1); 16 | } 17 | 18 | public static int findPeakElement(int[] nums, int low, int high) { 19 | while (low <= high) { 20 | int middle = low + (high - low) / 2; 21 | 22 | int leftElement = middle == 0 ? Integer.MIN_VALUE : nums[middle - 1]; 23 | int rightElement = middle == nums.length - 1 ? Integer.MIN_VALUE : nums[middle + 1]; 24 | 25 | if (nums[middle] > leftElement && nums[middle] > rightElement) { 26 | return middle; 27 | } 28 | 29 | if (nums[middle] < rightElement) { 30 | return findPeakElement(nums, middle + 1, high); 31 | } else { 32 | return findPeakElement(nums, low, middle - 1); 33 | } 34 | } 35 | return -1; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/Greedy/MinimumMovesToReachTargetScore.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.Greedy; 2 | 3 | /** 4 | * https://leetcode.com/problems/minimum-moves-to-reach-target-score/description/ 5 | *

6 | * 2139. Minimum Moves to Reach Target Score 7 | *

8 | * similar to {@link BrokenCalculator} 9 | */ 10 | public class MinimumMovesToReachTargetScore { 11 | 12 | public static void main(String[] args) { 13 | System.out.println(minMoves(5, 0)); 14 | System.out.println(minMoves(19, 2)); 15 | System.out.println(minMoves(10, 4)); 16 | System.out.println(minMoves(1000000000, 5)); 17 | System.out.println(minMoves(766972377, 92)); 18 | } 19 | 20 | public static int minMoves(int target, int maxDoubles) { 21 | int minMoves = 0; 22 | while (target > 1) { 23 | if (target % 2 == 0) { 24 | if (maxDoubles > 0) { 25 | maxDoubles--; 26 | minMoves++; 27 | } else { 28 | minMoves += target / 2; 29 | } 30 | target /= 2; 31 | } else { 32 | target -= 1; 33 | minMoves++; 34 | } 35 | } 36 | return minMoves; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/Greedy/coding_with_mik/BrokenCalculator.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.Greedy.coding_with_mik; 2 | 3 | /** 4 | * https://leetcode.com/problems/broken-calculator/ 5 | */ 6 | public class BrokenCalculator { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(brokenCalc(5, 100)); 10 | } 11 | /** 12 | * So we have given 2 operations, either subtract or multiply 13 | * if we take opposite approach of dividing the target and doing addition instead 14 | * 15 | * Also for odd we can't really divide by 2 else we will get decimal, so we should make it even by adding 1 16 | * and then divide 17 | * 18 | */ 19 | public static int brokenCalc(int startValue, int target) { 20 | int totalOperation = 0; 21 | while (startValue < target) { 22 | target = target % 2 == 0 ? target / 2 : target + 1; 23 | totalOperation++; 24 | } 25 | return totalOperation + (startValue - target); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/Greedy/coding_with_mik/MaximumBagsWithFullCapacityOfRocks.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.Greedy.coding_with_mik; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * 2279. Maximum Bags With Full Capacity of Rocks 7 | * https://leetcode.com/problems/maximum-bags-with-full-capacity-of-rocks/description/ 8 | */ 9 | public class MaximumBagsWithFullCapacityOfRocks { 10 | public static void main(String[] args) { 11 | System.out.println(maximumBags(new int[]{2, 3, 4, 5}, new int[]{1, 2, 4, 4}, 2)); 12 | System.out.println(maximumBags(new int[]{10, 2, 2}, new int[]{2, 2, 0}, 100)); 13 | } 14 | 15 | public static int maximumBags(int[] capacity, int[] rocks, int additionalRocks) { 16 | int[] remainder = new int[capacity.length]; 17 | for (int i = 0; i < capacity.length; i++) { 18 | remainder[i] = capacity[i] - rocks[i]; 19 | } 20 | Arrays.sort(remainder); 21 | 22 | int count = 0; 23 | for (int j : remainder) { 24 | if (j == 0) { 25 | count++; 26 | } else if (j <= additionalRocks) { 27 | additionalRocks -= j; 28 | count++; 29 | } 30 | } 31 | return count; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/Greedy/coding_with_mik/MaximumElementAfterDecreasingAndRearranging.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.Greedy.coding_with_mik; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * 1846. Maximum Element After Decreasing and Rearranging 7 | * https://leetcode.com/problems/maximum-element-after-decreasing-and-rearranging/description/ 8 | */ 9 | public class MaximumElementAfterDecreasingAndRearranging { 10 | 11 | public static void main(String[] args) { 12 | MaximumElementAfterDecreasingAndRearranging obj = new MaximumElementAfterDecreasingAndRearranging(); 13 | System.out.println(obj.maximumElementAfterDecrementingAndRearranging(new int[]{2, 2, 1, 2, 1})); 14 | } 15 | 16 | public int maximumElementAfterDecrementingAndRearranging(int[] arr) { 17 | Arrays.sort(arr); 18 | int max = 1; 19 | for (int i = 1; i < arr.length; i++) { 20 | arr[i] = Math.min(arr[i - 1] + 1, arr[i]); 21 | max = arr[i]; 22 | } 23 | return max; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/Greedy/coding_with_mik/MaximumIceCreamBars.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.Greedy.coding_with_mik; 2 | 3 | import java.util.Arrays; 4 | 5 | public class MaximumIceCreamBars { 6 | 7 | /** 8 | * 1833. Maximum Ice Cream Bars 9 | * https://leetcode.com/problems/maximum-ice-cream-bars/description/ 10 | */ 11 | public static void main(String[] args) { 12 | 13 | } 14 | 15 | public int maxIceCream(int[] costs, int coins) { 16 | Arrays.sort(costs); 17 | int maxIceCream = 0; 18 | for (int cost : costs) { 19 | if (cost <= coins) { 20 | coins -= cost; 21 | maxIceCream++; 22 | } else { 23 | break; 24 | } 25 | } 26 | return maxIceCream; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/KthSmallestElementInBST.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 02/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class KthSmallestElementInBST { 9 | 10 | public static void main(String[] args) { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/ListNode.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 15/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class ListNode { 9 | public int val; 10 | public ListNode next; 11 | public ListNode prev; 12 | public ListNode child; 13 | 14 | public ListNode() { 15 | } 16 | 17 | public ListNode(int val) { 18 | this.val = val; 19 | } 20 | 21 | public void printList(ListNode head) { 22 | ListNode temp = head; 23 | while (temp != null) { 24 | System.out.print(temp.val + " --> "); 25 | temp = temp.next; 26 | } 27 | System.out.println(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/PalindromicSubstrings.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 02/05/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class PalindromicSubstrings { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(countSubstrings("abc")); 12 | System.out.println(countSubstrings("aaa")); 13 | } 14 | 15 | static int totalCount = 0; 16 | 17 | public static int countSubstrings(String s) { 18 | totalCount = 0; 19 | for (int i = 0; i < s.length(); i++) { 20 | extendPalindrome(s, i, i); 21 | extendPalindrome(s, i, i + 1); 22 | } 23 | return totalCount; 24 | } 25 | 26 | public static void extendPalindrome(String s, int low, int high) { 27 | while (low >= 0 && high < s.length() && s.charAt(low) == s.charAt(high)) { 28 | low--; 29 | high++; 30 | totalCount++; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/PerformStringShifts.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 14/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class PerformStringShifts { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(stringShift("abc", new int[][]{{0, 1}, {1, 2}})); 12 | System.out.println(stringShift("abcdefg", new int[][]{{1, 1}, {1, 1}, {0, 2}, {1, 3}})); 13 | System.out.println(stringShift("ABCD", new int[][]{{1, 1}, {1, 2}, {1, 3}, {1, 4}})); 14 | } 15 | 16 | public static String stringShift(String s, int[][] shift) { 17 | for (int[] currentShift : shift) { 18 | if (currentShift[1] > s.length()) { 19 | currentShift[1] = currentShift[1] % s.length(); 20 | } 21 | if (currentShift[0] == 1) { 22 | s = s.substring(s.length() - currentShift[1]) + s.substring(0, s.length() - currentShift[1]); 23 | } else { 24 | s = s.substring(currentShift[1]) + s.substring(0, currentShift[1]); 25 | } 26 | } 27 | return s; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/PopulatingNextRightPointersInEachNode.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | import static com.leetcode.year_2020.tree.ConstructBinaryTreeUsingPreOrderAndInorderTraversal.buildTreeFromPreOrderAndInorder; 4 | import static com.leetcode.year_2020.TreeNode.inorder; 5 | 6 | /** 7 | * @author neeraj on 26/04/20 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class PopulatingNextRightPointersInEachNode { 12 | 13 | public static void main(String[] args) { 14 | TreeNode tree = buildTreeFromPreOrderAndInorder( 15 | new int[]{1,2,4,5,3,6,7}, 16 | new int[]{4,2,5,1,6,3,7} 17 | ); 18 | 19 | TreeNode connectedRoot = connect(tree); 20 | inorder(connectedRoot); 21 | } 22 | 23 | public static TreeNode connect(TreeNode root) { 24 | if(root == null) return null; 25 | if(root.left != null) { 26 | root.left.next = root.right; 27 | } 28 | if(root.right != null && root.next != null) { 29 | root.right.next = root.next.left; 30 | } 31 | connect(root.left); 32 | connect(root.right); 33 | return root; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/ProductofArrayExceptSelf.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | import com.util.LogUtil; 4 | 5 | import java.util.Arrays; 6 | 7 | /** 8 | * @author neeraj on 15/04/20 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class ProductofArrayExceptSelf { 13 | 14 | public static void main(String[] args) { 15 | LogUtil.printArray(productExceptSelf(new int[]{1, 2, 3, 4})); 16 | } 17 | 18 | public static int[] productExceptSelf(int[] nums) { 19 | int[] output = new int[nums.length]; 20 | Arrays.fill(output, 1); 21 | int previousProduct = 1; 22 | for (int i = 0; i < nums.length; i++) { 23 | output[i] *= previousProduct; 24 | previousProduct *= nums[i]; 25 | } 26 | 27 | previousProduct = 1; 28 | for (int i = nums.length - 1; i >= 0; i--) { 29 | output[i] *= previousProduct; 30 | previousProduct *= nums[i]; 31 | } 32 | return output; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/RandomListNode.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 18/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class RandomListNode { 9 | public int val; 10 | public RandomListNode next, random; 11 | 12 | public RandomListNode(int val) { 13 | this.val = val; 14 | } 15 | 16 | public void printList(RandomListNode head) { 17 | RandomListNode curr = head; 18 | String next = "-1"; 19 | String random = "-1"; 20 | System.out.println("NODE | NEXT | RANDOM"); 21 | while (curr != null) { 22 | next = curr.next != null ? curr.next.val+ " HashCode[ " + curr.next.hashCode() + " ]" : "-1"; 23 | random = curr.random != null ? curr.random.val + " HashCode[ " + curr.random.hashCode() + " ]" : "-1"; 24 | System.out.print(curr.val + " HashCode ["+ curr.hashCode() + " ]" + " | " + next + " | " + random); 25 | curr = curr.next; 26 | System.out.println(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/SplitAStringInBalancedStrings.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 01/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class SplitAStringInBalancedStrings { 9 | 10 | public static void main(String[] args) { 11 | testIt("RLRRLLRLRL"); 12 | testIt("RLLLLRRRLR"); 13 | testIt("LLLLRRRR"); 14 | testIt("RLRRRLLRLL"); 15 | } 16 | 17 | public static void testIt(String s) { 18 | System.out.println(balancedStringSplit(s)); 19 | } 20 | 21 | public static int balancedStringSplit(String s) { 22 | int balance = 0; 23 | int total = 0; 24 | 25 | for (char c : s.toCharArray()) { 26 | if (c == 'L') { 27 | balance += 1; 28 | } else { 29 | balance -= 1; 30 | } 31 | if (balance == 0) { 32 | total += 1; 33 | } 34 | } 35 | return total; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/TreeNode.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020; 2 | 3 | /** 4 | * @author neeraj on 25/04/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class TreeNode { 9 | 10 | public int val; 11 | public TreeNode left; 12 | public TreeNode right; 13 | public TreeNode next; 14 | 15 | public TreeNode(int x) { 16 | val = x; 17 | } 18 | 19 | public static void inorder(TreeNode root) { 20 | if (root == null) return; 21 | inorder(root.left); 22 | System.out.print(root.val + "\t"); 23 | inorder(root.right); 24 | } 25 | 26 | public static void preorder(TreeNode root) { 27 | if (root == null) return; 28 | System.out.print(root.val + "\t"); 29 | preorder(root.left); 30 | preorder(root.right); 31 | } 32 | 33 | public static void postOrder(TreeNode root) { 34 | if (root == null) return; 35 | postOrder(root.left); 36 | postOrder(root.right); 37 | System.out.print(root.val + "\t"); 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "" + val; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/all_premium/tags/google/sort/WiggleSort.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.all_premium.tags.google.sort; 2 | 3 | import com.util.LogUtil; 4 | 5 | /** 6 | * https://www.lintcode.com/problem/508/ 7 | */ 8 | public class WiggleSort { 9 | 10 | public static void main(String[] args) { 11 | int[] nums = new int[]{3, 5, 2, 1, 6, 4}; 12 | wiggleSort(nums); 13 | LogUtil.printArray(nums); 14 | } 15 | 16 | public static void wiggleSort(int[] nums) { 17 | // 3,5,2,1,6,4 18 | for (int i = 0; i < nums.length - 1; i++) { 19 | if (i % 2 == 0) { 20 | if (nums[i + 1] < nums[i]) { 21 | swap(nums, i, i + 1); 22 | } 23 | } else { 24 | if (nums[i + 1] > nums[i]) { 25 | swap(nums, i, i + 1); 26 | } 27 | } 28 | } 29 | // 1,2,3,4 30 | } 31 | 32 | public static void swap(int[] nums, int i, int j) { 33 | int temp = nums[j]; 34 | nums[j] = nums[i]; 35 | nums[i] = temp; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/array/FindAllNumbersDisappearedInAnArray.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.array; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * @author neeraj on 29/06/20 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class FindAllNumbersDisappearedInAnArray { 12 | 13 | public static void main(String[] args) { 14 | System.out.println(findDisappearedNumbers(new int[]{4, 3, 2, 7, 8, 2, 3, 1})); 15 | } 16 | 17 | public static List findDisappearedNumbers(int[] nums) { 18 | List result = new ArrayList<>(); 19 | 20 | for (int i = 0; i < nums.length; i++) { 21 | int indexToBeReplaced = Math.abs(nums[i]) - 1; 22 | if (nums[indexToBeReplaced] > 0) { // No One has modified it's value till now 23 | nums[indexToBeReplaced] = 0 - nums[indexToBeReplaced]; 24 | } 25 | } 26 | 27 | for (int i = 0; i < nums.length; i++) { 28 | if (nums[i] > 0) { 29 | result.add(i + 1); 30 | } 31 | } 32 | return result; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/array/FindPermutation.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.array; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Stack; 5 | 6 | public class FindPermutation { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(findPerm("ID", 3)); 10 | System.out.println(findPerm("IDID", 5)); 11 | System.out.println(findPerm("IDDDIIID", 8)); 12 | } 13 | 14 | public static ArrayList findPerm(final String A, int B) { 15 | final ArrayList result = new ArrayList<>(); 16 | final Stack stack = new Stack<>(); 17 | for (int i = 0; i < B; i++) { 18 | stack.push(i + 1); 19 | if (i < A.length() && A.charAt(i) == 'I') { 20 | while (!stack.isEmpty()) { 21 | result.add(stack.pop()); 22 | } 23 | } 24 | } 25 | while (!stack.isEmpty()) { 26 | result.add(stack.pop()); 27 | } 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/array/LargestNumber.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.array; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | /** 8 | * https://www.interviewbit.com/problems/largest-number/ 9 | */ 10 | public class LargestNumber { 11 | 12 | public static void main(String[] args) { 13 | System.out.println(largestNumber(new int[]{3, 30, 34, 5, 9})); 14 | } 15 | 16 | public static String largestNumber(final int[] A) { 17 | final List numbers = new ArrayList<>(); 18 | for (int i : A) { 19 | numbers.add("" + i); 20 | } 21 | Collections.sort(numbers, (a, b) -> { 22 | int val = (b + a).compareTo(a + b); 23 | System.out.println("Comparing " + (b + a) + " and " + (a + b) + " and result is " + val); 24 | return val; 25 | }); 26 | StringBuilder str = new StringBuilder(); 27 | for (String i : numbers) { 28 | str.append(i); 29 | } 30 | return str.toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/array/PerfectPeak.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.array; 2 | 3 | /** 4 | * https://www.interviewbit.com/problems/perfect-peak-of-array/ 5 | */ 6 | public class PerfectPeak { 7 | 8 | public static void main(String[] args) { 9 | System.out.println(perfectPeak(new int[]{5706, 26963, 24465, 29359, 16828, 26501, 28146, 18468, 9962, 2996, 492, 11479, 23282, 19170, 15725, 6335})); 10 | } 11 | 12 | public static int perfectPeak(int[] A) { 13 | int[] leftMax = new int[A.length]; 14 | int[] rightMin = new int[A.length]; 15 | leftMax[0] = A[0]; 16 | rightMin[A.length - 1] = A[A.length - 1]; 17 | 18 | for (int i = 1; i < A.length; i++) { 19 | leftMax[i] = Math.max(leftMax[i - 1], A[i]); 20 | } 21 | for (int i = A.length - 2; i >= 0; i--) { 22 | rightMin[i] = Math.min(rightMin[i + 1], A[i]); 23 | } 24 | 25 | for (int i = 1; i < A.length - 1; i++) { 26 | if ((leftMax[i - 1] < A[i]) && (A[i] < rightMin[i + 1])) { 27 | return 1; 28 | } 29 | } 30 | return 0; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/challenges/October_challenge/KDiffPairsInAnArray.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.challenges.October_challenge; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | /** 8 | * @author neeraj on 05/10/20 9 | * Copyright (c) 2019, data-structures. 10 | * All rights reserved. 11 | */ 12 | public class KDiffPairsInAnArray { 13 | 14 | public static void main(String[] args) { 15 | System.out.println(findPairs(new int[]{3, 1, 4, 1, 5}, 2)); 16 | System.out.println(findPairs(new int[]{1, 2, 4, 4, 3, 3, 0, 9, 2, 3}, 3)); 17 | System.out.println(findPairs(new int[]{1, 1, 1, 1, 1}, 0)); 18 | } 19 | 20 | public static int findPairs(int[] nums, int k) { 21 | Arrays.sort(nums); 22 | Set partner = new HashSet<>(); 23 | Set pairs = new HashSet<>(); 24 | int count = 0; 25 | for (int i = 0; i < nums.length; i++) { 26 | if (partner.contains(nums[i])) { 27 | if (pairs.add(nums[i])) { 28 | count++; 29 | } 30 | } 31 | partner.add(nums[i] + k); 32 | } 33 | return count; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/challenges/October_challenge/NumberofRecentCalls.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.challenges.October_challenge; 2 | 3 | import java.util.ArrayDeque; 4 | import java.util.Deque; 5 | 6 | /** 7 | * @author neeraj on 05/10/20 8 | * Copyright (c) 2019, data-structures. 9 | * All rights reserved. 10 | */ 11 | public class NumberofRecentCalls { 12 | 13 | public static void main(String[] args) { 14 | RecentCounter recentCounter = new RecentCounter(); 15 | recentCounter.ping(1); 16 | recentCounter.ping(100); 17 | recentCounter.ping(3000); 18 | recentCounter.ping(3002); 19 | } 20 | 21 | static class RecentCounter { 22 | 23 | Deque deque; 24 | 25 | public RecentCounter() { 26 | deque = new ArrayDeque<>(); 27 | } 28 | 29 | public int ping(int t) { 30 | deque.add(t); 31 | int res = findRecent(t - 3000); 32 | System.out.println(res); 33 | return res; 34 | } 35 | 36 | public int findRecent(int low) { 37 | while (deque.peekFirst() < low) { 38 | deque.pollFirst(); 39 | } 40 | return deque.size(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/graph/GraphUser.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.graph; 2 | 3 | /** 4 | * @author neeraj on 26/05/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class GraphUser { 9 | 10 | public static void main(String[] args) { 11 | Graph graph = new Graph(6); 12 | graph.addEdge(1, 2, false); 13 | graph.addEdge(1, 5, false); 14 | graph.addEdge(1, 4, false); 15 | graph.addEdge(2, 3, false); 16 | graph.addEdge(3, 4, false); 17 | 18 | graph.dfs(graph, 1); 19 | graph.bfs(graph, 1); 20 | graph.dfsUsingStack(graph, 1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/prefix_sum_technique/RandomPickIndex.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.prefix_sum_technique; 2 | 3 | import java.util.*; 4 | 5 | public class RandomPickIndex { 6 | 7 | public static void main(String[] args) { 8 | 9 | } 10 | 11 | class Solution { 12 | 13 | private Random random = new Random(); 14 | private Map> itemToIndexListMap = new HashMap<>(); 15 | public Solution(int[] nums) { 16 | for(int i = 0; i < nums.length; i++) { 17 | itemToIndexListMap.putIfAbsent(nums[i], new ArrayList<>()); 18 | itemToIndexListMap.get(nums[i]).add(i); 19 | } 20 | } 21 | 22 | public int pick(int target) { 23 | List allIndexes = itemToIndexListMap.get(target); 24 | int randomIndex = random.nextInt(allIndexes.size()); 25 | return allIndexes.get(randomIndex); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/sliding_window/NumberofSubstringsContainingAllThreeCharacters.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.sliding_window; 2 | 3 | /** 4 | * @author neeraj on 14/07/20 5 | * Copyright (c) 2019, data-structures. 6 | * All rights reserved. 7 | */ 8 | public class NumberofSubstringsContainingAllThreeCharacters { 9 | 10 | public static void main(String[] args) { 11 | System.out.println(getTotalSubstringCount("abcabc")); 12 | } 13 | 14 | public static int getTotalSubstringCount(String str) { 15 | int[] count = new int[3]; 16 | 17 | int totalSubstring = 0; 18 | int end = 0, start = 0; 19 | while (end < str.length()) { 20 | count[str.charAt(end) - 'a']++; 21 | end++; 22 | while (start < str.length() && count[0] > 0 && count[1] > 0 && count[2] > 0) { 23 | count[str.charAt(start) - 'a']--; 24 | start++; 25 | } 26 | // Why totalSubstring+=start ? 27 | // Since everything before start was already meeting the criteria of having all three characters 28 | // which is why everything before start contributes to it. 29 | totalSubstring += start; 30 | } 31 | return totalSubstring; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/stack/ValidParentheses.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.stack; 2 | 3 | import java.util.Stack; 4 | 5 | public class ValidParentheses { 6 | 7 | public static void main(String[] args) { 8 | System.out.println(isValid("()")); 9 | System.out.println(isValid("()[]{}")); 10 | System.out.println(isValid("(]")); 11 | System.out.println(isValid("([)]")); 12 | System.out.println(isValid("{[]}")); 13 | } 14 | 15 | public static boolean isValid(String s) { 16 | Stack st = new Stack<>(); 17 | 18 | for (char c : s.toCharArray()) { 19 | if (c == '(') st.push(')'); 20 | else if (c == '{') st.push('}'); 21 | else if (c == '[') st.push(']'); 22 | else if (st.isEmpty() || st.pop() != c) { 23 | // basically whenever you encounter closed bracket just check 24 | // if stack isn't empty and the top of stack matches the current closed character. 25 | return false; 26 | } 27 | } 28 | return st.isEmpty(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/stack/codingWithMIK/BuildAnArrayWithStackOperations.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.stack.codingWithMIK; 2 | 3 | import java.util.*; 4 | 5 | public class BuildAnArrayWithStackOperations { 6 | 7 | public static void main(String[] args) { 8 | BuildAnArrayWithStackOperations obj = new BuildAnArrayWithStackOperations(); 9 | System.out.println(obj.buildArray(new int[]{1, 3}, 3)); 10 | System.out.println(obj.buildArray(new int[]{1, 2, 3}, 3)); 11 | System.out.println(obj.buildArray(new int[]{1, 2}, 4)); 12 | } 13 | 14 | public List buildArray(int[] target, int n) { 15 | int targetPointer = 0; 16 | List operations = new ArrayList<>(); 17 | 18 | int nTracker = 1; 19 | while (targetPointer < target.length) { 20 | if (nTracker == target[targetPointer]) { 21 | operations.add("Push"); 22 | targetPointer++; 23 | } else { 24 | operations.add("Push"); 25 | operations.add("Pop"); 26 | } 27 | nTracker++; 28 | } 29 | return operations; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/stack/codingWithMIK/MinimumDeletionsToMakeStringBalanced.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.stack.codingWithMIK; 2 | 3 | import java.util.Stack; 4 | 5 | public class MinimumDeletionsToMakeStringBalanced { 6 | 7 | public static void main(String[] args) { 8 | MinimumDeletionsToMakeStringBalanced obj = new MinimumDeletionsToMakeStringBalanced(); 9 | System.out.println(obj.minimumDeletions("aababbab")); 10 | System.out.println(obj.minimumDeletions("bbaaaaabb")); 11 | System.out.println(obj.minimumDeletions("aaaaaaa")); 12 | System.out.println(obj.minimumDeletions("bbbbbb")); 13 | System.out.println(obj.minimumDeletions("babab")); 14 | } 15 | 16 | public int minimumDeletions(String s) { 17 | int b_count = 0; 18 | int minDeletes = 0; 19 | for (char c : s.toCharArray()) { 20 | if (c == 'b') { 21 | b_count++; 22 | } else { 23 | if (b_count > 0) { 24 | minDeletes++; 25 | b_count--; 26 | } 27 | } 28 | } 29 | return minDeletes; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/tree/BinaryTreeLongestConsecutiveSequence_1.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.tree; 2 | 3 | import com.leetcode.year_2020.TreeNode; 4 | 5 | /** 6 | * https://www.lintcode.com/problem/595/ 7 | * 595 · Binary Tree Longest Consecutive Sequence 8 | */ 9 | public class BinaryTreeLongestConsecutiveSequence_1 { 10 | 11 | public static void main(String[] args) { 12 | 13 | } 14 | 15 | static int LONGEST = 0; 16 | 17 | public int longestConsecutive(TreeNode root) { 18 | LONGEST = 0; 19 | longest(root, null, 1); 20 | return LONGEST; 21 | } 22 | 23 | private void longest(TreeNode root, TreeNode parent, int distance) { 24 | if (root == null) return; 25 | if (parent != null) { 26 | if (root.val - parent.val == 1) { 27 | distance++; 28 | } else { 29 | distance = 1; 30 | } 31 | } 32 | LONGEST = Math.max(distance, LONGEST); 33 | longest(root.left, root, distance); 34 | longest(root.right, root, distance); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/tree/ConvertSortedArrayToBinarySearchTree.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.tree; 2 | 3 | import com.leetcode.year_2020.TreeNode; 4 | 5 | public class ConvertSortedArrayToBinarySearchTree { 6 | 7 | public static void main(String[] args) { 8 | TreeNode root = sortedArrayToBST(new int[]{-10, -3, 0, 5, 9}); 9 | TreeNode.inorder(root); 10 | System.out.println(); 11 | root = sortedArrayToBST(new int[]{1, 2, 3, 4, 5, 6}); 12 | TreeNode.inorder(root); 13 | System.out.println(); 14 | root = sortedArrayToBST(new int[]{1,3}); 15 | TreeNode.inorder(root); 16 | } 17 | 18 | public static TreeNode sortedArrayToBST(int[] nums) { 19 | return helper(nums, 0, nums.length - 1); 20 | } 21 | 22 | public static TreeNode helper(int[] nums, int low, int high) { 23 | if (low <= high) { 24 | int mid = low + (high - low) / 2; 25 | TreeNode root = new TreeNode(nums[mid]); 26 | root.left = helper(nums, low, mid - 1); 27 | root.right = helper(nums, mid + 1, high); 28 | return root; 29 | } 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/tree/avltree/MainApp.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.tree.avltree; 2 | 3 | public class MainApp { 4 | 5 | public static void main(String[] args) { 6 | Tree tree = new AVLTree<>(); 7 | /** 8 | * 9 | * 10 10 | * / 11 | * 6 12 | * / \ 13 | * 4 9 14 | */ 15 | tree.insert(10).insert(6).insert(4).insert(9); 16 | 17 | tree.traverse(); 18 | 19 | // Add Node 5 on the right of 4 20 | tree.insert(5); 21 | tree.traverse(); 22 | 23 | // Delete Node 6 24 | tree.delete(6); 25 | tree.traverse(); 26 | 27 | tree = new AVLTree<>(); 28 | /** 29 | * 10 30 | * \ 31 | * 20 32 | * \ 33 | * 30 ================> 30 34 | * \ / \ 35 | * 40 20 40 36 | * \ / \ 37 | * 50 10 50 38 | */ 39 | tree.insert(10).insert(20).insert(30).insert(40).insert(50); 40 | tree.traverse(); 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/tree/avltree/Node.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.tree.avltree; 2 | 3 | import lombok.Data; 4 | import lombok.NonNull; 5 | 6 | @Data 7 | public class Node> { 8 | @NonNull 9 | private T data; 10 | private int height = 1; // Initially every node is a leaf node and should be given height=1 11 | private Node leftChild; 12 | private Node rightChild; 13 | } 14 | -------------------------------------------------------------------------------- /src/com/leetcode/year_2020/tree/avltree/Tree.java: -------------------------------------------------------------------------------- 1 | package com.leetcode.year_2020.tree.avltree; 2 | 3 | public interface Tree> { 4 | Tree insert(T data); 5 | 6 | void delete(T data); 7 | 8 | void traverse(); 9 | 10 | T getMax(); 11 | 12 | T getMin(); 13 | 14 | boolean isEmpty(); 15 | } 16 | -------------------------------------------------------------------------------- /src/com/multithreading/CriticalSectionRaceCondition.java: -------------------------------------------------------------------------------- 1 | package com.multithreading; 2 | 3 | public class CriticalSectionRaceCondition { 4 | 5 | public void show() { 6 | for (int i = 0; i < 5; i++) { 7 | System.out.println(Thread.currentThread().getName() + " - Number: " + i); 8 | } 9 | } 10 | 11 | public static void main(String[] args) { 12 | CriticalSectionRaceCondition raceCondition = new CriticalSectionRaceCondition(); 13 | Runnable runner = new Runnable() { 14 | @Override 15 | public void run() { 16 | raceCondition.show(); 17 | } 18 | }; 19 | 20 | new Thread(runner, "Thread 1").start(); 21 | new Thread(runner, "Thread 2").start(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/com/multithreading/SafeCheckThenAct.java: -------------------------------------------------------------------------------- 1 | package com.multithreading; 2 | 3 | /** 4 | * Since we have synchronized the change number method, hence race condition will not happen 5 | * and The number will change only once. 6 | */ 7 | public class SafeCheckThenAct { 8 | private int number; 9 | 10 | synchronized public void changeNumber() { 11 | if (number == 0) { 12 | System.out.println(Thread.currentThread().getName() + " | Changed"); 13 | number = -1; 14 | } else { 15 | System.out.println(Thread.currentThread().getName() + " | Not Changed"); 16 | } 17 | } 18 | 19 | public static void main(String[] args) { 20 | SafeCheckThenAct safeCheckThenAct = new SafeCheckThenAct(); 21 | 22 | for (int i = 0; i < 50; i++) { 23 | new Thread(new Runnable() { 24 | @Override 25 | public void run() { 26 | safeCheckThenAct.changeNumber(); 27 | } 28 | }, "T " + i).start(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/multithreading/ThreadSafetyForObjectMemberVariables.java: -------------------------------------------------------------------------------- 1 | package com.multithreading; 2 | 3 | public class ThreadSafetyForObjectMemberVariables { 4 | 5 | public static void main(String[] args) throws InterruptedException { 6 | NotThreadSafe notThreadSafe1 = new NotThreadSafe(); 7 | NotThreadSafe notThreadSafe2 = new NotThreadSafe(); 8 | 9 | new Thread(new Runner(notThreadSafe1)).start(); 10 | new Thread(new Runner(notThreadSafe2)).start(); 11 | 12 | Thread.sleep(5000); 13 | System.out.println(notThreadSafe1.builder.toString()); 14 | System.out.println(notThreadSafe2.builder.toString()); 15 | } 16 | } 17 | 18 | class Runner implements Runnable { 19 | private NotThreadSafe notThreadSafe; 20 | 21 | public Runner(NotThreadSafe notThreadSafe) { 22 | this.notThreadSafe = notThreadSafe; 23 | } 24 | 25 | @Override 26 | public void run() { 27 | this.notThreadSafe.add(Thread.currentThread().getName()); 28 | } 29 | } 30 | 31 | 32 | class NotThreadSafe { 33 | StringBuilder builder = new StringBuilder(); 34 | 35 | public void add(String text) { 36 | this.builder.append(text); 37 | } 38 | } -------------------------------------------------------------------------------- /src/com/multithreading/UnsafeCheckThenAct.java: -------------------------------------------------------------------------------- 1 | package com.multithreading; 2 | 3 | /** 4 | * In this example it was expected to change the number field only once 5 | * but due to Race condition it end up changing any number of times 6 | */ 7 | public class UnsafeCheckThenAct { 8 | private int number; 9 | 10 | public void changeNumber() { 11 | if (number == 0) { 12 | System.out.println(Thread.currentThread().getName() + " | Changed"); 13 | number = -1; 14 | } else { 15 | System.out.println(Thread.currentThread().getName() + " | Not Changed"); 16 | } 17 | } 18 | 19 | public static void main(String[] args) { 20 | UnsafeCheckThenAct unsafeCheckThenAct = new UnsafeCheckThenAct(); 21 | 22 | for (int i = 0; i < 50; i++) { 23 | new Thread(new Runnable() { 24 | @Override 25 | public void run() { 26 | unsafeCheckThenAct.changeNumber(); 27 | } 28 | }, "T " + i).start(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/multithreading/UnsafeReadModifyWrite.java: -------------------------------------------------------------------------------- 1 | package com.multithreading; 2 | 3 | public class UnsafeReadModifyWrite { 4 | private int number; 5 | 6 | public void incrementNumber() { 7 | number++; 8 | } 9 | 10 | public int getNumber() { 11 | return this.number; 12 | } 13 | 14 | public static void main(String[] args) throws InterruptedException { 15 | final UnsafeReadModifyWrite unsafeReadModifyWrite = new UnsafeReadModifyWrite(); 16 | int noOfThreads = 1000; 17 | Thread[] threads = new Thread[noOfThreads]; 18 | 19 | for (int i = 0; i < noOfThreads; i++) { 20 | new Thread(() -> unsafeReadModifyWrite.incrementNumber(), "T " + i).start(); 21 | } 22 | 23 | Thread.sleep(6000); 24 | System.out.println("Final number (should be 1000): " + unsafeReadModifyWrite.getNumber()); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/com/serialization/SerializationWithInheritance.java: -------------------------------------------------------------------------------- 1 | package com.serialization; 2 | 3 | import java.io.*; 4 | 5 | public class SerializationWithInheritance { 6 | 7 | public static void main(String[] args) throws Exception { 8 | Dog object = new Dog(); 9 | 10 | // Serialization 11 | FileOutputStream fos = new FileOutputStream("abc.ser"); 12 | ObjectOutputStream oos = new ObjectOutputStream(fos); 13 | oos.writeObject(object); 14 | 15 | // Deserialization 16 | FileInputStream fis = new FileInputStream("abc.ser"); 17 | ObjectInputStream ois = new ObjectInputStream(fis); 18 | Dog object2 = (Dog) ois.readObject(); 19 | 20 | System.out.println(object.i + "::::" + object.j); 21 | 22 | System.out.println("Serialized Object"); 23 | System.out.println(object2.i + "::::" + object2.j); 24 | } 25 | } 26 | 27 | abstract class Animal implements Serializable { 28 | int i = 10; 29 | int j = 20; 30 | } 31 | 32 | class Dog extends Animal { 33 | } -------------------------------------------------------------------------------- /src/com/stackoverflow/CharCount.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class CharCount { 4 | 5 | public static void main(String[] args) { 6 | String s = "sagarbatra"; 7 | int counter; 8 | char[] myArray = new char[s.length()]; 9 | 10 | 11 | for (int i = 0; i < s.length(); i++) { 12 | counter = 1; 13 | char temp = s.charAt(i); 14 | for (int j = i + 1; j < s.length(); j++) { 15 | if (s.charAt(j) == temp) { 16 | counter++; 17 | } 18 | } 19 | if (!myArrayContains(myArray, temp)) { 20 | myArray[i] = temp; 21 | System.out.println(s.charAt(i) + "=" + counter); 22 | } 23 | } 24 | } 25 | 26 | public static Boolean myArrayContains(char[] myArray, char characterToFind) { 27 | for (char ch : myArray) { 28 | if (ch == characterToFind) { 29 | return true; 30 | } 31 | } 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/stackoverflow/ChildException.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class ChildException extends ParentException { 4 | 5 | ChildException(String str) { 6 | super(str); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/com/stackoverflow/CountOccurrences.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class CountOccurrences 4 | { 5 | public static void main( String[] args ) throws java.lang.Exception 6 | { 7 | printOccurrences( "AAAABBCCCDAA" ); 8 | } 9 | 10 | public static void printOccurrences( String str ) 11 | { 12 | int len = str.length(); 13 | char[] arr = str.toCharArray(); 14 | char contChar = arr[0]; 15 | int count = 0; 16 | StringBuffer sb = new StringBuffer(); 17 | for( int i = 0; i < arr.length; i++ ) 18 | { 19 | if( contChar == arr[i] ) 20 | { 21 | count++; 22 | 23 | // this below condition helps you to add that last A missed frequency 24 | if( i + 1 >= arr.length ) 25 | { // Since after this iteration loop will not enter the else block 26 | sb.append( count ).append( contChar ); 27 | } 28 | } 29 | else 30 | { 31 | sb.append( count ).append( contChar ); 32 | contChar = arr[i]; 33 | count = 0; 34 | i--; 35 | } 36 | } 37 | System.out.println( sb.toString() ); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/com/stackoverflow/DateHelper.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | public class DateHelper { 7 | 8 | public static void main(String[] args) throws Exception { 9 | System.out.println(formatDate("12-11-2014")); 10 | System.out.println(formatDate("12/11/2014")); 11 | } 12 | 13 | public static String formatDate(String str) throws Exception { 14 | SimpleDateFormat forwardSlashFormatter = new SimpleDateFormat("dd/MM/yyyy"); 15 | SimpleDateFormat hyphenFormatter = new SimpleDateFormat("dd-MM-yyyy"); 16 | Date parsedDate; 17 | 18 | if (str.matches("([0-9]{2})/([0-9]{2})/([0-9]{4})")) { 19 | parsedDate = forwardSlashFormatter.parse(str); 20 | return hyphenFormatter.format(parsedDate); 21 | } else if (str.matches("([0-9]{2})-([0-9]{2})-([0-9]{4})")) { 22 | parsedDate = hyphenFormatter.parse(str); 23 | return forwardSlashFormatter.format(parsedDate); 24 | } 25 | return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/com/stackoverflow/MyList.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class MyList extends ArrayList { 6 | 7 | @Override 8 | public String toString() { 9 | StringBuffer str = new StringBuffer(); 10 | for (int i = 0; i < super.size(); i++) { 11 | str.append(super.get(i)).append("\n"); 12 | } 13 | return str.toString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/com/stackoverflow/ParentException.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class ParentException extends Exception { 4 | 5 | ParentException() { 6 | 7 | } 8 | 9 | ParentException(String str) { 10 | super(str); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/com/stackoverflow/Pattern.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | /** 4 | * 1 2 3 4 5 4 3 2 1 5 | * 1 2 3 4 3 2 1 6 | * 1 2 3 2 1 7 | * 1 2 1 8 | * 1 9 | */ 10 | public class Pattern { 11 | 12 | public static void main(String[] args) { 13 | int N = 9; 14 | int i, j, k; 15 | 16 | for (i = 1; i <= N; i++) { 17 | for (int space = 0; space < i - 1; space++) { 18 | System.out.print("\t"); 19 | } 20 | for (j = 1; j <= N - i; j++) { 21 | System.out.print(j + "\t"); 22 | } 23 | for (k = j; k >= 1; k--) { 24 | System.out.print(k + "\t"); 25 | } 26 | System.out.println(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/com/stackoverflow/RegularExpressionTest.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | public class RegularExpressionTest { 7 | 8 | public static void main(String[] args) { 9 | 10 | String sample = ""; 11 | 12 | // Pattern pattern = Pattern.compile("elapsed=\".*?\""); 13 | // Matcher matcher = pattern.matcher(sample); 14 | // System.out.println(matcher.matches()); 15 | // System.out.println(matcher.groupCount()); 16 | 17 | Pattern p = Pattern.compile("elapsed=\\\"([^\\\"]*)\\\""); 18 | Matcher m = p.matcher(sample); 19 | while (m.find()) { 20 | System.out.println(m.group(1)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/com/stackoverflow/RemoveSpace.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class RemoveSpace { 4 | 5 | public static void main(String[] args) { 6 | String s = " What is java"; 7 | 8 | StringBuffer t = new StringBuffer(s); 9 | for (int i = 0; i < t.length(); i++) { 10 | if (t.charAt(i) == ' ') { 11 | t.deleteCharAt(i); 12 | i--; 13 | } else { 14 | break; 15 | } 16 | } 17 | System.out.println(t.toString()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/com/stackoverflow/StringCountAndChange.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | /* package whatever; // don't place package name! */ 4 | 5 | class StringCountAndChange { 6 | 7 | public static void main(String[] args) { 8 | String s = "sagar"; 9 | 10 | String h = "neeraj"; 11 | System.out.println(s.length() + h.length()); 12 | 13 | StringBuffer sagarBuffer = new StringBuffer(s); 14 | if (sagarBuffer.charAt(0) >= 97 && sagarBuffer.charAt(0) <= 122) { 15 | sagarBuffer.setCharAt(0, (char) (sagarBuffer.charAt(0) - 32)); 16 | } 17 | System.out.println(sagarBuffer.toString()); 18 | 19 | StringBuffer neerajBuffer = new StringBuffer(h); 20 | if (neerajBuffer.charAt(0) >= 97 && neerajBuffer.charAt(0) <= 122) { 21 | neerajBuffer.setCharAt(0, (char) (neerajBuffer.charAt(0) - 32)); 22 | } 23 | System.out.println(neerajBuffer.toString()); 24 | } 25 | 26 | 27 | } -------------------------------------------------------------------------------- /src/com/stackoverflow/StringReverse.java: -------------------------------------------------------------------------------- 1 | package com.stackoverflow; 2 | 3 | public class StringReverse { 4 | 5 | public static void main(String[] args) { 6 | String s = "sagar is android developer"; 7 | int first = 0, second = 0, len = s.length(); 8 | for (int i = 0; i < len; i++) { 9 | second = s.indexOf(" ", first + 1); 10 | if (second == -1) { 11 | second = len - 1; 12 | System.out.print(" "); 13 | } 14 | for (int j = second; j >= first; j--) { 15 | System.out.print(s.charAt(j)); 16 | } 17 | first = second; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/com/stackoverflow/file_search_test/neeraj_java_developer_3_yrs_.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neerajjain92/data-structures/db401747a3302dfa34a1b0fbf6f988e527c39f43/src/com/stackoverflow/file_search_test/neeraj_java_developer_3_yrs_.pdf --------------------------------------------------------------------------------