摘要: https://leetcode.cn/problems/reverse-linked-list-ii/ class Solution: def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Opti 阅读全文
posted @ 2022-11-11 23:18 7aughing 阅读(11) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/least-number-of-unique-integers-after-k-removals/ # https://leetcode.com/problems/least-number-of-unique-integers-after-k 阅读全文
posted @ 2022-11-09 08:01 7aughing 阅读(7) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/reach-a-number/ # 假设target=4, # 一直累加步数,直到其正好大于等于target # 0 + 1 + 2 + 3 = 6 # 此时累加和已经大于target,且差值为偶数6-4=2;那么实际上只要将加上距离为1的时 阅读全文
posted @ 2022-11-07 07:33 7aughing 阅读(15) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/palindrome-partitioning-ii/ # dp[i] 表示 s[0..i] 切分为回文子串的最小分割次数 # dp[i] = min(dp[j] + 1) , 如果 s[j+1...i]是回文串, j < i # dp[i] 阅读全文
posted @ 2022-11-06 20:20 7aughing 阅读(9) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/flip-string-to-monotone-increasing/ def minFlipsMonoIncr(self, s: str) -> int: # n0: 统计当前字符的右边还有多少个0需要被置为1 # n1: 统计当前字符的左 阅读全文
posted @ 2022-11-06 19:35 7aughing 阅读(16) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/find-the-duplicate-number/submissions/ 方法1:pos记录无重复区间的下一个位置 (TLE) def findDuplicate(self, nums: List[int]) -> int: pos = 阅读全文
posted @ 2022-11-06 13:45 7aughing 阅读(12) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/implement-queue-using-stacks/ push: 直接插入辅助栈 pop/peak: 1.如果数据栈有数据,直接出栈; 2.1.否则,如果辅助栈有数据,不停出栈给到数据栈 2.2.出栈数据栈中的元素 class MyQu 阅读全文
posted @ 2022-11-06 11:15 7aughing 阅读(3) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/word-ladder/ 阅读全文
posted @ 2022-10-22 23:31 7aughing 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 检查数据 如果输入的是图片数据,先检查是否有 打不开的图片/大小明显异常的图片; 检查输入模型的数据是否与所使用的loss函数提供接口中的要求相一致。 检查所有除式中的分母 特别是在自己实现的归一化函数中,尤其需要注意。 检查是否有进行log_softmax。 检查是否有使用正确的激活函数。 如果在 阅读全文
posted @ 2022-10-22 23:06 7aughing 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 1、序列化 #coding:utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np im 阅读全文
posted @ 2022-10-22 22:53 7aughing 阅读(130) 评论(0) 推荐(0) 编辑