摘要: Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations: 阅读全文
posted @ 2016-09-27 06:12 lilixu 阅读(116) 评论(0) 推荐(0) 编辑
摘要: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time 阅读全文
posted @ 2016-06-21 17:21 lilixu 阅读(261) 评论(0) 推荐(0) 编辑
摘要: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文
posted @ 2016-06-21 14:34 lilixu 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-06-20 15:33 lilixu 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 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 fo 阅读全文
posted @ 2016-06-20 14:20 lilixu 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2016-06-01 17:29 lilixu 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree {3 阅读全文
posted @ 2016-06-01 17:28 lilixu 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a 阅读全文
posted @ 2016-06-01 15:25 lilixu 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
posted @ 2016-05-31 14:17 lilixu 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2016-05-30 15:36 lilixu 阅读(119) 评论(0) 推荐(0) 编辑