- 博客(184)
- 收藏
- 关注
原创 力扣第二十九天(DP topic)
文章目录problem Ⅰsolution `DP`problem Ⅱsolution 1 `DP`solution 2 `short code`problem Ⅲsolutionproblem Ⅰ509. Fibonacci NumberThe Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the
2022-02-14 23:35:03
330
原创 力扣第二十八天(heap(priority queue) topic)
文章目录problem Ⅰsolution 1 `hashmap and priority queue`solution 2 `bucket`problem Ⅱmy solution 1 `max priority queue`solution 2 `sort`great solution 1 `binary search`great solution 2 `quick select`problem Ⅰ451. Sort Characters By FrequencyGiven a string s,
2022-02-13 16:32:35
759
原创 力扣第二十七天(heap(priority queue) topic)
文章目录problem Ⅰsolution 1problem Ⅱsolutionproblem Ⅰ215. Kth Largest Element in an ArrayGiven an integer array nums and an integer k, return the kth largest element in the array.Note that it is the kth largest element in the sorted order, not the kth dist
2022-02-12 15:50:40
7695
原创 力扣第二十六天(Graph topic)
文章目录problem Ⅰsolution 1 `matrix`solution 2 `only use a vector of size n`problem Ⅱsolution 1problem Ⅲsolutionproblem Ⅰ997. Find the Town JudgeIn a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the tow
2022-02-11 16:20:24
631
原创 力扣第二十五天(Tree topic)
文章目录problem Ⅰmy solution 1 `DFS`my solution 2 `use parent pointer`problem Ⅱsolution 1 `TLE`solution 2problem Ⅰ236. Lowest Common Ancestor of a Binary TreeGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.Accordin
2022-02-10 15:33:42
449
原创 力扣第二十四天(Tree topic)
文章目录problem Ⅰsolution 1 `recursive` `inorder-traversal`solution 2 `iterative (use stack)` `inorder-traversal`problem 2solutionproblem Ⅰ230. Kth Smallest Element in a BSTGiven the root of a binary search tree, and an integer k, return the kth smallest v
2022-02-09 13:52:18
341
原创 力扣第二十三天(Tree Topic)
文章目录problem Ⅰsolution 1 `BFS`solution 2 `DFS`problem 2solution `DFS`problem 3solution 1solution 2 `recursive [a little bit slow]`problem Ⅰ199. Binary Tree Right Side ViewGiven the root of a binary tree, imagine yourself standing on the right side of it,
2022-02-08 18:27:16
644
原创 力扣第二十二天 (Tree topic)
文章目录problem Ⅰmy solutionproblem Ⅱmy solution 1 `brute force`my solution 2 `hashmap`problem Ⅲmy solution 1 `use stack to reverse`my solution 2 `use reverse() instead of using stack`problem Ⅰ108. Convert Sorted Array to Binary Search TreeGiven an integer
2022-02-07 16:55:35
6530
原创 力扣第二十一天(stack, queue)
文章目录problem Ⅰmy solution 1 `stack`my solution 2 `cnt`problem Ⅱmy solution `wrong`my solution `queue`problem Ⅲsolutionproblem Ⅰ1249. Minimum Remove to Make Valid ParenthesesGiven a string s of ‘(’ , ‘)’ and lowercase English characters.Your task is to r
2022-02-06 15:08:37
344
原创 力扣第二十天(Linked List)
文章目录problem Ⅰmy solutionproblem Ⅱmy solution `wrong`my solution 1 `recursive`my solution 2 `iterative`problem Ⅰ143. Reorder ListYou are given the head of a singly linked-list. The list can be represented as:L0 → L1 → … → Ln - 1 → LnReorder the list
2022-02-05 15:25:57
548
原创 力扣第十九天(Linked List)
文章目录problem Ⅰmy solution 1 `loop`my solution 2 `concise solution 1`my problem 3 `recurisive (faster, less space)`problem Ⅱ`Rotten problem`my solutionproblem Ⅰ24. Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.
2022-02-04 15:16:55
1356
原创 力扣第十八天(Linked List)
文章目录problem Ⅰmy solution Ⅰmy solution Ⅱproblem Ⅱmy solutionothers solution `slow than me`problem Ⅰ160. Intersection of Two Linked ListsGiven the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the t
2022-02-03 21:46:26
1227
原创 力扣第十七天(Linked List)
文章目录problem Ⅰmy solutionproblem Ⅱmy solution Ⅰmy solution Ⅱproblem Ⅰ2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digi
2022-02-02 22:42:17
192
原创 力扣第十六天(String)
文章目录session Ⅰ Data Structureproblem Ⅰmy solution Ⅰ `TLE`my solution Ⅱ `DP more time less space`my solution Ⅲ `DP`session Ⅰ Data Structureproblem Ⅰmy solution Ⅰ TLEclass Solution {public: bool isreverse(string s){ int n = s.size();
2022-02-01 14:27:38
636
原创 力扣第十五天
文章目录session Ⅰ Algorithmproblem Ⅰmy solutionproblem Ⅱmy solutionproblem Ⅲmy solutionproblem Ⅳ `repeated`my solutionsession Ⅰ Algorithmproblem Ⅰ231. Power of TwoGiven an integer n, return true if it is a power of two. Otherwise, return false.An integer
2022-01-31 10:16:50
90
原创 力扣第十四天
文章目录session Ⅰ Algorithmproblem Ⅰmy solution 1problem Ⅱmy solution Ⅰ`Time Limit Exceeded`my solution Ⅱ `Top down DP`my solution Ⅲ `Bottom up DP`problem Ⅲmy solution Ⅰ `with DP-array`my solution Ⅱ`without DP-array`problem Ⅳmy solution `Bottom up DP`session
2022-01-30 16:46:44
619
原创 C++类内初始化vector 报错:expected parameter declarator
有一天我在打力扣的时候,我在solution类内初始化一个vector的时候,编译器发生了报错Line 3: Char 19: error: expected parameter declarator vector<int> t(46,0); ^我的代码长这样class Solution {public: vector<int> t(46,0);//这样子 int climbStairs(int n) {
2022-01-30 14:54:12
2596
原创 力扣第十三天
文章目录session Ⅰ Algorithmproblem Ⅰmy solutionsession Ⅰ Algorithmproblem Ⅰ21. Merge Two Sorted ListsYou are given the heads of two sorted linked lists list1 and list2.Merge the two lists in a one sorted list. The list should be made by splicing together
2022-01-29 15:13:55
898
原创 力扣第十二天
文章目录session Ⅰ Algorithmproblem Ⅰmy solution Ⅰ `Time Limit Exceeded`my solution 2 `very fast`problem Ⅱsession Ⅰ Algorithmproblem Ⅰ49. Group AnagramsGiven an array of strings strs, group the anagrams together. You can return the answer in any order.An A
2022-01-28 16:29:20
308
原创 力扣第十一天
session Ⅰ algorithmproblem Ⅰ542. 01 MatrixGiven an m x n binary matrix mat, return the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1:Input: mat = [[0,0,0],[0,1,0],[0,0,0]]Output: [[0,0,0],[0,1,0],[0
2022-01-27 15:36:56
661
原创 力扣第十天
文章目录session Ⅱ Data Structureproblem Ⅰmy solutionfaster solutionproblem Ⅱmy solutionfaster solutionsession Ⅱ Data Structureproblem Ⅰ290. Word PatternGiven a pattern and a string s, find if s follows the same pattern.Here follow means a full match, such
2022-01-26 13:00:20
1284
原创 力扣第九天
session Ⅰ algorithmproblem Ⅰ DFS617. Merge Two Binary TreesYou are given two binary trees root1 and root2.Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge t
2022-01-25 15:11:43
409
原创 力扣第八天
文章目录session Ⅰ algorithmproblem Ⅰmy wrong solution `Time Limit Exceeded`correct solution `recursion`problem Ⅱsession Ⅰ algorithmproblem Ⅰmy wrong solution Time Limit Exceededclass Solution {public: vector<vector<int>> floodFill(vector&l
2022-01-24 15:38:33
1028
原创 力扣第七天
文章目录session Ⅱ DataStructureproblem Ⅰsolution 1 `Time Limit Exceeded`correct solutionproblem Ⅱproblem Ⅲsession Ⅱ DataStructureproblem Ⅰ334. Increasing Triplet SubsequenceGiven an integer array nums, return true if there exists a triple of indices (i, j,
2022-01-23 21:51:26
1116
原创 vscode 添加万能头文件#include<bits/stdc++.h>
文章目录前言配置前言有一天我在愉快的刷着leetcode突然觉得写头文件好TM麻烦,于是就想着配置一下万能头文件配置的过程我觉得还是记录一下吧,很多初学者可能会犯迷糊配置首先,我们要清楚,我们在vscode上写C/C++程序的时候,我们的一些设置文件是在c_cpp_properties.json这个文件上配置的这个文件的位置在:想要修改c_cpp_properties.json这个文件,我们可以在vscode上使用快捷键Ctrl+shift+p然后点击下图的箭头所指的选项呐呐呐呐
2022-01-22 14:02:48
6401
6
原创 力扣第六天
文章目录session Ⅰ Algorithmproblem Ⅰmy wrong ansmy correct ansproblem ⅡWindow Sliding Techniquesession Ⅰ Algorithmproblem Ⅰ3. Longest Substring Without Repeating CharactersGiven a string s, find the length of the longest substring without repeating charact
2022-01-22 13:15:50
556
原创 力扣第五天
文章目录session Ⅰ Algorithmproblem Ⅰproblem Ⅱsession Ⅱ DataStructureproblem Ⅰproblem Ⅱmy wrong solutionmy success solutionmy faster solutionsession Ⅰ Algorithmproblem Ⅰ876. Middle of the Linked ListGiven the head of a singly linked list, return the middle
2022-01-21 15:59:52
510
原创 力扣第四天
文章目录session Ⅰ Algorithmproblem Ⅰproblem Ⅱmy solutionothers solutionsession Ⅱ DataStructureproblem Ⅰmy solution (recursion)my solution (loop)my solution (loop with pre declare)problem Ⅱproblem Ⅲsession Ⅰ Algorithmproblem Ⅰ344. Reverse StringWrite a func
2022-01-20 15:26:18
682
原创 力扣第三天
文章目录session Ⅰ Algorithmproblem Ⅰproblem Ⅱsession Ⅱ DataStructureproblem Ⅰproblem Ⅱmy wrong anscorrect ansproblem Ⅲsession Ⅰ Algorithmproblem Ⅰ283. Move ZeroesGiven an integer array nums, move all 0’s to the end of it while maintaining the relative ord
2022-01-19 13:38:56
390
原创 力扣第二天
文章目录session Ⅰproblem Ⅰproblem Ⅱsession Ⅰproblem Ⅰ977. Squares of a Sorted ArrayGiven an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.class Solution {public: vect
2022-01-18 15:09:54
850
原创 vscode 采用C++17版本进行编译
有一天我在打题的时候,使用了这种方式来初始化一个vectorvector<int> nums = {-4,-1,0,3,10};编译器马上很快就执行了编译命令if ($?) { g++ day2_1.cpp -o day2_1 } ; if ($?) { .\day2_1 }并且也很快的报了错(寄了)day2_1.cpp: In function 'int main()':day2_1.cpp:17:37: error: in C++98 'nums' must be initi
2022-01-18 12:02:48
8264
3
原创 大数据处理与分析---课程总结
文章目录实验大作业本学期的大数据处理与分析课程相当精品,老师不仅给我们提供了精美详细的电子版板书(纯手写),课堂上也对板书的内容进行了精彩的公式推导,并且举了一些生动的例子以方便我们直观理解。课程内容相当多,基本涵盖了大数据背景下的存储容灾算法、分布式数据一致性算法、分布式机器学习算法、大数据统计分析算法等多种算法,是一个相当合适的大数据算法入门课程本次课程的全部实验以及大作业都放到GitHub上了,需要的学弟学妹们可以自取,A+水平并且本专栏里也有对每个实验的博客讲解,可以参考实验实验大作
2022-01-18 00:42:37
2602
原创 力扣第一天
文章目录problem Ⅰproblem Ⅱproblem Ⅲproblem Ⅰ704. Binary SearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -
2022-01-18 00:19:47
531
原创 抽样技术--系统抽样
文章目录定义直线等距抽样圆形等距抽样等概系统抽样不等概系统抽样定义N个单元按一定顺序排列,抽一个起始单元,然后等距抽样直到满n个为止直线等距抽样r为初始起点,( j - 1 )k表示第几个抽样间隔圆形等距抽样i的确定等概系统抽样总体均值的方差不等概系统抽样...
2022-01-04 14:42:14
1507
原创 抽样技术--不等概率抽样
文章目录不等概抽样放回不等概抽样代码法拉希里法不放回不等概抽样只抽取一个样本单元的不等概抽样有放回不等概抽样不等概抽样放回不等概抽样总体的第i个单元被抽中的概率M0M_0M0:总体的总规模MiM_iMi:总体的第i个单元的大小为MiM_iMi这种不等概抽样称作放回的与规模大小成比例的概率抽样简称PPS抽样PPS的实施主要有两种方法:代码法就是根据样本规模来分配代码(id),然后对所有代码进行简单随机抽样拉希里法不用累计代码,两次随机数决定抽中的单位第一次:[1, N]之间的
2021-12-31 10:28:14
14605
1
原创 抽样技术--绪论
文章目录调查与抽样基本概念总体参数与统计量总体均值估计总体总值估计总体比例估计总体比率估计估计量方差、偏差、均方误差抽样误差与非抽样误差精度与费用几种基本的抽样方式简单随机抽样分层抽样系统抽样(等距抽样)整群抽样多阶段抽样非随机抽样技术抽样调查步骤调查与抽样调查:全面调查、非全面调查抽样:随机抽样:可以对由抽样产生的抽样误差进行估计非随机抽样:无法估计抽样误差抽样框:包含所有抽样单元的名单抽样单元:基本概念总体参数与统计量总体均值估计总体总值估计总体比例估计总体比率估
2021-12-29 15:48:38
1644
原创 大数据渐进学习性能框架测试
文章目录实验目的实验内容数据划分模型训练渐进融合RSP数据块下渐进融合HDFS数据块下渐进融合实验结论不懂RSP的请看我的这篇不懂HDFS的请看我的这篇实验目的掌握大规模数据集渐进融合学习框架的使用方法实验内容将大规模数据集Magic Dataset(记作 )随机划分成训练集 D^\hat DD^和验证集DDD两部分,之后确定训练集 的随机样本划分D^1,D^2,...,D^k\hat D_1,\hat D_2,...,\hat D_kD^1,D^2,...,D^k,其中 且对于任意的
2021-12-26 19:12:30
357
原创 大数据概率密度函数估计
文章目录实验目的实验内容实验过程对一维大规模数据进行核密度估计常用的核函数绘制概率密度图核密度估计函数的差异比较将总体划分为RSP数据块,并比较RSP的kde与总体的kdeRSP数据块的划分比较差异实验目的掌握基于随机样本划分数据块的大规模概率密度函数估计基本方法实验内容以一维大规模数据集 为例(N很大),构建核密度估计器其中h>0h>0h>0为窗口宽度(该参数可以自行设定),并绘制f(x)f(x)f(x)的图形。将x1,x2,...,xN{x_1,x_2,...,x_N}x
2021-12-22 13:15:51
1098
原创 数学文化赏析期末笔记
文章目录一. 笔记1)各种知识点2)数集3)几何4)幻方5)难题、猜想与定理二. 典中典题目:二进制猜数游戏斐波那契数列派对问题扑克牌余数问题取石子:扑克牌魔术RSA 编码直角三角形任取整点符佬的笔记感觉还有一丢丢遗漏,我这里补充一下一. 笔记1)各种知识点数学关注本质、共性、规律和联系结构:代数结构:“合作”,运算 & 运算规律。解决计算问题顺序结构:对比,大小、先后、隶属。解决比较问题拓扑结构:亲疏 & 规模大小的距离。解决度量问题数学从结论(公理)出发,采用逻辑演
2021-12-20 23:29:12
6490
3
原创 《来自深渊》观后感
阿比斯之洞这个世界上有个岛,岛的主体是一个巨大的洞,通向深渊,具有超自然的力量,又称为阿比斯之洞,洞分为几层,分别为洞口,也就是岛上居民所居住的城市“奥斯”第一层,普通森林的样子第二层,颠倒之森第三层,大断层第四层,巨人之杯第五层,骸骨之海第六层,来无还之都奈落之底故事因为洞里面有“遗物”(具有超自然力量的物品),这东西在外面很值钱,所以这个岛上的居民都想去洞里面探险寻宝,这些探险寻宝的人称为“探窟家”,探窟家都有佩戴一个笛子探窟家分为
2021-12-18 23:27:54
4388
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅