摘要: class Solution { public int evalRPN(String[] tokens) { Stack stack=new Stack(); for(String token:tokens) { if(token.equals("+")||token.equals("-")||token.equal... 阅读全文
posted @ 2017-10-17 10:40 Weiyu Wang 阅读(106) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int maxPoints(Point[] points) { if(points.length> map=new HashMap>(); for(int i=0;i m = new HashMap(); m.put(y, 1); map.put(x, m); ... 阅读全文
posted @ 2017-10-17 08:02 Weiyu Wang 阅读(100) 评论(0) 推荐(0) 编辑
摘要: class Solution { public ListNode sortList(ListNode head) { if(head==null||head.next==null) return head; ListNode p=head,q=head; while(p.next!=null&&p.next.next... 阅读全文
posted @ 2017-10-17 04:58 Weiyu Wang 阅读(94) 评论(0) 推荐(0) 编辑
摘要: class Solution { public ListNode insertionSortList(ListNode head) { ListNode pre=new ListNode(0); ListNode p=head, q; while(p!=null) { q=pre; ... 阅读全文
posted @ 2017-10-17 04:41 Weiyu Wang 阅读(111) 评论(0) 推荐(0) 编辑
摘要: class LRUCache { class DNode{ public int val; public int key; public DNode pre; public DNode next; public DNode(int k, int v){ key=k; ... 阅读全文
posted @ 2017-10-17 04:26 Weiyu Wang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List postorderTraversal(TreeNode root) { Stack stack=new Stack(); List res=new ArrayList(); while(root!=null||!stack.isEmpty()) { ... 阅读全文
posted @ 2017-10-17 03:21 Weiyu Wang 阅读(104) 评论(0) 推荐(0) 编辑