/*# Java-Data-Structures-and-Algorithms Optimized Java solutions for 150+ DSA patterns with documented Time/Space complexity analysis.
- Language: Java
- Concepts: Arrays, Strings, HashMaps, Two Pointers, Trees, Graphs, Dynamic Programming.
- Documentation: Every solution includes a Big-O analysis header.
- Style: Following Google Java Style Guide for clean, readable code.
To demonstrate Separation of Concerns, the Linked List section is implemented using a modular approach:
- Node.java: The data model and reference structure.
- LinkListSingly.java: The core algorithm implementation (Logic).
- LL.java: The driver class for execution and test cases.
| # | Problem | Topic | Complexity | Status |
|---|---|---|---|---|
| 1 | Two Sum | Hash Table |
|
β |
| 2 | Valid Palindrome | Two Pointers |
|
β |
| 3 | Merge Sorted Array | Two Pointers |
|
β |
| 4 | Remove Element | Two Pointers |
|
β |
| 5 | Remove Duplicates | Two Pointers |
|
β |
| 6 | Majority Element | Two Pointers |
|
β |
| 7 | Length Of Last Word | One Pointer |
|
β |
| 8 | Singly Linked List | Node β’ Logic β’ Driver |
|
β |
| 9 | Linked List Cycle | slow and fast Pointer |
|
β |
| 10 | Reverse Words In String | Two Pointers String |
|
β |
| 11 | Reverse Linked List II | Partial Reversal |
|
β |
| 12 | Merge Two Sorted Lists | Linked List |
|
β |
| 13 | Linked List Cycle II | slow and fast pointer |
|
β |
| 14 | First Occurence In String | Sliding window |
|
β |
| 15 | Longest Common Prefix In String | Strings scanning |
|
β |
| 16 | Two Sum II | Two Pointers |
|
β |
| 17 | Three Sum | Two Pointers/sorting |
|
β |
| 18 | Palindrome Number | Math / Reversal |
|
β |
| 19 | BinarySearch Search | Divide and conquer |
|
β |
| 20 | PlusOne Number | Math / Arrays |
|
β |
| 21 | Add Two Numbers | Linked List/Math |
|
β |
| 22 | SearchIn2DMatrix | BinarySearch Search |
|
β |
| 23 | Roman To Int | Arrays /Strings |
|
β |
| 24 | Int To Roman | Arrays /Strings |
|
β |
| 25 | Square Root | Math |
|
β |
| 26 | Power Function | Math |
|
β |
| 27 | Min Sub Array | Math |
|
β |
| 28 | Longest Sub String | Math/HashSet |
|
β |
| 29 | Find All Sub String | Math/HashSet |
|
β |
| 30 | Max Area | Array/Two Pointer Approach |
|
β |
| 31 | Spiral Matrix | Array/Matrix |
|
β |
| 32 | Is Valid Sudoku | Array/Matrix |
|
β |
| 33 | Can construct | HashMap |
|
β |
| 33 | Isomorphic | HashMap |
|
β |
| 34 | Word Pattern | HashMap |
|
β |
| 35 | Happy Number | Linked List/Math |
|
β |
| 36 | Group Anagrams | Hash Table / String |
|
β |
| 37 | Contains Duplicate II | Hash Table / Sliding Window |
|
β |
| 38 | SummaryRanges | Two Pointer /Arrays |
|
β |
| 39 | Merge Intervals | Two Pointer /Arrays/Greedy Approach |
|
β |
| 40 | Insert Interval | Two Pointer /Arrays/Greedy Approach |
|
β |
| 41 | Insert Interval | Two Pointer /Arrays/Greedy Approach |
|
β |
| 42 | Jump One | Arrays/Greedy Approach |
|
β |
| 43 | MaxDepth | BinarySearch Tree / Math |
|
β |
| 44 | Same Tree | BinarySearch Tree / Recursion |
|
β |
| 45 | Invert Tree | BinarySearch Tree / Recursion |
|
β |
| 46 | Sysmmetric Tree | BinarySearch Tree / Recursion |
|
β |
| 47 | Construct A Tree From Both Preoder And Inorder | BinarySearch Tree / Recursion/HashMap |
|
β |
| 48 | Construct A Tree From Both Postorder And Inorder | BinarySearch Tree / Recursion/HashMap |
|
β |
| 49 | Populating Next Right Pointers II | BinarySearch Tree / Iterative/LinkList |
|
β |
| 50 | Flatten BinarySearch Tree To LinkedList | BinarySearch Tree /Recursion Using preorder /LinkList |
|
β |
| 51 | Path Sum Solver | BinarySearch Tree /Recursion |
|
β |
| 52 | Jump To End II | Array/Greedy |
|
β |
| 53 | Sum To Root Leaf | BinarySearch Tree /Recursion /DFS |
|
β |
| 54 | SubString Concatenation | String /HashMap /ArrayList |
|
β |
| 55 | Path Sum Solver II | BinarySearch Tree/DFS /Recursion |
|
β |
| 56 | BinarySearch Adder | Bit Manupulation / Math |
|
β |
| 57 | Reverse Bits | Bit Manupulation /Divide and Conquer |
|
β |
| 58 | Hamming Weight calculator | Bit Manupulation /Bitwise operator |
|
β |
| 59 | Single Number | Bit Manupulation /Bitwise operator /XoR operator |
|
β |
| 60 | Single Number II | Bit Manupulation /Bitwise operator /XoR operator |
|
β |
| 61 | Range Bitwise And | Bit Manupulation /Bitwise operator |
|
β |
| 62 | Count Trailing Zeroes | Math |
|
β |
| 63 | Max Points in the (X, Y) plane | Math |
|
β |
| 64 | Merge K Sorted Lists | Math/Divide and Conquer /LinkedList |
|
β |
| 65 | Kadane's Algorithm | Math/Kadene's Algorithm |
|
β |
| 66 | Peak Finder | Math/Binary Search/ Recursive |
|
β |
| 67 | Search In Rotated Sorted Array | Math/Binary Search/ Recursive |
|
β |
| 68 | Return First And Last Target In Array | Math/Binary Search/ Recursive |
|
β |
| 69 | Find Minimum In Rotated Array | Math/Binary Search/ Recursive |
|
β |
| 70 | Find The Median From Two Sorted Array | Math/Binary Search/Recursive/Iterative |
|
β |
| 71 | Valid Parentheses Check | Stack |
|
β |
| 72 | Unix Style Path Simplifier | Stack /String |
|
β |
| 73 | Reverse Polish Notation | Stack /String /Switch |
|
β |
| 74 | Stack Implementation Like pop(), push(), MinStack() etc | Stack/ArrayList |
|
β |
| 75 | Basic Calculator Using Stack | Stack/ArrayDeque/Deque |
|
β |
| 76 | Find Kth Element In Unsorted Array | Heap/PriorityQueue |
|
β |
| 77 | Find The Sum of SubArray Using Kadane's Algo | Kadanes Algorithm/Math |
|
β |
| 78 | Rotate Image By 90 Degree | Array/Matrix |
|
β |
| 79 | Array To Binary seatch Tree Conversion | Array/Binary Search Tree/ Recursion |
|
β |
| 80 | Jump II | Array |
|
β |
| 81 | Binary Search Iterator | Binary Tree, Recursion |
|
β |
| 82 | Reverse Nodes In K Group | LinkedList, Recursion |
|
β |
| 83 | H Index Finder | Array,Bucket Sort |
|
β |
Each folder is categorized by data structure. Navigate to a folder and open the .java file to see the logic and performance analysis in the comments.
*/