随笔分类 -  math

1 2 下一页

[leetcode]Valid Number
摘要:Valid NumberValidate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the ... 阅读全文

posted @ 2014-08-16 00:02 喵星人与汪星人 阅读(765) 评论(0) 推荐(0) 编辑

[leetcode]Sudoku Solver
摘要:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that the... 阅读全文

posted @ 2014-08-09 21:17 喵星人与汪星人 阅读(213) 评论(0) 推荐(0) 编辑

[leetcode]Divide Two Integers
摘要:Divide Two IntegersDivide two integers without using multiplication, division and mod operator.不用* 、/、%来做除法。只能加减了啊亲!算法思路:一个一个加上去必超时,例如dividend = Integ... 阅读全文

posted @ 2014-08-08 18:30 喵星人与汪星人 阅读(315) 评论(0) 推荐(0) 编辑

[leecode]Evaluate Reverse Polish Notation
摘要:Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may ... 阅读全文

posted @ 2014-08-05 10:28 喵星人与汪星人 阅读(113) 评论(0) 推荐(0) 编辑

[leetcode]Add Binary
摘要:Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".算法思路:模拟二进制加法,跟十进制木有区别,将a,b转置(不转置的话,倒着... 阅读全文

posted @ 2014-07-24 21:08 喵星人与汪星人 阅读(310) 评论(0) 推荐(0) 编辑

[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 i... 阅读全文

posted @ 2014-07-23 23:40 喵星人与汪星人 阅读(157) 评论(0) 推荐(0) 编辑

[leetcode]Permutation Sequence
摘要:Permutation SequenceThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the fo... 阅读全文

posted @ 2014-07-23 20:32 喵星人与汪星人 阅读(329) 评论(0) 推荐(0) 编辑

[leetcode]Next Permutation
摘要:Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangemen... 阅读全文

posted @ 2014-07-23 18:41 喵星人与汪星人 阅读(262) 评论(0) 推荐(0) 编辑

[leetcode]PermutationsII
摘要:Permutations IIGiven a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the follow... 阅读全文

posted @ 2014-07-23 17:25 喵星人与汪星人 阅读(287) 评论(0) 推荐(0) 编辑

[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 co... 阅读全文

posted @ 2014-07-23 16:17 喵星人与汪星人 阅读(240) 评论(0) 推荐(0) 编辑

[leetcode]Permutations
摘要:PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3]... 阅读全文

posted @ 2014-07-22 16:26 喵星人与汪星人 阅读(209) 评论(0) 推荐(0) 编辑

[leetcode]Combinations
摘要:CombinationsGiven two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3... 阅读全文

posted @ 2014-07-22 15:40 喵星人与汪星人 阅读(277) 评论(0) 推荐(0) 编辑

[leetcode]Palindrome Number
摘要:Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers b... 阅读全文

posted @ 2014-07-17 23:35 喵星人与汪星人 阅读(213) 评论(0) 推荐(0) 编辑

[leetcode]Reverse Integer
摘要:Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about th... 阅读全文

posted @ 2014-07-17 20:40 喵星人与汪星人 阅读(189) 评论(0) 推荐(0) 编辑

[leetcode]Plus One
摘要:Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant dig... 阅读全文

posted @ 2014-07-17 19:43 喵星人与汪星人 阅读(200) 评论(0) 推荐(0) 编辑

[leetcode]Set Matrix Zeroes
摘要:Set Matrix ZeroesGiven amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight... 阅读全文

posted @ 2014-07-17 16:56 喵星人与汪星人 阅读(199) 评论(0) 推荐(0) 编辑

NSum小结
摘要:本文载自【k sum problem】以及【NSum】有位同僚,对该问题做出了代码的小结,想看吗?戳我戳我。问题陈述:在一个数组,从中找出k个数(每个数不能重复取。数组中同一个值有多个,可以取多个),使得和为零。找出所有这样的组合,要求没有重复项(只要值不同即可,不要求在原数组中的index不同)解... 阅读全文

posted @ 2014-07-13 23:52 喵星人与汪星人 阅读(581) 评论(0) 推荐(0) 编辑

[leetcode]4Sum
摘要:4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum... 阅读全文

posted @ 2014-07-13 22:49 喵星人与汪星人 阅读(543) 评论(0) 推荐(0) 编辑

[leetcode]3Sum Closest
摘要:3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three int... 阅读全文

posted @ 2014-07-13 21:19 喵星人与汪星人 阅读(152) 评论(0) 推荐(0) 编辑

[leetcode]3Sum
摘要:3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El... 阅读全文

posted @ 2014-07-13 20:51 喵星人与汪星人 阅读(578) 评论(0) 推荐(0) 编辑

1 2 下一页