摘要:
The idea is to search for the left and right boundaries of target via two binary searches. Well, some tricks may be needed. Take a look at this link :... 阅读全文
摘要:
The most obvious idea is to maintain two divisors to get the most and least significantdigits and compare them. Well, there are much more clever ideas... 阅读全文
摘要:
The idea is to add the two numbers (represented by linked lists) nodes after nodes and store the result in the longer list. Since we may append the ad... 阅读全文
摘要:
The basic idea is to maintain a hash table for each elementnuminnums, usingnumas key and its index (1-based) as value. For eachnum, search fortarget -... 阅读全文
摘要:
This problem can be solved easily if we are allowed to use more than O(1) space. For example, you may create a copy of the original matrix (O(mn)-spac... 阅读全文
摘要:
This problem is a little tricky at first glance. However, if you have finished theHouse Robberproblem, this problem can simply bedecomposed into two H... 阅读全文
摘要:
Since we are not allowed to rob two adjacent houses, we keep two variablespreandcur. During thei-th loop,prerecords the maximum profit that we do not ... 阅读全文
摘要:
Well, this problem can be solved in 1-line clearly. Take a look at this link:-)1 class Solution {2 public:3 string convertToTitle(int n) {4 ... 阅读全文