自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(82)
  • 收藏
  • 关注

原创 【leetcode】Tree——Symmetric Tree(101)

题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3

2016-09-17 11:42:15 329

原创 【leetcode】Tree——Binary Tree Level Order Traversal(102)

题目:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7],    3   / \  9

2016-08-21 16:54:21 301

原创 【leetcode】String——Palindrome Pairs(336)

题目:Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.Example 1:Given

2016-08-14 17:04:46 364

原创 【leetcode】String——Distinct Subsequences(115)

题目:Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be

2016-08-14 11:53:48 252

原创 【leetcode】String——Word Ladder II(126)

题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord toendWord, such that:Only one letter can be changed at a t

2016-08-13 21:37:11 421

原创 【leetcode】String——Interleaving String(97)

题目:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbba

2016-06-09 16:04:24 337

原创 【leetcode】String——Scramble String(87)

题目:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \

2016-06-09 11:22:26 291

原创 【leetcode】String——Substring with Concatenation of All Words(30)

题目:You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in wordsexactly o

2016-05-29 21:12:11 288

原创 【leetcode】String——Edit Distance(72)

题目:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted o

2016-05-28 23:05:51 333

原创 【leetcode】String——Longest Valid Parentheses(32)

题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "

2016-05-24 09:36:53 326

原创 【leetcode】String——Decode Ways(91)

题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the t

2016-05-03 17:45:59 335

原创 【leetcode】String——Restore IP Addresses (93)

题目:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"].

2016-04-28 17:32:04 347

原创 【leetcode】String——Basic Calculator II (227)

题目:Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division

2016-04-28 15:25:01 315

原创 【leetcode】String——Letter Combinations of a Phone Number (17)

题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:D

2016-04-18 16:07:14 324

原创 【leetcode】String——Roman to Integer(13)

题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.简述:基本字符IVXLCDM

2016-04-17 21:49:27 257

原创 【leetcode】String——Count and Say(38)

题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is rea

2016-04-17 12:19:06 293

原创 【数据结构与算法设计】希尔排序

希尔排序( 最坏O(N^2)  )重要概念:增量序列 增量增量hk习惯于取len/2,然后递减hk=hk/2,直到等于1。对于hk排序:下标为hk,hk+1,...,len-1 元素i,i放到i,i-hk, i-2hk...正确的位置上。个人理解:也就是间隔hk排序,最后会进行间隔1排序,也就是全局排序。//默认是升序public void sort(int[]nums){

2016-04-14 15:14:27 470

原创 【笔记】初试Redis

"赶时髦"尝试了一下Redis在配置和运行的过程中遇到了一些小case:ps命令安装redis启动服务后,想通过ps命令查看当前进程状态ps -aux (也可以加上过滤 ps -aux | grep redis)当我使用ps -aux | grep redis的时候,发现有两个进程,原来 grep redis 也算是进程。同样,pa -aux 也是进程。ps命令详解

2016-04-14 11:02:24 329

原创 【leetcode】String——Add Binary(67)

题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".思路:很经典的 "加法进位"问题,判断循环的条件:while(i>=0||j>=0||carry==1)代码:public static St

2016-04-11 15:18:52 271

原创 【笔记】Java中 int进行右移运算

写代码的时候,使用了int>>> 运算(右移一位,高位补0)但是遇到一个很奇怪的现象: int i = 123; int j = i >>>32;  这时候j并不是想象中的0,而是123,数值并没有发生变化。

2016-04-11 14:26:15 1600

原创 【Java】Integer的常量池

笔试的时候遇到一个问题:Integer i1 = 127;Integer i2 = 127;Integer i3 = 128;Integer i4 = 128;System.out.println(i1==i2);System.out.println(i1.equals(i2));System.out.println(i3==i4);System.out.println(i3.e

2016-04-05 09:37:41 1251

原创 【leetcode】Array——3Sum Closest(16)

题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have

2016-03-29 10:58:13 336

原创 【leetcode】Array——4Sum(18)

题目: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 array which gives the sum of target.Note:

2016-03-28 21:28:21 319

原创 【leetcode】Array——Best Time to Buy and Sell Stock I/II/III

Best Time to Buy and Sell Stock题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, b

2016-03-26 15:31:49 312

原创 【leetcode】Array——Combination Sum I/II/III

Combination Sum题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.A solution set is: [7] [2, 2, 3]

2016-03-26 10:42:48 253

原创 【Android安全】初步认识Drozer

首先在手机上安全drozer agent,在电脑上面安全drozer console。然后使用adb设置转发端口:adb forward tcp:31415 tcp:31415然后在手机上打开agent应用程序,并Enable service用电脑的drozer连接手机的agent,进入console模式:drozer console connect (接下来好戏就开始了!)列举已

2016-03-23 21:47:45 550

原创 【leetcode】Array——Construct Binary Tree from Preorder and Inorder Traversal(105)

题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.思路:使用递归。preorder[0]是整个tree的root,在inerder中定位roo

2016-03-21 22:56:43 218

原创 【leetcode】Array——Container With Most Water(11)

题目: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 (i

2016-03-21 21:07:39 262

原创 【leetcode】Array——Find Minimum in Rotated Sorted Array II(154)

题目:前一道题链接:http://blog.csdn.net/u013127687/article/details/50935939Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexit

2016-03-20 13:34:43 209

原创 【leetcode】Array——Find Minimum in Rotated Sorted Array(153)

题目: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 exi

2016-03-20 12:05:17 337

原创 【leetcode】Array——Find Peak Element(162)

题目: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 pea

2016-03-19 22:39:43 223

原创 【leetcode】Array——First Missing Positive(41)

题目:Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses

2016-03-19 21:24:32 198

转载 【leetcode】Array——Find the Duplicate Number(287)

题目:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate n

2016-03-19 16:42:03 457

转载 【笔记】mac配置文件

转自http://blog.sina.com.cn/s/blog_62f189570102vd8a.html1。修改profile文件:(所有用户)#vi /etc/profile加入:export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin保存退出。2。修改.b

2016-03-19 11:41:25 786

原创 【笔记】java打包jar之后运行出现中文乱码

今天调试的时候,在eclipse里面可以正常显示中文,但是把工程打成jar之后,在cmd里面用java -jar 执行的时候,确出现了乱码。初步解决的方法是: java -Dfile.encoding=utf-8 -jar ***.jar这种方法只能解决最后生成的结果中,不会出现中文乱码,但是dos显示的中文仍是乱码。

2016-03-17 17:21:15 13765 2

原创 【leetcode】Array——Insert Interval(57)

题目:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Ex

2016-03-13 21:04:09 342

转载 【leetcode】Array——Largest Rectangle in Histogram(84)

题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.For example,Given heights = [

2016-03-13 13:26:17 286

原创 【leetcode】Array——Contains Duplicate II(219)

题目:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k

2016-03-13 10:16:49 388

原创 【leetcode】Array——Contains Duplicate(217)

题目: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 ele

2016-03-12 22:22:47 302

原创 【leetcode】Array——Jump Game2(45)

题目: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.Your

2016-03-12 21:48:53 311

空空如也

空空如也

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

TA关注的人

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