摘要: 描述: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->nullptr and k = 2, return 4->5- 阅读全文
posted @ 2017-12-14 10:03 飘舞的雪 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 描述: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 阅读全文
posted @ 2017-12-14 09:35 飘舞的雪 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 描述: Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2- 阅读全文
posted @ 2017-12-13 10:09 飘舞的雪 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 描述: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve 阅读全文
posted @ 2017-12-13 10:01 飘舞的雪 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 描述: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->nullptr, m = 2 and n = 4, return 1-> 阅读全文
posted @ 2017-12-13 09:51 飘舞的雪 阅读(84) 评论(0) 推荐(0) 编辑
摘要: LRU Cache 描述: Design and implement a data structure for Last Recently Used(LRU) Cache. It should support the following operations: get and set. get(ke 阅读全文
posted @ 2017-11-29 10:30 飘舞的雪 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 参考58沈剑大神架构师之路上的文章,谈谈Leader-Follower线程模型: 上图就是L/F多线程模型的状态变迁点,共6个关键点: (1)线程有3种状态:领导leading,处理processing,追随following (2)假设共N个线程,其中只有1个leading线程(等待任务),x个p 阅读全文
posted @ 2017-10-20 14:57 飘舞的雪 阅读(1814) 评论(0) 推荐(0) 编辑
摘要: C语言中的左移和右移运算符移位后的结果老是忘记,最近在刷有关位操作的题目,正好整理下: 1. 左移运算符(<<) 左移运算符是用来将一个数的各二进制位左移若干位,移动的位数由右操作数指定(右操作数必须是非负值),其右边空出的位用0填补,高位左移溢出则舍弃该高位。 2. 右移运算符(>>) 右移运算符 阅读全文
posted @ 2017-10-11 09:32 飘舞的雪 阅读(7118) 评论(0) 推荐(0) 编辑
摘要: Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that 阅读全文
posted @ 2017-10-02 14:58 飘舞的雪 阅读(174) 评论(0) 推荐(0) 编辑