摘要:
No.135 CandyThere areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the fol... 阅读全文
摘要:
No.42 Trapping Rain WaterGivennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able... 阅读全文
摘要:
No.149 Max Point on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.尝试1:考虑不周,一条直线上的点会重复计数,但没找到解... 阅读全文
摘要:
No.147 Insertion Sorted ListSort a linked list using insertion sort.单链表排序:使用插入排序时间复杂度是排序算法的O(n^2),空间复杂度是O(1)难度:无他,把思路理顺,注意细节,并测试一下;另外头结点的巧妙应用,int最小表示方... 阅读全文
摘要:
No.21 Merge Two Sorted ListMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th... 阅读全文
摘要:
No.148 Sort ListSort a linked list inO(nlogn) time using constant space complexity.分析: 常量空间且O(nlogn)时间复杂度,单链表适合用归并排序,双向链表适合用快速排序 有一个问题是:若算上栈空间,空间复杂度... 阅读全文
摘要:
No.49 AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Tags:Hash TableString难点... 阅读全文