自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(216)
  • 收藏
  • 关注

原创 Leetcode#77||

2015-08-19 16:53:07 316

原创 Leetcode#76||Minimum Window Substring

public class Solution { public String minWindow(String s, String t) { String result = ""; if (s == null || t == null || s.length() < t.length()) { return resul

2015-08-19 16:51:15 321

原创 Leetcode#75||Sort Colors

public class Solution { public void sortColors(int[] nums) { if (nums == null || nums.length < 2) { return; } int length = nums.length;

2015-08-19 14:03:30 305

原创 Leetcode#74||Search a 2D Matrix

public class Solution { public boolean searchMatrix(int[][] matrix, int target) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) { return false; }

2015-08-19 07:55:22 313

原创 Leetcode#73||Set Matrix Zeroes

public class Solution { public void setZeroes(int[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) { return; } int row

2015-08-18 18:17:18 423

原创 Leetcode#72||Edit Distance

public class Solution { public int minDistance(String word1, String word2) { int m = word1.length(); int n = word2.length(); int[][] dist = new int[m + 1][n + 1];

2015-08-18 18:05:44 238

原创 Leetcode#71||

2015-08-18 17:50:59 220

原创 Leetcode#70||Climbing Stairs

public class Solution { public int climbStairs(int n) { if (n <= 0) { return 0; } else if (n == 1) { return 1; } int i = 1;

2015-08-18 15:44:09 274

原创 Leetcode#69||Sqrt(x)

public class Solution { public int mySqrt(int x) { if (x < 0) { return -1; } int left = 1; int right = x; while (left <= right

2015-08-18 15:36:59 241

原创 Leetcode#68||

2015-08-18 15:21:50 220

原创 Leetcode#67||Add Binary

public class Solution { public String addBinary(String a, String b) { if (a.length() < b.length()) { String temp = a; a = b; b = temp; }

2015-08-18 15:20:34 256

原创 Leetcode#66||Plus One

public class Solution { public int[] plusOne(int[] digits) { if (digits == null || digits.length == 0) { return digits; } int carry = 1;

2015-08-18 14:54:28 270

原创 Leetcode#65||Valid Number

public class Solution { public boolean isNumber(String s) { int length = s.length(); int i = 0; int e = length - 1; while (i < length && Character

2015-08-18 14:47:35 351

原创 Leetcode#64||Minimum Path Sum

public class Solution { public int minPathSum(int[][] grid) { if (grid == null || grid.length == 0 || grid[0].length == 0) { return -1; } int m = grid.

2015-08-18 11:32:37 262

原创 Leetcode#63||Unique Paths II

public class Solution { public int uniquePathsWithObstacles(int[][] obstacleGrid) { if (obstacleGrid == null || obstacleGrid.length == 0 || obstacleGrid[0].length ==0) { return

2015-08-18 11:23:30 221

原创 Leetcode#62||Unique Paths

public class Solution { public int uniquePaths(int m, int n) { if (m < 1 || n < 1) { return 0; } int[] paths = new int[n]; for (int j

2015-08-18 11:13:34 287

原创 Leetcode#61||Rotate List

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

2015-08-18 11:08:55 286

原创 Leetcode#60||Permutation Sequence

public class Solution { public String getPermutation(int n, int k) { StringBuilder result = new StringBuilder(); List list = new ArrayList(); int factorial = 1;

2015-08-18 10:59:01 315

原创 Leetcode#59||Spiral Matrix II

public class Solution { public int[][] generateMatrix(int n) { int[][] result = new int[n][n]; int t= 0; int cnt = 1; while (t < n / 2) {

2015-08-17 18:14:04 292

原创 Leetcode#58||Length of Last Word

public class Solution { public int lengthOfLastWord(String s) { if (s == null || s.length() == 0) { return 0; } int result = 0; char[]

2015-08-17 15:50:54 252

原创 Leetcode#57||Insert Interval

/** * Definition for an interval. * public class Interval { * int start; * int end; * Interval() { start = 0; end = 0; } * Interval(int s, int e) { start = s; end = e; } * } */

2015-08-17 15:42:29 240

原创 Leetcode#56||Merger Intervals

/** * Definition for an interval. * public class Interval { * int start; * int end; * Interval() { start = 0; end = 0; } * Interval(int s, int e) { start = s; end = e; } * } */

2015-08-17 15:09:16 215

原创 Leetcode#55||Jump Game

public class Solution { public boolean canJump(int[] nums) { if (nums == null || nums.length == 0) { return false; } int maxRange = 0;

2015-08-17 14:51:24 414

原创 Leetcode#54||Spiral Matrix

public class Solution { public List spiralOrder(int[][] matrix) { List result = new ArrayList(); if (matrix == null || matrix.length == 0 || matrix[0] == null) {

2015-08-17 14:46:26 219

原创 Leetcode#53||Maximum Subarray

public class Solution { public int maxSubArray(int[] nums) { if (nums == null || nums.length == 0) { return 0; } int length = nums.length;

2015-08-17 10:21:32 199

原创 Leetcode#52||

2015-08-17 10:15:14 172

原创 Leetcode#51||

2015-08-17 10:14:57 178

原创 Leetcode#50||Pow (x, n)

public class Solution { public double myPow(double x, int n) { if (n < 0) { return 1 / pow(x, -n); } else { return pow(x, n); } }

2015-08-17 10:13:52 260

原创 Leetcode#49||Group Anagrams

public class Solution { public List> groupAnagrams(String[] strs) { List> result = new ArrayList>(); if (strs == null || strs.length == 0) { return result;

2015-08-17 10:04:32 199

原创 Leetcode#48||Rotate Image

public class Solution { public void rotate(int[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) { return; } int length

2015-08-17 09:49:09 206

原创 Leetcode#47||

2015-08-17 09:37:48 240

原创 Leetcode#46||

2015-08-17 09:37:00 167

原创 Leetcode#45||Jump Game II

public class Solution { public int jump(int[] nums) { if (nums == null || nums.length == 0) { return 0; } int left = 0; int right = 0;

2015-08-15 17:37:21 233

原创 Leetcode#44||

2015-08-15 17:03:09 171

原创 Leetcode#43||Multiply Strings

public class Solution { public String multiply(String num1, String num2) { String s1 = new StringBuilder(num1).reverse().toString(); String s2 = new StringBuilder(num2).reverse().t

2015-08-15 17:02:31 237

原创 Leetcode#42||Trapping Rain Water

public class Solution { public int trap(int[] height) { if (height == null || height.length < 3) { return 0; } int result = 0; int maxHeightInd

2015-08-15 09:09:25 207

原创 Leetcode#41||First Missing Positive

public class Solution { public int firstMissingPositive(int[] nums) { if (nums == null || nums.length == 0) { return 1; } int length = nums.length;

2015-08-15 08:57:14 223

原创 Leetcode#40||

2015-08-15 08:21:09 207

原创 Leetcode#39||

2015-08-15 08:20:34 213

原创 Leetocde#38||Count and Say

public class Solution { public String countAndSay(int n) { if (n < 1) { return null; } String result = "1"; int t = n; while (

2015-08-15 08:17:34 198

空空如也

空空如也

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

TA关注的人

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