Reverse Linked List II
摘要:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.Note:Givenm,nsatisfy the following condition:1 ≤m≤n≤ length of list.代码: 1 /** 2 * Definition for singly-linked list. 3 * s
阅读全文
posted @
2013-10-18 20:55
猿人谷
阅读(449)
推荐(0) 编辑
Single Number and Single Number II
摘要:[1] Given an array of integers, every element appears twice except for one. Find that single one.[2] Given an array of integers, every element appears three times except for one. Find that single one. (better solution is needed)Note: Your algorithm should have a linear runtime complexity. Could you
阅读全文
posted @
2013-10-18 20:36
猿人谷
阅读(2447)
推荐(0) 编辑