随笔分类 -  LeetCode

上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 61 下一页
摘要:Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the vali 阅读全文
posted @ 2017-10-01 12:40 Grandyang 阅读(11011) 评论(3) 推荐(1)
摘要:Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the k 阅读全文
posted @ 2017-09-30 23:54 Grandyang 阅读(4118) 评论(3) 推荐(0)
摘要:Implement a magic directory with buildDict, and search methods. For the method buildDict, you'll be given a list of non-repetitive words to build a di 阅读全文
posted @ 2017-09-29 21:52 Grandyang 阅读(4728) 评论(1) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil 阅读全文
posted @ 2017-09-28 22:30 Grandyang 阅读(5143) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two l 阅读全文
posted @ 2017-09-27 21:06 Grandyang 阅读(10544) 评论(3) 推荐(1)
摘要:There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, 阅读全文
posted @ 2017-09-26 10:53 Grandyang 阅读(5684) 评论(5) 推荐(0)
摘要:Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. 阅读全文
posted @ 2017-09-25 05:04 Grandyang 阅读(7086) 评论(3) 推荐(0)
摘要:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2017-09-24 01:29 Grandyang 阅读(10025) 评论(4) 推荐(0)
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might 阅读全文
posted @ 2017-09-23 22:18 Grandyang 阅读(6418) 评论(1) 推荐(0)
摘要:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ 阅读全文
posted @ 2017-09-22 23:50 Grandyang 阅读(5077) 评论(0) 推荐(0)
摘要:If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers. For each integer in this list: Given a 阅读全文
posted @ 2017-09-21 20:40 Grandyang 阅读(7136) 评论(0) 推荐(0)
摘要:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1element. We define an array is non-decre 阅读全文
posted @ 2017-09-20 22:26 Grandyang 阅读(10504) 评论(1) 推荐(0)
摘要:Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to two trees which have the equal sum of values after r 阅读全文
posted @ 2017-09-19 10:14 Grandyang 阅读(5102) 评论(2) 推荐(0)
摘要:Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binar 阅读全文
posted @ 2017-09-18 00:05 Grandyang 阅读(12050) 评论(5) 推荐(0)
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2017-09-17 13:38 Grandyang 阅读(5213) 评论(1) 推荐(0)
摘要:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subseq 阅读全文
posted @ 2017-09-15 12:40 Grandyang 阅读(11547) 评论(2) 推荐(0)
摘要:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the 阅读全文
posted @ 2017-09-14 10:42 Grandyang 阅读(16709) 评论(11) 推荐(0)
摘要:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or 阅读全文
posted @ 2017-09-13 13:20 Grandyang 阅读(3053) 评论(0) 推荐(0)
摘要:You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm: Create 阅读全文
posted @ 2017-09-13 03:27 Grandyang 阅读(7842) 评论(1) 推荐(0)
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E 阅读全文
posted @ 2017-09-12 03:42 Grandyang 阅读(9465) 评论(2) 推荐(1)

上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 61 下一页
Fork me on GitHub