k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4 Output: True (5), (1, 4), (2,3), (2,3) have equal sums Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4 Output: True (5), (1, 4), (2,3), (2,3) have equal sums Input: nums = [1], k = 3 Output: ?? Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4 Output: True (5), (1, 4), (2,3), (2,3) have equal sums Input: nums = [1], k = 3 Output: false Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4 Output: True (5), (1, 4), (2,3), (2,3) have equal sums Input: nums = [1], k = 3 Output: false Input: nums = [1, 1, 1], k = 3 Output: ?? Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4 Output: True (5), (1, 4), (2,3), (2,3) have equal sums Input: nums = [1], k = 3 Output: false Input: nums = [1, 1, 1], k = 3 Output: true Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true If k = 1, we’re done! Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true If k = 1, we’re done! nums = [1, 2], k = 2 -> returns false Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true If k = 1, we’re done! nums = [1, 2], k = 2 -> returns false If sum(nums) % k != 0 , we can return false Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true If k = 1, we’re done! nums = [1, 2], k = 2 -> returns false If sum(nums) % k != 0 , we can return false nums = [1, 2, 3], k = 2 -> returns true Partition to K Equal Sum Subsets
k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal. Let’s think about some base cases to get us started: nums = [1, 2] , k = 1 -> returns true If k = 1, we’re done! nums = [1, 2], k = 2 -> returns false If sum(nums) % k != 0 , we can return false nums = [1, 2, 3], k = 2 -> returns true Each bucket needs sum(nums) / k => 3 Partition to K Equal Sum Subsets
solving for? 2. GetCandidates - get all the possible potential solutions (local solutions) 3. IsSolution - is this candidate a solution? 4. Backtrack - Undo any state that was caused with local guesses Partition to K Equal Sum Subsets
group’s sum doesn’t exceed target - add it to k group - recursively search with one less number if every number is in a group, search was successful Partition to K Equal Sum Subsets
-> tells us which numbers have been used already. It also allows us to set the ith bit, unset the ith bit, check if ith bit is set in one step Partition to K Equal Sum Subsets
-> tells us which numbers have been used already. It also allows us to set the ith bit, unset the ith bit, check if ith bit is set in one step For example: nums[] = [2, 1, 4, 3, 5, 6, 2], mask = (1100101), which means that { 2, 1, 5, 2 } have been used in this state Partition to K Equal Sum Subsets
into Partition to K equal subsets with DP if you’re super advanced. Otherwise, simple backtracking approach with recursion would be fine 99.99% of the time. Review Week! Coming Up
-> tells us which numbers have been used already. It also allows us to set the ith bit, unset the ith bit, check if ith bit in one step For example: nums[] = [2, 1, 4, 3, 5, 6, 2], mask = (1100101), which means that { 2, 1, 5, 2 } have been used in this state Partition to K Equal Sum Subsets
-> tells us which numbers have been used already. It also allows us to set the ith bit, unset the ith bit, check if ith bit in one step For example: nums[] = [2, 1, 4, 3, 5, 6, 2], mask = (1100101), which means that { 2, 1, 5, 2 } have been used in this state Let’s say our target = 8, dp[1100101] = (2 + 1 + 5 + 2) % 8 = 2 -> We need to find an unused number to satisfy the next state Partition to K Equal Sum Subsets
many questions without trying to look for the answers first - Not asking for the projects / tasks I want. Not telling my manager what I want - Overpromising
many questions without trying to look for the answers first - Not asking for the projects / tasks I want. Not telling my manager what I want - Overpromising - Trying to change too much within the first 3 months
many questions without trying to look for the answers first - Not asking for the projects / tasks I want. Not telling my manager what I want - Overpromising - Trying to change too much within the first 3 months - Not getting iterative feedback
many questions without trying to look for the answers first - Not asking for the projects / tasks I want. Not telling my manager what I want - Overpromising - Trying to change too much within the first 3 months - Not getting iterative feedback - Not learning from my own interview mistakes
many questions without trying to look for the answers first - Not asking for the projects / tasks I want. Not telling my manager what I want - Overpromising - Trying to change too much within the first 3 months - Not getting iterative feedback - Not learning from my own interview mistakes - Trying to learn all the cool new techlogies and frameworks