随笔分类 -  Leetcode

leetcode practice notes
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD 阅读全文
posted @ 2018-01-09 09:13 安新 阅读(119) 评论(0) 推荐(0) 编辑
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2018-01-08 13:29 安新 阅读(125) 评论(0) 推荐(0) 编辑
摘要:In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes (wi 阅读全文
posted @ 2017-12-11 04:42 安新 阅读(505) 评论(0) 推荐(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-08-26 11:30 安新 阅读(170) 评论(0) 推荐(0) 编辑
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2017-08-06 00:17 安新 阅读(141) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2017-08-05 12:19 安新 阅读(132) 评论(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 @ 2017-07-31 06:14 安新 阅读(160) 评论(0) 推荐(0) 编辑
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2017-07-30 11:26 安新 阅读(235) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and sum 阅读全文
posted @ 2017-07-29 21:29 安新 阅读(224) 评论(0) 推荐(0) 编辑
摘要:112. Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals th 阅读全文
posted @ 2017-07-29 10:04 安新 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: # it actually examines the know 阅读全文
posted @ 2017-07-26 14:06 安新 阅读(133) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define 阅读全文
posted @ 2017-07-25 23:13 安新 阅读(160) 评论(0) 推荐(0) 编辑
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2017-07-22 10:08 安新 阅读(122) 评论(0) 推荐(0) 编辑
摘要:Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1:Input: "bbbab 阅读全文
posted @ 2017-07-19 12:47 安新 阅读(123) 评论(0) 推荐(0) 编辑
摘要:In LeetCode Store, there are some kinds of items to sell. Each item has a price. However, there are some special offers, and a special offer consists 阅读全文
posted @ 2017-07-16 04:32 安新 阅读(690) 评论(0) 推荐(0) 编辑
摘要:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o 阅读全文
posted @ 2017-07-13 21:15 安新 阅读(243) 评论(0) 推荐(0) 编辑
摘要:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyza 阅读全文
posted @ 2017-07-08 23:22 安新 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should 阅读全文
posted @ 2017-07-07 13:54 安新 阅读(260) 评论(0) 推荐(0) 编辑
摘要:Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2017-07-05 10:39 安新 阅读(130) 评论(0) 推荐(0) 编辑
摘要:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin 阅读全文
posted @ 2017-07-04 13:20 安新 阅读(139) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示