JS的数字类型js的数字类型只有一种,叫做Number.js中的所有数字皆属于此类型。包括整数1,-2,3,浮点数1.1,-1.2,1.3都属于此类型。所以,在js中,typof 整数或者 typof 浮点数返回的都是number.JS的类型转换js中有三个常用函数用于将非数字类型转换为数字类型,分别是,Number(),parseInt,parseFloat();可以直接在window作用域下调用...
分类:
编程语言 时间:
2015-07-10 16:46:36
阅读次数:
118
手动输入一行字符串,并对其排序。
脚本如下:#!/bin/bash
#a test about sort
echo "please input a number list"
read -a arrs
for((i=0;i<${#arrs[@]};i++)){
for((j=0;j<${#arrs[@]}-1;j++)){
if [[ ${arrs[j]} -gt ${arrs[j+...
分类:
编程语言 时间:
2015-07-10 15:15:42
阅读次数:
123
题目如下:
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one...
分类:
其他好文 时间:
2015-07-10 15:14:42
阅读次数:
127
Maximum Depth of Binary Tree (DFS, TREE)Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path fr...
分类:
其他好文 时间:
2015-07-10 13:17:22
阅读次数:
99
题目:
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
Input...
分类:
编程语言 时间:
2015-07-10 09:41:01
阅读次数:
181
解法一:
int NumberOf1Between1AndN(unsigned int n)
{
int number = 0;
for (unsigned int i = 1; i
number += NumberOf1(i);
return number;
}
int NumberOf1(unsigned int n)
{
int number = 0;
w...
分类:
其他好文 时间:
2015-07-10 09:40:15
阅读次数:
177
Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used...
分类:
其他好文 时间:
2015-07-10 09:30:20
阅读次数:
237
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...
分类:
其他好文 时间:
2015-07-10 09:29:59
阅读次数:
424
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...
分类:
其他好文 时间:
2015-07-10 00:14:30
阅读次数:
116
一、所有数据类型的常量都看作对象。(一)、JS自带的数据类型怎样创建对象?number、String这些基本类型的值,23、"abc"等常量本身就是对象。Date类型:通过一个构造函数创建对象,new Date(2015,7,8)(二)、用户怎样创建自定义的对象?1.通过var o = new Ob...
分类:
Web程序 时间:
2015-07-10 00:13:02
阅读次数:
185