I suffer from Imposter Syndrome( a recurring emotional experience) and if you answered “YES” to any of the questions below, then you have it too my friend.

**Perfectionist (Convinced any error is a sign of weakness)**

1. Do you have trouble letting it go after making a mistake?

2. Are you over prepared for meetings or presentations?


This snippet is helpful while preparing for interviews as it groups together similar python Backtracking problems and solution. Please let me know if you have found similar backtracking problems, will add it to the post.

SUBSET PROBLEMS

  • 78. Subsets:** Runtime: 16 ms, faster than 96.05%
    class Solution(object):
    def subsets(self, nums):
    “””
    :type nums: List[int]
    :rtype: List[List[int]]
    “””
    res = []
    self.dfs(nums, [], res)
    return res

    def dfs(self, nums, path, res):
    res.append(path)
    for i in range(len(nums)):
    self.dfs(nums[i+1:], path + [nums[i]], res)
  • 90. Subsets II:** Runtime: 20 ms, faster than 96.23%
    class Solution(object):
    def subsetsWithDup(self, nums):
    “””
    :type nums: List[int]
    :rtype: List[List[int]]…

Imperfect_Kate

I write to share, build confidence and meet like minded people.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store