上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2015-06-22 03:43 胡潇 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.解题:寻找单链表中环的入口,如果不存在环则返回null。假设单链表有环,先利用判断单链表是否有环(Linked ... 阅读全文
posted @ 2015-06-21 04:01 胡潇 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it.解题:判断单链表是否具有环,使用两个指针once和twice遍历链表,once一次走一步,twice一次走两步,如果相遇,则说明有环,否则没有。原因是,如果单链表具有环,不论once和twi... 阅读全文
posted @ 2015-06-20 04:04 胡潇 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解题:题目比较简单... 阅读全文
posted @ 2015-06-19 04:27 胡潇 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2015-06-18 01:19 胡潇 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-06-17 04:27 胡潇 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文
posted @ 2015-05-22 08:24 胡潇 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].解题思... 阅读全文
posted @ 2015-05-22 08:20 胡潇 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl... 阅读全文
posted @ 2015-05-22 08:13 胡潇 阅读(222) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文
posted @ 2015-05-21 09:54 胡潇 阅读(153) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 13 下一页