- 博客(117)
- 收藏
- 关注
转载 [LeetCode]74. Divide Two Integers除法运算
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Subscribeto see which companies asked this question解法1:因为题目限制不能用乘法、除法和...
2015-11-12 17:47:00
92
转载 牛顿迭代法 Newton-Raphson Method
待补充。转载于:https://www.cnblogs.com/aprilcheny/p/4957379.html
2015-11-11 21:14:00
474
转载 [LeetCode]73. Sqrt(x)平方根
Implementint sqrt(int x).Compute and return the square root ofx.Subscribeto see which companies asked this question解法1:使用求正数的平方根的一般二分查找法:class Solution {public: int my...
2015-11-11 21:11:00
122
转载 [LeetCode]72. Basic Calculator基本计算器
Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus sign-,non-negativeintegers and emp...
2015-11-11 10:44:00
129
转载 [LeetCode]71. Missing Number缺失的数
Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]return2.Note:Your algorithm should run...
2015-11-10 09:16:00
101
转载 [LeetCode]70. Ugly Number II第N个丑数
Write a program to find then-th ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For example,1, 2, 3, 4, 5, 6, 8, 9, 10, 12is the sequence of the first...
2015-11-09 16:55:00
97
转载 [LeetCode]69. Recerse Integer旋转整数
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before codi...
2015-11-09 14:52:00
89
转载 [LeetCode]68. Palindrome Number回文数字
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converti...
2015-11-09 13:32:00
95
转载 [LeetCode]67. Number of Digit One1的个数和
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6, because digit 1 occurred in the following...
2015-11-09 10:52:00
70
转载 [LeetCode]66. Factorial Trailing Zeros阶乘的尾零个数
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thanks to@tsfor adding this problem and creating ...
2015-11-09 09:23:00
238
转载 [LeetCode]65. Ugly Number丑数
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For example,6, 8are ugly while14is not ugly sin...
2015-11-08 09:26:00
64
转载 [LeetCode]64. Add Digits数根
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + 8 = 11,1 + 1 = 2. Since2has only on...
2015-11-08 08:17:00
88
转载 统计给定整数的二进制表示中1的个数
转载自网友zdd的博客『算法-求二进制数中1的个数』问题描述任意给定一个32位无符号整数n,求n的二进制表示中1的个数,比如n = 5(0101)时,返回2,n = 15(1111)时,返回4这也是一道比较经典的题目了,相信不少人面试的时候可能遇到过这道题吧,下面介绍了几种方法来实现这道题,相信很多人可能见过下面的算法,但我相信很少有人见到本文中所有的算法。如果您上头...
2015-11-06 20:23:00
378
转载 [LeetCode]63. Power of Two 2的幂次
Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to@jianchao.li.fighterfor adding this problem and creating all test cases.Subscribeto se...
2015-11-06 20:18:00
93
转载 [LeetCode]62. Excel Sheet Column Title Excel列序号
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-06 18:56:00
81
转载 [LeetCode]61. Excel Sheet Column Number Excel列序号
Related to questionExcel 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...
2015-11-06 18:15:00
67
转载 [LeetCode]60. Rectangle Area矩形面积
Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the tot...
2015-11-06 16:45:00
105
转载 [LeetCode]59. H-Index H指数
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition of h-index on Wikipedia: ...
2015-11-06 15:31:00
102
转载 [LeetCode]58. Fraction to Recurring Decimal分数化小数
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses....
2015-11-05 17:29:00
144
转载 [LeetCode]57. Binary Tree Inorder Traversal中序遍历二叉树
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note:Recursive solution...
2015-11-05 10:11:00
76
转载 [LeetCode]56. Group Anagrams变位词分组
Given an array of strings, group anagrams together.For example, given:["eat", "tea", "tan", "ate", "nat", "bat"],Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note:...
2015-11-04 10:02:00
150
转载 [LeetCode]55. Single Number独数
Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complexity. Could you implement it without using...
2015-11-03 10:59:00
78
转载 [LeetCode]54. Count Primes统计素数
Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.解法1:扫描一遍,依次判断每个数是...
2015-11-03 10:09:00
86
转载 [LeetCode]53. Happy Number快乐数
Write 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 sum of the squa...
2015-11-02 15:02:00
96
转载 [LeetCode]52. Bulls and Cows猜数字游戏
You are playing the following Bulls and Cows game with your friend: You write a 4-digit secret number and ask your friend to guess it. Each time your friend guesses a number, you give a hint. The...
2015-11-02 13:45:00
285
转载 [LeetCode]51. Ismorphic 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 replaced with ano...
2015-11-02 11:27:00
71
转载 [LeetCode]50. Valid Anagram有效变位词
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may ...
2015-11-01 10:54:00
83
转载 [LettCode]49. Valid Sudoku有效数独
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'. A partially fille...
2015-11-01 08:53:00
113
转载 [LeetCode]48. 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 str. ...
2015-10-31 09:56:00
116
转载 Ubuntu 14.04中安装Sublime Text 3并使用SublimeClang插件
转载请说明出处:http://blog.csdn.net/cywosp/article/details/32721011 Sublime Text是个跨平台的编辑器,支持Windows、Linux、Mac系统平台,支持各种语言的代码编辑,配合上对应的插件,话上点时间学习,你将会对它 爱不释手,大大的提高你的编码效率。本文将讲解在Ubuntu 14.04系统中安装SublimeT...
2015-10-30 10:02:00
155
转载 [LeetCode]47. Integer to English Words整数的读法
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231- 1.For example,123 -> "One Hundred Twenty Three"12345 -> "Twelve Tho...
2015-10-29 11:11:00
120
转载 [LeetCode]46. Restore IP Addresses复原IP地址
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"]. (Order...
2015-10-28 20:57:00
83
转载 [LeetCode]45. Reverse Words in a String按单词翻转字符串
Given 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 programmers: Try to solve itin-placeinO(1)...
2015-10-28 10:30:00
112
转载 [LeetCode]44. Implement strStr()实现strStr()函数
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02): The signature of the function had been updated...
2015-10-26 20:54:00
79
转载 [LeetCode]43. Integer to Roman整数转罗马数字
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解法:与罗马数字转整数过程相反。例如数字2438,罗马数字表示为MM CD XXX VIII,即是每个分位上的数字分别用当前分位的基数表示即可。因为整数范围在[1,...
2015-10-26 10:43:00
109
转载 [LeetCode]42. Roman to Integer罗马数字转整数
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.罗马数字基本字符共7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。需要注意的是罗马数字中没有“0”,与进位制无关。...
2015-10-26 09:44:00
92
转载 [LeetCode]41. String to Integer(atoi)字符串转整数
Implementatoito 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...
2015-10-25 17:57:00
74
转载 [LeetCode]40. Valid Palinadrome有效回文串
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"isnota p...
2015-10-25 09:57:00
57
转载 [LeetCode]39. Longest Valid Parentheses最长有效括号对
待补充。Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest valid parentheses substring i...
2015-10-24 18:20:00
73
转载 [LeetCode]38. Length of Last Word最后单词长度
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note:A word is ...
2015-10-24 18:16:00
67
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅