09 2016 档案

摘要:Find the sum of all left leaves in a given binary tree. Example: 这道题让我们求一棵二叉树的所有左子叶的和,那么看到这道题我们知道这肯定是考二叉树的遍历问题,那么最简洁的写法肯定是用递归,由于我们只需要累加左子叶之和,那么我们在进入递归 阅读全文
posted @ 2016-09-30 13:40 Grandyang 阅读(9909) 评论(1) 推荐(0) 编辑
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the 阅读全文
posted @ 2016-09-24 09:55 Grandyang 阅读(2458) 评论(2) 推荐(0) 编辑
摘要:A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
posted @ 2016-09-22 15:10 Grandyang 阅读(11254) 评论(6) 推荐(0) 编辑
摘要:Given an integer n, return the nth digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]. Example 1: Input: n = 3 Output: 3 阅读全文
posted @ 2016-09-21 10:59 Grandyang 阅读(13767) 评论(1) 推荐(1) 编辑
摘要:A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but i 阅读全文
posted @ 2016-09-20 13:16 Grandyang 阅读(18745) 评论(13) 推荐(0) 编辑
摘要:Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
posted @ 2016-09-19 04:04 Grandyang 阅读(18331) 评论(4) 推荐(3) 编辑
摘要:Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2016-09-18 06:33 Grandyang 阅读(1537) 评论(0) 推荐(0) 编辑
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2016-09-18 05:33 Grandyang 阅读(1396) 评论(0) 推荐(0) 编辑
摘要:Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given 阅读全文
posted @ 2016-09-17 23:59 Grandyang 阅读(18419) 评论(10) 推荐(2) 编辑
摘要:A星(A*, A Star)算法详解 CSDN技术主题月 “深度学习”代码笔记专栏 UC Berkeley CS188 Intro to AI 阅读全文
posted @ 2016-09-16 00:25 Grandyang 阅读(625) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number m 阅读全文
posted @ 2016-09-15 21:45 Grandyang 阅读(14627) 评论(7) 推荐(0) 编辑
摘要:Given a positive integer n and you can do operations as follow: What is the minimum number of replacements needed for n to become 1? Example 1: Exampl 阅读全文
posted @ 2016-09-14 20:57 Grandyang 阅读(9161) 评论(6) 推荐(0) 编辑
摘要:Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a 阅读全文
posted @ 2016-09-13 21:02 Grandyang 阅读(8764) 评论(4) 推荐(2) 编辑
摘要:There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more coins left. T 阅读全文
posted @ 2016-09-12 12:15 Grandyang 阅读(3395) 评论(3) 推荐(0) 编辑
摘要:There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The player who take t 阅读全文
posted @ 2016-09-11 12:42 Grandyang 阅读(2275) 评论(0) 推荐(0) 编辑
摘要:There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach 阅读全文
posted @ 2016-09-10 23:36 Grandyang 阅读(10424) 评论(3) 推荐(0) 编辑
摘要:Give an integer array,find the longest increasing continuous subsequence in this array. An increasing continuous subsequence: Can be from right to lef 阅读全文
posted @ 2016-09-09 21:37 Grandyang 阅读(1786) 评论(0) 推荐(0) 编辑
摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than 阅读全文
posted @ 2016-09-08 11:13 Grandyang 阅读(19468) 评论(19) 推荐(1) 编辑
摘要:Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is be 阅读全文
posted @ 2016-09-07 13:01 Grandyang 阅读(30518) 评论(12) 推荐(1) 编辑
摘要:A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: This is how the UTF-8 encoding would work: Given an array of inte 阅读全文
posted @ 2016-09-06 23:22 Grandyang 阅读(13250) 评论(7) 推荐(1) 编辑
摘要:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is po 阅读全文
posted @ 2016-09-05 13:57 Grandyang 阅读(13599) 评论(3) 推荐(0) 编辑
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el 阅读全文
posted @ 2016-09-03 23:58 Grandyang 阅读(1136) 评论(0) 推荐(0) 编辑
摘要:Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Comparison of a nut to ano 阅读全文
posted @ 2016-09-02 12:58 Grandyang 阅读(1491) 评论(0) 推荐(0) 编辑
摘要:Find the kth smallest number in at row and column sorted matrix. Have you met this question in a real interview? Yes Find the kth smallest number in a 阅读全文
posted @ 2016-09-01 12:24 Grandyang 阅读(1061) 评论(0) 推荐(0) 编辑

Fork me on GitHub