- 博客(115)
- 资源 (25)
- 收藏
- 关注
原创 leetcode--Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].分类:二叉树题意:后续遍历二叉树解
2015-06-30 16:00:42 846
原创 volley源码解析(七)--最终目的之Response<T>
在上篇文章中,我们最终通过网络,获取到了HttpResponse对象HttpResponse是android包里面的一个类,然后为了更高的扩展性,我们在BasicNetwork类里面看到,Volley将其包装成一个Volley自己的对象NetworkResponse另外,在BasicNetwork类中我们也注意到,对HttpResponse包装成NetworkResponse的过程中,使用
2015-06-24 00:30:59 3122 1
原创 volley源码解析(六)--HurlStack与HttpClientStack之争
Volley中网络加载有两种方式,分别是HurlStack与HttpClientStack,我们来看Volley.java中的一段代码if (stack == null) {//如果没有限定stack if (Build.VERSION.SDK_INT >= 9) {//adk版本在9或者以上 stack = new HurlStack(
2015-06-23 22:16:29 3234 1
原创 leetcode--Populating Next Right Pointers in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr
2015-06-23 00:18:38 871
原创 leetcode--Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.N
2015-06-21 12:39:58 569
原创 leetcode--Implement Stack using Queues
mplement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return wheth
2015-06-21 11:43:47 537
原创 leetcode--Combination Sum III
Find all possible combinations of k numbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Ensure that numbers wit
2015-06-21 11:24:51 580
原创 leetcode--House Robber II
Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time
2015-06-21 09:54:11 563
原创 leetcode--Add and Search Word - Data structure design
Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular expression string containing only letter
2015-06-20 23:02:30 650
原创 leetcode--Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the array [2,3,1
2015-06-20 21:26:40 824
原创 leetcode--Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.class TrieNode { // Initialize your data structure here.
2015-06-20 20:51:00 690
原创 leetcode--Bitwise AND of Numbers Range
Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.public class Solution { public int rangeBitwiseAnd(int m, int n) { int i = 0; while(n!=m){
2015-06-20 19:29:22 602
原创 leetcode--Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume
2015-06-20 17:03:37 570
原创 leetcode--Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1
2015-06-20 16:41:08 871
原创 leetcode--Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is9534330.Note: The result may be very
2015-06-20 16:08:17 574
原创 leetcode--Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and
2015-06-20 15:02:08 940
原创 leetcode--Fraction to Recurring Decimal
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For
2015-06-20 14:52:40 494
原创 leetcode--Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that
2015-06-20 13:53:56 597
原创 leetcode--Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public String intToRoman(int num) { int[] radix = new in
2015-06-20 13:44:50 553
原创 leetcode--Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public int romanToInt(String s) { int res = 0; for(int i=0;i
2015-06-20 13:32:59 526
原创 leetcode--Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the arra
2015-06-20 13:13:09 555
原创 剑指offer--旋转数组的最小数字
把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。import java.util.ArrayList;public class Solution { public int minNumberInRotateArray(int
2015-06-20 13:09:38 1280
原创 leetcode--Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest pr
2015-06-20 13:02:50 595
原创 leetcode--Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place in O(1
2015-06-19 23:37:13 538
原创 leetcode--Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",
2015-06-19 23:04:05 495
原创 leetcode--Sort List
Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x)
2015-06-19 18:34:05 454
原创 leetcode--Insertion Sort List
Sort a linked list using insertion sort./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public c
2015-06-19 18:30:12 466
原创 leetcode--Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3]./** * Definition for a binary tre
2015-06-19 18:15:44 769
原创 leetcode--Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to {1,4
2015-06-19 18:10:51 460
原创 leetcode--Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * cl
2015-06-19 17:40:53 462
原创 leetcode--Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * class ListNode { * int val; * Lis
2015-06-19 17:36:53 488
原创 leetcode--Word Break
Given a string s and a dictionary of words dict, determine ifs can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet",
2015-06-19 17:22:40 762
原创 leetcode--Single Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using
2015-06-19 16:49:37 479
原创 leetcode--Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra
2015-06-19 14:46:11 654
原创 leetcode--Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each
2015-06-19 13:47:01 451
原创 leetcode--Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","b"],
2015-06-18 23:49:37 509
原创 leetcode--Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O XX X O
2015-06-16 22:44:25 636
原创 leetcode--Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number123.Find the total sum
2015-06-16 21:14:09 874
原创 leetcode--Word Ladder
Given two words (beginWord and endWord), and a dictionary, find the length of shortest transformation sequence frombeginWord to endWord, such that:Only one letter can be changed at a timeEach in
2015-06-16 20:39:25 603
原创 leetcode--Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one
2015-06-16 19:53:06 508
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关注的人