自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

这里是野生的高槻弥生~喵~

这里是野生的高槻弥生~喵~

  • 博客(60)
  • 资源 (1)
  • 收藏
  • 关注

原创 哦豁,我玩球了

转行了转行了,跨行如隔山,去做射频去了。

2023-09-20 14:46:33 52

原创 95. Unique Binary Search Trees II. Sol

官方解答写的很好搬运一下Given an integern, returnall the structurally uniqueBST's (binary search trees), which has exactlynnodes of unique values from1ton. Return the answer inany order.Example 1:Input: n = 3Output: [[1,null,2,null,3],[1,null,3,2],...

2022-02-23 21:23:20 99

原创 779. K-th Symbol in Grammar. Sol

这个题目是没有官方Sol的。用循环是不可以解出的(Memory or Time exceeded),罕见的必须要用递归的题目,而且递归的写法也很优雅We build a table ofnrows (1-indexed). We start by writing0in the1strow. Now in every subsequent row, we look at the previous row and replace each occurrence of0with01, and...

2022-02-22 18:57:36 127

原创 满血复活~喵呜~喵~呜~

满血复活

2022-02-20 18:35:43 85

原创 50. Pow(x, n). O(logN)​ Sol

搬运一下官方解答的二分法,时间复杂度为O(log)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...

2022-02-14 03:35:21 269

原创 70. Climbing Stairs. Iter--Sol

也是斐波那契数列的变体。区别是初始项不同。如果直接用递归做会比较耗时You are climbing a staircase. It takesnsteps to reach the top.Each time you can either climb1or2steps. In how many distinct ways can you climb to the top?Example 1:Input: n = 2Output: 2Explanation: There...

2022-02-14 03:20:08 212

原创 509. Fibonacci Number. Sol

还是Easy的题目,所以多做一点提升自信心(bushi)用递归很简单,不过这里不是用递归做的,是用普通的迭代,只需要一个for循环就够了TheFibonacci numbers, commonly denotedF(n)form a sequence, called theFibonacci sequence, such that each number is the sum of the two preceding ones, starting from0and1. That is,...

2022-02-14 03:10:38 139

原创 119. Pascal‘s Triangle II. Sol

Easy难度的题目,其实是二项式展开,不需要递归就可以了Given an integerrowIndex, return therowIndexth(0-indexed) row of thePascal's triangle.InPascal's triangle, each number is the sum of the two numbers directly above it as shown:Example 1:Input: rowIndex = 3O...

2022-02-14 01:50:21 180

原创 700. Search in a Binary Search Tree. Sol

是一道Easy题目,但是想要写的简洁一点也不容易You are given therootof a binary search tree (BST) and an integerval.Find the node in the BST that the node's value equalsvaland return the subtree rooted with that node. If such a node does not exist, returnnull.Examp...

2022-02-13 21:11:59 136

原创 344. Reverse String. Sol

搬运的官方sol,感觉不用区分奇偶还是不错滴Write a function that reverses a string. The input string is given as an array of characterss.You must do this by modifying the input arrayin-placewithO(1)extra memory.Example 1:Input: s = ["h","e","l","l","o"]Output:...

2022-02-13 19:22:30 182

原创 236. Lowest Common Ancestor of a Binary Tree. Sol

只需要遍历两次的解法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 both...

2022-02-12 18:16:21 240

原创 297. Serialize and Deserialize Binary Tree. Sol

懒得写了。。直接搬运一下官方答案Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or an

2022-02-12 16:27:08 73

原创 117. Populating Next Right Pointers in Each Node II. Sol

自己写的普通层序遍历from collections import dequeclass Solution: def connect(self, root): if not root or (root.left==None and root.right==None): return root queue = deque([root,]) while queue: # number of elem

2022-02-12 00:58:57 155

原创 117. Populating Next Right Pointers in Each Node II. Sol

官方解答写的非常好,搬运一下class Solution: def processChild(self, childNode, prev, leftmost): if childNode: # If the "prev" pointer is alread set i.e. if we # already found atleast one node on the next level,

2022-02-12 00:54:18 539

原创 前序和中序遍历重建二叉树--105. Construct Binary Tree from Preorder and Inorder Traversal. Sol

Given two integer arrayspreorderandinorderwherepreorderis the preorder traversal of a binary tree andinorderis the inorder traversal of the same tree, construct and returnthe binary tree.Example 1:Input: preorder = [3,9,20,15,7], inorder ...

2022-02-11 18:40:25 163

原创 后序和中序遍历重建二叉树--106. Construct Binary Tree from Inorder and Postorder Traversal. Sol

非常有意思的一道题Given two integer arraysinorderandpostorderwhereinorderis the inorder traversal of a binary tree andpostorderis the postorder traversal of the same tree, construct and returnthe binary tree.Example 1:Input: inorder = [9,3,15,20...

2022-02-11 18:18:55 302

原创 妖梦你还有很多幽灵要杀

​​​​​​​

2022-02-11 16:27:20 170

原创 250. Count Univalue Subtrees. Sol

不讲武德地使用了set()函数Given therootof a binary tree, return the number ofuni-valuesubtrees.Auni-value subtreemeans all nodes of the subtree have the same value.Example 1:Input: root = [5,1,5,5,5,null,5]Output: 4Example 2:Input: root = []...

2022-02-11 16:22:26 86

原创 112. Path Sum. Sol

Recursion 简洁的递归算法Given therootof a binary tree and an integertargetSum, returntrueif the tree has aroot-to-leafpath such that adding up all the values along the path equalstargetSum.Aleafis a node with no children.Example 1:Input: ...

2022-02-10 20:48:32 250

原创 101. Symmetric Tree. Sol

提供一种很有意思的递归解法Given therootof a binary tree,check whether it is a mirror of itself(i.e., symmetric around its center).Example 1:Input: root = [1,2,2,3,4,4,3]Output: trueExample 2:Input: root = [1,2,2,null,3,null,3]Output: false...

2022-02-10 19:44:20 182

原创 104. Maximum Depth of Binary Tree. Sol

Given therootof a binary tree, returnits maximum depth.A binary tree'smaximum depthis the number of nodes along the longest path from the root node down to the farthest leaf node.from collections import dequeclass Solution: def maxDepth(self...

2022-02-10 16:34:09 155

原创 二叉树Morris遍历——Binary Tree Morris Traversal without Modifying Tree

基于官方解答的改进,Morris Traversal 且不用更改原来树的结构Morris原文Traversing binary trees simply and cheaply - ScienceDirectPreOrder 前序遍历 class Solution(object): def preorderTraversal(self, root): node, output = root, [] while node: i

2022-02-10 02:40:32 368

原创 61. Rotate List. Sol

Given theheadof a linkedlist, rotate the list to the right bykplaces.Example 1:Input: head = [1,2,3,4,5], k = 2Output: [4,5,1,2,3]Example 2:Input: head = [0,1,2], k = 4Output: [2,0,1]Constraints:The number of nodes in the l...

2022-02-06 02:18:00 271

原创 138. Copy List with Random Pointer. Sol

LeetCode官方教程参考答案,穷学生只充了一个月的会员,记录下来备忘A linked list of lengthnis given such that each node contains an additional random pointer, which could point to any node in the list, ornull.Construct adeep copyof the list. The deep copy should consist of exac...

2022-02-06 00:11:58 55

原创 708. Insert into a Sorted Circular Linked List. Sol

Given a Circular Linked List node, which is sorted in ascending order, write a function to insert a valueinsertValinto the list such that it remains a sorted circular list. The given node can be a reference to any single node in the list and may not nece..

2022-02-05 23:49:58 296

原创 430. Flatten a Multilevel Doubly Linked List. Sol

You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additionalchild pointer. This child pointer may or may not point to a separate doubly linked list, also containing these special nodes. These chi.

2022-02-05 22:19:35 77

原创 2. Add Two Numbers. Sol

重点是添加新的结点。You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse order, and each of their nodes contains a single digit. Add the two numbers and return the sumas a linked list.You may assume t...

2022-02-05 19:35:08 706

原创 21. Merge Two Sorted Lists. Sol

LeetCode官方教程参考答案,穷学生只充了一个月的会员,记录下来备忘You are given the heads of two sorted linked listslist1andlist2.Merge the two lists in a onesortedlist. The list should be made by splicing together the nodes of the first two lists.Returnthe head of the merg...

2022-02-05 17:10:01 41

原创 203. Remove Linked List Elements. Sol

Given theheadof a linked list and an integerval, remove all the nodes of the linked list that hasNode.val == val, and returnthe new head.Example 1:Input: head = [1,2,6,3,4,5,6], val = 6Output: [1,2,3,4,5]Example 2:Input: head = [], val...

2022-02-04 06:12:58 583

原创 206. Reverse Linked List. Sol

LeetCode官方教程参考答案,穷学生只充了一个月的会员,记录下来备忘本专栏无以上特殊说明的其他Sol是自己写的Given theheadof a singly linked list, reverse the list, and returnthe reversed list.Example 1:Input: head = [1,2,3,4,5]Output: [5,4,3,2,1]Example 2:Input: head = [1,2]Outp...

2022-02-04 05:05:16 392

原创 19. Remove Nth Node From End of List. Sol

Given theheadof a linked list, remove thenthnode from the end of the list and return its head.Example 1:Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]Example 2:Input: head = [1], n = 1Output: []Example 3:Input: head = [1,2], n...

2022-02-04 04:30:26 784

原创 160. Intersection of Two Linked Lists.Sol

Given the heads of two singly linked-listsheadAandheadB, returnthe node at which the two lists intersect. If the two linked lists have no intersection at all, returnnull.For example, the following two linked lists begin to intersect at nodec1:T...

2022-02-04 00:29:20 60

原创 142. Linked List Cycle II .Sol

总之官方答案是错的。。。下面是自己写的O(1)解法,缺点是比较慢。。。Given theheadof a linked list, returnthe node where the cycle begins. If there is no cycle, returnnull. (其实应该是None,太久没写Python了比较生,语法都不会了)There is a cycle in a linked list if there is some node in the list that c...

2022-02-03 21:02:16 775

原创 希望接下来的一年能继续努力呀~

首先每日一问自己啥时候写完leetcode

2022-02-03 19:46:27 429

原创 LeetCode 141. Linked List Cycle Sol.

LeetCode官方教程参考答案,穷学生只充了一个月的会员,记录下来备忘Givenhead, the head of a linked list, determine if the linked list has a cycle in it.There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following thenextp...

2022-01-29 18:06:41 217

原创 LeetCode 707. Design Linked List Sol.

LeetCode官方教程参考答案,穷学生只充了一个月的会员,记录下来备忘Design your implementation of the linked list. You can choose to use a singly or doubly linked list.A node in a singly linked list should have two attributes:valandnext.valis the value of the current node, andne...

2022-01-29 01:27:32 61

原创 接下来的更新计划~

放一些接下来的更新计划~To be UpdateRF Power Amplifierfor Wireless Communication的读书笔记~LOGIC SYNTHESISAND VERIFICATION ALGORITHMS的读书笔记~还有一些关于VLSI 设计的内容,虽然学的并不好~

2021-12-09 14:08:11 108

原创 作者还活着

STM32 学习笔记 —— 基于ucgui ucos的LED亮度控制和ADC实时采样显示程序最菜的我又回来啦~这次是ucgui ucos程序的配置和修改,程序的蓝本为奋斗stm32配套例程——ucgui ucos ADC程序和LED闪烁控制程序,这两个程序的功能分别为:...

2021-07-05 21:53:41 73

原创 Pandas dtype object 对象转化成float数组以及String Replace Error 解决方法

新手友好的纯小白入门指南,因为我自己也是小白。Pandas读取csv文件后遇到了问题,读入的数据DataFrame格式可以理解为字典,每一个column对应csv表格中的一列。为了进行下一步处理,需要将原来的数据转化为浮点数(float)格式。但是使用dtype()查看了一下,发现需要读数据的那一列的元素格式是object。是我比较菜,python才入门一个星期,实在不知道这是什么东东。读...

2020-03-31 10:56:32 8861 3

原创 Python3 小白吃土之旅(3)—— 第4章-7 统计学生平均成绩与及格人数 (15分)

本题要求编写程序,计算学生们的平均成绩,并统计及格(成绩不低于60分)的人数。题目保证输入与输出均在整型范围内。输入格式:输入在第一行中给出非负整数N,即学生人数。第二行给出N个非负整数,即这N位学生的成绩,其间以空格分隔。输出格式:按照以下格式输出:average = 成绩均值count = 及格人数其中平均值精确到小数点后一位。输入样例:57...

2020-03-26 10:45:56 402

简易教务系统.zip

渣渣做的简易教务网系统,是学校的大作业,因为是第一次接触Qt和SQLite也不是很熟练,大家看看就好啦^_^ 有学生和老师两种账户,可以实现用户注册及登陆,学生选课退课(可避免冲突),老师开课,查询并防止开课冲突的功能。 后续会补充文档说明哒! 如果是学弟学妹们来下载,还是建议自己亲手做一遍哦~

2019-10-22

空空如也

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

TA关注的人

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