摘要:An intuitive DFS one.
阅读全文
03 2016 档案
摘要:Neat DP problem to go. If you don't like log(), you can use lookup table. And, this is an amazing solution: https://leetcode.com/discuss/93501/simple-
阅读全文
摘要:Nice one. Try to learn the way of thinking, with the help of the below image: https://leetcode.com/discuss/89336/best-submission-searching-for-the-cro
阅读全文
摘要:Recursion of course. But please make sure you cover all the cases. class Solution(object): # return: max value with node picked, max val w\o node pick
阅读全文
摘要:Backtrace idea is straightforward. But there are always smarter solutions - like this: https://leetcode.com/discuss/87314/non-recursive-time-space-sol
阅读全文
摘要:My first reaction was to use Manacher - which is O(n*k*k) - n is the no. of words, and k is the average length of words. Code of Manacher based soluti
阅读全文