随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2018-03-20 16:00 __Meng 阅读(106) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa 阅读全文
posted @ 2018-03-20 15:18 __Meng 阅读(413) 评论(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 @ 2018-03-19 20:59 __Meng 阅读(119) 评论(0) 推荐(0)
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2018-03-19 14:54 __Meng 阅读(122) 评论(0) 推荐(0)
摘要:Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should return the largest palindro 阅读全文
posted @ 2018-03-18 20:43 __Meng 阅读(118) 评论(0) 推荐(0)
摘要:Shuffle a set of numbers without duplicates. Example: 阅读全文
posted @ 2018-03-18 16:30 __Meng 阅读(95) 评论(0) 推荐(0)
摘要:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文
posted @ 2018-03-16 16:20 __Meng 阅读(124) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2018-03-16 14:47 __Meng 阅读(144) 评论(0) 推荐(0)
摘要:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2018-03-16 14:33 __Meng 阅读(168) 评论(0) 推荐(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 @ 2018-03-15 19:40 __Meng 阅读(119) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2018-03-15 18:53 __Meng 阅读(193) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all 阅读全文
posted @ 2018-03-15 16:23 __Meng 阅读(104) 评论(0) 推荐(0)
摘要:S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to per 阅读全文
posted @ 2018-03-14 22:06 __Meng 阅读(247) 评论(0) 推荐(0)
摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2018-03-13 18:52 __Meng 阅读(126) 评论(0) 推荐(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 @ 2018-03-13 14:37 __Meng 阅读(186) 评论(0) 推荐(0)
摘要:In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascend 阅读全文
posted @ 2018-03-12 09:51 __Meng 阅读(140) 评论(0) 推荐(0)
摘要:We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, 阅读全文
posted @ 2018-03-11 19:12 __Meng 阅读(173) 评论(0) 推荐(0)
摘要:There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison 阅读全文
posted @ 2018-03-11 12:15 __Meng 阅读(217) 评论(0) 推荐(0)
摘要:Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the 阅读全文
posted @ 2018-03-11 10:44 __Meng 阅读(130) 评论(0) 推荐(0)
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2018-03-10 19:12 __Meng 阅读(164) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页