leetcode
文章平均质量分 56
newbie_ljm
这个作者很懒,什么都没留下…
展开
-
Leetcode 第13题Roman to Integer
题目:Roman to Integer Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 题目含义: 将罗马符号转换为对应数字大小的整型数字 思路: 对于罗马符号I代表的是1;V代表的是5;X代表的是10; L代表的是50;C代表的是10原创 2015-12-08 23:30:10 · 344 阅读 · 0 评论 -
Leetcode 第205题 Isomorphic Strings
题目: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 rep原创 2015-11-29 00:24:11 · 335 阅读 · 0 评论 -
Leetcode 第8题 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 yourself what a原创 2015-11-29 23:57:46 · 244 阅读 · 0 评论 -
Leetcode 第191题 Number of 1 Bits
题目: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 represen原创 2015-11-29 23:47:41 · 292 阅读 · 0 评论 -
Leetcode 第88题 Merge Sorted Array
题目:Merge Sorted Array Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m +原创 2015-12-01 15:30:59 · 321 阅读 · 0 评论 -
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, “()” and “()[]{}原创 2015-12-01 20:21:41 · 384 阅读 · 0 评论 -
Leetcode 第190题 Reverse Bits
题目: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 a原创 2015-12-01 16:30:56 · 256 阅读 · 0 评论 -
Leetcode 第268题Missing Number
题目:Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm原创 2015-12-20 20:58:37 · 342 阅读 · 0 评论 -
Leetcode 第119题 Pascal's Triangle II
题目:Pascal’s 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-12-03 23:38:03 · 198 阅读 · 0 评论 -
Leetcode 第118题 Pascal's Triangle
题目: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] ] Subscribe to s原创 2015-12-03 23:33:06 · 305 阅读 · 0 评论 -
Leetcode 第12题Integer to Roman
题目:Integer to Roman Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999. 题目分析: 题目的含义是将1到3999的数字转换为对应的罗马符号 思路: 根据罗马符号的特点和数字表达的特点,建立一个数字将0到9;10到90;10原创 2015-12-08 23:37:56 · 465 阅读 · 0 评论 -
Leetcode 第228题 Summary Ranges
题目:Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”].Credits: Special thanks to @jianchao.li原创 2015-11-29 00:13:15 · 280 阅读 · 0 评论 -
Leetcode 第66题 Plus One
题目: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-11-29 00:03:36 · 720 阅读 · 0 评论 -
Leetcode 231题Power of Two
Leetcode 231题Power of Two题目 Given an integer, write a function to determine if it is a power of two. 即判断一个数是否是2的次方数 —— [ Power of Two ] 思路如果一个数是2的次方数,那么n用二进制表示的数只有一位上是1,其他位上都是0,例如100000,0010,0原创 2015-11-23 13:18:56 · 286 阅读 · 0 评论 -
Leetcode 204题 Count Primes
题目 :Count PrimesCount the number of prime numbers less than a non-negative number, n.题目分析: 这道题目的意思是写一函数实现找出小于n的数中有多少个质数? 思路: 最小的质数是2,那么所有2的倍数即偶数都不是质数。 第二个质数是3,那么所有3的倍数都不是质数。 第三个质数是5,那么所以5的倍数都不是质数。 以此类推原创 2015-11-24 13:05:41 · 319 阅读 · 0 评论 -
Leetcode 第290题Word Pattern
题目:Word Pattern Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in原创 2015-12-10 23:35:49 · 272 阅读 · 0 评论 -
Leetcode 第2题Add Two Numbers
题目: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 r原创 2015-12-10 23:08:50 · 403 阅读 · 0 评论 -
Leetcode 第6题ZigZag Conversion
题目:ZigZag Conversion 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原创 2015-12-10 23:18:30 · 294 阅读 · 0 评论 -
Leetcode 第125题 Valid Palindrome
题目: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原创 2015-11-25 17:51:26 · 272 阅读 · 0 评论 -
Leetcode 第171题 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 -> 1 B -> 2 C -> 3 ... Z -原创 2015-11-25 19:01:13 · 249 阅读 · 0 评论 -
Leetcode 第232题 Implement Queue using Stacks
题目:Implement Queue using Stacks Implement the following operations of a queue using stacks.* push(x) -- Push element x to the back of queue. * pop() -- Removes the element from in front of queue. * pee原创 2015-11-28 00:10:16 · 278 阅读 · 0 评论 -
Leetcode 第168题 Excel Sheet Column Title
题目: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原创 2015-11-27 14:59:48 · 302 阅读 · 0 评论 -
Leetcode 第225题 Implement Stack using Queues
题目:Implement Stack using Queues Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top elem原创 2015-11-27 23:33:30 · 236 阅读 · 0 评论 -
Leetcode 第278题 First Bad Version
题目:First Bad Version You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is de原创 2015-12-25 22:52:17 · 217 阅读 · 0 评论