[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...
[LeetCode] Intersection of Two Linked Lists
Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: &nbs...
[LeetCode] Find Peak Element
Find Peak ElementA 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 multi...
[LeetCode] Excel Sheet Column Title
Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2&n...
[LeetCode] Majority Element
Majority ElementGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty ...
[LeetCode] Factorial Trailing Zeroes
Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.解题思路:n!=2^x*3^y*5^z...,注意到一个2和一个5贡献一...
[LeetCode] Excel Sheet Column Number
Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A...
[LeetCode] Repeated DNA Sequences
Repeated DNA SequencesAll DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated ...
[LeetCode] Largest Number
Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The ...
[LeetCode] Binary Search Tree Iterator
Binary Search Tree IteratorImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest n...