
刷题
lzAllen
这个作者很懒,什么都没留下…
展开
-
Stacking学习策略
Stacking学习策略1. 交叉验证KFold交叉验证——sklearn.model_selection.KFold2. Stacking理论Stacking 模型融合原理详解3. Stacking代码实践集成学习中的 stacking 以及python实现转载 2020-10-23 22:14:54 · 372 阅读 · 0 评论 -
目标检测方面的面试题
目标检测怎么提升召回率1 提高采样密度(特征/图像增强、增多预设proposal .. )。2 在对于误检不敏感任务中降低分类阈值。3 数据的增广,合成新的数据。4 使用聚类来设置anchor的大小和比例,使得边框有一个好的初始化。5 在测试的时候降低分类的阈值。6 使用基于IOU, 或者位置边框的损失函数,拉开不匹配的,拉近匹配的框。...原创 2020-09-24 16:29:47 · 2695 阅读 · 0 评论 -
LeetCode刷题 插分数组技巧
LeetCode刷题 插分数组技巧具体方法参考labuladong的论那些小而美的算法技巧:差分数组/前缀和1109. 航班预订统计方法一: 使用hashmap来辅助的暴力遍历叠加解法(超时)class Solution(object): # 用hash辅助的暴力法, 但是会超时 def corpFlightBookings(self, bookings, n): """ :type bookings: List[List[int]]原创 2020-09-10 16:19:08 · 255 阅读 · 0 评论 -
剑指offer刷题记录
剑指offer刷题记录2020/09/02链表中倒数第k个结点递归法:链表的后续遍历,并用self.k来记录倒数节点的位置,找到了就返回找到的节点,否则返回None# -*- coding:utf-8 -*-# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def __init__(self): .原创 2020-09-02 19:41:26 · 176 阅读 · 0 评论 -
Leetcode刷题(24) DP Table斜着遍历, 且只用Table的上半三角的动态规划
Leetcode刷题(24) DP Table斜着遍历, 且只用Table的上半三角的动态规划博弈问题参考labuladong的动态规划之博弈问题877. 石子游戏class Solution(object): def stoneGame(self, piles): """ :type piles: List[int] :rtype: bool """ n = len(piles) dp原创 2020-08-19 10:53:25 · 360 阅读 · 0 评论 -
Leetcode刷题(25) 树的问题
Leetcode刷题(25) 树的问题剑指 Offer 68 - II. 二叉树的最近公共祖先# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution(object): def l原创 2020-08-30 23:01:04 · 201 阅读 · 0 评论 -
Leetcode刷题(23) BFS系列
Leetcode刷题(23) BFS系列773. 滑动谜题该为python的实现方式,主要参考labuladong的益智游戏克星:BFS暴力搜索算法import collectionsimport copyclass Solution(object): def slidingPuzzle(self, board): """ :type board: List[List[int]] :rtype: int """原创 2020-08-14 12:16:30 · 180 阅读 · 0 评论 -
牛客华为机试
明明的随机数和Leetcode的移动零很相似import sysdef main(): # sys.stdin = open('input.txt', 'r') lines = sys.stdin.readlines() # 第一组数的起点(该组数有几个) start = 0 for i, num in enumerate(lines): if start == i: nums = [] ...原创 2020-08-14 21:55:30 · 664 阅读 · 0 评论 -
Leetcode刷题(22) 以基本数据结构的高级数据结构及其API
146. LRU缓存机制class ListNode: def __init__(self, key=None, value=None): self.key = key self.value = value self.prev = None self.next = Noneclass LRUCache: def __init__(self, capacity): self.capac转载 2020-08-12 14:52:53 · 158 阅读 · 0 评论 -
牛客刷题(网易)
牛牛找工作import sys# 利用HashMap来将任务升维度来降低时间复杂度def main(): # 读取所有的行 lines = sys.stdin.readlines() # 将输入转化为一个二维数组,每一行都是其中的一个一维数组 lines = [l.strip().split() for l in lines if l.strip()] # 获得工作的数量和工人的数量 n, m = int(lines[0][0]), int(line原创 2020-08-07 12:33:18 · 240 阅读 · 0 评论 -
Leetcode刷题(21) 链表反转系列
Leetcode刷题(21) 链表反转系列具体方法参考labuladong的如何k个一组反转链表,该比较是用python的实现25. K 个一组翻转链表reverse(a, b)使用的是迭代的方法,在开区间[a, b)中反转链表,reverseKGroup(a, k)使用的是递归的方法。# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# s原创 2020-07-21 09:01:04 · 153 阅读 · 0 评论 -
Leetcode刷题(20) 回溯实践
Leetcode刷题(19) 回溯实践参考buladong的回溯算法最佳实践:括号生成22. 括号生成class Solution(object): def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ left = n right = n track = [] res原创 2020-07-12 21:26:04 · 208 阅读 · 0 评论 -
Leetcode刷题(19) 哈希表老辅助了
Leetcode刷题(18) 哈希表老辅助了在数组问题中,哈希表常常可以用空间复杂度换时间复杂度1. 两数之和参考labuladong的TwoSum问题的核心思想class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """原创 2020-07-10 19:48:00 · 268 阅读 · 0 评论 -
Leetcode刷题(18) 最大自序和, 最长递增子序列,最大....
Leetcode刷题(17) 最大自序和, 最长递增子序列这两道题较为类似,dp数组的定义比较特别,转移方程也很相似。方法参考labuladong的动态规划设计:最大子数组和动态规划设计:最长递增子序列53. 最大子序和class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """原创 2020-07-08 19:37:25 · 226 阅读 · 0 评论 -
Leetcode刷题(17) 双指针系列
Leetcode刷题(16) 双指针系列快慢指针系列(泛指)参考labuladong的如何去除有序数组的重复元素26. 删除排序数组中的重复项# 双指针(快慢指针)class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ n = len(nums)原创 2020-07-07 21:53:43 · 169 阅读 · 0 评论 -
Leetcode刷题(11) 背包问题系列(动态规划)
Leetcode刷题(11) 背包问题系列416. 分割等和子集参考labuladong的经典动态规划:0-1 背包问题,经典动态规划:0-1背包问题的变体# 0-1背包问题的变体class Solution(object): def canPartition(self, nums): """ :type nums: List[int] :rtype: bool """ size = len(nums)原创 2020-07-04 19:13:44 · 667 阅读 · 0 评论 -
Leetcode刷题(16) 回文链表系列
Leetcode刷题(16) 回文链表系列具体方法参考: labuladong的如何判断回文链表, 以下python的重写234. 回文链表# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.next = None# 单链表的后续遍历class Solution(object):原创 2020-07-02 22:23:48 · 188 阅读 · 0 评论 -
Leetcode刷题(15) 双字符串的问题
Leetcode刷题(15) 双子串的问题多用双指针和动态规划1143. 最长公共子序列具体方法参考labuladong经典动态规划:最长公共子序列方法一: 自底向下的递归(双指针)class Solution(object): def longestCommonSubsequence(self, text1, text2): """ :type text1: str :type text2: str :rtype原创 2020-07-01 22:02:51 · 205 阅读 · 0 评论 -
Leetcode刷题(14) 高楼扔鸡蛋
Leetcode刷题(14) 高楼扔鸡蛋具体方法参考labuladong的经典动态规划:高楼扔鸡蛋动态规划问题887. 鸡蛋掉落方法一: 动态规划,线性搜索 (python超时)class Solution(object): def superEggDrop(self, K, N): """ :type K: int :type N: int :rtype: int """ # 备忘原创 2020-06-30 23:02:30 · 653 阅读 · 0 评论 -
Leetcode刷题(13) 滑动窗口最大值(单调队列专用)
Leetcode刷题(13) 滑动窗口最大值(单调队列专用)具体方法参考labuladong的特殊数据结构:单调队列,python重写239. 滑动窗口最大值import collections# 创建一个单调队列的类, 队头大--->队尾小class MonotonicQueue(object): def __init__(self): # 创建一个双向list self.queue = deque() def getmax(sel原创 2020-06-30 22:01:32 · 227 阅读 · 0 评论 -
Leetcode刷题(12) 单调栈的应用
Leetcode刷题(12)Next Greater Element(单调栈专用)具体方法参考: labudadong的特殊数据结构:单调栈该笔记是在做LeetCode的时候使用python的重写版本496. 下一个更大元素 I# Next Greater Number 一般使用单调栈来解答class Solution(object): def nextGreaterElement(self, nums1, nums2): """ :type原创 2020-06-29 22:23:00 · 208 阅读 · 0 评论 -
Leetcode刷题(11) 打家劫舍系列问题
Leetcode刷题(11)打家劫舍系列问题方法参考labuladong的实现团灭 LeetCode 打家劫舍问题,并python重写了一遍198. 打家劫舍方法一: 递归+备忘录class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ # 有多少户人家 .原创 2020-06-28 21:46:02 · 328 阅读 · 0 评论 -
Leetcode刷题(9) 双指针之滑动窗口系列(多用于字符串匹配)
Leetcode刷题(5)76. 最小覆盖子串方法: 滑动窗口, 双指针class Solution(object): def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ # 维护两个字典,其中都记录着字符和对应的频数 windows = dict() # 窗口内的need中包含的原创 2020-08-14 12:13:59 · 222 阅读 · 0 评论