摘要: https://leetcode.com/problems/combination-sum/ 1 class Solution { 2 public: 3 void getResult(vector>& res,vector& path,int target,int index,int su... 阅读全文
posted @ 2015-07-18 18:22 阿怪123 阅读(161) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/divide-two-integers/需要注意的,int类型的数据,正数最大和负数最小可以表示到:2147483647-2147483648正数最大的二进制码为:011111111......1111,负数最小的二进制码为:1000000... 阅读全文
posted @ 2015-07-18 17:41 阿怪123 阅读(173) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/generate-parentheses/递归,用两个指标left和right来标记出合法规则,之后再left和right都达到n后,满足了可以输出的条件此时,就可以把这个string压入到res中了。 1 class Solution {... 阅读全文
posted @ 2015-07-18 15:52 阿怪123 阅读(118) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/product-of-array-except-self/第一次循环,建立left数组和right数组,通过动态规划来压缩时间复杂度。第二次循环,直接通过left和right数组相乘得到结果,并直接返回到res数组 1 class Solu... 阅读全文
posted @ 2015-07-18 11:51 阿怪123 阅读(144) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/delete-node-in-a-linked-list/ 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 ... 阅读全文
posted @ 2015-07-18 11:16 阿怪123 阅读(133) 评论(0) 推荐(0)