摘要: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode rem... 阅读全文
posted @ 2016-04-02 21:04 阿怪123 阅读(87) 评论(0) 推荐(0)
摘要: public class Solution { public boolean containsDuplicate(int[] nums) { Map mp=new HashMap(); int len=nums.length; for(int i=0;i<len;i++) { if(mp.contai... 阅读全文
posted @ 2016-04-02 20:38 阿怪123 阅读(116) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ... 阅读全文
posted @ 2016-04-02 20:32 阿怪123 阅读(119) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ... 阅读全文
posted @ 2016-04-02 20:25 阿怪123 阅读(120) 评论(0) 推荐(0)
摘要: 罗马数字主要特点: I V X L C D M 1 5 10 50 100 500 1000 1 基本数字,I,X,C。自身连用构成数目、或者放大在大数的右边连用构成数目、不可以超过三个;放在大数左边不能超过一个 2 基本数字 V L D 不可以作为小数放在大数左边来作为减数。放在大数的右边采用想家 阅读全文
posted @ 2016-04-02 19:56 阿怪123 阅读(101) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { public ListNode ins... 阅读全文
posted @ 2016-04-02 17:20 阿怪123 阅读(108) 评论(0) 推荐(0)
摘要: public class Solution { public boolean isPalindrome(String s) { List my=new ArrayList(); int len=s.length(); for(int i=0;i='a'&&temp='0'&&temp='A'&&temp<='Z') ... 阅读全文
posted @ 2016-04-02 16:36 阿怪123 阅读(99) 评论(0) 推荐(0)
摘要: public class Solution { public int findPeakElement(int[] nums) { int length=nums.length; if(length==1) return 0; int i=0; for(;inums[... 阅读全文
posted @ 2016-04-02 14:52 阿怪123 阅读(67) 评论(0) 推荐(0)
摘要: class MyQueue { // Push element x to the back of queue. public void push(int x) { stin.push(x); } // Removes the element from in front of queue. public void pop() { ... 阅读全文
posted @ 2016-04-02 14:42 阿怪123 阅读(136) 评论(0) 推荐(0)
摘要: 第一次尝试用暴力比较法,超时 之后选择用hashmap的方法,节省时间复杂度 阅读全文
posted @ 2016-04-02 11:38 阿怪123 阅读(113) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ... 阅读全文
posted @ 2016-04-02 11:16 阿怪123 阅读(130) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ... 阅读全文
posted @ 2016-04-02 11:11 阿怪123 阅读(105) 评论(0) 推荐(0)
摘要: public class Solution { public boolean isPowerOfTwo(int n) { if(n<=0) return false; else if(n==1) return true; int temp=n; int count=0; ... 阅读全文
posted @ 2016-04-02 10:34 阿怪123 阅读(150) 评论(0) 推荐(0)