- 博客(13)
- 收藏
- 关注
原创 【leetcode】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 yourself what are the possible input cases.
2015-05-04 20:18:11 305
原创 【leetcode】Isomorphic Strings
Isomorphic StringsGiven 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 mu
2015-04-30 16:22:55 408
转载 [LeetCode] Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2015-04-30 14:09:24 305
原创 【leetcode】Compare Version Numbers
Compare Version NumbersCompare 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
2015-04-30 13:13:59 315
原创 【leetcode】Happy Numbers
Happy NumberWrite 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
2015-04-30 12:09:01 342
原创 【leetcode】excel
Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 分析:可以当作是进制转换
2015-04-28 23:16:50 336
原创 【leetcode】Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as0011100101
2015-04-28 17:26:53 272
原创 【leetcode】Number of 1 Bits
题目:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation
2015-04-28 16:17:24 312
转载 【leetcode】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 adjace
2015-04-28 16:01:17 355
原创 【leetcode】Count Primes
Description:Count the number of prime numbers less than a non-negative number, nReferences:How Many Primes Are There?Sieve of Eratosthenes分析:一开始觉得不难,遍历一遍比n小的整数,判断某个数是不是合数
2015-04-28 15:06:44 255
原创 【leetcode】7—reverse integer
Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321思路:先判断正负,然后计算位数,最后通过取商和余数,进行转换。class Solution
2015-04-28 12:58:52 269
原创 【leetcode】20—valid parentheses
Valid Parentheses Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "(
2015-04-28 12:51:09 329
原创 【leetcode】6—Zigzag
题目:The 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 legibility)P A H NA
2015-04-28 12:39:40 280
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人