Fork me on GitHub
摘要: 描述 Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. 示例 阅读全文
posted @ 2018-03-30 17:20 Lancel0t 阅读(362) 评论(0) 推荐(1) 编辑
摘要: 描述 Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? 示例 <! more 算法分析 难度 :中 分析 :条件参考Remove Duplicates算法,只不过之前元素只允许重复1次,现 阅读全文
posted @ 2018-03-30 17:17 Lancel0t 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space 阅读全文
posted @ 2018-03-30 17:06 Lancel0t 阅读(246) 评论(0) 推荐(0) 编辑