Блог пользователя cdschenshuai

Автор cdschenshuai, 11 лет назад, По-английски

It's a post recording problems that I think is helpful to MY problem solving ability.
Caution: May NOT fit your appetite!
2B - The least round way
3D - Least Cost Bracket Sequence
Chinese solution
5C - Longest Regular Bracket Sequence
7B - Memory Manager
7D - Palindrome Degree
Finding longest palindromic substring using Manacher's algorithm in O(n)
9D - How many trees?
dp[i][j]: i nodes with height less than j, dp[i][j] = sum{dp[k][j-1] * dp[i-k-1][j-1]}(Choosing number k+1 as the root node)
12D - Ball
Binary Indexed Tree. A 2D version can be found here
13C - Sequence
13E - Holes
Divide array with length n into sqrt(n) consecutive blocks
14D - Two Paths
Very good problem, reference
14E - Camels
reference
16E - Fish
Conditional probability
18D - Seller Bob
recommended solution 253348
18E - Flag 2
dp[level][colorA][colorB], so dp[level[i][j] = change + min(dp[level-1][ii][jj] (i != ii && j != jj), where change means differences between original level-th row and new 'ijijiji...ijij..' row. Time complexity is O(n*26*26*(m+26*26))
19B - Checkout Assistant
Tricky 0-1 knapsack problem.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится