自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 资源 (6)
  • 收藏
  • 关注

原创 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 the

2016-02-29 09:42:08 522

原创 LeetCode题解:First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the

2016-02-29 09:31:00 427

原创 LeetCode题解:Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example: Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1 sumRange(2, 5) -> -1 sumRange(0, 5

2016-02-28 15:17:37 389

原创 LeetCode题解:Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:1 / \ 2 3 \ 5 All root-to-leaf paths are:[“1->2->5”, “1->3”]题意:给定二叉树,返回所有路径思路:DFS代码:/** *

2016-02-28 15:03:06 332

原创 LeetCode题解:Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5题意:移除链表中所有给定值的结点思路:……代码:/** * Definition f

2016-02-28 15:00:35 306

原创 LeetCode题解:Word Pattern

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Examples:

2016-02-28 14:56:50 539

原创 LeetCode题解:Bulls and Cows

You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that

2016-02-28 14:47:11 596

原创 LeetCode题解:Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another chara

2016-02-28 11:05:57 407

原创 LeetCode题解:Reverse Bits

Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110

2016-02-28 10:44:42 414

原创 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 = 2

2016-02-28 10:30:28 350

原创 LeetCode题解:Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integ

2016-02-28 10:13:40 394

原创 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?题意:给定k,返回Pascal 三角形的第k行,要

2016-02-28 10:08:13 584

原创 LeetCode题解:Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).题意:层序遍历思路:……代码:/** * Definition for a binary tree node. * public class TreeNode {

2016-02-28 10:05:56 349

原创 LeetCode题解:Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn’t matter what you leave beyond the new length.题意:给定一个数组与

2016-02-28 09:55:07 437

原创 LeetCode题解:Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题意:将两个有序链表合并得到一个新的有序链表思路:……代码:/** * Definition for singly-l

2016-02-28 09:26:18 665

原创 LeetCode题解:Power of Three

Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?题意 :给定整数,判断是否为3的幂解题思路:纯计算……代码:public boolean isPowerOfThree(int

2016-02-28 09:19:43 387

原创 LeetCode题解:Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it in

2016-02-28 09:11:30 354

原创 LeetCode题解:Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in plac

2016-02-27 20:22:20 556

原创 LeetCode题解:Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000

2016-02-27 20:17:06 477

原创 LeetCode题解:Reverse Linked List

Reverse a singly linked list.题意:反转单链表解题思路:一直取下一个节点作为头部代码:public class Solution { public ListNode reverseList(ListNode head) { return reverseListInt(head,null); } public ListNode reve

2016-02-27 20:12:07 360

原创 LeetCode题解:Excel Sheet Column Number

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 题意:给

2016-02-27 20:06:59 409

原创 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.题意:判断两棵树是否相同解题思路:可以

2016-02-27 20:02:09 263

原创 LeetCode题解:Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct

2016-02-27 20:00:24 351

原创 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.题意:给定二叉树,找出最大深度思路:DFSpublic class Solution

2016-02-27 19:52:00 302

原创 LeetCode题解:Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2016-02-27 19:42:48 703

原创 LeetCode题解:Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?题意:给定链表,返回环的起点;

2016-02-10 15:56:01 303

原创 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?题意:给定链表,判断是否为环。要求O(1)空间思路:快慢指针,如果存在环,快指针必然遇到慢指针代码:/** * Definition for singly-linked list

2016-02-10 15:22:17 273

原创 LeetCode题解:Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given s = “leetcode”, dict = [“leet”, “co

2016-02-09 17:41:01 539

原创 LeetCode题解:Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题意:给定一个链表包含一个随机的指针,指针可能指向链表中任意一个元素或者指向n

2016-02-09 17:36:31 342

原创 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 ex

2016-02-09 17:30:43 432

原创 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 me

2016-02-09 16:39:55 1268

原创 LeetCode题解:Candy

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least one candy.

2016-02-09 16:37:03 454

原创 LeetCode题解:Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its nex

2016-02-09 14:04:24 406

原创 LeetCode题解:Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization: Nodes are labeled uniquely.We use # as a separator for each node, an

2016-02-09 13:47:23 408

原创 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”], [“

2016-02-09 13:39:43 452

原创 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 X X O O X X X O X X O

2016-02-09 13:33:32 441

原创 LeetCode题解:Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is [1, 2, 3, 4].

2016-02-09 13:29:45 338

原创 ShapableLoadingView 酷炫到爆炸的进度条

项目地址ShapableLoadingViewIntroShapableLoadingView 是高度可配置且可自定义的进度条控件,你可以设置任何可通过 Path 绘制的图形作为动画元素。English VersionPreview使用1. 添加依赖dependencies { ... compile 'com.github.chaossss:ShapableLoadingView:

2016-02-06 09:59:22 663

原创 MVP架构开发的鼠绘漫画客户端

IShuHui利用鼠绘的接口,参考 MVP 架构开发的鼠绘漫画 App。APK 下载Snapshots 参考/引用MousePaint 最初灵感来源于此项目,但项目本身代码质量不高,很多部分很混乱,于是重构大部分代码,用MVP架构重新开发,完成本项目。在此感谢cjj的分享GlideokhttpButterKnifeandroid-PullRefreshLayoutCircleIndi

2016-02-06 09:51:14 608

图片异步加载

博客 http://blog.csdn.net/u012403246 中剖析Android消息传递机制的Demo

2015-05-24

View事件传递机制Demo源码

View事件传递机制Demo源码,欢迎大家学习

2015-04-17

Android自定义控件:可重用的自定义Dialog类

Android自定义控件:可重用的自定义Dialog类

2015-03-20

Android自定义控件:Android L控件点击水波纹的实现(源码 + Demo)

Android自定义控件:Android L控件点击水波纹的实现(源码 + Demo)

2015-01-18

(源码)Android自定义进度条的4种实现方法

(源码)Android自定义进度条的4种实现方法

2014-11-25

(源码)老版优酷的三级菜单

Android自定义控件:老版优酷的三级菜单(效果图 + Demo)

2014-11-20

空空如也

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

TA关注的人

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