Built-in Control Structures 内置控制结构1 if 控制结构scala的if跟java的if结构上相同,功能上也差不太多,scala的说法是,if能够返回一个值 val fileName = if (!args.isEmpty) args(0) else "default....
分类:
其他好文 时间:
2014-07-07 18:33:10
阅读次数:
169
Problem Description:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your alg...
分类:
其他好文 时间:
2014-07-07 15:47:17
阅读次数:
272
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-07 14:58:47
阅读次数:
175
卓越网的kindle paperwhite, 899元的价钱,好吸引啊,我是不是也应该买一个呢,从卓越网中看见kindle paperwhite的1代开始,一直想买,等到现在的2代也出了,也继续在考虑,其实我已经有部红米note了,5.5寸的屏幕,究竟还是否还需要在卓越网购买多一部kindle pa...
分类:
其他好文 时间:
2014-07-03 11:58:14
阅读次数:
186
题目
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it witho...
分类:
其他好文 时间:
2014-06-30 19:38:37
阅读次数:
226
题目
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it...
分类:
其他好文 时间:
2014-06-30 19:23:18
阅读次数:
200
题目
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down...
分类:
其他好文 时间:
2014-06-30 11:10:34
阅读次数:
211
【题目】
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursive solution is trivial, could you do it iteratively?
【题意】
非递归实现后续遍...
分类:
其他好文 时间:
2014-06-30 10:10:10
阅读次数:
177
【题目】
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive solution is trivial, could you do it iteratively?
【题意】
非递归返回先序遍历...
分类:
其他好文 时间:
2014-06-30 06:21:18
阅读次数:
334
【题目】
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
【题意】
给定一个整数以外,其中除了一个整数只出现一次以外...
分类:
其他好文 时间:
2014-06-29 22:52:35
阅读次数:
246