Skip to content

Prepare For Coder Interview – Denny

  • Basic
  • Medium
  • Hard
  • Architect
  • Life

Review: Combinations and Permutations Problems

Posted on January 22, 2018July 26, 2020 by braindenny

Combinations and Permutations Problems



Sample Problems:

  • LeetCode: Combination Sum III

Code Skeleton:

func dfs(combination []int, pos int, nums []int, res *[][]int) {
     // No need to keep going
     if (...) {
       *res = append(*res, combination)
     }

     // Add nums[pos]
     for i:=pos; i<len(nums); i++ {
        // deep copy
        combination2 := make([]int, len(combination))
        copy(combination2, combination)
        combination2 = append(combination2, nums[i])
        dfs(combination2, i+1, nums, res)
     }
}

// main function

  • CheatSheet: Leetcode For Code Interview
  • CheatSheet: Common Code Problems & Follow-ups

See all combination: #combination

  • Review: Combinations and Permutations Problems
  • LintCode: Subset With Target
  • LintCode: Prime Product
  • LeetCode: Subsets II
  • LeetCode: Subsets
  • LeetCode: Pyramid Transition Matrix
  • LeetCode: Permutations II
  • LeetCode: Permutations
  • LeetCode: Permutation Sequence
  • LeetCode: Partition Equal Subset Sum
  • LeetCode: Palindrome Permutation II
  • LeetCode: Next Permutation
  • LeetCode: Letter Tile Possibilities
  • LeetCode: Letter Combinations of a Phone Number
  • LeetCode: Letter Case Permutation
  • LeetCode: Largest Time for Given Digits
  • LeetCode: Generalized Abbreviation
  • LeetCode: Find Permutation
  • LeetCode: Decode Ways
  • LeetCode: Combinations
  • LeetCode: Combination Sum IV
  • LeetCode: Combination Sum III
  • LeetCode: Combination Sum II
  • LeetCode: Combination Sum
  • LeetCode: Brace Expansion
  • LeetCode: Binary Watch
  • LeetCode: Arithmetic Slices
  • LeetCode: Ambiguous Coordinates
  • LeetCode: 3Sum With Multiplicity

See more blog posts.

linkedin
github
slack

Post Views: 7
Posted in ReviewTagged #combination, review

Post navigation

Review: Greedy Problems
LeetCode: Surrounded Regions

Leave a Reply Cancel reply

Your email address will not be published.

Tags

#array #backtracking #bfs #binarytree #bitmanipulation #blog #classic #codetemplate #combination #dfs #dynamicprogramming #game #graph #greedy #heap #inspiring #interval #linkedlist #manydetails #math #palindrome #recursive #slidingwindow #stack #string #subarray #trie #twopointer #twosum binarysearch editdistance hashmap intervaldp knapsack monotone oodesign presum rectangle redo review rotatelist series sql treetraversal unionfind

Recent Posts

  • a
  • a
  • a
  • a
  • a

Recent Comments

    Archives

    Categories

    • Amusing
    • Basic
    • Easy
    • Hard
    • Life
    • Medium
    • Resource
    • Review
    • Series
    • Uncategorized
    Proudly powered by WordPress | Theme: petals by Aurorum.