100 Most-Asked DSA Coding Questions in Python
Curated for Python Developers and Data Engineers
Arrays & Lists
• Find the largest element in an array
• Find the second largest element
• Reverse an array
• Rotate array by k elements (left/right)
• Move all zeros to the end
• Remove duplicates from sorted array
• Find missing number in a sequence
• Find intersection and union of arrays
• Find pair with given sum
• Maximum subarray sum (Kadane’s Algorithm)
Strings
• Reverse a string
• Check if string is palindrome
• Find first non-repeating character
• Check if two strings are anagrams
• Longest common prefix
• String compression
• All permutations of string
• Longest palindrome substring
• Check unique characters
• String rotation check
Linked List
• Reverse linked list
• Detect loop (Floyd’s Cycle)
• Find middle node
• Remove Nth node from end
• Merge two sorted lists
• Add numbers represented by lists
• Remove duplicates
• Check palindrome list
• Intersection of two lists
• Rotate list by k nodes
Stacks & Queues
• Implement stack and queue
• Stack using queues
• Queue using stacks
• Balanced parentheses
• Evaluate postfix expression
• Next greater element
• Stock span
• Min stack
• Circular queue
Binary Trees & BST
• Tree traversals (Pre/In/Post)
• Level order traversal
• Height of tree
• Leaf count
• Check identical trees
• Check symmetry
• Lowest common ancestor
• Diameter of tree
• Array to BST
• Balanced tree check
Recursion & Backtracking
• Factorial
• Fibonacci
• Subsets
• Permutations
• N-Queens
• Sudoku solver
• Word search
• Rat in maze
• Balanced parentheses generation
• Tower of Hanoi
Searching & Sorting
• Binary search
• Linear search
• First/Last occurrence
• Count occurrences
• Bubble sort
• Selection sort
• Insertion sort
• Merge sort
• Quick sort
• Kth smallest/largest element
Hashing & Dictionaries
• Two sum
• Subarray with zero sum
• Longest subarray with given sum
• Find duplicates
• Group anagrams
• First repeating element
• Word frequency count
• Duplicates within k distance
• Longest consecutive sequence
Dynamic Programming
• Fibonacci (DP)
• LCS
• LIS
• 0/1 Knapsack
• Coin Change