DSA
DSA in Java
Solve 150 classic interview problems pattern by pattern, with pseudocode first, an animated walkthrough of every step and a tested Java solution.
All levels14 modules166 lessonsabout 10 hours54 free lessons
Modules
01Arrays and hashing16 lessons
- 1.1The pattern: arrays and hashingFree2 min
- 1.2Contains DuplicateFree3 min
- 1.3Single NumberFree2 min
- 1.4Plus OneFree2 min
- 1.5Best Time to Buy and Sell StockPro2 min
- 1.6Best Time to Buy and Sell Stock IIPro2 min
- 1.7Move ZeroesPro2 min
- 1.8Remove ElementPro2 min
- 1.9Remove Duplicates from Sorted ArrayPro2 min
- 1.10Intersection of Two Arrays IIPro2 min
- 1.11Roman to IntegerPro2 min
- 1.12Longest Common PrefixPro2 min
- 1.13Rotate ImagePro2 min
- 1.14Group AnagramsPro2 min
- 1.15Reduce Array Size to The HalfPro2 min
- 1.16Merge IntervalsPro2 min
02Two pointers12 lessons
- 2.1The pattern: two pointersFree2 min
- 2.2Valid PalindromeFree3 min
- 2.3Two Sum II - Input Array Is SortedFree3 min
- 2.4Intersection of Two ArraysFree3 min
- 2.5Backspace String ComparePro3 min
- 2.6Long Pressed NamePro3 min
- 2.7Maximum Ascending Subarray SumPro3 min
- 2.8Sort ColorsPro4 min
- 2.9Container With Most WaterPro3 min
- 2.103SumPro3 min
- 2.114SumPro4 min
- 2.12Max Consecutive Ones IIIPro3 min
03Sliding window9 lessons
- 3.1The pattern: sliding windowFree3 min
- 3.2Maximum Average Subarray IFree5 min
- 3.3Longest Substring Without Repeating CharactersFree4 min
- 3.4Permutation in StringFree4 min
- 3.5Find All Anagrams in a StringPro5 min
- 3.6Longest Repeating Character ReplacementPro5 min
- 3.7Fruit Into BasketsPro5 min
- 3.8Count Number of Nice SubarraysPro5 min
- 3.9Minimum Window SubstringPro5 min
04Binary search9 lessons
- 4.1The pattern: binary searchFree3 min
- 4.2Binary SearchFree5 min
- 4.3Search Insert PositionFree5 min
- 4.4First Bad VersionFree5 min
- 4.5Arranging CoinsPro5 min
- 4.6Find First and Last Position of Element in Sorted ArrayPro5 min
- 4.7Search in Rotated Sorted ArrayPro5 min
- 4.8Find Peak ElementPro5 min
- 4.9Split Array Largest SumPro5 min
05Linked lists13 lessons
- 5.1The pattern: linked listsFree3 min
- 5.2Delete Node in a Linked ListFree5 min
- 5.3Middle of the Linked ListFree5 min
- 5.4Remove Linked List ElementsFree5 min
- 5.5Merge Two Sorted ListsPro5 min
- 5.6Linked List CyclePro6 min
- 5.7Linked List Cycle IIPro6 min
- 5.8Palindrome Linked ListPro5 min
- 5.9Remove Nth Node From End of ListPro6 min
- 5.10Intersection of Two Linked ListsPro6 min
- 5.11Reverse Linked List IIPro6 min
- 5.12Add Two NumbersPro6 min
- 5.13Merge k Sorted ListsPro6 min
06Stacks and queues11 lessons
- 6.1The pattern: stacks and queuesFree3 min
- 6.2Valid ParenthesesFree4 min
- 6.3Implement Queue using StacksFree4 min
- 6.4Min StackFree4 min
- 6.5Next Greater Element IPro5 min
- 6.6Minimum Add to Make Parentheses ValidPro4 min
- 6.7Evaluate Reverse Polish NotationPro4 min
- 6.8Daily TemperaturesPro5 min
- 6.9Design Circular QueuePro5 min
- 6.10Decode StringPro5 min
- 6.11Open the LockPro5 min
07Recursion10 lessons
08Backtracking15 lessons
- 8.1The pattern: backtrackingFree2 min
- 8.2SubsetsFree3 min
- 8.3Subsets IIFree4 min
- 8.4Letter Case PermutationFree3 min
- 8.5CombinationsPro4 min
- 8.6Letter Combinations of a Phone NumberPro3 min
- 8.7Combination SumPro4 min
- 8.8Combination Sum IIPro4 min
- 8.9Combination Sum IIIPro4 min
- 8.10Combination Sum IVPro4 min
- 8.11PermutationsPro3 min
- 8.12Permutations IIPro4 min
- 8.13Next PermutationPro5 min
- 8.14Word SearchPro4 min
- 8.15N-QueensPro5 min
09Trees19 lessons
- 9.1The pattern: treesFree3 min
- 9.2Binary Tree Preorder TraversalFree4 min
- 9.3Binary Tree Inorder TraversalFree4 min
- 9.4Binary Tree Postorder TraversalFree3 min
- 9.5Maximum Depth of Binary TreePro3 min
- 9.6Same TreePro3 min
- 9.7Symmetric TreePro3 min
- 9.8Path SumPro3 min
- 9.9Binary Tree Level Order TraversalPro3 min
- 9.10Binary Tree Level Order Traversal IIPro3 min
- 9.11Binary Tree Zigzag Level Order TraversalPro3 min
- 9.12Binary Tree Right Side ViewPro4 min
- 9.13Convert Sorted Array to Binary Search TreePro3 min
- 9.14Validate Binary Search TreePro4 min
- 9.15Minimum Distance Between BST NodesPro3 min
- 9.16Kth Smallest Element in a BSTPro3 min
- 9.17Binary Search Tree IteratorPro4 min
- 9.18Unique Binary Search TreesPro3 min
- 9.19Serialize and Deserialize BSTPro4 min
10BFS, DFS and grids14 lessons
- 10.1The pattern: BFS, DFS & gridsFree2 min
- 10.2Flood FillFree4 min
- 10.3Number of IslandsFree3 min
- 10.4Max Area of IslandFree3 min
- 10.5Number of Closed IslandsPro3 min
- 10.6Walls and GatesPro3 min
- 10.701 MatrixPro3 min
- 10.8Rotting OrangesPro3 min
- 10.9Number of ProvincesPro3 min
- 10.10All Paths From Source to TargetPro3 min
- 10.11Detect Cycle in an Undirected GraphPro3 min
- 10.12Course SchedulePro4 min
- 10.13Perfect SquaresPro3 min
- 10.14Word LadderPro4 min
11Graphs14 lessons
- 11.1The pattern: graphsFree2 min
- 11.2Find the Town JudgeFree4 min
- 11.3Employee ImportanceFree3 min
- 11.4Keys and RoomsFree3 min
- 11.5Course Schedule IIPro3 min
- 11.6Find Eventual Safe StatesPro4 min
- 11.7Is Graph Bipartite?Pro3 min
- 11.8Possible BipartitionPro4 min
- 11.9Redundant ConnectionPro4 min
- 11.10Number of Operations to Make Network ConnectedPro4 min
- 11.11Most Stones Removed with Same Row or ColumnPro4 min
- 11.12Accounts MergePro4 min
- 11.13Surrounded RegionsPro4 min
- 11.14Network Delay TimePro4 min
12Dynamic programming18 lessons
- 12.1The pattern: dynamic programmingFree2 min
- 12.2N-th Tribonacci NumberFree3 min
- 12.3Min Cost Climbing StairsFree3 min
- 12.4Maximum SubarrayFree3 min
- 12.5House RobberPro4 min
- 12.6Maximum Product SubarrayPro3 min
- 12.7Coin ChangePro4 min
- 12.8Minimum Cost For TicketsPro4 min
- 12.92 Keys KeyboardPro4 min
- 12.10Decode WaysPro4 min
- 12.11Word BreakPro3 min
- 12.12TrianglePro4 min
- 12.13Minimum Falling Path SumPro4 min
- 12.14Partition Equal Subset SumPro3 min
- 12.15Ones and ZeroesPro4 min
- 12.16Longest Increasing SubsequencePro4 min
- 12.17Longest Arithmetic SubsequencePro3 min
- 12.18Edit DistancePro3 min