摘要: 传送门 Description Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 阅读全文
posted @ 2017-08-13 23:58 zxzhang 阅读(298) 评论(0) 推荐(0)
摘要: 传送门 Description Determine whether an integer is a palindrome. Do this without extra space. 思路 题意:判断输入的整数是否是一个回文数,要求不允许使用额外的空间 题解:可以肯定的是小于0以及尾数为0的整数不是回 阅读全文
posted @ 2017-08-13 23:48 zxzhang 阅读(183) 评论(0) 推荐(0)
摘要: 传送门 Description Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate num 阅读全文
posted @ 2017-08-13 23:22 zxzhang 阅读(356) 评论(0) 推荐(0)
摘要: Floyd判圈算法(Floyd Cycle Detection Algorithm),又称龟兔赛跑算法(Tortoise and Hare Algorithm),是一个可以在有限状态机、迭代函数或者链表上判断是否存在环,求出该环的起点与长度的算法。该算法据高德纳称由美国科学家罗伯特·弗洛伊德发明,但 阅读全文
posted @ 2017-08-13 22:51 zxzhang 阅读(4608) 评论(2) 推荐(7)