自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xinglu31的专栏

xinglu的个人博客,好记性不如烂笔头

  • 博客(17)
  • 收藏
  • 关注

原创 Minimum Depth of Binary Tree

/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi...

2014-05-20 11:39:58 524

原创 Longest Common Prefix

public class Solution { public String longestCommonPrefix(String[] strs) { int len = strs.length; if(len == 0){ return ""; } if(len == 1){ return strs[0]; } int length =...

2014-05-20 10:20:19 474

原创 Sum Root to Leaf Numbers

/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi...

2014-05-20 09:42:06 532

原创 Binary Tree Level Order Traversal

/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi...

2014-05-15 20:20:07 506

原创 Longest Consecutive Sequence

public class Solution { public int longestConsecutive(int[] num) { Arrays.sort(num); int count = 1; int res = 1; int tmp = 0 ; int countTmp = 0; for(int i = 1 ; i < num.len...

2014-05-15 20:10:46 485

原创 Plus One

public class Solution { public int[] plusOne(int[] A) { if(A.length >= 1) { int[] B = new int[A.length + 1]; int added = 1; for(int i = A.length - 1 ; i >= 0 ; i--){ i...

2014-05-14 19:31:29 483

原创 Single Number II

public class Solution { public int singleNumber(int[] A) { Arrays.sort(A);// for(int i = 0 ; i < A.length ; i++){// System.out.println(A[i]);// } int...

2014-05-14 13:59:39 512

原创 Remove Duplicates from Sorted Array II

public class Solution { public int removeDuplicates(int[] A) { int count = 0; int tmp = 0; if(A == null || A.length == 0){ return 0; } if(A.leng...

2014-05-12 16:56:30 462

原创 Remove Duplicates from Sorted List

/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */public...

2014-05-12 15:16:20 656

原创 Remove Duplicates from Sorted Array

Remove Duplicates from Sorted Arraypublic class Solution { public int removeDuplicates(int[] A) { boolean isEqual = false; int count = 0; int tmp = 0; if(A == null...

2014-05-12 09:03:53 478

原创 Convert Sorted Array to Binary Search Tree

/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi

2014-05-06 18:59:05 441

原创 Binary Tree Level Order Traversal II

/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { publi...

2014-05-06 18:57:09 700

原创 Length of Last Word

public class Solution { public int lengthOfLastWord(String s) { int res = 0; if(s.length() == 0){ return res; } char[] sArray = s.toCharArray(); ...

2014-05-06 09:02:53 433

原创 Balanced Binary Tree

public class Solution { public boolean isBalanced(TreeNode root) { if(root == null){ return true; } int depth = maxDepth(root.left) - maxDepth(root.right);

2014-05-05 20:03:21 599

原创 Binary Tree Traversal

Binary Tree Preorder Traversal

2014-05-05 19:27:08 444

原创 Maximum Subarray

public class Solution { public int maxSubArray(int[] A) { int res = 0; if(A.length == 0){ return res; } int max = A[0]; for(int i = 0 ; i < A.le

2014-05-04 17:24:38 398

原创 Pow(x, n)

public class Solution { public double pow(double x, int n) { double res = 1; if(n == 0){ return res; }else if(n > 0){ if(n == 1){ re

2014-05-04 16:12:31 478

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除