- 博客(12)
- 收藏
- 关注
原创 快上车!EventBus使用
首先在接收EventMessage的地方---注册事件EventBus.getDefault().register(this);然后这里就开始时刻监控有没有通知它启动。在注解中定义接收处在发动EVEnt时在哪个线程中进行@Subscribe(threadMode = ThreadMode.MAIN)public void onMoonEvent(MessageEven
2017-05-08 16:06:02 353
转载 网络加载图片用glide,真神器啊
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> Button
2017-05-06 19:12:06 202
原创 LeetCode钻研9 判断链表是否有环
/快慢指针能相遇说明有环!publicclass Solution { publicboolean hasCycle(ListNode head) { if(head==null) returnfalse; ListNode fast=head;
2017-01-26 09:45:51 196
原创 LeetCode钻研7 链表的后半与前半进行穿插
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given{1,2,3,4}, reorder it to{1
2017-01-25 16:37:49 196
原创 LeetCode钻研8 前序遍历树
publicArrayList preorderTraversal(TreeNode root){ //非递归简洁版 if(root == null) returnnew ArrayList} TreeNode current = root;
2017-01-23 17:33:42 178
原创 leetCode钻研6 二叉树的后序遍历
import java.util.Stack;import java.util.ArrayList;public class Solution { public ArrayList postorderTraversal(TreeNode root) { TreeNode p=root,r=null; Stack s=new Stack();
2017-01-05 23:02:23 298
原创 leetcode钻研5 链表的插入排序
Sort a linked list using insertion sort.public class Solution{ public ListNode insertionSortList(ListNode head){ ListNode dumy=new ListNode(Integer.MIN_VALUE);ListNode pre=dumy;Li
2016-12-30 19:17:35 229
原创 leetcode4 链表的归并排序
Sort a linked list in O(n log n) time using constant space complexity.publicclass Solution { publicListNode sortList(ListNode head) { if(head==n
2016-12-28 22:28:07 237
原创 leetcode钻研3 串最多点的直线上面点的个数(二维)
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.import java.util.*; class Point { int x; int y; Point() { x = 0
2016-12-17 14:50:10 490
原创 leetcode钻研2 后续表达式
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3",
2016-12-16 20:53:00 224
原创 leetcode钻研1 求树最短路径到叶子
public class Solution { public int run(TreeNode root) { if(root==null) return 0; if(root.right==null&&root.left==null) return 1; if(root.right==null) ret
2016-12-16 10:22:38 485
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人