LeetCode Biweekly Contest 24
| Rank | Name | Score | Finish Time | Q1 (3) | Q2 (4) | Q3 (5) | Q4 (6) |
|---|---|---|---|---|---|---|---|
| 700 / 7729 | YoungForest | 18 | 1:17:49 | 0:04:50 | 0:10:38 | 0:17:45 | 1:02:49 3 |
Recently I participated in two Codeforces contests, and my CF rating is hovering around 1400+. Codeforces problems are much harder than LeetCode’s. I did not manage to keep going. This is also related to CF not having a very good discuss section; after each contest ends, I can only read the official editorial.
1413. Minimum Value to Get Positive Step by Step Sum
Track the most negative prefix sum. One thing to note is that startValue must be positive.
Time complexity: O(N),
space complexity: O(N).
1 | class Solution: |
1414. Find the Minimum Number of Fibonacci Numbers Whose Sum Is K
Greedy. Always choose the largest Fibonacci number that is less than or equal to i, then recursively solve the remaining value.
Time complexity: O((log k)^2),
space complexity: O(log k).
1 | class Solution: |
1415. The k-th Lexicographical String of All Happy Strings of Length n
Use backtracking to enumerate all Happy strings in lexicographical order until the k-th one is found.
Time complexity: O(min(3 ^ n, k)),
space complexity: O(n).
1 | class Solution { |
1416. Restore The Array
DP. dp[i]: the number of ways to split the array ending at the i-th element.dp[i] = sum(dp[j] for j + 1, ..., i can form a valid number)
Time complexity: O(N * log K),
space complexity: O(N).
1 | class Solution: |