自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 求二叉树的最小深度

题目:求给定二叉树的最小深度。最小深度是指树的根结点到最近叶子结点的最短路径上结点的数量。Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest lea...

2020-03-17 18:16:14 394

原创 期末作业:8.3

题目:吝啬SAT问题是这样的:给定一组句子(每个字句都是其中文字的析取)和整数k,求一个最多有k个变量为true的满足赋值——如果该赋值存在。证明吝啬SAT是NP-完全问题。解:当变量的总的个数为k个时,这就是一个SAT问题,因此可以把SAT问题归约为吝啬SAT问题,易知,此归约只需要多项式的时间,由课本可知,SAT是NP完全问题,因此,吝啬SAT也是一个NP完全问题。

2017-07-15 18:35:52 278

原创 【LectCode】98. Validate Binary Search Tree

题目: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

2017-07-15 18:24:27 266

原创 【LectCode】102. Binary Tree Level Order Traversal

题目: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 /

2017-07-15 16:26:08 220

原创 【LectCode】129. Sum Root to Leaf Numbers

题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find

2017-07-15 13:32:40 309

原创 【LectCode】450. Delete Node in a BST

题目:Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be

2017-07-15 12:36:56 192

原创 【LectCode】222. Count Complete Tree Nodes

题目:Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely

2017-07-15 01:36:51 193

原创 【LectCode】230. Kth Smallest Element in a BST

题目:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ? k ? BST's total elements.Follow up:Wh

2017-07-15 00:11:50 180

原创 【LectCode】513. Find Bottom Left Tree Value

题目:Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2

2017-07-14 23:26:21 232

原创 【LectCode】515. Find Largest Value in Each Tree Row

题目:515. Find Largest Value in Each TDescriptionHintsSubmissionsDiscussSolutionDiscuss Editorial SolutionPick OneYou need to find the largest

2017-07-14 22:58:29 224

原创 【LectCode】16. 3Sum Closest

题目:16. 3Sum ClosestDescriptionHintsSubmissionsSolutionsTotal Accepted: 126037Total Submissions: 408305Difficulty: MediumContributor: LeetCodeGiven

2017-06-04 19:16:27 238

原创 【LectCode】15. 3Sum

题目:15. 3SumDescriptionHintsSubmissionsSolutionsTotal Accepted: 210369Total Submissions: 978070Difficulty: MediumContributor: LeetCodeGiven an arra

2017-06-04 18:31:35 259

原创 【LectCode】34. Search for a Range

题目:34. Search for a RangeAdd to ListDescriptionHintsSubmissionsSolutionsTotal Accepted: 130169Total Submissions: 418001Difficulty: MediumContributor: LeetCode

2017-05-08 00:02:30 338

原创 【LeetCode】50. Pow(x, n)

题目:50. Pow(x, n)Add to ListDescriptionHintsSubmissionsSolutionsTotal Accepted: 143792Total Submissions: 539052Difficulty: MediumContributor: LeetCodeI

2017-04-23 14:19:46 344

原创 【LeetCode】8. String to Integer (atoi)

题目:mplement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input

2017-03-26 18:12:48 181

原创 【leetcode】215. Kth Largest Element in an Array

题目:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, ret

2017-03-12 23:53:16 224

原创 【LeetCode】4.Median Of Two Sorted Arrays

题目: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)).Example 1:

2017-03-06 13:24:11 195

原创 【LeetCode】2.Add Two Numbers

题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r

2017-02-25 15:54:32 210

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除