You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🧠 Data Structures & Algorithms (DSA) Playlist Solutions
A curated collection of optimal solutions to Data Structures and Algorithms problems from LeetCode, CSES, and competitive programming sheets. Every solution is written in Java with an emphasis on algorithmic patterns, clean code, edge-case handling, and optimal time & space complexity.
📌 Repository Overview
This repository documents my structured DSA preparation and problem-solving journey. Rather than memorizing individual solutions, the focus is on identifying reusable patterns (e.g., Two Pointers, Monotonic Stacks, Binary Search on Answer, Cyclic Sort) to build deep intuition for technical interviews and competitive programming.
Monotonic Stack: Efficiently finding the next/previous smaller or greater element in $O(n)$ time without nested $O(n^2)$ loops (applied in Histogram, Stock Span, Next Greater Element).
Binary Search on Answer: Transforming an optimization problem into a monotonic feasibility check ($T/F$ predicate space), e.g., Koko Eating Bananas.
Cyclic Sort: In-place array arrangement in $O(n)$ time and $O(1)$ extra space when elements are within $[1, n]$ range (applied in First Missing Positive).
Two Pointers & Fast-Slow Pointers: Cycle detection, cycle entry finding, and palindrome/midpoint processing in singly-linked lists.
Bi-directional Hashing: Enforcing strict one-to-one (bijection) mappings for isomorphic strings and patterns.
🛠️ How to Compile & Run
Each file contains complete, standalone solution classes or runnable mains. You can compile and test any file using standard Java tooling:
# Navigate to the topic foldercd"Arrays"# Compile any Java file
javac "Basic Problems.java"# Or run directly with modern JDK (Java 11+)
java "Advanced Problems.java"