avatar_url

Sandesh Rana | Python

I'm a developer from Himalayas, with a passion for crafting efficient and elegant code, with creativity and precision.

Backtracking

21 Aug 2024 » programming, algorithm

Backtracking: Easy to Hard Problems

Easy

  1. Permutations (Generates all permutations of a given list of numbers)
  2. Combination Sum (Finds all combinations that sum up to a target)
  3. Subsets (Generates all possible subsets of a given set)
  4. Letter Combinations of a Phone Number (Generates combinations of letters for a given phone number)
  5. Generate Parentheses (Generates all combinations of well-formed parentheses)

Medium

  1. N-Queens (Solves the N-Queens problem to place N queens on an N×N chessboard)
  2. Combination Sum II (Finds unique combinations that sum up to a target with duplicates allowed)
  3. Word Search (Finds if a word exists in a grid of characters)
  4. Sudoku Solver (Solves a Sudoku puzzle using backtracking)
  5. Palindromic Substrings (Counts all palindromic substrings in a given string)

Hard

  1. N-Queens II (Counts all distinct solutions for the N-Queens problem)
  2. Word Search II (Finds all words in a grid using a given dictionary)
  3. Expression Add Operators (Finds all possible ways to add operators to make the expression equal to a target value)
  4. Palindrome Partitioning II (Finds the minimum cut needed to partition a string into palindromes)
  5. Combination Sum III (Finds all possible combinations of k numbers that add up to a target with unique digits)