- 博客(25)
- 收藏
- 关注
原创 4 Sum
Fair 4 SumShow Result My Submissions19%AcceptedGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quad
2014-11-30 00:20:07 230
原创 Unique Permutations
Fair Unique PermutationsShow Result My Submissions16%AcceptedGiven a list of numbers with duplicate number in it. Find allunique permutations.ExampleFor numbers [1,2,2] t
2014-11-29 03:05:01 328
原创 Unique Subsets
Given a list of numbers that may has duplicate numbers, return all possible subsetsNoteEach element in a subset must be in non-descending order.The ordering between two subsets is free.The
2014-11-29 02:22:17 359
原创 Interleaving String
Fair Interleaving StringMy Submissions54%AcceptedGiven three strings: s1, s2, s3, determine whether s3 is formed by the interleaving of s1 and s2.ExampleFor s1 = "aabcc" s2
2014-11-25 01:30:22 267
原创 Distinct Subsequences
Fair Distinct SubsequencesShow Result My Submissions25%AcceptedGiven a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string
2014-11-25 00:19:08 226
原创 Longest Increasing Subsequence Show Result My Submissions
Given a sequence of integers, find the longest increasing subsequence (LIS).You code should return the length of the LIS.ExampleFor [5, 4, 1, 2, 3], the LIS is [1, 2, 3], return 3For [4
2014-11-24 09:41:47 221
转载 Convert Sorted List to Binary Search Tree
Problem :Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
2014-11-24 06:17:09 248
原创 Copy List with Random Pointer
Fair Copy List with Random PoiAcceptedA 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 cop
2014-11-24 04:02:17 221
原创 Partition List
public class Solution { /** * @param head: The first node of linked list. * @param x: an integer * @return: a ListNode */ public ListNode partition(ListNode head, int x) {
2014-11-23 08:45:09 286
原创 Reverse Linked List II
Fair Reverse Linked List IIShow Result My Submissions27%AcceptedReverse a linked list from position m to n.NoteGiven m, n satisfy the following condition: 1 ≤ m ≤ n ≤ len
2014-11-23 06:48:04 194
原创 Reverse Linked List
Easy Reverse Linked ListShow Result My Submissions37%AcceptedReverse a linked list.ExampleFor linked list 1->2->3, the reversed linked list is 3->2->1Challenge Expa
2014-11-23 05:04:49 340
原创 Remove Duplicates from Sorted List II
Fair Remove Duplicates from Sorted List IIShow Result My Submissions28%AcceptedGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinct nu
2014-11-23 04:53:06 315
原创 Construct Binary Tree from Inorder and Postorder Traversal
Fair Construct Binary Tree from Inorder and Postorder TraversalShow Result My Submissions37%AcceptedGiven inorder and postorder traversal of a tree, construct the binary tree
2014-11-20 05:31:21 284
原创 Construct Binary Tree from Preorder and Inorder Traversal
Fair Construct Binary Tree from Preorder and Inorder TraversalShow Result My Submissions35%AcceptedGiven preorder and inorder traversal of a tree, construct the binary tree.
2014-11-20 04:36:18 326
原创 Binary Tree Zigzag Level Order Traversal
Fair Binary Tree Zigzag Level Order TraversalShow Result My Submissions29%AcceptedGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from
2014-11-17 10:38:04 300
原创 Binary Tree Level Order Traversal II
/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * this.left =
2014-11-17 10:09:48 217
原创 Binary Tree Level Order Traversal
Fair Binary Tree Level Order TraversalShow Result My Submissions30%AcceptedGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right
2014-11-17 09:46:26 224
原创 Search Range in Binary Search Tree
Fair Search Range in Binary Search TreeShow Result My Submissions43%AcceptedGiven two values k1 and k2 (where k1 ExampleFor example, if k1 = 10 and k2 = 22, then your
2014-11-17 08:22:52 268
原创 Lowest Common Ancestor
Fair Lowest Common AncestorMy Submissions32%AcceptedGiven the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.The lowest common ances
2014-11-17 07:09:40 227
原创 Binary Tree Maximum Path Sum
Fair Binary Tree Maximum Path SumShow Result My Submissions22%AcceptedGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.
2014-11-17 05:08:58 341
原创 Median of two Sorted Arrays
class Solution { /** * @param A: An integer array. * @param B: An integer array. * @return: a double whose format is *.5 or *.0 */ public double findMedianSortedArrays(int[
2014-11-16 02:26:41 396
原创 LINUX sed - i streaming editor
Problem:The steps that I take: create table using the following HQL commands: CREATE TABLE 10projects(......) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';The tabl
2014-11-09 04:13:45 427
原创 Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.public class Solution { public TreeNode sortedArrayToBST(int[] num) { if (num == null) return nu
2014-11-07 23:49:25 284
原创 Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th
2014-11-07 14:00:38 192
原创 Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.Idea: u
2014-11-06 03:24:44 211
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人