![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
刷题
一只小小肥羊
这个作者很懒,什么都没留下…
展开
-
算法 | 判断链表是否有环?
public boolean hasCycle(ListNode head) { if (head == null || head.next == null){ return false; } ListNode oneStep = head.next; ListNode twoStep = head.next...原创 2019-01-03 16:15:55 · 114 阅读 · 0 评论 -
刷题 | 求二叉树中根节点到叶子节点路径和为指定值
import java.util.ArrayList; //将题目分解成更小的子问题,(子节点,sum-父节点的值) public class A28pathSum { public static void main(String[] args) { A28pathSum test = new A28pathSum(); TreeNode a1 = new...原创 2019-01-07 15:25:02 · 1127 阅读 · 0 评论 -
刷题 | 二叉树的各种遍历java实现
package ImportantAlgorithm; import javafx.geometry.Pos; import java.util.ArrayDeque; public class PreOrder { public static void main(String[] args) { TreeNode a1 = new TreeNode(5); ...原创 2019-01-22 14:56:04 · 158 阅读 · 0 评论