随笔分类 -  LeetCode

上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 61 下一页
摘要: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 阅读(5610) 评论(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 阅读(7000) 评论(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 阅读(9631) 评论(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 阅读(6345) 评论(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 阅读(5006) 评论(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 阅读(7042) 评论(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 阅读(10389) 评论(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 阅读(5045) 评论(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 阅读(11896) 评论(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 阅读(5183) 评论(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 阅读(11460) 评论(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 阅读(16329) 评论(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 阅读(3026) 评论(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 阅读(7695) 评论(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 阅读(9380) 评论(2) 推荐(1) 编辑
摘要:Given the root of a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one  阅读全文
posted @ 2017-09-10 06:41 Grandyang 阅读(8830) 评论(19) 推荐(1) 编辑
摘要:Print a binary tree in an m*n 2D string array following these rules: Example 1: Example 2: Example 3: Note: The height of binary tree is in the range 阅读全文
posted @ 2017-09-07 12:37 Grandyang 阅读(6041) 评论(0) 推荐(0) 编辑
摘要:Imagine you have a special keyboard with the following keys: Key 1: (A): Print one 'A' on screen. Key 2: (Ctrl-A): Select the whole screen. Key 3: (Ct 阅读全文
posted @ 2017-08-29 15:18 Grandyang 阅读(7774) 评论(0) 推荐(0) 编辑
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the 阅读全文
posted @ 2017-08-27 09:27 Grandyang 阅读(8319) 评论(8) 推荐(1) 编辑
摘要:In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the senate 阅读全文
posted @ 2017-08-27 07:17 Grandyang 阅读(4531) 评论(0) 推荐(0) 编辑

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