摘要:
leetcode go语言版本,主要为了熟悉下语言 1. Two Sum 双指针版本, O(NlogN) hash查找版本,理论O(N) 2. Add Two Numbers 要想办法把代码写简洁...不要好几个循环判断... 3. Longest Substring Without Repeati 阅读全文
摘要:
LeetCode169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ 阅读全文
摘要:
136. Single Number Given an array of integers, every element appears twice except for one. Find that single one. (Easy) Note:Your algorithm should hav 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. (Medium) 分析: 因为题目要求复杂度为O(nlogn),故可以考虑归并排序的思想。 归并排序的一般步骤为: 1)将待排序数组(链表)取中点并一分为二; 阅读全文
摘要:
链表相关题 141. Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? (Easy) 分析: 阅读全文