[LeetCode] Valid Parentheses
Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the inpu...
[LeetCode] 3Sum Closest
3Sum ClosestGiven 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...
[LeetCode] Remove Nth Node From End of List
Remove Nth Node From End of ListGiven a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->...
[LeetCode] 4Sum
4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = targ...
[LeetCode] 3Sum
3SumGiven 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...
[LeetCode] Roman to Integer
Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路:罗马数字转化成数字。一种方法是映射法,每一位(阿拉伯数字)的字符到阿拉伯数字的映射。如下所示:class Solution {...
[LeetCode] Container With Most Water
Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such tha...
[LeetCode] Integer to Roman
Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解题思路:数字转罗马字符。并不是非常复杂,罗马字符的表示如维基百科所述http://zh.wikipedia.org/wiki/%E7%BD%97%E9%A...
[LeetCode] Longest Palindromic Substring
Longest Palindromic SubstringGiven 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...
[LeetCode] Bitwise AND of Numbers Range
Bitwise AND of Numbers RangeGiven a range [m, n] where 0
[LeetCode] Reverse Integer
Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321解题思路:这道题比较简单,需要注意的就是要考虑int类型翻转之后,可能会溢出,若溢出,则返回0。先用一个long long类型来存储结果,然后转化成int类型,若数值不变,...
[LeetCode] ZigZag Conversion
ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better le...
[LeetCode] String to Integer (atoi)
String to Integer (atoi)Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask your...
[LeetCode] Palindrome Number
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.解题思路:思路比较简单,将原来的数求逆数。若逆数与原数相等,返回true,否则,返回false。弄清楚,负数能否回文?若溢出咋办?这里总结一下,若遇到整数的逆转,或者字符转化为整数,就需要考虑是否溢出的问题。解决办法就...
[LeetCode] Longest Substring Without Repeating Characters
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for &q...
[LeetCode] Add Two Numbers
Add Two NumbersYou 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 retu...
[LeetCode] Evaluate Reverse Polish Notation
Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or ano...
c#爬取Silverlight网页 2
此前的一篇文章:C#爬取Silverlight网页,描述了如何爬取加密的Silverlight网页,并以北京空气质量官网的破解进行了说明。按此办法,我想继续破解由中山大学先进技术研究院开发的一系列的Silverlight网站,譬如福建省空气质量实时发布系统,却一无所获。关键在于找到密钥和盐值非常难。有时候reflector并不能工作。其实我犯了一个错误,被此前的破解思路给羁绊了。下面我们以福建省空...
[LeetCode] Reverse Words in a String
Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programme...
[LeetCode] Maximum Product Subarray
Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray...