随笔分类 -  LeetCode

上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 61 下一页
摘要:Implement an iterator to flatten a 2d vector. For example,Given 2d vector = [ [1,2], [3], [4,5,6] ] By calling next repeatedly until hasNext returns f 阅读全文
posted @ 2016-02-23 13:37 Grandyang 阅读(13156) 评论(3) 推荐(0) 编辑
摘要:Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the subtree have the same value. Example : Input: 阅读全文
posted @ 2016-02-22 13:34 Grandyang 阅读(14005) 评论(4) 推荐(1) 编辑
摘要:Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequen 阅读全文
posted @ 2016-02-21 12:51 Grandyang 阅读(14446) 评论(2) 推荐(0) 编辑
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog 阅读全文
posted @ 2016-02-20 14:28 Grandyang 阅读(11854) 评论(4) 推荐(0) 编辑
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are o 阅读全文
posted @ 2016-02-19 14:29 Grandyang 阅读(14499) 评论(3) 推荐(0) 编辑
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number i 阅读全文
posted @ 2016-02-18 00:54 Grandyang 阅读(10901) 评论(2) 推荐(0) 编辑
摘要:Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Your algorithm 阅读全文
posted @ 2016-02-17 10:45 Grandyang 阅读(17733) 评论(3) 推荐(1) 编辑
摘要:Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. word1 and word2 may be the same 阅读全文
posted @ 2016-02-16 13:15 Grandyang 阅读(10524) 评论(0) 推荐(0) 编辑
摘要:A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) 阅读全文
posted @ 2016-02-15 14:12 Grandyang 阅读(29293) 评论(15) 推荐(0) 编辑
摘要:Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not 阅读全文
posted @ 2016-02-14 13:01 Grandyang 阅读(18214) 评论(15) 推荐(0) 编辑
摘要:Design a class which receives a list of words in the constructor, and implements a method that takes two words word1 and word2 and return the shortest 阅读全文
posted @ 2016-02-13 14:57 Grandyang 阅读(12946) 评论(2) 推荐(1) 编辑
摘要:Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. Example:Assume that words = ["p 阅读全文
posted @ 2016-02-12 14:55 Grandyang 阅读(16304) 评论(6) 推荐(1) 编辑
摘要:Given an input string , reverse the string word by word. Example: Input: ["t","h","e"," ","s","k","y"," ","i","s"," ","b","l","u","e"] Output: [& 阅读全文
posted @ 2016-02-11 07:48 Grandyang 阅读(13320) 评论(3) 推荐(0) 编辑
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function 阅读全文
posted @ 2016-02-10 00:33 Grandyang 阅读(18984) 评论(6) 推荐(0) 编辑
摘要:Given a string s , find the length of the longest substring t that contains at most 2 distinct characters. Example 1: Input: "eceba" Output: 3 Explana 阅读全文
posted @ 2016-02-09 15:20 Grandyang 阅读(20543) 评论(5) 推荐(1) 编辑
摘要:Given a sorted integer array nums, where the range of elements are in the inclusive range [lower, upper], return its missing ranges. Example: Input: n 阅读全文
posted @ 2016-02-08 07:21 Grandyang 阅读(16195) 评论(3) 推荐(2) 编辑
摘要:Given two strings s and t, determine if they are both one edit distance apart. Note: There are 3 possiblities to satisify one edit distance apart: Exa 阅读全文
posted @ 2016-02-07 14:34 Grandyang 阅读(16966) 评论(6) 推荐(0) 编辑
摘要:Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find 阅读全文
posted @ 2016-02-06 15:46 Grandyang 阅读(15979) 评论(6) 推荐(0) 编辑
摘要:Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick 阅读全文
posted @ 2016-02-05 15:22 Grandyang 阅读(21006) 评论(11) 推荐(0) 编辑
摘要:Given a file and assume that you can only read the file using a given method read4, implement a method read to read n characters. Your method read may 阅读全文
posted @ 2016-02-04 15:09 Grandyang 阅读(16672) 评论(10) 推荐(0) 编辑

上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 61 下一页
Fork me on GitHub