- 博客(32)
- 收藏
- 关注
转载 [leetcode] 046. Permutations 解题报告
本题要采用 回溯法 来解决class Solution { public List<List<Integer>> permute(int[] nums) { List<List<Integer>> list = new ArrayList<>(); backtrack(...
2018-09-18 23:05:00
96
转载 [leetcode] 226. Invert Binary Tree 解题报告
本题目可以采用三种方法Straightforward DFS recursive, iterative, BFS solutions1.深度优先 递归2.迭代3.广度优先a.要弄懂final关键字的含义此题不加也行class Solution { public TreeNode invertTree(TreeNode root) { ...
2018-09-16 21:46:00
87
转载 [leetcode] 121. Best Time to Buy and Sell Stock 解题报告
动态规划,注意处理当前最大值小于0的情况public int maxProfit(int[] prices) { if (prices == null || prices.length <= 1) return 0; int curMax = 0,result = 0; for (int i = 1; i < pr...
2017-11-01 18:38:00
75
转载 [leetcode] 112. Path Sum 解题报告
根部到叶子节点路径之和为某值,递归public boolean hasPathSum(TreeNode root, int sum) { if (root==null) return false; if (root.val==sum && root.left==null && root.right==null) ...
2017-10-31 18:09:00
57
转载 [leetcode] 190. Reverse Bits 解题报告
递归,注意结果的三重判断public boolean isBalanced(TreeNode root) { if (root==null) return true; return Math.abs(getHeight(root.left)-getHeight(root.right)) <=1 && isBalanced(...
2017-10-31 14:46:00
79
转载 [leetcode] 189. Rotate Array 解题报告
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,6,5], it becomes[5,6,7], finally we reverse t...
2017-10-31 10:29:00
55
转载 [leetcode] 100. Same Tree 解题报告
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.空值判断+递归...
2017-09-27 07:53:00
51
转载 [leetcode] 88. Merge Sorted Array 解题报告
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is greater or equal tom+n) to hold addi...
2017-09-27 07:50:00
57
转载 [leetcode] 83. Remove Duplicates from Sorted List 解题报告
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3....
2017-09-27 07:11:00
45
转载 [leetcode] 70. Climbing Stairs 解题报告
You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note:Givennwill be a pos...
2017-09-26 23:08:00
56
转载 [leetcode] 69. Sqrt(x) 解题报告
Implementint sqrt(int x).Compute and return the square root ofx.using only integer division for the Newton method workspublic int mySqrt(int x) { long r=x; while (r*r...
2017-09-26 22:44:00
44
转载 [leetcode] 67. Add Binary 解题报告
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".判断数字时用charAt(i)-'0'即可public String addBinary(String a, String b) { Strin...
2017-09-26 21:22:00
51
转载 [leetcode] 66. Plus One 解题报告
Given a non-negative integer represented as anon-emptyarray of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The dig...
2017-09-25 23:23:00
85
转载 [leetcode] 058. Length of Last Word 解题报告
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note:A word is ...
2017-09-25 21:12:00
61
转载 flag找工作参考博客
http://blog.csdn.net/linhuanmars/article/category/2336231转载于:https://www.cnblogs.com/pulusite/p/7202067.html
2017-07-18 18:31:00
98
转载 博文目录
java基础反射注解代理泛型异常IONIOObject类JVM内存模型类加载机制调优Tomcat调优java并发JMMvolatilesynchronizedlockAQSCondition线程池原理java集合java集合架构概况HashMapArrayLis...
2017-06-01 11:33:00
136
转载 比较好的博文例子
leetcode好博文:http://blog.csdn.net/crazy1235/article/details/51420522转载于:https://www.cnblogs.com/pulusite/p/5840748.html
2016-09-04 23:21:00
123
转载 [leetcode] 100. Same Tree 解题报告
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.递归遍历一刷:...
2016-09-04 23:17:00
51
转载 [leetcode] 237. Delete Node in a Linked List 解题报告
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> 4and you are given the third nod...
2016-09-04 23:11:00
52
转载 [leetcode] 349. Intersection of Two Arrays 解题报告
Given two arrays, write a function to compute their intersection.Example:Givennums1=[1, 2, 2, 1],nums2=[2, 2], return[2].Note:Each element in the result must be unique.The result...
2016-09-04 23:08:00
63
转载 [leetcode] 283. Move Zeroes 解题报告
Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givennums = [0, 1, 0, 3, 12], after calling yo...
2016-09-04 23:02:00
69
转载 [leetcode] 389. Find the Difference 解题报告
Given two stringssandtwhich consist of only lowercase letters.Stringtis generated by random shuffling stringsand then add one more letter at a random position.Find the letter that was...
2016-09-04 22:58:00
82
转载 [leetcode] 104. Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.递归遍历 左子树 和 右子树一刷: public...
2016-09-04 22:54:00
54
转载 [leetcode] 258. Add Digits
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + 8 = 11,1 + 1 = 2. Since2has only o...
2016-09-04 22:42:00
56
转载 [leetcode] 136. Single Number
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
2016-09-04 22:18:00
50
转载 [leetcode] 371. Sum of Two Integers 解题报告
Calculate the sum of two integersaandb, but you arenot allowedto use the operator+and-.Example:Givena= 1 andb= 2, return 3.用 异或 表示sum,与 表示 carry,carry左移一位后,递归调用getSum(sum,carry<...
2016-09-04 22:02:00
57
转载 [leetcode] 292. Nim Game 解题报告
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will b...
2016-09-04 21:54:00
62
转载 [leetcode] 344.Reverse String 解题报告
Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".即反转字符串,逆序遍历依次append到StringBuffer即可一刷: public String reverseStr...
2016-09-04 21:49:00
62
转载 leetcode刷题记录--至少要刷3遍--必须每天更新
2016.9.2 刷11题(加以前刷的) 344、292、371、136、258、104 之前: 1、7、9、26、27 共374题 剩余363题2016.9.3 刷5题 389、283、349、237、100 共刷16题 剩余358题转载于:https://www.cnblogs.com/pulusite/p/5837616.html...
2016-09-03 17:36:00
459
转载 博文转载
eclipse快捷键:ctrl+f11 运行 http://www.360doc.com/content/08/1120/16/16915_1965253.shtml转载于:https://www.cnblogs.com/pulusite/p/5037874.html
2015-12-11 02:56:00
60
转载 用c与数据结构算法最难的挑战开始自己的编程旅程吧
c转载于:https://www.cnblogs.com/pulusite/p/4750829.html
2015-08-22 18:28:00
107
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人