2014年12月3日

Single Number

摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... 阅读全文

posted @ 2014-12-03 12:04 code#swan 阅读(65) 评论(0) 推荐(0)

Single Number II

摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp... 阅读全文

posted @ 2014-12-03 12:02 code#swan 阅读(92) 评论(0) 推荐(0)

Copy List with Random Pointer

摘要: 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 @ 2014-12-03 12:00 code#swan 阅读(117) 评论(0) 推荐(0)

Word Break

摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文

posted @ 2014-12-03 11:59 code#swan 阅读(104) 评论(0) 推荐(0)

Word Break II

摘要: Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl... 阅读全文

posted @ 2014-12-03 11:57 code#swan 阅读(104) 评论(0) 推荐(0)

Linked List Cycle

摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *... 阅读全文

posted @ 2014-12-03 11:56 code#swan 阅读(89) 评论(0) 推荐(0)

Linked List Cycle II

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?/**... 阅读全文

posted @ 2014-12-03 11:55 code#swan 阅读(90) 评论(0) 推荐(0)

Reorder List

摘要: Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文

posted @ 2014-12-03 11:46 code#swan 阅读(83) 评论(0) 推荐(0)

Binary Tree Preorder Traversal

摘要: Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not... 阅读全文

posted @ 2014-12-03 11:43 code#swan 阅读(82) 评论(0) 推荐(0)

Binary Tree Postorder Traversal

摘要: Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No... 阅读全文

posted @ 2014-12-03 11:42 code#swan 阅读(92) 评论(0) 推荐(0)

导航