2018年1月30日

【LeetCode】2. Add Two Numbers

摘要: 传送门:https://leetcode.com/problems/add-two-numbers/description/ 解析:模拟竖式加法即可,注意进位。 阅读全文

posted @ 2018-01-30 18:10 小问号??? 阅读(107) 评论(0) 推荐(0)

【LeetCode】1. Two Sum

摘要: 传送门:https://leetcode.com/problems/two-sum/description/ 解析:完全不需要两重循环,直接O(n)即可。我们这里利用到了map,当遍历到当前数字x时,我们就只需要寻找target-x即可,此时记下x的位置,那么当我们遍历到target-x时,m[ta 阅读全文

posted @ 2018-01-30 16:59 小问号??? 阅读(90) 评论(0) 推荐(0)

导航