Leetcode题解
文章平均质量分 60
xinxinp_
这个作者很懒,什么都没留下…
展开
-
783. 二叉搜索树结点最小距离
给定一个二叉搜索树的根结点 root, 返回树中任意两节点的差的最小值。示例:输入: root = [4,2,6,1,3,null,null]输出: 1解释:注意,root是树结点对象(TreeNode object),而不是数组。给定的树 [4,2,6,1,3,null,null] 可表示为下图: 4 / \ 2 ...原创 2018-08-12 00:38:51 · 353 阅读 · 0 评论 -
551. 学生出勤纪录 I
给定一个字符串来代表一个学生的出勤纪录,这个纪录仅包含以下三个字符:'A' : Absent,缺勤 'L' : Late,迟到 'P' : Present,到场如果一个学生的出勤纪录中不超过一个'A'(缺勤)并且不超过两个连续的'L'(迟到),那么这个学生会被奖赏。你需要根据这个学生的出勤纪录判断他是否会被奖赏。示例 1:输入: "PPALLP"输出: True示例...原创 2018-08-12 00:54:44 · 78 阅读 · 0 评论 -
806. Number of Lines To Write String
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it...原创 2018-08-28 13:59:54 · 118 阅读 · 0 评论 -
143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-...原创 2018-08-28 16:42:37 · 98 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", which the length is 3.Example 2:...原创 2018-08-29 14:38:15 · 88 阅读 · 0 评论 -
50. Pow(x, n)
Implement pow(x, n), which calculates x raised to the power n (x^n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00000,...原创 2018-09-03 17:07:19 · 193 阅读 · 0 评论