06 2015 档案

摘要:Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].解题... 阅读全文
posted @ 2015-06-30 04:29 胡潇 阅读(308) 评论(0) 推荐(0)
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-06-29 04:15 胡潇 阅读(261) 评论(0) 推荐(0)
摘要:Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-06-27 21:18 胡潇 阅读(176) 评论(0) 推荐(0)
摘要:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"Corner Cases:Did you con... 阅读全文
posted @ 2015-06-25 10:30 胡潇 阅读(211) 评论(0) 推荐(0)
摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-06-24 02:59 胡潇 阅读(280) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ... 阅读全文
posted @ 2015-06-23 03:40 胡潇 阅读(263) 评论(0) 推荐(0)
摘要: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 胡潇 阅读(207) 评论(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 胡潇 阅读(203) 评论(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 胡潇 阅读(211) 评论(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 胡潇 阅读(164) 评论(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 胡潇 阅读(154) 评论(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 胡潇 阅读(177) 评论(0) 推荐(0)