DSA Problems
Arrays
• Two Sum
• Contains Duplicate
• Best Time to Buy and Sell Stock
• Merge Sorted Array
• Majority Element
• Remove Duplicates from a Sorted Array
• Max Consecutive Ones
• Check if array is sorted and rotated
• Move Zeroes
• Single Number
• Pascal's Triangle
• Rotate Array
(Cont…)
Arrays
• Majority Element II
• Product of Array Except for Self
• Maximum Subarray/ Maximum Sum Subarray/ Kadanes Algorithm
• Maximum Product Subarray
• Container With Most Water
• Missing Number
• Longest Consecutive Sequence
• Set Matrix Zeroes
• Spiral Matrix
• Rotate Image
• Rearrange array elements by sign
• Next Permutation
• Sort Colors
Arrays
• Subarray sum equals k
• Merge Intervals
• Find the Duplicate Number
• Repeat and Missing Number Array
• Count Inversions
• Search in a 2D Matrix
• Pow(x, n)
• Unique Paths
• 3Sum
• 4Sum
• Largest Subarray with Sum 0
• Subarray with given XOR
• Trapping Rain Water
Strings
Strings
• Valid Palindrome
• Valid Anagram
• Roman To Integer
• Longest Common Prefix
• Find the index of the first occurrence in a string
• Remove Outermost Parentheses
• Isomorphic Strings
• Largest Odd Number in String
• Rotate String
• Maximum Nesting Depth of the Parentheses
• Sum of beauty of all substrings
• Minimum add to make parentheses valid
(Cont…)
Strings
• Group Anagrams
• Longest Palindromic Substring
• Palindromic Substrings
• Encode and Decode Strings
• Reverse words in a string
• Minimum Characters required to make a string palindromic
• String to Integer Atoi
• Count and Say
• Compare Version Numbers
• Sort Characters by Frequency
• Shortest Palindrome
• Longest Happy Prefix
Backtracking
Backtracking
• Permutations
• Rat in a Maze
• Combination Sum
• Combination Sum II
• Palindrome Partitioning
• Word Search
• N Queens
• Sudoku Solver
Bit Manipulation
Bit Manipulation
• Number of 1 Bits/ Brian Kernighan's Algorithm/ Number of set Bits/
Hamming Weight/ Population Count
• Counting Bits
• Reverse Bits
• Power of Two
• Single Number
• Minimum Bit Flips to Convert Number
• Divide Two Integers
• Subsets
• Sum of Two Integers
• Count Primes
• Pow(x, n)
(Cont…)
Heaps
Heaps
• Kth Largest Element in a Stream
• Kth Largest Element in an array
• Top K Frequent Elements
• Task Scheduler
• Hand of Straights
• Design Twitter
• Maximum Sum Combinations
• Merge K Sorted Lists
• Find Median from Data Stream
LinkedList
LinkedList
• Reverse a Linked List
• Detect Cycle in a Linked List
• Middle of the Linked List
• Merge Two Sorted Lists
• Intersection of two linked lists
• Palindrome Linked List
• Delete the middle node of a linked list
• Odd Even Linked List
• Delete Node in a Linked List
• Linked List Cycle II
• Add Two Numbers
(Cont…)
LinkedList
• Remove Nth Node From End Of List
• Reorder List
• Flattening a Linked List
• Copy List with Random Pointer
• Sort List
• Rotate List
• Reverse Nodes in K Group
• Merge K Sorted Lists
Stack
Stack
• Valid Parentheses
• Implement Stack using Queues
• Next Greater Element I
• Nearest Smaller Element
• Sum of Subarray Minimums
• Next Greater Element II
• Min Stack
• Online Stock Span
• Asterioid Collision
• Sum of subarray ranges
(Cont…)
Stack
• Remove K Digits
• LRU Cache
• Largest Rectangle in Histogram
• Maximal Rectangle
• LFU Cache
Binary Search
Binary Search
• Binary Search
• Search Insert Position
• Kth Missing Positive Number
• Find first and last position of element in sorted array
• Search in a rotated sorted array
• Search in a rotated sorted array II
• Find Minimum in Rotated Sorted Array
• Single Element in a Sorted Array
• Allocate Books
• Aggressive Cows
• Kth Element of Two Sorted Array
(Cont…)
Binary Search
• Longest Increasing Subsequence
• Median of Two Sorted Arrays
• Find Peak Element
• Koko Eating Bananas
• Minimum Number of days to make m bouquets
• Find the smallest divisor given a threshold
• Capacity to ship packages within D Days
• Find a peak element II
• Search in a 2D matrix
• Search in a 2D matrix II
• Split Array Largest Sum
Dynamic Programming
Dynamic Programming
• Climbing Stairs (Count ways to reach the n-th stairs)
• Best Time to Buy and Sell Stock
• Best Time to Buy and Sell Stock II
• Unique Paths
• Unqiue Paths II
• Longest Increasing Subsequence
• 0/1 Knapsack
• Word Break Problem
• House Robber
• House Robber II
(Cont…)
Dynamic Programming
• Decode Ways
• Egg Dropping Puzzle
• Maximum Sum Increasing Subsequence
• Word Break
• Minimum Path Sum
• Coin Change
• Triangle
• Target Sum
• Minimum Failing Path Sum
• Partition Equal Subset Sum
• Edit Distance
(Cont…)
Dynamic Programming
• Delete Operation for Two Strings
• Largest divisible subset
• Number of longest increasing subsequence
• Count Square Submatrices with all ones
• Longest Common Subsequence
• Best time to buy and sell stock with cooldown
• Partition array for maximum sum
• Best time to buy and sell stock with transaction free
• Best time to buy and sell stock III
• Best time to buy and sell stocok IV
• Palindromic Partitioning
(Cont…)
Dynamic Programming
• Matrix Chain Multiplication
• Minimum Cost to Cut a Stick
• Paritition Array into two arrays to minimize sum difference
• Minimum Insertion Steps to make a string palindrome
• Shortest Common Supersequence
• Distinct Subsequence
• Wildcard Matching
• Burst Ballons
• Parsing a boolean expression
• Palindrome Partitioning II
• Maximal Rectangle
(Cont…)
Greedy
Greedy
• N Meetings in One Room
• Lemonade Change
• Assign Cookies
• JUMP Game
• Jump Game II
• Valid Parenthesis String
• Insert Interval
• Merge Intervals
• Non-overlapping intervals
• Candy
(Cont…)
Greedy
• Meeting Rooms 1
• Meeting Rooms 2
• Minimum Platforms
• Job Sequencing Problem
• Candy
Sliding Window
Sliding Window
• Valid Anagram
• Longest Repeating Character Replacement
• Longest substring without repeating characters
• Max Consecutive Ones III
• Binary Subarrays with Sum
• Count Number of Nice Subarrays
• Maximum Points you can obtain from cards
• Number of substrings containing all three characters
• Minimum Window Substring
• Sliding Window Maximum
• Subarrays with K different Integers
Trees
Trees
• Invert/Flip Binary Tree / Mirror Tree
• Inorder Traversal
• Preorder Traversal
• Postorder Traversal
• Count Complete Tree Nodes
• Subtree of Another Tree
• Same Tree
• Symmetric Tree
• Maximum Depth of Binary Tree
• Diameter of Binary Tree
(Cont…)
Trees
• Balanced Binary Tree
• Search in a Binary Search Tree
• Insert into a Binary Search Tree
• Two Sum IV Input is a BST
• Floor From BST
• Ceil From BST
• Left View of Binary Tree
• Bottom View of Binary Tree
• Top View of a Binary Tree
• Right Side View
• Level Order Travesal
(Cont…)
Trees
• Lowest Common Ancestor of a Binary Tree
• Binary Tree Zigzag Level Order Traversal
• Convert Sorted Array to Binary Search Tree
• Delete Node in a BST
• Maximum Width of Binary Tree
• Binary Tree Maximum Path Sum
• Construct Binary Tree from Preorder and Inorder Traversal
• Binary Tree Level Order Traversal
• Validate Binary Search Tree
• Flatten Binary Tree to Linked List
• Populating next right pointers in each node
(Cont…)
Trees
• Kth Largest Element in a BST
• Kth Smallest Element in a BST
• All Nodes Distance K in Binary Tree
• Predecessor and Successor
• Lowest Common Ancestor of a Binary Search Tree
• Recover Binary Search Tree
• Vertical Order Traversal of a Binary Tree
• Serialize and Deserialize Binary Tree
Graph
Graph
• DFS of Graph
• BFS of Graph
• Flood Fill
• Clone Graph Link
• Course Schedule I
• Topological Sort
• Number of Provinces
• Pacific Atlantic Water Flow
• Rotting Oranges
• Number of Islands
(Cont…)
Graph
• Is Graph Bipartite
• Implement Dijkstra Algorithm
• Graph Valid Tree
• Number of Provinces
• Minimum Spanning Tree
• Surrounded Regions
• Number of Enclaves
• Find Eventual Safe States
• 01 Matrix
• Shortest Path in BInary Matrix
• Path with Minimum Effort
(Cont…)
Graph
• Cheapest Flights within K Stops
• Network Delay Time
• Number of Ways to Arrive at destination
• Number of Operations to make network connected
• Most stones removed with same row or columns
• Accounts Merge
• Alien Dictionary
• Word Ladder
• Word Ladder II
• Making a large island
• Swim in rising water
(Cont…)
Trie
Trie
• Implement Trie (Prefix Tree)
• Implement Trie II
• Power Set
• Count Distinct Substrings
• Maximum Xor of Two Numbers in an Array
• Complete String
• Maximum Xor with an element from array
• HashMap + Doubly LinkedList

DSA_PROBLEMS_GOOGLE_HR_FOR_PLACEMENT.pptx

  • 1.
  • 2.
    Arrays • Two Sum •Contains Duplicate • Best Time to Buy and Sell Stock • Merge Sorted Array • Majority Element • Remove Duplicates from a Sorted Array • Max Consecutive Ones • Check if array is sorted and rotated • Move Zeroes • Single Number • Pascal's Triangle • Rotate Array (Cont…)
  • 3.
    Arrays • Majority ElementII • Product of Array Except for Self • Maximum Subarray/ Maximum Sum Subarray/ Kadanes Algorithm • Maximum Product Subarray • Container With Most Water • Missing Number • Longest Consecutive Sequence • Set Matrix Zeroes • Spiral Matrix • Rotate Image • Rearrange array elements by sign • Next Permutation • Sort Colors
  • 4.
    Arrays • Subarray sumequals k • Merge Intervals • Find the Duplicate Number • Repeat and Missing Number Array • Count Inversions • Search in a 2D Matrix • Pow(x, n) • Unique Paths • 3Sum • 4Sum • Largest Subarray with Sum 0 • Subarray with given XOR • Trapping Rain Water
  • 5.
  • 6.
    Strings • Valid Palindrome •Valid Anagram • Roman To Integer • Longest Common Prefix • Find the index of the first occurrence in a string • Remove Outermost Parentheses • Isomorphic Strings • Largest Odd Number in String • Rotate String • Maximum Nesting Depth of the Parentheses • Sum of beauty of all substrings • Minimum add to make parentheses valid (Cont…)
  • 7.
    Strings • Group Anagrams •Longest Palindromic Substring • Palindromic Substrings • Encode and Decode Strings • Reverse words in a string • Minimum Characters required to make a string palindromic • String to Integer Atoi • Count and Say • Compare Version Numbers • Sort Characters by Frequency • Shortest Palindrome • Longest Happy Prefix
  • 8.
  • 9.
    Backtracking • Permutations • Ratin a Maze • Combination Sum • Combination Sum II • Palindrome Partitioning • Word Search • N Queens • Sudoku Solver
  • 10.
  • 11.
    Bit Manipulation • Numberof 1 Bits/ Brian Kernighan's Algorithm/ Number of set Bits/ Hamming Weight/ Population Count • Counting Bits • Reverse Bits • Power of Two • Single Number • Minimum Bit Flips to Convert Number • Divide Two Integers • Subsets • Sum of Two Integers • Count Primes • Pow(x, n) (Cont…)
  • 12.
  • 13.
    Heaps • Kth LargestElement in a Stream • Kth Largest Element in an array • Top K Frequent Elements • Task Scheduler • Hand of Straights • Design Twitter • Maximum Sum Combinations • Merge K Sorted Lists • Find Median from Data Stream
  • 14.
  • 15.
    LinkedList • Reverse aLinked List • Detect Cycle in a Linked List • Middle of the Linked List • Merge Two Sorted Lists • Intersection of two linked lists • Palindrome Linked List • Delete the middle node of a linked list • Odd Even Linked List • Delete Node in a Linked List • Linked List Cycle II • Add Two Numbers (Cont…)
  • 16.
    LinkedList • Remove NthNode From End Of List • Reorder List • Flattening a Linked List • Copy List with Random Pointer • Sort List • Rotate List • Reverse Nodes in K Group • Merge K Sorted Lists
  • 17.
  • 18.
    Stack • Valid Parentheses •Implement Stack using Queues • Next Greater Element I • Nearest Smaller Element • Sum of Subarray Minimums • Next Greater Element II • Min Stack • Online Stock Span • Asterioid Collision • Sum of subarray ranges (Cont…)
  • 19.
    Stack • Remove KDigits • LRU Cache • Largest Rectangle in Histogram • Maximal Rectangle • LFU Cache
  • 20.
  • 21.
    Binary Search • BinarySearch • Search Insert Position • Kth Missing Positive Number • Find first and last position of element in sorted array • Search in a rotated sorted array • Search in a rotated sorted array II • Find Minimum in Rotated Sorted Array • Single Element in a Sorted Array • Allocate Books • Aggressive Cows • Kth Element of Two Sorted Array (Cont…)
  • 22.
    Binary Search • LongestIncreasing Subsequence • Median of Two Sorted Arrays • Find Peak Element • Koko Eating Bananas • Minimum Number of days to make m bouquets • Find the smallest divisor given a threshold • Capacity to ship packages within D Days • Find a peak element II • Search in a 2D matrix • Search in a 2D matrix II • Split Array Largest Sum
  • 23.
  • 24.
    Dynamic Programming • ClimbingStairs (Count ways to reach the n-th stairs) • Best Time to Buy and Sell Stock • Best Time to Buy and Sell Stock II • Unique Paths • Unqiue Paths II • Longest Increasing Subsequence • 0/1 Knapsack • Word Break Problem • House Robber • House Robber II (Cont…)
  • 25.
    Dynamic Programming • DecodeWays • Egg Dropping Puzzle • Maximum Sum Increasing Subsequence • Word Break • Minimum Path Sum • Coin Change • Triangle • Target Sum • Minimum Failing Path Sum • Partition Equal Subset Sum • Edit Distance (Cont…)
  • 26.
    Dynamic Programming • DeleteOperation for Two Strings • Largest divisible subset • Number of longest increasing subsequence • Count Square Submatrices with all ones • Longest Common Subsequence • Best time to buy and sell stock with cooldown • Partition array for maximum sum • Best time to buy and sell stock with transaction free • Best time to buy and sell stock III • Best time to buy and sell stocok IV • Palindromic Partitioning (Cont…)
  • 27.
    Dynamic Programming • MatrixChain Multiplication • Minimum Cost to Cut a Stick • Paritition Array into two arrays to minimize sum difference • Minimum Insertion Steps to make a string palindrome • Shortest Common Supersequence • Distinct Subsequence • Wildcard Matching • Burst Ballons • Parsing a boolean expression • Palindrome Partitioning II • Maximal Rectangle (Cont…)
  • 28.
  • 29.
    Greedy • N Meetingsin One Room • Lemonade Change • Assign Cookies • JUMP Game • Jump Game II • Valid Parenthesis String • Insert Interval • Merge Intervals • Non-overlapping intervals • Candy (Cont…)
  • 30.
    Greedy • Meeting Rooms1 • Meeting Rooms 2 • Minimum Platforms • Job Sequencing Problem • Candy
  • 31.
  • 32.
    Sliding Window • ValidAnagram • Longest Repeating Character Replacement • Longest substring without repeating characters • Max Consecutive Ones III • Binary Subarrays with Sum • Count Number of Nice Subarrays • Maximum Points you can obtain from cards • Number of substrings containing all three characters • Minimum Window Substring • Sliding Window Maximum • Subarrays with K different Integers
  • 33.
  • 34.
    Trees • Invert/Flip BinaryTree / Mirror Tree • Inorder Traversal • Preorder Traversal • Postorder Traversal • Count Complete Tree Nodes • Subtree of Another Tree • Same Tree • Symmetric Tree • Maximum Depth of Binary Tree • Diameter of Binary Tree (Cont…)
  • 35.
    Trees • Balanced BinaryTree • Search in a Binary Search Tree • Insert into a Binary Search Tree • Two Sum IV Input is a BST • Floor From BST • Ceil From BST • Left View of Binary Tree • Bottom View of Binary Tree • Top View of a Binary Tree • Right Side View • Level Order Travesal (Cont…)
  • 36.
    Trees • Lowest CommonAncestor of a Binary Tree • Binary Tree Zigzag Level Order Traversal • Convert Sorted Array to Binary Search Tree • Delete Node in a BST • Maximum Width of Binary Tree • Binary Tree Maximum Path Sum • Construct Binary Tree from Preorder and Inorder Traversal • Binary Tree Level Order Traversal • Validate Binary Search Tree • Flatten Binary Tree to Linked List • Populating next right pointers in each node (Cont…)
  • 37.
    Trees • Kth LargestElement in a BST • Kth Smallest Element in a BST • All Nodes Distance K in Binary Tree • Predecessor and Successor • Lowest Common Ancestor of a Binary Search Tree • Recover Binary Search Tree • Vertical Order Traversal of a Binary Tree • Serialize and Deserialize Binary Tree
  • 38.
  • 39.
    Graph • DFS ofGraph • BFS of Graph • Flood Fill • Clone Graph Link • Course Schedule I • Topological Sort • Number of Provinces • Pacific Atlantic Water Flow • Rotting Oranges • Number of Islands (Cont…)
  • 40.
    Graph • Is GraphBipartite • Implement Dijkstra Algorithm • Graph Valid Tree • Number of Provinces • Minimum Spanning Tree • Surrounded Regions • Number of Enclaves • Find Eventual Safe States • 01 Matrix • Shortest Path in BInary Matrix • Path with Minimum Effort (Cont…)
  • 41.
    Graph • Cheapest Flightswithin K Stops • Network Delay Time • Number of Ways to Arrive at destination • Number of Operations to make network connected • Most stones removed with same row or columns • Accounts Merge • Alien Dictionary • Word Ladder • Word Ladder II • Making a large island • Swim in rising water (Cont…)
  • 42.
  • 43.
    Trie • Implement Trie(Prefix Tree) • Implement Trie II • Power Set • Count Distinct Substrings • Maximum Xor of Two Numbers in an Array • Complete String • Maximum Xor with an element from array
  • 44.
    • HashMap +Doubly LinkedList