
算法
文章平均质量分 69
思维之上
我依旧没有看到计算机科学的大门,我只是见到了通过大门传过来的思维之光
展开
-
【LeetCode 385】Mini Parser(Python)
Problem:Given a nested list of integers represented as a string, implement a parser to deserialize it.Each element is either an integer, or a list -- whose elements may also be integers or other l...原创 2018-09-13 09:24:20 · 381 阅读 · 0 评论 -
【LeetCode 4】Median of Two Sorted Arrays(Python)
Problem:There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume n...原创 2018-09-12 12:58:53 · 356 阅读 · 0 评论 -
【LeetCode 135】Candy (Python)
Problem:There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on...原创 2018-03-17 15:22:55 · 509 阅读 · 0 评论 -
【LeetCode 11】Container With Most Water (Python)
Question:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). ...原创 2018-03-17 12:05:14 · 245 阅读 · 0 评论 -
【LeetCode 15】3Sum (C++)
Problem:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not conta...原创 2018-03-15 17:13:09 · 404 阅读 · 0 评论 -
【LeetCode 96】Unique Binary Search Trees (C++)
Problem: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's. 1 3 3 2 1 \ ...原创 2018-03-14 10:39:50 · 244 阅读 · 0 评论 -
【LeetCode 110】Balanced Binary Tree (C++)
Problem:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the depth of the two subtrees of every node never d...原创 2018-03-13 21:16:10 · 388 阅读 · 0 评论 -
【LeetCode 114】Flatten Binary Tree to Linked List (C++)
Problem:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ ...原创 2018-03-12 22:52:38 · 262 阅读 · 0 评论 -
【LeetCode 98】Validate Binary Search (C++)
Problem:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th...原创 2018-03-11 17:09:43 · 283 阅读 · 0 评论 -
【LeetCode 102】Binary Tree Level Order Traversal (C++)
Problem:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20...原创 2018-03-11 11:48:08 · 291 阅读 · 0 评论 -
【LeetCode 606】 Construct String from Binary Tree (C++)
Problem: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 represented by empty parenthesis pair "()". An...原创 2018-03-11 10:23:50 · 176 阅读 · 0 评论