![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java
文章平均质量分 71
Stan_lu
这个作者很懒,什么都没留下…
展开
-
(美服leetcode)71. Simplify Path
题目:Given a stringpath, which is anabsolute path(starting with a slash'/') to a file or directory in a Unix-style file system, convert it to the simplifiedcanonical path.In a Unix-style file system, a period'.'refers to the current directory, a d...原创 2022-04-11 10:37:14 · 322 阅读 · 0 评论 -
(美服leetcode)50. Pow(x, n)
题目:Implementpow(x, n), which calculatesxraised to the powern(i.e.,xn).Example 1:Input: x = 2.00000, n = 10Output: 1024.00000Example 2:Input: x = 2.10000, n = 3Output: 9.26100Example 3:Input: x = 2.00000, n = -2Output: 0.25000...原创 2022-04-11 09:56:58 · 455 阅读 · 0 评论 -
(美服leetcode)227. Basic Calculator II
题目:Given a stringswhich represents an expression,evaluate this expression and return its value.The integer division should truncate toward zero.You may assume that the given expression is always valid. All intermediate results will be in the rang...原创 2022-04-10 05:52:13 · 120 阅读 · 0 评论 -
(美服leetcode)921. Minimum Add to Make Parentheses Valid
题目:A parentheses string is valid if and only if:It is the empty string, It can be written asAB(Aconcatenated withB), whereAandBare valid strings, or It can be written as(A), whereAis a valid string.You are given a parentheses strings. In...原创 2022-04-10 04:42:55 · 402 阅读 · 0 评论 -
(美服leetcode)236. Lowest Common Ancestor of a Binary Tree
题目:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodespandqas the lowest node inTthat has bothpandq...原创 2022-04-10 04:06:48 · 111 阅读 · 0 评论 -
(美服leetcode)1026. Maximum Difference Between Node and Ancestor
题目:Given therootof a binary tree, find the maximum valuevfor which there existdifferentnodesaandbwherev = |a.val - b.val|andais an ancestor ofb.A nodeais an ancestor ofbif either: any child ofais equal tobor any child ofais an ...原创 2022-01-01 02:25:28 · 123 阅读 · 0 评论 -
(美服leetcode)1015. Smallest Integer Divisible by K
题目:Given a positive integerk, you need to find thelengthof thesmallestpositive integernsuch thatnis divisible byk, andnonly contains the digit1.Returnthelengthofn. If there is no suchn, return -1.Note:nmay not fit in a 64-bit sign...原创 2021-12-31 03:03:47 · 132 阅读 · 0 评论 -
(美服leetcode)116. Populating Next Right Pointers in Each Node
题目:You are given aperfect binary treewhere all leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node { int val; Node *left; Node *right; Node *next;}Populate each next p..原创 2021-12-30 01:13:23 · 256 阅读 · 0 评论 -
(美服leetcode) 1901. Find a Peak Element II
题目:Apeakelement in a 2D grid is an element that isstrictly greaterthan all of itsadjacentneighbors to the left, right, top, and bottom.Given a0-indexedm x nmatrixmatwhereno two adjacent cells are equal, findanypeak elementmat[i][j]and r...原创 2021-12-29 06:23:14 · 542 阅读 · 0 评论 -
(美服leetcode) 973. K Closest Points to Origin
题目:Given an array ofpointswherepoints[i] = [xi, yi]represents a point on theX-Yplane and an integerk, return thekclosest points to the origin(0, 0).The distance between two points on theX-Yplane is the Euclidean distance (i.e.,√(x1- x2)2...原创 2021-12-27 04:44:09 · 133 阅读 · 0 评论