码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
Lintcode: Nth to Last Node in List
Find the nth to last element of a singly linked list. The minimum number of nodes in list is n.ExampleGiven a List 3->2->1->5->null and n = 2, return....
分类:其他好文   时间:2015-04-02 06:34:52    阅读次数:101
[LeetCode]Plus One
Plus One Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. 解题思路:...
分类:其他好文   时间:2015-04-02 01:20:13    阅读次数:152
要发就发
#include #include #include #define NUM 320 int number[NUM]; int prime(int m); /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc,...
分类:其他好文   时间:2015-04-01 23:51:44    阅读次数:143
leetCode191-Number of 1 Bits
链接:https://leetcode.com/problems/number-of-1-bits/ 此题关键是如何判断一个数字的第i为是否为0  即: x& (1 class Solution { public: int hammingWeight(uint32_t n) { int count = 0; for(int i = 0; i < 32; ...
分类:其他好文   时间:2015-04-01 20:01:26    阅读次数:122
实数比较
要求用户输入两个实数,程序通过比较之后,输出最大的数。 在这里学习到了三目运算符。#include /** * 用户输入两个实数,输出最大的实数 * @brief main * @return */ int main(void) { float x,y; float c; printf("%s\n","please input two number(...
分类:其他好文   时间:2015-04-01 19:59:46    阅读次数:108
leetcode_num179_Largest Number
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. 两两比较 可以利用sort函数来排序,自定义comp...
分类:其他好文   时间:2015-04-01 19:59:41    阅读次数:120
LeetCode - Palindrome Number
用Java刷这道题没有太大意义。public class Solution { public boolean isPalindrome(int x) { boolean ans = false; StringBuilder sb = new Str...
分类:其他好文   时间:2015-04-01 19:52:35    阅读次数:107
JS中如何判断null、undefined与NaN
1.判断undefined:Js代码 vartmp=undefined;if(typeof(tmp)=="undefined"){alert("undefined");}说明:typeof 返回的是字符串,有六种可能:"number"、"string"、"boolean"、"object"、"fun...
分类:Web程序   时间:2015-04-01 19:44:29    阅读次数:129
JavaScript的算术运算符
ECMAScript 定义了 5 个算术运算符,加、减、乘、除、求模(取余)。如果在算术运算的值不是数值,那么后台会先使用 Number()转型函数将其转换为数值(隐式转换)。一、加法 var box = 1 + 2; //等于 3 var box = 1 + NaN; ...
分类:编程语言   时间:2015-04-01 19:06:35    阅读次数:212
iOS常见算法(二分法 冒泡 选择)
二分法: 平均时间复杂度:O(log2n) int halfFuntion(int a[], int length, int number)  { int start = 0; int end = length - 1; int index = 0; while(start  { index = start + (end - start)/2 if(a[index] == n...
分类:移动开发   时间:2015-04-01 17:51:32    阅读次数:154
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!