码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
[leetcode] Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
分类:其他好文   时间:2014-07-07 14:48:39    阅读次数:160
[leetcode] Subsets
Given a set of distinct integers, S, return all possible subsets.
分类:其他好文   时间:2014-07-07 14:31:24    阅读次数:164
Leetcode Spiral Matrix
Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],...
分类:其他好文   时间:2014-07-07 14:22:37    阅读次数:210
Interleaving String
Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="...
分类:其他好文   时间:2014-07-07 14:12:24    阅读次数:204
Leetcode Sqrt(x)
参考Babylonian method(x0 越接近S的平方根越好)class Solution {public: int sqrt(double x) { if(x == 0) return 0; double root = x/2, tolerance = 1....
分类:其他好文   时间:2014-07-07 14:08:29    阅读次数:173
leetcode - Merge Two Sorted Lists
题目:Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the ...
分类:其他好文   时间:2014-07-07 14:06:19    阅读次数:221
leetcode - Linked List Cycle II
题目:Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it withou...
分类:其他好文   时间:2014-07-07 13:44:29    阅读次数:281
[LeetCode] Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100". 1 class Solution 2 { 3 public: 4 ...
分类:其他好文   时间:2014-07-03 11:23:54    阅读次数:164
不使用四则运算符计算两个整数的和
这里笔者只写出关键代码:int add(int n,intm){ if(m==0) returnn; ① int sum=n^m; ② int carry=(n&m)<<1; ③ return add(sum,carry); ④} 在分析每步代码之前先看两个例子...
分类:其他好文   时间:2014-06-30 23:50:59    阅读次数:428
Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:其他好文   时间:2014-06-30 21:36:50    阅读次数:292
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!