Questions:Given an unsorted integer array, find
the first missing positive integer.For
example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm...
分类:
其他好文 时间:
2014-06-13 13:16:42
阅读次数:
205
${"%u"+java.lang.Integer.toHexString(region.toString().charAt(s.toInt()))}
这样转换成的每个字符后面会有空行,用的时候需要regionUnicode.toSt...
分类:
其他好文 时间:
2014-06-12 17:47:11
阅读次数:
186
今天项目中遇到要获取前几个和最后几个元素,查了资料发现了这个slice()方法很实用,废了一番功夫终于明白怎么用的了。slice(start[,end]):start类型:Integer开始选取子集的位置。第一个元素是0.如果是负数,则可以从集合的尾部开始选起。end(可选)类型:Integer结束...
分类:
Web程序 时间:
2014-06-12 15:25:44
阅读次数:
263
Reverse Linked List IIReverse a linked list from
positionmton. Do it in-place and in one-pass.For example:Given
1->2->3->4->5->NULL, m= 2 andn= 4,retu...
分类:
其他好文 时间:
2014-06-12 07:03:54
阅读次数:
308
问题:
给定一个链表的头指针,以及一个整数k,要求将链表按每k个为一组,组内进行链表逆置。少于k个的部分不做处理。
分析:
个人觉得问题的重点是熟悉链表的就地逆置操作,就是头插法。其他的考察点如果还有的话,就的细心程度。
实现:
void reverseList(ListNode *&pre, ListNode *head)
{
ListNode *tail = NULL;
w...
分类:
其他好文 时间:
2014-06-10 17:25:45
阅读次数:
305
原题地址:https://oj.leetcode.com/problems/integer-to-roman/题意:Given
an integer, convert it to a roman numeral.Input is guaranteed to be within the
range f...
分类:
编程语言 时间:
2014-06-10 17:06:11
阅读次数:
261
一次过 1 public class Solution { 2 public String
intToRoman(int num) { 3 StringBuffer res = new StringBuffer(); 4 if (num >
3999 || n...
分类:
其他好文 时间:
2014-06-10 16:12:12
阅读次数:
215