自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

斗code、年华

停下休息的时候不要忘记别人还在奔跑。

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

原创 【leetcode】【73】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 soluti

2015-11-27 11:39:05 416

原创 【leetcode】Game of Life

一、问题描述According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."Given a b

2015-11-27 11:21:14 443

原创 【leetcode】【104】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.二、问题分析与 Minimum Depth

2015-11-27 10:04:13 334

原创 【leetcode】【111】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.二、问题分析递归解法,判断左右两边子树哪个d

2015-11-27 10:00:02 253

原创 【leetcode】【46】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].二、问

2015-11-26 14:49:36 367

原创 【leetcode】【77】Combinations

一、问题描述Given two integers n and k, return all possible combinations of k 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]

2015-11-26 14:45:38 43648

原创 【leetcode】【74】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 int

2015-11-26 14:32:05 330

原创 【leetcode】【162】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 multipl

2015-11-26 14:22:49 242

原创 【leetcode】【48】Rotate Image

一、问题描述You 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?二、问题分析首先明确题意:将一个n阶方阵顺时针旋转90度。这种类型的题目往

2015-11-24 11:42:51 307

原创 【leetcode】Container With Most Water

一、问题描述Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (

2015-11-24 11:29:36 293

原创 【leetcode】Minimum Path Sum

一、问题描述Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down

2015-11-23 11:40:32 273

原创 【leetcode】Spiral Matrix II

一、问题描述Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8

2015-11-23 11:35:57 323

原创 【leetcode】Kth Smallest Element in a BST

一、问题描述Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.二、问题分析结合BST

2015-11-18 17:35:38 321

原创 【Android学习笔记】Broadcast receiver

一、What is a Broadcast receiver?广播是一种广泛运用的在应用程序之间传输信息的机制 。而 BroadcastReceiver 是对发送出来的广播进行过滤接收并响应的一类组件; 来自普通应用程序,如一个应用程序通知其他应用程序某些数据已经下载完毕。 BroadcastReceiver 自身并不实现图形用户界面,但是当它收到某个通知后, BroadcastRec

2015-11-18 17:17:31 411

转载 【Android学习笔记】App Widget 桌面小插件

App Widget是一种可以被放在其他应用中(如Launcher)并接收周期性更新的应用视图。这些视图在UI上就表现为Widget,并且你可以同App Widget Provider一起发布。对于能够包含其他App Widget的应用程序组件,称为App Widget Host。基本信息要创建一个App Widget,你需要完成以下步骤:lAppWidgetProviderInf

2015-11-18 15:58:08 2429

原创 【leetcode】【22】Generate Parentheses

一、问题描述Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()

2015-11-17 16:53:40 482

原创 【leetcode】【89】Gray Code

一、问题描述The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the

2015-11-17 16:43:15 332

原创 【leetcode】【24】Swap Nodes in Pairs

一、问题描述Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only const

2015-11-13 18:31:40 287

原创 【leetcode】【75】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 t

2015-11-13 18:27:31 364

原创 【leetcode】【62】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 t

2015-11-13 18:19:21 359

原创 【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 duplicat

2015-11-13 18:13:41 289

原创 【leetcode】Convert Sorted Array to Binary Search Tree

一、问题描述Given an array where elements are sorted in ascending order, convert it to a height balanced BST.二、问题分析先复习下什么是二叉搜索树(引自Wikipedia):二叉查找树(Binary Search Tree),也称有序二叉树(ordered binary tree

2015-11-13 17:43:21 287

原创 【Android学习笔记】Android中的进程和线程

一、进程和线程概述如果某个应用程序组件是第一次被启动,且这时应用程序也没有其他组件在运行,则Android系统会为应用程序创建一个包含单个线程的linux进程。默认情况下,同一个应用程序的所有组件都运行在同一个进程和线程里(叫做“main”主线程)。如果组件启动时,已经存在应用程序的进程了(因为应用程序的其它组件已经在运行了),则此组件会在已有的进程和线程中启动运行。不过,可以指定组件运行在其

2015-11-13 17:30:16 405

原创 【Android学习笔记】Intent详解

一、Intent简介Android程序的3个核心组件——Activity、services、广播接收器——是通过intent传递消息的。intent消息对于运行时绑定不同的组件是很方便的,这些组件可以是同一个程序也可以是不同的。一个intent对象,是一个被动的数据结构,它保存了一个操作的抽象描述——或通常是一个广播的实例,一些发生的事情的描述,一个通知。传递intent到不同组件的机制是互不

2015-11-13 17:12:26 407

原创 【Android学习笔记】Android进程间通信方式Messenger

一、什么是Messenger如果你的服务需要与其他进程进行IPC,那么除了AIDL的方式外,有一种更为简单的方式,那就是采用基于Message的Messenger方式。当你需要进行IPC时,使用 Messenger 要比用AIDL实现接口要容易些,因为 Messenger 会把所有调用服务的请求放入一个队列。而纯粹的AIDL接口会把这些请求同时发送给服务,这样服务就必须要能够多线程运行。具

2015-11-13 16:38:00 402

原创 【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 [

2015-11-10 17:44:55 289

原创 【leetcode】【137】Single Number II

1.问题描述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

2015-11-10 16:55:02 300

原创 【Android学习笔记】用于共享数据的Content Provider

一、What is a content provider?Content provider管理android以结构化方式存放的数据。他以相对安全的方式封装数据并且提供简易的处理机制。Content provider提供不同进程间数据交互的标准化接口。当你准备取出content provider中的数据时,你需要获得一个和当前context相关的ContentResolver对象作为客户

2015-11-10 16:42:00 669

原创 【leetcode】【35】Search Insert Position

一、问题描述Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates i

2015-11-06 19:43:52 316

原创 【leetcode】【96】Unique Binary Search Trees

一、问题描述Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2

2015-11-06 19:25:28 321

原创 【Android学习笔记】偷摸持久运行的Service

一、What is a service ?Service作为Android的四大组件之一,往往执行一些后台的耗时操作,比如网络下载上传、媒体播放、IO操作、与content provider交互等等。Service可以分为两大类,其一:开启服务之后即自己运行自己的,往往没有返回结果,不需要与activity交互,这类服务叫做started;其二:需要与activity交互,形成一个C/S的交互

2015-11-06 19:14:42 648

原创 【leetcode】Missing Number

1、问题描述Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your alg

2015-11-05 18:57:03 315

原创 【leetcode】Populating Next Right Pointers in Each Node

一、问题描述Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next

2015-11-05 18:46:55 308

原创 【Android学习笔记】Activity的小弟--Fragment以及异步加载数据的Loader

一、What is a fragment?首先,fragment总是被嵌入到一个activity中,你可以把它看做是activity中的一个模块,也是用来呈现数据的,但它不需要在manifest中配置,因此可以看做一个轻量级的activity。它有着自己的生命周期,但又依赖与attach的activity。Fragment的出现是为了解决大屏适配的问题,但现在你可以利用fragment来实现更

2015-11-05 18:29:32 2507

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

2015-11-04 18:09:55 407

原创 【leetcode】【141】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?二、问题分析典型的two points问题,通过设置快慢指针,如果有环,那么快指针总会追上慢指针;如果不存在环,那么快指针会先指向nul

2015-11-04 17:48:17 304

原创 【Android学习笔记】Activity--侃天诌地

一、What is a activity?Activity作为Android的四大组件(activity、service、content provider、broadcast receiver)之一,是我们最常打交道的。Activity为用户提供了一个用来交互的界面(其中可以包含很多组件),是app与用户交流的窗口,比如打电话、拍照等等。通常情况下,它会填满整个屏幕,当然你可以通过manife

2015-11-04 17:38:17 434

原创 【Android学习笔记】Android概述与开发环境搭建

一、Android概述   2003 年 10 月,Andy Rubin 等人一起创办了 Android 公司。2005 年 8 月谷歌收购了这家仅仅成立了 22 个月的公司,并让 Andy Rubin继续负责 Android 项目。在经过了数年的研发之后,谷歌终于在2008 年推出了 Android 系统的第一个版本。到目前为止,已经发布了12

2015-11-04 15:17:05 494

空空如也

空空如也

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

TA关注的人

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