Suggest the user's next DSA problem to solve from the LeetCode Top Interview 150, GFG 160, HackerRank Interview Preparation Kit, or InterviewBit Programming track study plans.
Step 0 — Load config
Look for dsa-coach.config.json in the current working directory. If present, parse it and use its values. For any missing key, fall back to the documented default below. If the file is absent entirely, use all defaults.
Config keys + defaults:
language (default "ts") — solution file extension.
solutionDirs (default { "leetcode": "leetcode", "geeksforgeeks": "geeksforgeeks", "hackerrank": "hackerrank", "interviewbit": "interviewbit" }) — platform key → folder name in the user's repo.
This skill only needs language and solutionDirs.
Step 1 — Scan local solution folders for solved problems
Do NOT fetch anything from the network. Detect solved problems by scanning the user's own repo locally (works offline).
For each platform folder in solutionDirs, enumerate the solution files. Prefer:
git ls-files -- "<dir>/**/*.<language>" "<dir>/*.<language>"
If git ls-files returns nothing (e.g. not a git repo or files untracked), fall back to a glob:
ls -1 <dir>/**/*.<language> <dir>/*.<language> 2>/dev/null
(Run the scan once per solutionDirs value, using the configured language extension.)
Build a list of every problem the user has already solved (by filename, LeetCode number, or problem name). Do NOT suggest any problem already in this list.
If $ARGUMENTS is "lc", only suggest from LeetCode (the leetcode key in solutionDirs). If "gfg", only from GFG (geeksforgeeks). If "hr", only from HackerRank (hackerrank). If "ib", only from InterviewBit (interviewbit). Otherwise alternate in round-robin order: LC → GFG → HR → IB → LC → …
Step 2 — Find the next unsolved problem
Use the ordered curriculum below. Go through each topic in order. Within a topic, go through problems in order. Find the FIRST problem the user has NOT yet solved and suggest that one.
Do not pick randomly. Walk the list in order and pick the first gap.
LeetCode Top 150 — Ordered Curriculum
Topic 1 — Array / String
- Merge Sorted Array (#88)
- Remove Element (#27)
- Remove Duplicates from Sorted Array (#26)
- Remove Duplicates from Sorted Array II (#80)
- Majority Element (#169)
- Rotate Array (#189)
- Best Time to Buy and Sell Stock (#121)
- Best Time to Buy and Sell Stock II (#122)
- Jump Game (#55)
- Jump Game II (#45)
- H-Index (#274)
- Insert Delete GetRandom O(1) (#380)
- Product of Array Except Self (#238)
- Gas Station (#134)
- Candy (#135)
- Trapping Rain Water (#42)
- Roman to Integer (#13)
- Integer to Roman (#12)
- Length of Last Word (#58)
- Longest Common Prefix (#14)
- Reverse Words in a String (#151)
- Zigzag Conversion (#6)
- Find the Index of the First Occurrence in a String (#28)
- Text Justification (#68)
Topic 2 — Two Pointers
- Valid Palindrome (#125)
- Is Subsequence (#392)
- Two Sum II - Input Array Is Sorted (#167)
- Container With Most Water (#11)
- 3Sum (#15)
Topic 3 — Sliding Window
- Minimum Size Subarray Sum (#209)
- Longest Substring Without Repeating Characters (#3)
- Substring with Concatenation of All Words (#30)
- Minimum Window Substring (#76)
Topic 4 — Matrix
- Valid Sudoku (#36)
- Spiral Matrix (#54)
- Rotate Image (#48)
- Set Matrix Zeroes (#73)
- Game of Life (#289)
Topic 5 — Hashmap
- Ransom Note (#383)
- Isomorphic Strings (#205)
- Word Pattern (#290)
- Valid Anagram (#242)
- Group Anagrams (#49)
- Two Sum (#1)
- Happy Number (#202)
- Contains Duplicate II (#219)
- Longest Consecutive Sequence (#128)
Topic 6 — Intervals
- Summary Ranges (#228)
- Merge Intervals (#56)
- Insert Interval (#57)
- Minimum Number of Arrows to Burst Balloons (#452)
Topic 7 — Stack
- Valid Parentheses (#20)
- Simplify Path (#71)
- Min Stack (#155)
- Evaluate Reverse Polish Notation (#150)
- Basic Calculator (#224)
Topic 8 — Linked List
- Linked List Cycle (#141)
- Add Two Numbers (#2)
- Merge Two Sorted Lists (#21)
- Copy List with Random Pointer (#138)
- Reverse Linked List II (#92)
- Reverse Nodes in k-Group (#25)
- Remove Nth Node From End of List (#19)
- Remove Duplicates from Sorted List II (#82)
- Rotate List (#61)
- Partition List (#86)
- LRU Cache (#146)
Topic 9 — Binary Tree: General
- Maximum Depth of Binary Tree (#104)
- Same Tree (#100)
- Invert Binary Tree (#226)
- Symmetric Tree (#101)
- Construct Binary Tree from Preorder and Inorder Traversal (#105)
- Construct Binary Tree from Inorder and Postorder Traversal (#106)
- Populating Next Right Pointers in Each Node II (#117)
- Flatten Binary Tree to Linked List (#114)
- Path Sum (#112)
- Sum Root to Leaf Numbers (#129)
- Binary Tree Maximum Path Sum (#124)
- Binary Search Tree Iterator (#173)
- Count Complete Tree Nodes (#222)
- Lowest Common Ancestor of a Binary Tree (#236)
Topic 10 — Binary Tree: BFS
- Binary Tree Right Side View (#199)
- Average of Levels in Binary Tree (#637)
- Binary Tree Level Order Traversal (#102)
- Binary Tree Zigzag Level Order Traversal (#103)
Topic 11 — Binary Search Tree
- Minimum Absolute Difference in BST (#530)
- Kth Smallest Element in a BST (#230)
- Validate Binary Search Tree (#98)
Topic 12 — Graph: General
- Number of Islands (#200)
- Surrounded Regions (#130)
- Clone Graph (#133)
- Evaluate Division (#399)
- Course Schedule (#207)
- Course Schedule II (#210)
Topic 13 — Graph: BFS
- Snakes and Ladders (#909)
- Minimum Genetic Mutation (#433)
- Word Ladder (#127)
Topic 14 — Trie
- Implement Trie (Prefix Tree) (#208)
- Design Add and Search Words Data Structure (#211)
- Word Search II (#212)
Topic 15 — Backtracking
- Letter Combinations of a Phone Number (#17)
- Combinations (#77)
- Permutations (#46)
- Combination Sum (#39)
- N-Queens II (#52)
- Generate Parentheses (#22)
- Word Search (#79)
Topic 16 — Divide & Conquer
- Convert Sorted Array to Binary Search Tree (#108)
- Sort List (#148)
- Construct Quad Tree (#427)
- Merge k Sorted Lists (#23)
Topic 17 — Kadane's Algorithm
- Maximum Subarray (#53)
- Maximum Sum Circular Subarray (#918)
Topic 18 — Binary Search
- Search Insert Position (#35)
- Search a 2D Matrix (#74)
- Find Peak Element (#162)
- Search in Rotated Sorted Array (#33)
- Find First and Last Position of Element in Sorted Array (#34)
- Find Minimum in Rotated Sorted Array (#153)
- Median of Two Sorted Arrays (#4)
Topic 19 — Heap
- Kth Largest Element in an Array (#215)
- IPO (#502)
- Find K Pairs with Smallest Sums (#373)
- Find Median from Data Stream (#295)
Topic 20 — Bit Manipulation
- Add Binary (#67)
- Reverse Bits (#190)
- Number of 1 Bits (#191)
- Single Number (#136)
- Single Number II (#137)
- Bitwise AND of Numbers Range (#201)
Topic 21 — Math
- Palindrome Number (#9)
- Plus One (#66)
- Factorial Trailing Zeroes (#172)
- Sqrt(x) (#69)
- Pow(x, n) (#50)
- Max Points on a Line (#149)
Topic 22 — 1D Dynamic Programming
- Climbing Stairs (#70)
- House Robber (#198)
- Word Break (#139)
- Coin Change (#322)
- Longest Increasing Subsequence (#300)
Topic 23 — Multidimensional DP
- Triangle (#120)
- Minimum Path Sum (#64)
- Unique Paths II (#63)
- Longest Palindromic Substring (#5)
- Interleaving String (#97)
- Edit Distance (#72)
- Best Time to Buy and Sell Stock III (#123)
- Best Time to Buy and Sell Stock IV (#188)
- Maximal Square (#221)
GFG 160 — Ordered Curriculum
Topic 1 — Arrays (Days 1–13)
- Second Largest Element in an Array
- Move All Zeroes to End
- Reverse an Array
- Rotate Array
- Next Permutation
- Majority Element II
- Stock Buy and Sell – Multiple Transaction Allowed
- Stock Buy and Sell – Max One Transaction Allowed
- Minimize the Heights II
- Kadane's Algorithm
- Maximum Product Subarray
- Max Circular Subarray Sum
- Smallest Positive Missing Number
Topic 2 — Strings (Days 14–20)
- Implement Atoi
- Add Binary Strings
- Anagram
- Non Repeating Character
- Search Pattern (KMP Algorithm)
- Min Chars to Add for Palindrome
- Strings Rotations of Each Other
Topic 3 — Sorting (Days 21–27)
- Sort 0s, 1s and 2s
- Find H-Index
- Count Inversions
- Overlapping Intervals
- Insert Interval
- Non-overlapping Intervals
- Merge Without Extra Space
Topic 4 — Searching (Days 28–35)
- Number of Occurrence
- Sorted and Rotated Minimum
- Search in Rotated Sorted Array
- Peak Element
- Kth Element of Two Arrays
- Aggressive Cows
- Allocate Minimum Pages
- Kth Missing Positive Number
Topic 5 — Matrix (Days 36–41)
- Spirally Traversing a Matrix
- Rotate by 90 Degree
- Search in a Row-Column Sorted Matrix
- Search in a Row-wise Sorted Matrix
- Search in a Sorted Matrix
- Set Matrix Zeroes
Topic 6 — Hashing (Days 42–50)
- Two Sum — Pair with Given Sum
- Count Pairs with Given Sum
- Find All Triplets with Zero Sum
- Intersection of Two Arrays with Duplicate Elements
- Union of Two Arrays with Duplicate Elements
- Longest Consecutive Subsequence
- Print Anagrams Together
- Subarrays with Sum K
- Count Subarrays with Given XOR
Topic 7 — Two Pointer Technique (Days 51–60)
- Count the number of possible triangles
- Count Pairs whose sum is less than target
- Sum Pair closest to target
- Pair with given sum in sorted array
- Count all triplets with given sum in sorted array
- Indexes of Subarray Sum
- Count distinct elements in every window
- Longest substring with distinct characters
- Trapping Rain Water
- Container With Most Water
Topic 8 — Prefix Sum (Days 61–64)
- Equilibrium Point
- Longest Subarray with Sum K
- Largest Subarray of 0s and 1s
- Product Array Puzzle
Topic 9 — Linked List (Days 65–74)
- Reverse a Linked List
- Rotate a Linked List
- Merge Two Sorted Linked Lists
- Reverse a Linked List in Groups of Given Size
- Add Number Linked Lists
- Clone List with Next and Random Pointer
- Detect Loop in Linked List
- Find the First Node of Loop in Linked List
- Remove Loop in Linked List
- LRU Cache
Topic 10 — Recursion & Backtracking (Days 75–79)
- Permutations of a String
- Implement Pow
- N-Queen Problem
- Solve the Sudoku
- Word Search
Topic 11 — Tree (Days 80–94)
- Level Order Traversal
- Height of Binary Tree
- Diameter of a Binary Tree
- Mirror Tree
- Construct Binary Tree from Parent Array
- Tree Traversal
- Boundary Traversal of Binary Tree
- Maximum Path Sum from Any Node
- K Sum Paths
- Check for BST
- Kth Smallest in BST
- Pair Sum in BST
- Fix Two Nodes of a BST
- Lowest Common Ancestor in a BST
- Construct Tree from Inorder and Preorder
Topic 12 — Heap (Days 95–98)
- K Largest Elements
- Merge K Sorted Arrays
- K Closest Points to Origin
- Find Median in a Stream
Topic 13 — Stack (Days 99–107)
- Next Greater Element
- Next Greater Element in Circular Array
- Stock Span Problem
- Histogram Maximum Rectangular Area
- Maximum of Minimum for Every Window Size
- The Celebrity Problem
- Evaluation of Postfix Expression
- Longest Valid Parentheses
- Implement Two Stacks in an Array
Topic 14 — Queue & Deque (Days 108–109)
- Sliding Window Maximum
- First Circular Tour to Complete Full Journey
Topic 15 — Dynamic Programming (Days 110–132)
- Nth Fibonacci Number
- Climbing Stairs
- Min Cost Climbing Stairs
- 0-1 Knapsack Problem
- Partition Equal Subset Sum
- Coin Change (Count Ways)
- Coin Change (Minimum Coins)
- Rod Cutting
- Egg Drop Problem
- Word Break
- Longest Common Subsequence
- Longest Increasing Subsequence
- Longest Palindromic Subsequence
- Edit Distance
- Wildcard Pattern Matching
- Matrix Chain Multiplication
- Palindrome Partitioning II
- Word Wrap Problem
- Maximum Profit in Job Scheduling
- Minimum Number of Jumps
- Maximum Difference of Zeros and Ones in Binary String
- Minimum Cost to Fill Given Weight in a Bag
- Optimal Binary Search Tree
Topic 16 — Greedy (Days 133–137)
- Activity Selection
- Job Sequencing Problem
- Huffman Encoding
- Fractional Knapsack
- Minimum Platforms
Topic 17 — Graphs (Days 138–152)
- BFS of Graph
- DFS of Graph
- Transitive Closure of a Graph
- Detect Cycle in Undirected Graph
- Detect Cycle in Directed Graph
- Topological Sorting
- Shortest Path in Undirected Graph with Unit Weights
- Shortest Path in Directed Acyclic Graph
- Dijkstra's Algorithm
- Bellman-Ford Algorithm
- Floyd Warshall Algorithm
- Prim's Minimum Spanning Tree
- Kruskal's Minimum Spanning Tree
- Bridge Edge in Graph
- Strongly Connected Components (Kosaraju's Algorithm)
Topic 18 — Tries (Days 153–155)
- Insert and Search in a Trie
- Implement Trie
- Phone Directory
Topic 19 — Bit Manipulation (Days 156–160)
- Power of 2
- Longest Consecutive 1s
- Count Set Bits
- Missing Number in Array
- Find Two Non-Repeating Numbers
HackerRank Interview Preparation Kit — Ordered Curriculum
Base URL: https://www.hackerrank.com/interview/interview-preparation-kit
Topic 1 — Warm-up Challenges
- Sock Merchant
- Counting Valleys
- Jumping on the Clouds
- Repeated String
Topic 2 — Arrays
- Arrays: Left Rotation
- New Year Chaos
- 2D Array - DS
- Minimum Swaps 2
- Array Manipulation
Topic 3 — Dictionaries and Hashmaps
- Hash Tables: Ransom Note
- Two Strings
- Sherlock and Anagrams
- Count Triplets
- Frequency Queries
Topic 4 — Sorting
- Sorting: Bubble Sort
- Mark and Toys
- Sorting: Comparator
- Fraudulent Activity Notifications
- Merge Sort: Counting Inversions
Topic 5 — String Manipulation
- Strings: Making Anagrams
- Alternating Characters
- Sherlock and the Valid String
- Special String Again
- Common Child
Topic 6 — Greedy Algorithms
- Luck Balance
- Minimum Absolute Difference in an Array
- Greedy Florist
- Max Min
- Reverse Shuffle Merge
Topic 7 — Search
- Hash Tables: Ice Cream Parlor
- Swap Nodes [Algo]
- Pairs
- Triple Sum
- Minimum Time Required
- Maximum Subarray Sum
- Making Candies
Topic 8 — Dynamic Programming
- Max Array Sum
- Candies
- Abbreviation
- Decibinary Numbers
Topic 9 — Stacks and Queues
- Balanced Brackets
- Queues: A Tale of Two Stacks
- Largest Rectangle
- Min Max Riddle
- Castle on the Grid
- Poisonous Plants
Topic 10 — Graphs
- Roads and Libraries
- Find the nearest clone
- BFS: Shortest Reach in a Graph
- DFS: Connected Cell in a Grid
- Matrix
Topic 11 — Trees
- Tree: Height of a Binary Tree
- Tree: Huffman Decoding
- Binary Search Tree: Lowest Common Ancestor
- Is This a Binary Search Tree?
- Balanced Forest
Topic 12 — Linked Lists
- Insert a node at a specific position in a linked list
- Inserting a Node Into a Sorted Doubly Linked List
- Reverse a doubly linked list
- Find Merge Point of Two Lists
- Linked Lists: Detect a Cycle
Topic 13 — Recursion and Backtracking
- Recursion: Fibonacci Numbers
- Recursion: Davis' Staircase
- Recursion: Crossword Puzzle
- Recursive Digit Sum
Topic 14 — Miscellaneous
- Flipping bits
- Time Complexity: Primality
- Friend Circle Queries
- Maximum Xor
InterviewBit Programming Track — Curated Curriculum
Base URL: https://www.interviewbit.com/courses/programming/
Curated canonical interview problems drawn from the official InterviewBit Programming track — picked to keep scope comparable to the other study plans (LC Top 150, GFG 160). Problem names match InterviewBit's titles exactly.
Topic 1 — Arrays
- Spiral Order Matrix I
- Max Sum Contiguous Subarray
- Max Non Negative SubArray
- Largest Number
- Kth Row of Pascal's Triangle
- Rotate Matrix
- Set Matrix Zeros
- First Missing Integer
- Next Permutation
- Merge Intervals
- Merge Overlapping Intervals
- Max Distance
- Maximum Absolute Difference
Topic 2 — Math
- All Factors
- Prime Sum
- Excel Column Number
- Excel Column Title
- Grid Unique Paths
- Reverse Integer
- Palindrome Integer
- Power Of Two Integers
- Trailing Zeros in Factorial
- Sorted Permutation Rank
- FizzBuzz
Topic 3 — Binary Search
- Sorted Insert Position
- Search For a Range
- Matrix Median
- Matrix Search
- Square Root of Integer
- Painter's Partition Problem
- Allocate Books
- Median of Array
- Rotated Sorted Array Search
- Implement Power Function
Topic 4 — Strings
- Palindrome String
- Longest Common Prefix
- Count And Say
- Longest Palindromic Substring
- Integer To Roman
- Roman To Integer
- Atoi
- ZigZag String
- Add Binary Strings
- Multiply Strings
- Compare Version Numbers
- Justified Text
- Valid IP Addresses
Topic 5 — Bit Manipulation
- Number of 1 Bits
- Reverse Bits
- Single Number
- Single Number II
- Divide Integers
- Different Bits Sum Pairwise
- Min XOR value
Topic 6 — Two Pointers
- Merge Two Sorted Lists II
- Remove Duplicates from Sorted Array
- Remove Element from Array
- Sort by Color
- 3 Sum
- 3 Sum Zero
- Container With Most Water
- Diffk
- Intersection Of Sorted Arrays
Topic 7 — Linked Lists
- Intersection of Linked Lists
- Reverse Linked List
- Palindrome List
- Remove Duplicates from Sorted List
- Remove Duplicates from Sorted List II
- Merge Two Sorted Lists
- Remove Nth Node from List End
- Rotate List
- Reverse Link List II
- Reorder List
- Add Two Numbers as Lists
- List Cycle
- Partition List
- Swap List Nodes in Pairs
- K Reverse Linked List
- Sort List
Topic 8 — Stacks and Queues
- Generate all Parentheses
- Reverse String
- Nearest Smaller Element
- Largest Rectangle in Histogram
- Sliding Window Maximum
- Min Stack
- Evaluate Expression
- Rain Water Trapped
- Redundant Braces
- Simplify Directory Path
Topic 9 — Backtracking
- Combinations
- Combination Sum
- Combination Sum II
- Letter Phone
- Subset
- Subsets II
- Palindrome Partitioning
- Generate all Parentheses II
- Permutations
- Gray Code
- NQueens
- Sudoku
- Kth Permutation Sequence
Topic 10 — Hashing
- Colorful Number
- 2 Sum
- 4 Sum
- Valid Sudoku
- Diffk II
- Anagrams
- Equal
- Copy List
- Longest Substring Without Repeat
- Substring Concatenation
- Fraction
- Points on the Straight Line
- Largest Continuous Sequence Zero Sum
- Window String
Topic 11 — Heaps and Maps
- N max pair combinations
- Magician and Chocolates
- Merge K Sorted Lists
- Distinct Numbers in Window
- LRU Cache
- Ways to form Max Heap
Topic 12 — Trees
- Vertical Order traversal of Binary Tree
- Inorder Traversal
- Preorder Traversal
- Postorder Traversal
- Max Depth of Binary Tree
- Min Depth of Binary Tree
- Balanced Binary Tree
- Identical Binary Trees
- Symmetric Binary Tree
- Invert the Binary Tree
- ZigZag Level Order Traversal BT
- Populate Next Right Pointers Tree
- Sorted Array To Balanced BST
- Least Common Ancestor
- Valid Binary Search Tree
- Kth Smallest Element in Tree
- BST Iterator
- Recover Binary Search Tree
- Path Sum
- Root to Leaf Paths With Sum
- Sum Root to Leaf Numbers
- Flatten Binary Tree to Linked List
- Construct Binary Tree From Inorder And Preorder
- 2-Sum Binary Tree
Topic 13 — Dynamic Programming
- Longest Common Subsequence
- Longest Palindromic Subsequence
- Edit Distance
- Repeating Subsequence
- Distinct Subsequences
- Scramble String
- Regular Expression Match
- Word Break
- Word Break II
- Longest Valid Parenthesis
- Palindrome Partitioning II
- Coin Sum Infinite
- Max Product Subarray
- Longest Increasing Subsequence
- Jump Game Array
- Min Jumps Array
- Min Sum Path in Matrix
- Min Sum Path in Triangle
- Dungeon Princess
- Unique Paths in a Grid
- Best Time to Buy and Sell Stocks I
- Best Time to Buy and Sell Stocks II
- Best Time to Buy and Sell Stocks III
- Rod Cutting
- Max Sum Without Adjacent Elements
- 0-1 Knapsack
- Equal Average Partition
- Max Rectangle in Binary Matrix
Topic 14 — Greedy
- Highest Product
- Bulbs
- Distribute Candy
- Gas Station
- Majority Element
- Assign Mice to Holes
- Seats
- Disjoint Intervals
Topic 15 — Graphs
- Valid Path
- Region in Binary Matrix
- Level Order
- Smallest Multiple With 0 and 1
- Snake Ladder Problem
- Min Cost Path
- Capture Regions on Board
- Word Search Board
- Word Ladder I
- Word Ladder II
- Black Shapes
- Clone Graph
- Stepping Numbers
- Commutable Islands
- Possibility of Finishing All Courses
- Cycle in Directed Graph
- Cycle in Undirected Graph
- Largest Distance between Nodes of a Tree
- Sum of Fibonacci Numbers
- Knight On Chess Board
- Smallest Sequence With Given Primes
Step 3 — Present the recommendation
Walk all four ordered lists, find the first unsolved problem in each, then pick whichever comes next in the natural round-robin progression: LC → GFG → HR → IB → LC → …
If $ARGUMENTS filters to one platform, only walk that list.
Format your response as:
Problem: [Full problem name]
Source: [LeetCode #XXX | GFG Day XX | HackerRank | InterviewBit ] — [direct link to problem]
Difficulty: [Easy / Medium / Hard]
Topic: [Category]
Progress: [e.g. "2/24 Array problems done on LC" or "First problem in this topic"]
Why now: [1 sentence on how this fits the progression]
Problem Statement:
[Clear description — 3-5 sentences, include input/output format]
Examples:
Example 1:
Input: [input]
Output: [output]
Explanation: [brief]
Example 2:
Input: [input]
Output: [output]
Constraints:
[All constraints]
Do NOT give hints, approach, or solution unless the user explicitly asks.
$ARGUMENTS