随笔分类 -  leetcode

摘要:本题要采用 回溯法 来解决 阅读全文
posted @ 2018-09-18 23:05 pulusite 阅读(110) 评论(0) 推荐(0)
摘要:本题目可以采用三种方法Straightforward DFS recursive, iterative, BFS solutions 1.深度优先 递归 2.迭代 3.广度优先 a.要弄懂final关键字的含义 此题不加也行 b.迭代 c.广度优先 阅读全文
posted @ 2018-09-16 21:46 pulusite 阅读(85) 评论(0) 推荐(0)
摘要:动态规划,注意处理当前最大值小于0的情况 阅读全文
posted @ 2017-11-01 18:38 pulusite 阅读(98) 评论(0) 推荐(0)
摘要:根部到叶子节点路径之和为某值,递归 阅读全文
posted @ 2017-10-31 18:09 pulusite 阅读(80) 评论(0) 推荐(0)
摘要:递归,注意结果的三重判断 阅读全文
posted @ 2017-10-31 14:46 pulusite 阅读(108) 评论(0) 推荐(0)
摘要:The basic idea is that, for example, nums = [1,2,3,4,5,6,7] and k = 3, first we reverse [1,2,3,4,5,6,7], it becomes[7,6,5,4,3,2,1]; then we reverse[7, 阅读全文
posted @ 2017-10-31 10:29 pulusite 阅读(103) 评论(0) 推荐(0)
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
posted @ 2017-09-27 07:50 pulusite 阅读(114) 评论(0) 推荐(0)
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2017-09-27 07:11 pulusite 阅读(79) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-09-26 23:08 pulusite 阅读(105) 评论(0) 推荐(0)
摘要:Implement int sqrt(int x). Compute and return the square root of x. using only integer division for the Newton method works 阅读全文
posted @ 2017-09-26 22:44 pulusite 阅读(107) 评论(0) 推荐(0)
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 判断数字时用charAt(i)-'0'即可 阅读全文
posted @ 2017-09-26 21:22 pulusite 阅读(113) 评论(0) 推荐(0)