Google-DSC-TMSL / ProjectAlgorithms

A place where you can find solutions to the most asked interview questions
https://github.com/Google-DSC-TMSL/ProjectAlgorithms
MIT License
12 stars 35 forks source link
algorithms beginner-friendly codechef codeforces cpp dsa geeksforgeeks hacktoberfest hacktoberfest2022 java leetcode python

Project Algorithms - A Problem Solver's Paradise


| Problem Name | Link | Approach | Code | | ------- | ------- | ---------- | -------- | | 3 Sum Closest | [LeetCode](https://leetcode.com/problems/3sum-closest/) | [Youtube](https://www.youtube.com/watch?v=qBr2hq4daWE) | [Java](./codes/java/3sumclosest.java)
[C++](./codes/cpp/3sumclosest.cpp) | | Time Based Key Value Store | [LeetCode](https://leetcode.com/problems/time-based-key-value-store/) | [Youtube](https://www.youtube.com/watch?v=fu2cD_6E8Hw)
[Medium](https://sakshi8699.medium.com/981-time-based-key-value-store-python-65bd81742818)| [Java](./codes/java/timebasedkeyvaluestore.java)
[Python](./codes/python/timebasedkeyvaluestore.py) | | Longest Common Substring | [GFG](https://www.geeksforgeeks.org/longest-common-substring-dp-29/) | [Youtube](https://www.youtube.com/watch?v=_wP9mWNPL5w&t=689s) | [Java](./codes/java/LongestCommonSubstring.java) | House Robber II | [LeetCode](https://leetcode.com/problems/house-robber-ii/) | [Youtube](https://www.youtube.com/watch?v=3WaxQMELSkw) | [Java](./codes/java/HouseRobberII.java) | | Design Hashmap | [LeetCode](https://leetcode.com/problems/design-hashmap/) | [Youtube](https://youtu.be/Xt4TuW31rtc?si=lEAxCq8KEhg45AA1) | [C++](./codes/cpp/Design-Hashmap.cpp) | | Minimum Swaps To Make Sequences Increasing | [LeetCode](https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/) | [Youtube](https://www.youtube.com/watch?v=IeT9Qz_vqHo) | [Java](./codes/java/minimumswapstomakesequencesincreasing.java)
[C++](./codes/cpp/minimumswapstomakesequencesincreasing.cpp) | | Find Kth Bit in Nth Binary String | [LeetCode](https://leetcode.com/problems/find-kth-bit-in-nth-binary-string/) | [Youtube](https://www.youtube.com/watch?v=34QYE5HAFy4) | [Java](./codes/java/KthBitNthBinaryString.java) | Set Matrix Zeros | [LeetCode](https://leetcode.com/problems/set-matrix-zeroes/) | [Youtube](https://www.youtube.com/watch?v=M65xBewcqcI) | [Java](./codes/java/setmatrixzeros.java) | | Generate Parentheses | [LeetCode](https://leetcode.com/problems/generate-parentheses/) | [YouTube](https://www.youtube.com/watch?v=4KpSXSIPH2s&t=860s) | [C++](https://github.com/VetlaPavanKalyan/ProjectAlgorithms/blob/main/codes/cpp/generate_paranthesis.cpp)
[Java](codes/java/GenerateParentheses.java) | Generate Subsets | [LeetCode](https://leetcode.com/problems/subsets/) | [YouTube](https://www.youtube.com/watch?v=4KpSXSIPH2s&t=860s) | [C++](https://github.com/VetlaPavanKalyan/ProjectAlgorithms/blob/main/codes/cpp/generate_subsets.cpp) | | Generate Subsets using Bit-Masking | [LeetCode](https://leetcode.com/problems/subsets/) | [YouTube](https://www.youtube.com/watch?v=4KpSXSIPH2s&t=860s) | [C++](https://github.com/VetlaPavanKalyan/ProjectAlgorithms/blob/main/codes/cpp/generate_subsets_bit_masking.cpp) | | Serialize and Deserialize BST | [Leetcode](https://leetcode.com/problems/serialize-and-deserialize-bst/) | [YouTube](https://www.youtube.com/watch?v=-YbXySKJsX8&t=613s)|[C++](https://github.com/ShreemoyeeMukherjee/ProjectAlgorithms/blob/ShreemoyeeMukherjee-patch-2/Serialize%20and%20Deserialize%20BST) | | Construct Binary Search Tree from Preorder Traversal | [LeetCode](https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/) | [YouTube](https://www.youtube.com/watch?v=UmJT3j26t1I&t=692s) | [C++](https://github.com/ShreemoyeeMukherjee/ProjectAlgorithms/blob/ShreemoyeeMukherjee-patch-2/codes/cpp/Construct%20Binary%20Search%20Tree%20from%20Preorder%20Traversal) | | First Unique Character in a String | [LeetCode](https://leetcode.com/problems/first-unique-character-in-a-string/) | [YouTube](https://www.youtube.com/watch?v=St47WCbQa9M) | [Java](./codes/java/FirstUniqueCharacterinaString.java) | | Trapping Rain Water | [LeetCode](https://leetcode.com/problems/trapping-rain-water/description/) | [YouTube](https://www.youtube.com/watch?v=m18Hntz4go8) | [C++](./codes/cpp/TrappingRainWater.cpp) | | Interleaving Strings | [LeetCode](https://leetcode.com/problems/interleaving-string/) | [YouTube](https://www.youtube.com/watch?v=3Rw3p9LrgvE) | [Python](./codes/python/InterleavingStringsProg.py) | | Group Anagrams | [LeetCode](https://leetcode.com/problems/group-anagrams/) | [YouTube](https://www.youtube.com/watch?v=ptgykfAEax8) | [Java](./codes/java/GroupAnagramsProg.java) | | Binary Tree Right Side View | [LeetCode](https://leetcode.com/problems/binary-tree-right-side-view/) | [YouTube](https://www.youtube.com/watch?v=jCqIr_tBLKs&t=390s) | [C++](./codes/cpp/BinaryTreeRightSideViewProg.cpp) | | Kadane's Algorithm | [GFG](https://practice.geeksforgeeks.org/problems/kadanes-algorithm-1587115620/1?page=1&company[]=Google&curated[]=7&sortBy=submissions) | [YouTube](https://www.youtube.com/watch?v=w4W6yya1PIc) | [Python](./codes/python/KadaneAlgo.py) | [Java] (./codes/java/kadanesalgo.java) | Implementing Dijkstra Algorithm | [GFG](https://practice.geeksforgeeks.org/problems/implementing-dijkstra-set-1-adjacency-matrix/1) | [YouTube](https://www.youtube.com/watch?v=SQ-pXKsBBz8) | [Python](./codes/python/DijkstraAlgo.py) | | Container With Most Water | [LeetCode](https://leetcode.com/problems/container-with-most-water/) | [YouTube](https://www.youtube.com/watch?v=ZHQg07n_tbg) | [Java](./codes/java/containerwithmostwater.java) | | Zigzag Conversion | [LeetCode](https://leetcode.com/problems/zigzag-conversion/) | [YouTube](https://www.youtube.com/watch?v=pEku6cp_J80) | [Java](./codes/java/zigzagconversion.java) | | Integer to Roman | [LeetCode](https://leetcode.com/problems/integer-to-roman/) | [YouTube](https://www.youtube.com/watch?v=f_F9ItFyiEg) | [Java](./codes/java/integertoroman.java) | | Palindromic Partitioning | [GFG](https://practice.geeksforgeeks.org/problems/palindromic-patitioning4845/1?page=1&difficulty[]=2&company[]=Google&curated[]=4&sortBy=submissions) | [YouTube](https://www.youtube.com/watch?v=VOiNexeScLU) | [Python](./codes/python/Palind_Part.py) | | Alien Dictionary | [GFG](https://practice.geeksforgeeks.org/problems/alien-dictionary/1?page=1&difficulty[]=2&company[]=Google&sortBy=submissions) | [YouTube](https://www.youtube.com/watch?v=U3N_je7tWAs) | [Python](./codes/python/Alien_Dic.py) | | String To Integer | [GFG](https://www.geeksforgeeks.org/how-to-convert-a-string-to-an-int-in-java/) | [YouTube](https://www.youtube.com/watch?v=Pnaqn6GOyzU) | [Java](./codes/java/Stringtointeger.java) | | Maximum Length of a Concatenated String with Unique Characters | [LeetCode](https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/) | [YouTube](https://www.youtube.com/watch?v=d4SPuvkaeoo) | [Java](./codes/java/maximum-length-of-a-concatenated-string-with-unique-characters.java) | | Sum of k smallest elements in BST| [GFG](https://www.geeksforgeeks.org/sum-k-smallest-elements-bst/) | [YouTube](https://www.youtube.com/watch?v=S02iWYlmyH4&t=3s) | [Python](./codes/python/Sum_of_k_smallest_elements_in_BST.py) | | Regular Expression Matching | [LeetCode](https://leetcode.com/problems/regular-expression-matching/) | [YouTube](https://www.youtube.com/watch?v=HAA8mgxlov8) | [Java](./codes/java/RegularExpressionMatching.java) | | Longest Valid Parentheses | [LeetCode](https://leetcode.com/problems/longest-valid-parentheses/) | [YouTube](https://www.youtube.com/watch?v=VdQuwtEd10M) | [Java](./codes/java/LongestValidParentheses.java) | | Rotate Image | [LeetCode](https://leetcode.com/problems/rotate-image/) | [YouTube](https://www.youtube.com/watch?v=Y72QeX0Efxw) | [Java](./codes/java/RotateImage.java) | | Substring with concatenation of all words | [LeetCode](https://leetcode.com/problems/substring-with-concatenation-of-all-words/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Java](./codes/java/SubstringWithConcatenationOfAllWords.java) | |Largest rectangular sub-matrix having sum divisible by k| [GFG](https://www.geeksforgeeks.org/largest-rectangular-sub-matrix-sum-divisible-k/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Python](./codes/python/largest_rectangular_sub_matrix_sum_divisbl_by_k) |Sum of Subarray Minimums |[LeetCode](https://leetcode.com/problems/sum-of-subarray-minimums/) |[Youtube](https://youtu.be/9-TXIVEXX2w?si=ktLhMFP8uMgkjXp5) |[C++](./codes/cpp/sum_of_subarray_minimums.cpp) |Trapping Rain Water |[LeetCode](https://leetcode.com/problems/trapping-rain-water/) |[Youtube](https://youtu.be/m18Hntz4go8?si=tIof7wcU0hnYjbyk) |[C++](./codes/cpp/trapping_rainwater.cpp) |Next Greater Element III |[LeetCode](https://leetcode.com/problems/next-greater-element-iii/) |[Youtube](https://youtu.be/fOeD3CW2c7c?si=n5lOpXS44P7R6q-y)|[C++](./codes/cpp/next_greater_element3.cpp) | Largest rectangular sub-matrix having sum divisible by k| [GFG](https://www.geeksforgeeks.org/largest-rectangular-sub-matrix-sum-divisible-k/) | [YouTube](https://www.youtube.com/watch?v=_MGzsJ0F8lE) | [Python](./codes/python/largest_rectangular_sub_matrix_sum_divisbl_by_k) | Word Break |[LeetCode](https://leetcode.com/problems/word-break/) |[Youtube](https://youtu.be/Sx9NNgInc3A?si=tzljO1p5FRdEaAPf) |[C++](./codes/cpp/word_break.cpp) | Combination Sum III |[LeetCode](https://leetcode.com/problems/combination-sum-iii/) |[Youtube](https://youtu.be/rP_K3WJnRR4?si=W1RUODPlWwOSvsnV) |[C++](./codes/cpp/combination_sum_iii.cpp) | Remove Nth Node From End of List |[LeetCode](https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/) |[Youtube](https://www.youtube.com/watch?v=Lhu3MsXZy-Q) |[C++](./codes/cpp/RemoveNthNodeFromEndOfList.cpp) | | Next Permutation |[LeetCode](https://leetcode.com/problems/next-permutation/description/) |[Youtube](https://www.youtube.com/watch?v=JDOXKqF60RQ) |[C++](./codes/cpp/nextPermutation.cpp) | | Spiral Matrix |[LeetCode](https://leetcode.com/problems/spiral-matrix/description/) |[Youtube](https://www.youtube.com/watch?v=3Zv-s9UUrFM) |[C++](./codes/cpp/SpiralMatrix.cpp) | | Sort Colors |[LeetCode](https://leetcode.com/problems/sort-colors/description/) |[Youtube](https://www.youtube.com/watch?v=oaVa-9wmpns) |[C++](./codes/cpp/SortColors.cpp)| | Odd Even Linked List |[LeetCode](https://leetcode.com/problems/odd-even-linked-list/) |[Youtube](https://www.youtube.com/watch?v=_VHInOZbp6A) |[C++](./codes/cpp/OddEvenList.cpp) | Add Two Numbers II |[LeetCode](https://leetcode.com/problems/add-two-numbers-ii/) |[Youtube](https://www.youtube.com/watch?v=B-uQN5wp6Jg) |[C++](./codes/cpp/AddTwoNumbers2.cpp) | Search in Rotated Sorted Array |[LeetCode](https://leetcode.com/problems/search-in-rotated-sorted-array/) |[Youtube](https://www.youtube.com/watch?v=iXLMMbdjeNM) |[C++](./codes/cpp/SearchRotatedSortedArray.cpp) | Linked List Cycle II |[LeetCode](https://leetcode.com/problems/linked-list-cycle-ii/) |[Youtube](https://www.youtube.com/watch?v=QfbOhn0WZ88) |[C++](./codes/cpp/LinkedListCycle2.cpp | Copy List with Random Pointer |[LeetCode](https://leetcode.com/problems/copy-list-with-random-pointer/) |[Youtube](https://www.youtube.com/watch?v=VNf6VynfpdM) |[C++](./codes/cpp/CopyListWithRandomPointer.cpp) | Remove Nth Node From End of List |[LeetCode](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) |[Youtube](https://www.youtube.com/watch?v=Lhu3MsXZy-Q) |[C++](./codes/cpp/RemoveNthNodeFromEndOfList.cpp) | Wiggle Subsequence | [LeetCode](https://leetcode.com/problems/wiggle-subsequence/description/) |[Youtube](https://www.youtube.com/watch?v=xtDu3jm5WsI)|[Python](./codes/python/wigglesubsequence.py) | Design Linked List | [LeetCode](https://leetcode.com/problems/design-linked-list/description/) |[Youtube](https://www.youtube.com/watch?v=Wf4QhpdVFQo)|[Python](./codes/python/designLinkedList.py) | Flatten Binary Tree to Linked List| [LeetCode](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/) |[Youtube](https://www.youtube.com/watch?v=rKnD7rLT0lI)|[Python](./codes/python/flattenbinarytree.py) | Longest Palindromic Subsequence |[LeetCode](https://leetcode.com/problems/longest-palindromic-subsequence) |[Youtube](https://youtu.be/wuOOOATz_IA?si=uh1SZsPDClMGZHSL) |[C++](./codes/cpp/longestPalindromicSubsequence.cpp) | Shortest Common Supersequence |[LeetCode](https://leetcode.com/problems/shortest-common-supersequence) |[Youtube](https://youtu.be/823Grn4_dCQ?si=98CB83DN0gOwoa9k) |[C++](./codes/cpp/shortestCommonSupersequence.cpp) | Partition Equal Subset Sum |[LeetCode](https://leetcode.com/problems/partition-equal-subset-sum) |[Youtube](https://youtu.be/UmMh7xp07kY?si=A4-OUJ4J0MKgzHpu) |[C++](./codes/cpp/partitionEqualSubsetSum.cpp) | Target Sum |[LeetCode](https://leetcode.com/problems/target-sum) |[Youtube](https://youtu.be/Hw6Ygp3JBYw?si=q3EJhX8Dr9jEQ6nj) |[C++](./codes/cpp/targetSum.cpp)


## Some Free Online Tutorials - [C++ STL (Most Useful for Competitive Programming)](https://www.youtube.com/watch?v=R5BEcvTVZj0&list=PLauivoElc3gh3RCiQA82MDI-gJfXQQVnn) - [Arrays](https://www.youtube.com/watch?v=n60Dn0UsbEk) - [Searching and Sorting](https://www.youtube.com/playlist?list=PLDzeHZWIZsTp4pb_WBRahP1tnipLuX9qM) - [Hashing](https://www.youtube.com/playlist?list=PLqM7alHXFySGwXaessYMemAnITqlZdZVE) - [Strings](https://www.youtube.com/watch?v=Wdjr6uoZ0e0&t=16s) - [Recursion and Backtracking](https://www.youtube.com/playlist?list=PLgUwDviBIf0rGlzIn_7rsaR2FQ5e6ZOL9) - [Bit Manipulation](https://www.youtube.com/watch?v=5rtVTYAk9KQ) - [Linked List](https://www.youtube.com/watch?v=q8gdBn9RPeI&t=2470s) - [Stack and Queues](https://www.youtube.com/playlist?list=PLgUwDviBIf0oSO572kQ7KCSvCUh1AdILj) - [Dynamic Programming](https://www.youtube.com/playlist?list=PLgUwDviBIf0qUlt5H_kiKYaNSqJ81PMMY) - [Data Structures and Algorithms](https://www.youtube.com/playlist?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA)


## Some Reference Books PDFs - [Algorithms](http://dsp-book.narod.ru/Algorithms.pdf)-*Robert Sedgewick* - [Introduction to Algorithms](https://sd.blackball.lv/library/Introduction_to_Algorithms_Third_Edition_(2009).pdf)-*Thomas H. Cormen,Charles E. Leiserson,Ronald L. Rivest,Clifford Stein* - [Data Structures and Algorithm made easy](https://www.pdfdrive.com/download.pdf?id=158226594&h=d9a09e7e092770b490569037e38267ec&u=cache&ext=pdf)-*Narasimha Karumanchi* - [Data Structures and Algorithms in Java](https://cin.ufpe.br/~grm/downloads/Data_Structures_and_Algorithms_in_Java.pdf)-*Robert Lafore* - [Advanced Data Structures](https://doc.lagout.org/Others/Data%20Structures/Advanced%20Data%20Structures%20%5BBrass%202008-09-08%5D.pdf)-*Peter Brass* - [Grokking Algorithms](https://edu.anarcho-copy.org/Algorithm/grokking-algorithms-illustrated-programmers-curious.pdf)-*Aditya Y. Bhargava* - [Problem Solving with Algorithms and Data Structures](https://www.cs.auckland.ac.nz/compsci105s1c/resources/ProblemSolvingwithAlgorithmsandDataStructures.pdf)-*Brad Miller,David Ranum*