![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法笔记
文章平均质量分 69
银域果酒
这个作者很懒,什么都没留下…
展开
-
力扣27题 移除元素 python的三种解法
力扣27题 移除元素暴力解法双指针三行解法 给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。 不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。示例 1:输入:nums = [3,2,2,3], val = 3输出:2, nums = [2,2]解释:函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。你不需要考虑原创 2021-09-17 21:51:53 · 816 阅读 · 0 评论 -
PAT A1020 Tree Traversals 根据后序和中序遍历求得层序遍历
PAT A1020 Tree Traversals 根据后序和中序遍历求得层序遍历Problem Description Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of原创 2021-03-12 19:46:40 · 136 阅读 · 0 评论