Skip to content

jatinkumar762/ProgrammingInterviewQuestions

Repository files navigation

πŸ“Ÿ Please give a star 🌟 to the repository if it helped you.


Programming Interview Questions

Leetcode Top 150 Problems - Link

Sorting Problems

  1. QuickSort implementation in java
  2. HeapSort implementation in java
  3. MergeSort implementation in java
  4. Selection Sort
  5. Bubble Sort
  6. Insertion Sort
  7. Sort an array of 0s, 1s and 2s | Dutch National Flag problem

Non-Comparison based Sorts

  1. Counting Sort

Searching and Sorting Problems

Easy

  1. Find first and last positions of an element in a sorted array
  2. Sort an array according to count of set bits
  3. Smallest factorial number
  4. Rearrange numbers with constant extra space
  5. Merge Sorted Array

Medium

  1. Search in Rotated Sorted Array
  2. Boyer-Moore Majority Voting Algorithm/ Majority Element
  3. Count triplets with sum smaller than X
  4. Minimum Swaps to Sort+
  5. Print all subarrays with 0 sum

Binary Search

Easy

  1. Sqrt(x)
  2. Nth Root of a Number using Binary Search
  3. Peak Element in array
  4. Search single element in a sorted array

Medium

Hard

Maths Problem

Easy

  1. Missing Number

Recursion

  1. Combination Sum

LinkedList

Easy

  1. Design Linked List
  2. Linked List Cycle

Medium

  1. Rotate List
  2. Find the starting point of the loop

Array

Easy

  1. Max and Min with minimum number of comparison
  2. Peak Element
  3. Find Union and Intersection of two arrays
  4. CommonElements in Three Sorted Arrays
  5. Alternate positive and negative numbers
  6. Three way partitioning
  7. Find Pivot Index
  8. Max Consecutive Ones II

Medium

  1. Next Permutation
  2. Kth smallest element
  3. Rotate Array
  4. Maximum Subarray or Kadane's Algorithm
  5. Minimize the Heights
  6. Minimum number of jumps
  7. Count Inversions
  8. Best time to buy and Sell stock
  9. Count pairs with given sum
  10. Factorials of large numbers
  11. Maximum Product Subarray
  12. House Robber
  13. Product of Array Except Self
  14. Longest consecutive subsequence
  15. Triplet Sum in Array
  16. Trapping Rain Water
  17. Median of 2 sorted arrays of equal size
  18. Median of 2 sorted arrays of different size
  19. Not a subset sum

String

Easy

  1. Longest K unique characters substring
  2. Isomorphic Strings
  3. Shuffle String
  4. Look and Say Pattern
  5. Remove all consecutive duplicates from the string
  6. Count Binary Substrings
  7. Letter Combinations of a Phone Number
  8. Longest Repeating Subsequence
  9. Word Search
  10. Roman Number to Integer
  11. Print Anagrams Together
  12. Isomorphic Strings
  13. Remove outermost Paranthesis

Medium

  1. Valid Substring
  2. Check if the given string is shuffled substring of another string
  3. Print all subsequences of a string
  4. Permutations of a given string
  5. Print all substrings
  6. Find the string in grid
  7. Next Permutation
  8. Permutations
  9. Number of Matching Subsequences
  10. KMP Algorithm/Longest Prefix Suffix
  11. Word Break
  12. Count Reversal
  13. Longest Common Subsequence
  14. Smallest distinct window
  15. Transform One String to Another using Minimum Number of Given Operation

Hard

  1. Minimum characters to be added at front to make string palindrome
  2. Recursively remove all adjacent duplicates

Matrix

Easy

  1. Common elements in all rows of a given matrix

Medium

  1. Spirally traversing a matrix
  2. Search a 2D Matrix
  3. Row with max 1s
  4. Sort the given 2D Matrix
  5. Diagonal Traverse

Stacks & Queues

Easy

  1. Implement Circular Queue
  2. BFS - Number of Islands
  3. Valid Parentheses.
  4. Convert Infix to Postfix
  5. Expression contains redundant bracket or not
  6. Daily Temperatures
  7. Implement Queue using Stacks
  8. Keys and Rooms

Medium

  1. πŸ”₯ BFS - Open the Lock
  2. Next Greater Element
  3. The Celebrity Problem
  4. Design a stack with operations on middle element
  5. Get minimum element from stack in O(1) time
  6. πŸ”₯ Validate Stack Sequences
  7. πŸ”₯ Valid Substring
  8. Inorder Traversal (Iterative)
  9. πŸ”₯ Decode String
  10. Implement Stack using Queues
  11. πŸ”₯ 01 Matrix

Binary Tree

Easy

  1. Maximum depth of binary tree
  2. Balanced Binary Tree
  3. Diameter of Binary Tree
  4. Same Tree

Medium

  1. ZigZag Tree Traversal
  2. Preorder, Inorder, and Postorder Traversal
  3. Binary Tree Level Order Traversal
  4. Binary Tree Maximum Path Sum
  5. [Boundary Traversal of binary tree]
  6. Top View of Binary Tree
  7. Bottom View of Binary Tree
  8. Binary Tree Right Side View
  9. Symmetric Tree

Hard

Binary Search Tree

Easy

  1. Check for BST
  2. Search in a Binary Search Tree
  3. Floor Binary Search Tree
  4. Ceil Binary Search Tree
  5. Insert a given Node in Binary Search Tree

Medium

  1. Predecessor and Successor
  2. Delete Node in a BST
  3. Kth Smallest Element in a BST
  4. Validate Binary Search Tree

Backtracking

Medium

  1. Permutations
  2. Permutations II
  3. Subsets
  4. Subsets II
  5. Combination Sum
  6. Combination Sum II
  7. Palindrome Partitioning

Dynamic Programming

Easy

  1. Perfect Square

Medium

  1. Longest Palindrome in a String
  2. Minimum Operations
  3. Minimum number of Coins
  4. Longest Common Substring
  5. Longest Increasing Subsequence
  6. Max length chain

Heap

Easy

  1. Implementation of a Heap

Sliding Window

Easy

  1. Count Occurences of Anagrams