个人博客:https://luxialan.com

摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2014-12-06 19:58 luxialan 阅读(125) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2014-12-06 16:18 luxialan 阅读(107) 评论(0) 推荐(0)
摘要: 求数组中某个出现n次的数是一类很有技巧的问题,这类问题思路巧妙,但是一旦想到思路,编程异常简单快速。这求出现n次的数问题可以归结为下列常见的三个问题:问题1:数组中只有一个数出现一次,其余的数出现2次,求这个出现一次的数是多少。问题2:数组中只有一次数出现一次,其余的数出现3次,求这个出现一次的数是... 阅读全文
posted @ 2014-12-06 09:28 luxialan 阅读(158) 评论(0) 推荐(0)