谷歌店面 L3 - 挂了

45分钟, 2 questions each with a follow up

  1. Word Break (LC 139).
    Follow up Word Break II (LC 140). Working solution for both.
  2. I pick a number from 1 to 100. You have to guess which number it is. Every time you guess wrong, I’ll tell you whether the number is higher or lower. If you get to the correct number in n tries, you have to pay $n. What is the best guessing strategy in this case?
    Follow Up: Now when you guess d, you have to pay $d. What is the best strategy now?

I couldn’t answer the follow up of the second question.