摘要:
class Solution { public int evalRPN(String[] tokens) { Stack stack=new Stack(); for(String token:tokens) { if(token.equals("+")||token.equals("-")||token.equal... 阅读全文
摘要:
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); ... 阅读全文
摘要:
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... 阅读全文
摘要:
class Solution { public ListNode insertionSortList(ListNode head) { ListNode pre=new ListNode(0); ListNode p=head, q; while(p!=null) { q=pre; ... 阅读全文
摘要:
class LRUCache { class DNode{ public int val; public int key; public DNode pre; public DNode next; public DNode(int k, int v){ key=k; ... 阅读全文
摘要:
class Solution { public List postorderTraversal(TreeNode root) { Stack stack=new Stack(); List res=new ArrayList(); while(root!=null||!stack.isEmpty()) { ... 阅读全文