摘要:
Problem Statement dp[i][j]: the number of subsets of A[0, i] whose sum is j. dp[0][0] = 1, there is only 1 way of not picking anything from an empty a 阅读全文
摘要:
You are given a 2D integer array, queries. For each queries[i], where queries[i] = [ni, ki], find the number of different ways you can place positive 阅读全文
摘要:
Problem Statement 1. N is up to 35, so trying all possible subsequences is too slow (2^35). We can apply the meet in the middle technique and divide A 阅读全文
摘要:
You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (in 阅读全文
摘要:
There are n uniquely-sized sticks whose lengths are integers from 1 to n. You want to arrange the sticks such that exactly k sticks are visible from t 阅读全文
摘要:
Problem Link Dp[i][j]: the number of possible ways from s[0, i] with the ith statement ending with indentation j. dp[0][0] = 1, the 1st statement must 阅读全文
摘要:
A. Counting Kangaroos is Fun There can be only at most N / 2 hold and held pairs based the problem's statment. So a greedy approach is just to divide 阅读全文
摘要:
Problem First I thought about modelling this problem as a directed graph, where between each pair of nodes, an edge represents a valid < > or > < tran 阅读全文
摘要:
Problem S: the set of numbers said by player 1; P: the set of numbers said by player 2; S^2 * P = a; S * P^2 = b; a * b = (S * P)^3, so a * b must be 阅读全文
摘要:
Problem Each fence is increased at most 2 times, so dp[i][j] is the min cost to make A[0, i] great with the last fence A[i] increased j times. The ans 阅读全文