自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 资源 (4)
  • 收藏
  • 关注

原创 leetcode四道组合总和题目的DP求解(39+40+216+377)

这四道题目相似,只是有不同的区别,这里记录一下这四道题目的DP解法。leetcode39:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same repeated number m

2020-07-03 21:01:31 181

原创 leetcode32 最长有效括号

题目:Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: “(()”Output: 2Explanation: The longest valid parentheses substring is “()”Example 2:Input: “)()()

2020-06-30 23:40:23 146

原创 leetcode31下一个更大的排列

题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).The replacement

2020-06-30 11:19:40 197

原创 leetcode567. Permutation in String

**题目:Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of the second string.Example 1:Input: s1 = “ab” s2 = “eidbaooo”Output: TrueE

2020-06-29 18:04:18 142

原创 leetcode30 Substring with Concatenation of All Words

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.Example 1:Input:s =

2020-06-29 16:37:31 97

原创 leetcode15三数之和、16三数最接近之和、18四数之和总结

这一类的问题相似,只不过是具体个数上有所区别。很自然的一种思路就是暴力破解法,然而这种方法的时间复杂度太高,若为K数之和,时间复杂度可以达到O(nk)。还有一种方法就是采用双指针法,也就是先固定好k-2个数,然后将剩下两个数采用双指针法进行选择。这样前面k-2个位置的选则复杂度为O(nk-2),再算上后面的双指针,总共的时间复杂度也就是O(nk-1),(这时间复杂度也挺高的…)。下面是具体的题目及代码。3SumGiven an array nums of n integers, are there e

2020-06-27 16:41:31 147

原创 pandas中对series和DataFrame进行排序

pandas中对series和DataFrame进行排序的函数是sort_index()和sort_values(),其中sort_index()是按照索引来排序,sort_values()是按照值来进行排序。#coding=utf-8import pandas as pdimport numpy as np#以下实现排序功能。series=pd.Series([3,4,1,6],in...

2019-02-15 16:08:20 2090

原创 python中删除某个元素

python中关于删除list中的某个元素,一般有三种方法:remove、pop、del1.remove: 删除单个元素,删除首个符合条件的元素,按值删除str=[1,2,3,4,5,2,6]str.remove(2)str[1, 3, 4, 5, 2, 6]2.pop: 删除单个或多个元素,按位删除(根据索引删除)str=[0,1,2,3,4,5,6]str.pop(1) ...

2019-02-15 15:32:50 506

原创 python dataframe drop_duplicates用法

这个函数是用来去除DataFrame中的重复部分例如:1 data.drop_duplicates()#data中一行元素全部相同时才去除2 data.drop_duplicates(['a','b'])#data根据’a','b'组合列删除重复项,默认保留第一个出现的值组合。传入参数keep='last'则保留最后一个3 4 data.drop_duplicates(['a','b']...

2019-02-15 15:12:01 2003

原创 pandas中groupby()函数的用法

pandas中的groupby()函数是非常常见的一个函数,顾明思议,这个函数的意思就是根据参数来把DataFrame进行分组。这个函数有大概两种使用方法:根据表本身的某一列或多列内容进行分组聚合通过字典或者Series进行分组根据表本身的某一列或多列内容进行分组聚合:这个是groupby的最常见操作,根据某一列的内容分为不同的维度进行拆解,将同一维度的再进行聚合按一列进行聚合:im...

2019-02-14 19:50:08 2141

原创 pandas中apply()函数的用法

apply()函数的基本形式为:DataFrame.apply(func, axis=0, broadcast=False, raw=False, reduce=None, args=(), **kwds)其中,func是你想要这个DataFrame应用的函数,可以自己编写,也可以是已经存在的,相当于C/C++的函数指针。如果这个参数是自己实现的话,函数的传入参数根据axis来定,比如axi...

2019-02-14 18:58:27 7163

原创 python中矩阵相加函数sum()

a.sum()是算a中每一元素之和a.sum(axis=0)是计算a中每一列元素之和a.sum(axis=1)是计算a中每一行元素之和

2019-02-14 17:20:28 7903 1

原创 numpy中的nonzero()函数详解

np.nonzero函数是numpy中用于得到数组array中非零元素的位置(数组索引)的函数。nonzero(a)返回数组a中非零元素的索引值数组。(1)只有a中非零元素才会有索引值,那些零值元素没有索引值;(2)返回的索引值数组是一个2维tuple数组,该tuple数组中包含一维的array数组。其中,一维array向量的个数与a的维数是一致的。(3)索引值数组的每一个array均是...

2019-02-13 18:56:15 3874

原创 numpy中array和mat的区别

mat()函数与array()函数生成矩阵所需的数据格式有区别(1) mat()函数中数据可以为字符串以分号(;)分割,或者为列表形式以逗号(,)分割。而array()函数中数据只能为后者形式。如mat()函数生成矩阵时一下两种方式都正确。a=numpy.mat('1 3;5 7')b=numpy.mat('2 4;6 8')a=numpy.mat([[1,3],[5,7]])b...

2019-02-13 11:34:22 989

原创 c++中关联容器map与set总结

1.Setset分为两种:unordered_set和set其中unordered_set中的元素存储是无序的,set中的元素存储是由序的。两种set中每个元素只存有一个key,它支持高效的关键字查询操作。set对应数学中的“集合。set具有以下的特点:储存同一类型的数据元素(这点和vector、queue等其他容器相同)每个元素的值都唯一(没有重复的元素)无法直接修改元素高效的插入删...

2019-02-03 21:54:28 176

原创 c++中string和int的相互转化

在c++中有时候需要对数据进行类型转化,今天我们来看一下c++中string与int相互转化的方法1.int转stringc++11标准增加了全局函数std::to_string:string to_string (int val);string to_string (long val);string to_string (long long val);string to_string...

2019-02-03 16:35:22 504

原创 c++中sort()函数的用法

在c++中我们经常会用到排序函数sort(),今天我们一起来学习一下sort()函数的具体用法.1、sort函数可以三个参数也可以两个参数,必须的头文件#include < algorithm>和using namespace std;2、它使用的排序方法是类似于快排的方法,时间复杂度为n*log2(n)3、Sort函数有三个参数:(第三个参数可不写)(1)第一个是要排序的数组...

2019-02-02 14:42:00 220

原创 c++中substr函数的用法

c++中string的substr函数具有以下的形式:substr(pos,n),这个函数是用来复制另一个string的从pos开始的n个元素例如:#include<string>#include<iostream>using namespace std;int main(){  string s("12345asdf");  string a = s.s...

2019-02-02 14:25:53 808

原创 vector 容器初始化的几种方式

1、不带参数的构造函数初始化vector<int> abc;//初始化一个vector,大小为02、带参数的构造函数初始化//初始化size,但每个元素值为默认值vector<int> abc(10); //初始化了10个默认值为0的元素//初始化size,并且设置初始值vector<int> cde(10,1); //初始化了10...

2019-02-01 19:26:04 7735

原创 c++常用容器vector总结

vector类称作向量类,它实现了动态数组,用于元素数量变化的对象数组。像数组一样,vector类也用从0开始的下标表示元素的位置;但和数组不同的是,当vector对象创建后,数组的元素个数会随着vector对象元素个数的增大和缩小而自动变化。1.构造函数vector():创建一个空vectorvector(int nSize):创建一个vector,元素个数为nSizevector(in...

2019-02-01 15:46:32 131

原创 opencv3.4.1+vs2015配置

今天我们来写一下如何在vs2015中配置opencv的方法,之前看很多博客上面说每一次重新建立项目都需要配置一遍OpenCV,这样做太麻烦了,其实只需要配置一次就可以了。1.下载并安装vs2015这个就没必要多说了,装社区版、专业版的其实都差不多,总之适合自己能用就行了2.下载opencv下载地址https://opencv.org/ 下载完之后直接解压就好。3. 配置环境变量右键...

2019-02-01 14:21:43 2788 1

解决eclipse无NDK选项设置问题.zip

完美解决eclipse中Android选项中没有NDK设置的问题,按照教程来即可解决

2019-05-09

完美卸载工具 total uninstall

可以完美卸载残留的应用,方便好用,不留一点痕迹

2019-05-05

机器学习实战以及代码

机器学习经典入门,包括各种分类及回归算法的实现以及原理

2019-02-01

压缩感知的实例

对于线性调频信号的采集的数据点比较少的情况下,采用压缩感知技术,用较少的采样点获得较好的恢复原信号的结果。

2018-09-16

空空如也

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

TA关注的人

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