2021/08/12
Leetcode:
- medium, 416. Partition Equal Subset Sum
public boolean canPartition(int[] nums) {
int sum = 0;
for(int num : nums) {
sum += num;
}
if(sum % 2 != 0)
return false;
int half = sum / 2;
boolean[] dp = new boolean[half + 1];
dp[0] = true;
for(int num: nums) {
for(int i = half; i >= num; i--) {
if(dp[i - num] == true)
dp[i] = true;
}
}
return dp[half];
}
- medium, 279. Perfect Squares
- hard, 312. Burst Balloons
- medium, 583. Delete Operation for Two Strings
- medium, 740. Delete and Earn
- medium, 799. Champagne Tower
- medium, 1143. Longest Common Subsequence
- hard, 1092. Shortest Common Supersequence
Longest common subsequence video, https://www.youtube.com/watch?v=ASoaQq66foQ