- 博客(498)
- 资源 (25)
- 收藏
- 关注
原创 leetcode--Subsets
Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,
2015-06-09 10:34:25 514
原创 leetcode--Combinations
Given two integers n and k, return all possible combinations ofk numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
2015-06-09 00:30:13 574
原创 leetcode--Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0,
2015-06-08 23:51:41 821
原创 leetcode--Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each
2015-06-08 22:58:09 514
原创 leetcode--Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(mn) s
2015-06-08 15:47:54 658
原创 leetcode--Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did you co
2015-06-08 13:19:37 509
原创 leetcode--Rectangle Area
Find the total area covered by two rectilinear rectangles in a2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the total a
2015-06-08 12:59:01 639
原创 leetcode--Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.public class Solution { public int mySqrt(int x) { double pre = 999; double next = 0; while(Math.abs(pre-next)>=0.00001){
2015-06-08 11:16:57 469
原创 leetcode--Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right whichminimizes the sum of all numbers along its path.Note: You can only move either down or right at
2015-06-08 10:59:48 630
原创 leetcode--Unique Paths II
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.
2015-06-08 10:32:59 745
原创 leetcode--Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo
2015-06-08 09:32:12 894
原创 leetcode--Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL./** * Definition for singly-linked lis
2015-06-08 09:20:57 572
原创 leetcode--Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""312""
2015-06-08 01:35:13 495
原创 leetcode--Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 ton2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [
2015-06-07 17:13:52 589
原创 leetcode--Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if
2015-06-07 17:03:57 569
原创 leetcode--Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You
2015-06-07 16:00:17 656
原创 leetcode--Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] has
2015-06-06 16:28:53 704
原创 leetcode--Pow(x, n)
Implement pow(x, n).public class Solution { public double myPow(double x, int n) { return Math.pow(x, n); }}
2015-06-06 16:17:24 520
原创 leetcode--Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.public class Solution { public List anagrams(String[] strs) { List res =
2015-06-06 16:10:19 527
原创 leetcode--Rotate Image
ou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?public class Solution { public void rotate(int[][] mat
2015-06-06 15:55:21 538
原创 leetcode--Permutations
Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1],[3,1,2], and [3,2,1].public class Solutio
2015-06-06 15:28:52 513
原创 leetcode--Contains Duplicate II
Given an array of integers and an integer k, find out whether there there are two distinct indicesi and j in the array such that nums[i] = nums[j] and the difference betweeni and j is at most k.pu
2015-06-06 15:27:55 912
原创 leetcode--Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is
2015-06-06 14:55:35 934
原创 leetcode--Reverse Linked List
Reverse a singly linked list./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public class Soluti
2015-06-06 14:52:00 488
原创 leetcode--Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alw
2015-06-06 14:48:26 481
原创 leetcode--Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB public clas
2015-06-06 14:36:35 481
原创 leetcode--Compare Version Numbers
Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and cont
2015-06-06 14:21:37 480
原创 leetcode--Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: a1 → a2 ↘
2015-06-06 00:19:14 489
原创 leetcode--Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2015-06-06 00:12:24 478
原创 leetcode--Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pa
2015-06-06 00:03:39 519
原创 leetcode--Pascal's Triangle II
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?public class Solut
2015-06-05 17:11:02 478
原创 leetcode--Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]public class Solution { p
2015-06-05 17:03:22 478
原创 leetcode--Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum
2015-06-05 16:49:02 576
原创 leetcode--Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node./** * Definition for a binary tree no
2015-06-05 16:41:00 562
原创 leetcode--Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofevery node never differ
2015-06-05 16:34:10 610
原创 leetcode--Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7},
2015-06-05 16:27:51 510
原创 leetcode--Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for a binary tree no
2015-06-05 16:24:33 441
原创 leetcode--Binary Tree Level Order Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution {
2015-06-05 16:21:02 518
原创 leetcode--Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following
2015-06-05 15:38:39 559
原创 leetcode--Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Definit
2015-06-05 15:26:59 582
SuperLoadingProgress
2015-12-12
android粒子爆炸
2015-12-04
粒子爆炸特效
2015-12-04
雷达图(蜘蛛网图)
2015-12-03
制作粒子爆炸特效
2015-12-02
模仿手机QQ红点消除功能
2015-11-18
NineoldAndroids
2015-11-14
ListView的多选模式
2015-11-12
TextView自适应
2015-11-11
通用Adapter
2015-11-07
Volley加载本地图片
2015-11-03
接收广播的最高优先级
2015-10-29
CircleIndicator
2015-08-22
SVGPathView
2015-08-17
EventBus代码
2015-08-11
VerticalScrollView
2015-08-09
PullScrollView
2015-07-30
DrawerArrowDrawable
2015-06-02
CircularProgressButton
2015-05-30
xlistview代码
2015-05-25
datepicker
2015-05-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人