输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 输入:head = [1,3,2]输出:[2,3,1] 限制: 0 <= 链表长度 <= 10000 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/cong-we ...
分类:
其他好文 时间:
2020-06-02 16:06:43
阅读次数:
62
https://leetcode-cn.com/problems/maximum-subarray/ 用DP,不断更新全局最大值与当前最大值 ...
分类:
其他好文 时间:
2020-06-02 13:15:24
阅读次数:
43
此博客链接:https://www.cnblogs.com/ping2yingshi/p/13027189.html 反转字符串中的字符串() 题目链接:https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/ 给定一个字符串,你 ...
分类:
其他好文 时间:
2020-06-01 20:28:19
阅读次数:
76
https://leetcode.com/problems/cherry-pickup/ 给一个N*N的矩阵代表一个果园,1代表有果子,0代表空地,-1代表墙,不可通过 现在要求你从(0,0)点先走到(N-1,N-1)点,只能向下或者向右移动,再从(N-1,N-1)点走回(0,0)点,只能向上或者向 ...
分类:
其他好文 时间:
2020-06-01 09:12:06
阅读次数:
61
题目描述 leetcode - 1:https://leetcode-cn.com/problems/two-sum/ 解题关键 hashmap的使用 碎碎念 题目比较简单,暴力过很容易,不过借助hash可以降低时间复杂度,但是增加了空间的消耗。学习了hashmap的使用 key:value 定义 ...
分类:
其他好文 时间:
2020-06-01 01:06:46
阅读次数:
77
地址 https://leetcode-cn.com/problems/symmetric-tree/ 给定一个二叉树,检查它是否是镜像对称的。 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。 1 / \ 2 2 / \ / \ 3 4 4 3 但是下面这个 [1,2,2,null,3,n ...
分类:
其他好文 时间:
2020-05-31 12:55:56
阅读次数:
49
题目链接:https://leetcode-cn.com/problems/ba-zi-fu-chuan-zhuan-huan-cheng-zheng-shu-lcof/ 应该先去除字符串首部的空格,然后再判断正负。 难点在于处理溢出。 INT_MAX 2147483647 INT_MIN -214 ...
分类:
其他好文 时间:
2020-05-31 11:01:35
阅读次数:
51
原题目(https://leetcode-cn.com/problems/partition-list/): 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。 你应当保留两个分区中每个节点的初始相对位置。 示例: 输入: head = 1->4- ...
分类:
其他好文 时间:
2020-05-31 00:39:22
阅读次数:
57
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist ...
分类:
其他好文 时间:
2020-05-30 23:25:31
阅读次数:
106
84. 柱状图中最大的矩形 题目来源:力扣(LeetCode)https://leetcode-cn.com/problems/largest-rectangle-in-histogram/ 题目 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。 求在该柱状图 ...
分类:
编程语言 时间:
2020-05-30 20:17:18
阅读次数:
73