自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(55)
  • 资源 (1)
  • 收藏
  • 关注

转载 165. Compare Version Numbers

题目:Compare 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 strings are non-emp

2016-06-30 16:35:06 288

转载 38. Count and Say

题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is rea

2016-06-30 16:04:25 263

转载 14. Longest Common Prefix

题目:Write a function to find the longest common prefix string amongst an array of strings.题意:写一个功能找到字符串数组中最长的公共子串;思路:将字符串数组中的每一个元素依次与后面的字符串对应的元素进行对比,如果相同就比较下一个,如果不相同就返回公共子串,如果子串长度超过

2016-06-30 14:57:13 284

转载 6. 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 H NA

2016-06-30 14:09:08 196

转载 20. 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 "()[]{}" are

2016-06-28 15:57:11 239

转载 125. 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 a car" 

2016-06-28 15:28:23 211

转载 28. Implement strStr()

题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题意:实现strStr()函数功能,用于判断字符串needle是否是haystack的子串。如果是,则该函数返回n

2016-06-28 14:32:46 311

转载 344. Reverse String

题目:Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".题意:写一个程序完成将输入的一个字符串反转之后返回;思路:定义两个下标le

2016-06-28 13:47:19 219

转载 345. Reverse Vowels of a String

题目:Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede"

2016-06-28 13:33:13 234

转载 69. Sqrt(x)

题目:Implement int sqrt(int x).Compute and return the square root of x.题意:实现int sqrt(int x)函数。计算并返回x的平方根。思路:二分法

2016-06-28 11:31:04 227

转载 60. Permutation Sequence

题目:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""21

2016-06-27 11:06:22 237

转载 50. Pow(x, n)

题目:Implement pow(x, n).题意:实现pow(x, n)函数;思路一:最容易想到的方法就是递归调用方法求n个x的乘积,注意考虑n的正负号,时间复杂度为O(n);代码:Runtime Error 因为时间复杂度是O(n)。对于较大的n这是不可接受的。class Solution {public:    double myP

2016-06-26 15:49:30 513

转载 365. Water and Jug Problem

题目:You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly zlitres using the

2016-06-26 14:53:42 1182

转载 43. Multiply Strings

题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note:The numbers can be arbitrarily large and are non-negative.Converting the input string

2016-06-26 14:01:52 234

转载 29. Divide Two Integers

题目:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.题意:不使用乘除法和取模运算来完成两个整数相除,如果溢出,则返回MAX_INT。

2016-06-25 12:05:04 256

转载 313. Super Ugly Number

题目:Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4,

2016-06-25 11:28:33 244

转载 264. Ugly Number II

题目:Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of t

2016-06-21 22:18:19 229

转载 343. Integer Break

题目:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n

2016-06-21 21:50:58 257

转载 279. Perfect Squares

题目:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4;

2016-06-18 17:04:29 310

转载 12. 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范围内。思路一:罗马数字规则:1, 罗马数字共有7个,

2016-06-18 16:04:12 267

转载 231. Power of Two

题目:Given an integer, write a function to determine if it is a power of two.题意:给定一个整数,写一个程序检测该整数是否是2的幂。思路一:最直接的方法就是不停地除以2,看最后的余数是否为1,要注意考虑输入是负数和0的情况。代码:递归版:8msclass Solution {

2016-06-18 15:59:15 220

转载 172. Factorial Trailing Zeroes

题目:Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.题意:给定一个整数n,返回n!(n的阶乘)数字中的后缀0的个数。note:你的解法应该满足对数时间复杂度。

2016-06-18 14:44:46 281

转载 263. Ugly Number

题目:Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not

2016-06-18 13:28:13 203

转载 258. Add Digits

题目:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2

2016-06-18 12:42:14 267

转载 8. 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

2016-06-18 10:49:24 249

转载 326. Power of Three

题目:Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?题意:给定一个整数,写一个程序检测该整数是否是3的幂。思路一:转载:http

2016-06-18 10:06:58 266

转载 13. Roman to Integer

题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题意:给定一个罗马数字,将其转换为整数,输入的范围在1到3999之间。思路:From: http://blog.unieagle.net/

2016-06-17 11:21:41 295

转载 9. Palindrome Number

题目:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to

2016-06-17 10:42:51 229

转载 223. Rectangle Area

题目:Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that

2016-06-17 09:52:24 223

转载 171. Excel Sheet Column Number

题目:Related 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

2016-06-17 09:38:03 316

转载 168. 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 28 -> AB

2016-06-16 22:28:34 304

转载 7. Reverse Integer

题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 题意:反向整数的位数。思路:将整数由低位到高位取出,再构成整数,用一个long long类型的整数存储转换之后的值来存储转换之后过大的值,之后对转换后的值进行判断是否溢出

2016-06-16 09:18:07 178

转载 86. Partition List

题目:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes i

2016-06-15 11:26:59 266

转载 143. Reorder List

题目:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reord

2016-06-13 16:04:40 193

转载 82. Remove Duplicates from Sorted List II

题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinct numbers from the original list. For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given

2016-06-13 14:50:28 395

转载 61. Rotate List

题目:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.题意:给定一个链表,将该链表从右边第k个位置

2016-06-11 18:58:22 175

转载 148. Sort List

题目:Sort a linked list in O(n log n) time using constant space complexity.题意:使用常数空间的空间复杂度以及O(n log n)时间复杂度的算法排序链表。思路:转载:http://blog.csdn.net/jiadebin890724/article/details/21334059

2016-06-11 17:43:29 218

转载 147. Insertion Sort List

题目:Sort a linked list using insertion sort.题意:使用插入排序排列链表思路:按照插入排序的算法,对链表进行轮询,将当前链表节点值与链表之前的部分进行对比,找到合适的位置进行插入。代码:24ms/** * Definition for singly-linked list. * struct ListN

2016-06-11 15:46:57 197

转载 328. Odd Even Linked List

题目:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to

2016-06-11 14:48:00 208

转载 142. Linked List Cycle II

题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra spa

2016-06-10 14:18:04 211

hc6800v32原理图

hc6800v32原理图

2013-09-21

空空如也

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

TA关注的人

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