摘要: problems:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the a... 阅读全文
posted @ 2015-06-05 09:56 尾巴草 阅读(149) 评论(0) 推荐(0) 编辑
摘要: problem:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the... 阅读全文
posted @ 2015-06-04 17:40 尾巴草 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Problems: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your func... 阅读全文
posted @ 2015-06-04 10:32 尾巴草 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Prob;lem: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 do... 阅读全文
posted @ 2015-06-04 10:01 尾巴草 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Problems:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra ... 阅读全文
posted @ 2015-06-04 09:32 尾巴草 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 基本思路:把 int 转换成string 借用stringstream 时间复杂度O(n) 1 class Solution { 2 public: 3 public: 4 bool isPalindrome(int x) { 5 6 stringstream ss; ... 阅读全文
posted @ 2015-06-03 21:46 尾巴草 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 问题描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t... 阅读全文
posted @ 2015-06-03 20:29 尾巴草 阅读(132) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2015-06-02 09:53 尾巴草 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1、单例模式: 单例模式是一种常用的软件设计模式。在它的核心结构中只包含一个被称为单例类的特殊类。通过单例模式可以保证系统中一个类只有一个实例而且该实例易于外界访问,从而方便对实例个数的控制并节约系统资源。如果希望在系统中某个类的对象只能存在一个,单例模式是最好的解决方案。2、单例模式优势: 由... 阅读全文
posted @ 2015-05-08 22:01 尾巴草 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.cnblogs.com/shaweng/archive/2012/07/03/2575302.html三个循环提供两个关于Activity的生命周期模型图示帮助理解: 图1 图2从图2所示的Activity生命周期不难看出,在这个图中包含了两层循环,第一层循环是onPau... 阅读全文
posted @ 2015-05-08 19:15 尾巴草 阅读(171) 评论(0) 推荐(0) 编辑