自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [Algorithm] Chapter 8_8.3

[Algorithm] Chapter 8_8.3题目描述解答过程题目描述STINGY SAT is th following problem: given a set of clauses (each a disjunction of literals) and an integer k, find a satisfying assignment in which at most k var

2017-12-31 11:31:14 303

原创 [LeetCode] 111.Minimum Depth of Binary Tree

[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 th

2017-12-27 07:55:04 177

原创 [LeetCode] 167.Two Sum II - Input array is sorted

[LeetCode] 167.Two Sum II - Input array is sorted题目描述解题思路实验代码题目描述Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target nu

2017-12-19 12:31:14 162

原创 [LeetCode] 669.Trim a Binary Search Tree

[LeetCode] 669.Trim a Binary Search Tree题目描述解题思路实验代码题目描述Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L).

2017-12-13 03:08:27 203

原创 [LeetCode] 620.Not Boring Movies

[LeetCode] 620.Not Boring Movies题目描述解题思路实验代码题目描述X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descri

2017-12-08 10:11:22 250

原创 [LeetCode] 500.Keyboard Row

[LeetCode] 500.Keyboard Row题目描述解题思路实验代码题目描述Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below.Example:

2017-12-08 09:38:02 178

原创 [LeetCode] 557.Reverse Words in a String III

[LeetCode] 557.Reverse Words in a String III题目描述解题思路实验代码题目描述Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial

2017-12-07 17:27:27 196 1

原创 [LeetCode] 461.Hamming Distance

[LeetCode] 461.Hamming Distance题目描述解题思路实验代码题目描述The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calcula

2017-12-07 16:53:21 179

原创 [LeetCode] 627.Swap Salary

[LeetCode] 627.Swap Salary题目描述解题思路实验代码题目描述Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) w

2017-12-07 16:29:40 202

原创 [LeetCode] 617.Merge Two Binary Trees

[LeetCode] 617.Merge Two Binary Trees题目描述解题思路实验代码题目描述Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others

2017-12-07 16:20:26 154

原创 [LeetCode] 657.Judge Route Circle

[LeetCode] 657.Judge Route Circle题目描述解题思路实验代码题目描述Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the

2017-12-07 15:44:25 294

原创 [LeetCode] 728.Self Dividing Numbers

[LeetCode] 728.Self Dividing Numbers题目描述解题思路实验代码题目描述A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0,

2017-12-07 15:32:11 429

原创 [LeetCode] 595.Big Countries

[LeetCode] 595.Big Countries题目描述解题思路实验代码题目描述There is a table World name continent area population gdp Afghanistan Asia 652230 25500100 20343000 Albania Europe 28748 28317

2017-12-07 15:06:58 199

原创 [LeetCode] 26.Remove Duplicates from Sorted Array

[LeetCode] 26.Remove Duplicates from Sorted Array题目描述解题思路实验代码题目描述Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not alloca

2017-12-07 14:24:58 148

原创 [LeetCode] 35.Search Insert Position

[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

2017-12-06 09:26:37 161

原创 [LeetCode] 27.Remove Element

[LeetCode] 27.Remove Element题目描述解题思路实验代码题目描述Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must

2017-11-28 00:18:28 152

原创 Golang中gzip过滤器的源码分析与解释

Golang中gzip过滤器的源码分析与解释与上次相同,这次gzip过滤器的源码,依旧是使用LiteIDE中自带的源码阅读功能来解读的。个人感觉在Go语言的学习中这款软件非常方便这次我们对gzip包的源码做个整体分析。下面就一部分一部分来看。引用的包可看到gzip包引用了如下包:package gzipimport ( "compress/flate" "errors" "f

2017-11-22 19:46:46 513

原创 [LeetCode] 9.Palindrome Number

[LeetCode] 9.Palindrome Number题目描述解题思路实验代码题目描述Determine whether an integer is a palindrome. Do this without extra space.解题思路题目很简单:判断一个整数是否为回文数。那么首先要明白一个概念,什么是回文数:设n是一任意自然数。若将n的各位数字反向排列所得自然数n1与n相等,则

2017-11-22 04:41:54 386

原创 Golang中net/http包源码分析与解释

Golang中net/http包源码分析与解释关于Golang语言的源码,我一直是使用LiteIDE中自带的源码阅读功能来解读的。这次对于net/http包的源码阅读与分析也是通过LiteIDE软件来完成的。 打开net/http包的相关源码,可以看出Golang对于http相关的操作有很多很完善的源码支持。比如对于server、client、transfer等等的操作。由于源码数量和功能很多,所

2017-11-15 09:30:49 789

原创 [LeetCode] 1.Two Sum

[LeetCode] 1.Two Sum题目描述解题思路实验代码题目描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one so

2017-11-15 04:37:01 146

原创 [LeetCode] 637.Average of Levels in Binary Tree

[LeetCode] 637.Average of Levels in Binary Tree题目描述解题思路实验代码题目描述Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example: Input:

2017-11-08 15:51:09 173

原创 [LeetCode] 538.Convert BST to Greater Tree

[LeetCode] 538.Convert BST to Greater Tree题目描述解题思路实验代码题目描述Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus

2017-10-28 17:00:06 179

原创 [LeetCode] 453.Minimum Moves to Equal Array Elements

[LeetCode] 453.Minimum Moves to Equal Array Elements题目描述解题思路实验代码题目描述Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a mo

2017-10-20 01:46:13 173

原创 [LeetCode] 448.Find All Numbers Disappeared in an Array

[LeetCode] 448.Find All Numbers Disappeared in an Array题目描述解题思路实验代码题目描述Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all

2017-10-10 18:22:53 241

原创 [LeetCode] 434.Number of Segments in a String

[LeetCode] 434.Number of Segments in a String题目描述解题思路实验代码题目描述Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note tha

2017-10-10 17:39:08 176

原创 [LeetCode] 404.Sum of Left Leaves

[LeetCode] 404.Sum of Left Leaves题目描述解题思路实验代码题目描述Find the sum of all left leaves in a given binary tree.Example:   3   / \  9 20    / \   15 7There are two left leaves in the binary t

2017-10-10 17:20:15 195

原创 [LeetCode] 405.Convert a Number to Hexadecimal

[LeetCode] 405.Convert a Number to Hexadecimal题目描述解题思路实验代码题目描述Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note: 1. All

2017-10-10 14:54:47 163

原创 [LeetCode] 476.Number Complement

[LeetCode] 476.Number Complement题目描述解题思路实验代码题目描述Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note: 1. The given

2017-10-05 16:53:15 193

原创 [LeetCode] 415.Add Strings

[LeetCode] 415.Add Strings题目描述解题思路实验代码题目描述Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note: 1. The length of both num1 and num2 is < 5100.

2017-09-27 03:07:19 217

原创 [LeetCode] 566.Reshape the Matrix

[LeetCode] 566.Reshape the Matrix题目描述解题思路实验代码题目描述In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original dat

2017-09-27 02:34:10 202

原创 [LeetCode] 541.Reverse String II

[LeetCode] 541.Reverse String II题目描述解题思路实验代码题目描述Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there a

2017-09-27 02:19:46 212

原创 [LeetCode] 520.Detect Capital

[LeetCode] 520.Detect Capital题目描述解题思路实验代码题目描述Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of th

2017-09-27 02:02:09 168

原创 [LeetCode] 344.Reverse String

[LeetCode] 344.Reverse String题目描述解题思路实验代码题目描述Write a function that takes a string as input and returns the string reversed. Example: Given s = “hello”, return “olleh”.解题思路这道题很简单,也做过很多类似的练习,就是

2017-09-23 11:11:12 154

原创 [LeetCode] 561.Array Partition I

[LeetCode] 561.Array Partition I题目描述解题思路实验代码题目描述Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of m

2017-09-21 07:51:45 246

原创 [LeetCode] 58.Length of Last Word

[LeetCode] 58.Length of Last Word题目描述解题思路实验代码题目描述Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last wor

2017-09-17 11:02:51 218

原创 [LeetCode] 412.Fizz Buzz

[LeetCode] 412.Fizz Buzz题目描述解题思路实验代码题目描述Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and fo

2017-09-17 03:12:34 317

原创 [LeetCode] 371.Sum of Two Integers

[LeetCode] 371.Sum of Two Integers题目描述解题思路实验代码题目描述Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.解题思路这道题目考察

2017-09-17 02:54:18 221

原创 [LeetCode] 389.Find the Difference

[LeetCode] 389.Find the Difference题目描述解题思路实验代码题目描述Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter a

2017-09-17 02:36:04 172

原创 [LeetCode] 145.Binary Tree Postorder Traversal

[LeetCode] 145.Binary Tree Postorder Traversal题目描述解题思路实验代码题目描述Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2

2017-09-17 02:07:30 235

原创 [LeetCode] 144.Binary Tree Preorder Traversal

[LeetCode] 144.Binary Tree Preorder Traversal题目描述解题思路实验代码题目描述Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2

2017-09-17 01:59:28 177

空空如也

空空如也

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

TA关注的人

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