摘要: Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va 阅读全文
posted @ 2018-02-06 23:23 ZHUQW 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, 阅读全文
posted @ 2018-02-06 22:37 ZHUQW 阅读(163) 评论(0) 推荐(0) 编辑
摘要: A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key 阅读全文
posted @ 2018-02-06 15:36 ZHUQW 阅读(138) 评论(0) 推荐(0) 编辑
摘要: To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same s 阅读全文
posted @ 2018-02-06 14:23 ZHUQW 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 容器类放入的都是元素的拷贝,而非引用。所以如果需要对元素做出改动,最好是把元素存在data[N]数组中,而仅仅在容器中存放数组下标。 函数传递容器类参数时,需要传引用,否则会超时。 vector vector作为数组,vector <int> num[ N ],可以当作二维数组使用,由于所有的vec 阅读全文
posted @ 2018-02-06 13:05 ZHUQW 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given 阅读全文
posted @ 2018-02-06 11:45 ZHUQW 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given s 阅读全文
posted @ 2018-02-06 09:55 ZHUQW 阅读(114) 评论(0) 推荐(0) 编辑