- 博客(9)
- 资源 (7)
- 收藏
- 关注
原创 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f
2015-09-20 16:53:06 720
原创 Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.s
2015-09-18 13:55:30 535
原创 Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2015-09-18 11:46:32 528
原创 Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?solution: two pointers, one pointer step 1, the other pointer step 2, find t
2015-09-08 18:39:40 453
原创 Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may a
2015-09-08 15:16:58 519
原创 Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2015-09-06 12:15:29 411
原创 Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.solution: 这道题是merge 2 sorted linked lists的扩展,从2-》K的问题,很多可以化为分治法(divide and conquer)求解。假设每个list都是n长
2015-09-06 11:01:26 387
原创 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()
2015-09-01 22:47:30 407
Software Architecture4+1
2009-03-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人