https://leetcode.com/problems/longest-word-in-dictionary/ In this problem, we build a Trie, and then we traverse it and try to get the leaf with the longest word. A simple twist is that, at every node, we only traverse further to a child if and only if the child is a word node, meaning it corresponds to a word existed…
Read moreHouse Robber II – How to rob houses efficiently.
https://leetcode.com/problems/house-robber-ii/ We are not actually talking about robbing real house here. The problem is: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one….
Read more