码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
leetCode 25.Reverse Nodes in k-Group (以k个节点为一组反转链表) 解题思路和方法
Reverse Nodes in k-Group  Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the...
分类:其他好文   时间:2015-07-07 17:04:14    阅读次数:170
LeetCode89:Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray...
分类:其他好文   时间:2015-07-07 16:53:37    阅读次数:108
Reverse Integer - Palindrome Number - 简单模拟
第一个题目是将整数进行反转,这个题实现反转并不难,主要关键点在于如何进行溢出判断。溢出判断再上一篇字符串转整数中已有介绍,本题采用其中的第三种方法,将数字转为字符串,使用字符串比较大小的方法进行比较。代码如下: 1 class Solution { 2 public: 3 int rever...
分类:其他好文   时间:2015-07-07 14:24:19    阅读次数:100
[leedcode 16] 3Sum Closest
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:其他好文   时间:2015-07-07 12:48:06    阅读次数:128
shell相关指令介绍
$#,脚本运行时后跟的参数个数#! /bin/bashcase "$#" in 0) printf "Enter a number: " read n=$REPLY ;; *) n=$1 ;; esacx=$(( (1 + $n) * $n /...
分类:系统相关   时间:2015-07-07 12:26:48    阅读次数:175
[leedcode 16]
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:其他好文   时间:2015-07-07 12:22:55    阅读次数:113
Happy Number
解决问题的思路: 第一步:从上图中,我们可以发现:在闭区间[1,13]内的所有数经过次数有限的迭代后,它们将会变成1或者4,而1是happy number,4不是happy number。进而可以判断出闭区间[1,13]内的所有数的happy性。第二步:下面我做了一个大胆的假设,所有的正数经过可接受的有限次迭代后都将变成1或者4。由于在数学上给出证明所需的时间远远大于用程序验证,所以暂且不进行...
分类:移动开发   时间:2015-07-07 11:11:47    阅读次数:120
leetCode(31):Combination Sum III
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Ensure that numbers wi...
分类:其他好文   时间:2015-07-07 11:07:18    阅读次数:94
类的对象和类的指针
类的对象和类的指针的区别zz如下程序:#include #include using namespace std;class Student{ public: static int number; string name;public: Student() { } void set(string s...
分类:其他好文   时间:2015-07-06 23:04:59    阅读次数:93
LeetCode39:Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of t...
分类:其他好文   时间:2015-07-06 21:45:12    阅读次数:107
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!