模板题:POJ 2352 Stars HDU1166 1 int lowbit(int x) 2 { 3 return x&(-x); 4 } 5 void update(int x,int val) 6 { 7 while(x0)17 {18 sum+=c[...
分类:
编程语言 时间:
2015-07-27 10:38:03
阅读次数:
125
获取尺寸
如下:
heigh([val|fn])
width([val|fn])
innerHeight()
innerWidth()
outerHeight([soptions])
outerWidth([options])
下面就一一介绍(这里多说一下jquery中很多都是既可以返回匹配元素的值,又可以设置匹配元素值)height()取得匹配元素当前计算的高度值(px...
分类:
Web程序 时间:
2015-07-26 19:20:45
阅读次数:
193
首先统一链表的数据结构为:
struct ListNode
{
int val;
struct ListNode *next;
ListNode(int x) :val(x), next(NULL) {}
};
题目一:从尾到头打印链表:输入一个链表,从尾到头打印链表每个节点的值。
分析:
难点在于链表只有指向后继的指针,没有指向前驱的指针。
转换思路,结合栈后...
分类:
其他好文 时间:
2015-07-26 19:13:26
阅读次数:
196
一 Tuple 元祖在sclal中有用的容器对象是元祖: Tuple,与列表一样,元素也是不可变的,但与列表不同,在一个元祖可以包含不同类型的元素。所以在scal用的非常多。def main(args: Array[String]): Unit = { val triple = (100, "Sc....
分类:
其他好文 时间:
2015-07-26 15:38:36
阅读次数:
133
Map练习object MapOps { def main(args: Array[String]): Unit = { val ages = Map("Rocky" -> 27, "Spark" -> 5) for ((k, v) <- ages) println("Key...
分类:
其他好文 时间:
2015-07-26 12:31:59
阅读次数:
110
一、数组
1、定长数组
声明数组的两种形式:
声明指定长度的数组 val 数组名= new Array[类型](数组长度)
提供数组初始值的数组,无需new关键字
Scala声明数组时,需要带有Array类名,且使用 () 来指明长度或提供初始值序列。
在JVM中,Scala的Array以Java数组的方式实现。如arr在JVM中的类型对应jav...
分类:
编程语言 时间:
2015-07-26 11:12:58
阅读次数:
1522
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* reverseList(struct Li...
分类:
其他好文 时间:
2015-07-25 18:19:20
阅读次数:
81
import scala.collection.mutable.ArrayBuffer/** * @author Guohui Li *//** * val A = new Array[T](N) * val B = Array(N1,N2) * 数组声明时若给出值,Scala可以进行类型推断...
分类:
其他好文 时间:
2015-07-25 18:08:46
阅读次数:
133
代码:#BSF searchclass TreeNode: def _init_(self,x): self.val = x self.left = None self.right = None def kthSmallest(s...
分类:
其他好文 时间:
2015-07-25 18:02:28
阅读次数:
84
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node
with val...
分类:
其他好文 时间:
2015-07-25 13:52:42
阅读次数:
99