我提交了好多次,错误莫名其妙的,到后来才明白过来,原来我把题目给理解错了。
这个题的意思不是说让你把最后的那k个位置的元素移到前面来,这种问题的做法就是用两个指针,先让一个走,走到一定的长度之后两个一起走,很简单。它实际的意思是整个链表循环右移,假设一个链表长度是N,那么循环右移N次之后,链表又变回了原来的样子。k的取值范围只说了是非负的,也就是它可以是大于N的,因此实际的移位次数只是(k%N)...
分类:
其他好文 时间:
2014-05-13 23:37:23
阅读次数:
299
简单总结下,我们从C++的内置数组讲到标准库提供的vector,
最后谈到C++11新增的array, 数组这个最基本的数据结构在C++中终于有了完整的支持。
分类:
其他好文 时间:
2014-05-13 18:04:29
阅读次数:
263
一、JS中的数据类型 1.数值型(Number):包括整数、浮点数。 2.布尔型(Boolean)
3.字符串型(String) 4.对象(Object) 5.数组(Array) 6.空值(Null)
7.未定义(Undefined)二、判断一个变量的数据类型1.数值型(...
分类:
编程语言 时间:
2014-05-13 17:24:30
阅读次数:
360
self.isOpen = [NSMutableArray array];
for (int j = 0; j
[self.isOpen addObject:[NSNumber numberWithInt:0]];
}
-(void)buttonClick:(UIButton*)button
{
NSNumber *num ...
分类:
其他好文 时间:
2014-05-13 08:12:11
阅读次数:
264
Given an array, for example, 246135, an inversion pair is the pair whose first value is larger than its second value according to the sequence from left to right, (2,1) (4,1) (4,3) (6,1) (6,3) (6,5)....
分类:
其他好文 时间:
2014-05-13 08:03:58
阅读次数:
338
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Best Time to Buy and Sell Stock
Total Accepted: 13234 Total
Submissions: 43145
Say you have an array for which the ith ele...
分类:
其他好文 时间:
2014-05-13 07:30:13
阅读次数:
276
如果一个多层次的数据结构达到两级或者两级以上,举例如下:
struct A{
int array_member[100];
//其他数据成员
};
struct B{
struct A *a_ptr;
//其他数据成员
}
那么通过B类型的指针b_ptr访问A类型的array_member的某一个元素array_member[0]则需要使用b_...
分类:
编程语言 时间:
2014-05-13 06:00:59
阅读次数:
270
作者:X
Wang出处:http://www.programcreek.com/2013/09/top-10-methods-for-java-arrays/转载文章,转载请注明作者和出处The
following are top 10 methods for Java Array. They ar...
分类:
编程语言 时间:
2014-05-12 22:07:28
阅读次数:
530
原题地址:http://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/题意:将一个排序好的数组转换为一颗二叉查找树,这颗二叉查找树要求是平衡的。解题思路:由于要求二叉查找树是平衡的。所以我们可以选在数组的中间那...
分类:
编程语言 时间:
2014-05-12 21:44:57
阅读次数:
379
目录instanceofconstructor构造函数名字鸭式辨型三种检测对象的类方式:
instanceof、constructor 、构造函数名字用法如下:1)instanceofconsole.log([1,2,3] instanceof
Array);trueconsole.log([1,2...
分类:
Web程序 时间:
2014-05-12 20:46:39
阅读次数:
426