自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 资源 (2)
  • 收藏
  • 关注

原创 【LeetCode】141. Linked List Cycle

问题Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail ...

2018-12-09 10:38:42 113

原创 【LeetCode】136. Single Number

【LeetCode】136. Single Number 问题思路常规解法基于比特操作的解法知识点比特位操作问题Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a line...

2018-12-09 09:18:12 128

原创 【LeetCode】017.Letter Combinations of a Phone Number

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

2015-07-03 13:10:42 323 1

原创 【LeetCode】016.3Sum Closest

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

2015-07-03 13:07:47 290

原创 【LeetCode】015.3Sum

题目: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 sum of zero.Note:Elements in a tripl

2015-05-20 22:12:55 341

原创 【LeetCode】012.Integer to Roman

题目:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解答:从千位到个位,根据位数不同选择不同的字母,char1,char5,char10分别代表该位表示1,5和10的字母。c为当前位数字(0---9),

2015-05-20 12:25:56 315

原创 【LeetCode】011.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 (i,

2015-05-20 11:30:16 277

原创 【LeetCode】005.Longest Palindromic Substring

题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.解答:典型动态规划

2015-05-19 22:34:35 276

原创 【LeetCode】003.Longest Substring Without Repeating Characters

题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is

2015-05-19 19:29:05 374

原创 【LeetCode】002.Add Two Numbers

题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it

2015-05-19 18:13:56 677

原创 【LeetCode】001.Two Sum

题目: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 two numbers such that they add up to the ta

2015-05-19 17:40:37 304

原创 【LeetCode】206.reverse linked list

题目:Reverse a singly linked list.解答:关键是弄明白next到底指向哪个元素;代码:/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) {

2015-05-11 22:20:58 215

原创 【LeetCode】205.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

2015-05-11 21:35:36 345

原创 【LeetCode】204.Count Primes

题目:Description:Count the number of prime numbers less than a non-negative number, nclick to show more hints.Credits:Special thanks to @mithmatt for adding this problem and creating

2015-05-11 21:00:22 263

原创 【LeetCode】203.Remove Linked List Elements

题目:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5解答:使用2个指针,一个指向当

2015-05-11 12:33:06 260

原创 【LeetCode】202.happy number

题目:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of th

2015-05-11 12:11:41 287

原创 【LeetCode】198.House Robber

题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac

2015-05-11 11:40:19 267

原创 【LeetCode】189.Rotate Array

题目:Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many soluti

2015-05-08 09:14:54 328

原创 【LeetCode】172.Factorial Trailing Zeroes

题目:Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.解答:对n!进行质因数分解n!=2^x * 3^y * 5^z * .....,容易看出,n!尾部零的数量

2015-05-07 18:58:04 264

原创 【LeetCode】171.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 -> 1 B -> 2 C -> 3

2015-05-07 18:33:03 266

原创 【LeetCode】168.Excel Sheet Column Title

题目:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB

2015-05-07 18:10:23 336

原创 【LeetCode】165.Compare Version Numbers

题目:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-emp

2015-04-09 17:57:11 258

原创 【LeetCode】160.Intersection of Two Linked Lists

题目:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-04-09 16:59:57 281

原创 【LeetCode】155.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(

2015-04-09 12:51:54 249

原创 【LeetCode】125.Valid Palindrome

题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" 

2015-04-09 11:46:16 245

原创 【LeetCode】119.Pascal 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?解答:

2015-04-03 09:16:07 248

原创 【LeetCode】118.Pascal's Triangle

题目:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]解答:帕斯卡三角规律:从1开始

2015-04-02 18:44:24 236

原创 【LeetCode】112.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

2015-04-02 18:19:12 257

原创 【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.解答:数深度相关问题用递归方式很好解决,递归公式为

2015-04-02 17:56:48 229

原创 【LeetCode】110.Balanced Binary Tree

题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node ne

2015-04-01 10:29:35 235

原创 【LeetCode】107.Binary Tree Level Order Traversal II

题目:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,

2015-03-31 15:51:11 277

原创 【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.解答:用的土方法,水平遍历,每次装入时带上层级信息

2015-03-31 15:08:29 373

原创 【LeetCode】102.Binary Tree Level Traversal

题目: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,#,#,15,7}, 3 / \ 9

2015-03-31 14:34:41 229

原创 【LeetCode】101.Symmetric Tree

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

2015-03-31 12:24:43 273

原创 【LeetCode】100.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.解答:

2015-03-31 12:06:52 227

原创 【LeetCode】088.Merge Sorted Array

题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional eleme

2015-03-30 16:24:12 223

原创 【LeetCode】083.Remove Duplicates from Sorted List

题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.解答:类似单链表的遍历。需要

2015-03-30 15:48:36 315

原创 【LeetCode】070.Climbing Staris

题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?解答:基础级的递归题,公式为f(n) =

2015-03-30 15:28:41 333

原创 【LeetCode】066.Add Binary

题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".解答:从后往前遍历计算即可,注意进位的情况,尤其是最高位的进位。Tips:Java中String 和 char[]的互相转换:Stri

2015-03-30 14:50:00 243

原创 【LeetCode】066.Plus One

题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解答:考虑进位问题,从

2015-03-27 16:18:40 256

HTML5 从入门到精通

这是一本介绍html5各种标签的入门书籍,精心制作了标签,使用起来非常方便,也便于随时查看各种标签。

2014-12-29

modern_operating_systems_3rd_edition

操作系统领域的经典之作; 手工增加了详细的目录,方便大家查看

2014-10-12

空空如也

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

TA关注的人

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