自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(105)
  • 资源 (1)
  • 收藏
  • 关注

原创 45. Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to...

2019-07-13 06:31:40 170 1

原创 41. First Missing Positive

Given an unsorted integer array, find the smallest missingpositive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Outpu...

2019-07-11 09:43:18 183

原创 40. Combination Sum II

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Each number incandidatesmay...

2019-07-08 13:36:44 169

原创 python append 与 拷贝

python中的赋值操作是赋值的索引,例如:a=[1,2,3]b=[]b.append(a)a.pop()print(b)#[[1, 2]]当a数组弹出一个元素后,b也会跟着改变。但是对a重新赋值会给a一个新的内存地址:a=[1,2,3]b=[]b.append(a)a=a[:len(a)-1]print(b)#[[1, 2, 3]]虽然对a的再次赋值是...

2019-07-08 11:47:24 516

原创 39. Combination Sum

Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamerepeat...

2019-07-08 11:18:00 90

原创 36. Valid Sudoku

Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must conta...

2019-06-30 11:58:40 79

原创 35. Search Insert Position

You may assume no duplicates in the array.Example 1:Input: [1,3,5,6], 5Output: 2Example 2:Input: [1,3,5,6], 2Output: 1Example 3:Input: [1,3,5,6], 7Output: 4Example 4:Input: [...

2019-06-30 10:59:31 105

原创 34. Find First and Last Position of Element in Sorted Array

Given an array of integersnumssorted in ascending order, find the starting and ending position of a giventargetvalue.Your algorithm's runtime complexity must be in the order ofO(logn).If the...

2019-06-30 06:08:06 77

原创 Leetcode 33. Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2019-04-08 12:42:45 85

原创 Leetcode 32. Longest Valid Parentheses

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...

2019-04-08 12:30:55 74

原创 Leetcode 152. Maximum Product Subarray

Given an integer arraynums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation:[2,3] h...

2019-03-29 11:47:16 83

原创 Leetcode 31. Next Permutation

Implementnext 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 o...

2019-03-29 06:12:30 94

原创 Keras 可视化

Keras可视化需要安装pydot和graphviz,需要先安装python graphviz,再安装软件graphvizWindowswindows下安装比较容易出问题,在我的电脑上使用pip安装不成功,使用conda安装比较简单1.安装graphviz软件https://graphviz.gitlab.io/_pages/Download/Download_windows.ht...

2019-03-28 00:09:27 107

原创 Leetcode 30. 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) insthat is a concatenation of each word inwordsexactly once and wi...

2019-03-26 10:08:48 80

原创 Leetcode 29. Divide Two Integers

Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividingdividendbydivisor.The integer division sho...

2019-03-26 06:57:47 87

原创 Leetcode 28. Implement strStr()

ImplementstrStr().Return the index of the first occurrence of needle in haystack, or-1if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example...

2019-03-25 13:13:40 96

原创 Leetcode 27. Remove Element

Given an arraynumsand a valueval, remove all instances of that valuein-placeand return the new length.Do not allocate extra space for another array, you must do this bymodifying the input arra...

2019-03-25 12:15:56 109

原创 Leetcode 26. Remove Duplicates from Sorted Array

Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymodifyi...

2019-03-24 08:15:12 124

原创 Leetcode 25:Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.kis a positive integer and is less than or equal to the length of the linked list. If the number of ...

2019-03-24 07:40:55 144

原创 机器学习 (一):线性回归

1. 最小二乘法与最大似然在回归问题中,我们最常用的就是最小二乘法,也就是均方误差MSE。                                                                               这个形式乍一看很合逻辑,也没有想过为什么会用这种形式。要衡量回归问题的误差,肯定要有模型和目标的差值,再平方一下,求导方便。但其实这个形式可...

2019-02-15 11:48:49 204 1

原创 概率论中的一些基础知识——条件概率 先验概率 后验概率 似然 概率分布函数 概率密度函数

1.条件概率条件概率反应的是在给定A的条件下B的概率由条件概率可得由此还可以推出全概率公式,在全概率公式里,P(A)是所有P(AB_i)的求和,对应概率图表中A的偏概率2.贝叶斯公式贝叶斯公式由条件概率推出,我们假设要做一个分类任务,给出数据A求它的标签B,这就是公式左边。直接求解比较困难,所以贝叶斯公式可以把它转化成P(A|B),即在标签B条件下是数据A的概率。...

2019-02-01 12:38:13 4428

原创 Leetcode 22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())"...

2019-01-31 11:23:04 140

原创 Leetcode 21. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-...

2019-01-31 10:52:42 135

原创 Leetcode 20. Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...

2019-01-31 10:48:05 164 1

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

Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, t...

2019-01-31 10:30:31 90

原创 Leetcode 18: 4Sum

Leetcode上有2Sum,3Sum等问题,基本思路都是一样的,从3Sum开始,固定其他数,剩下两个数变成2Sum问题。2Sum问题在排序数组里用首尾两个游标遍历class Solution(object): def fourSum(self, nums, target): """ :type nums: List[int] :typ...

2019-01-31 01:02:45 202

原创 关于Google Bert中的一些问题

1.Bert 中的双向transformer是什么Bert中提出了一个双向transformer,看着感觉很神秘,但是看下论文中的图这个其实就是transformer中的encoder层,很普通的结构。可以看到gpt中用的是decoder结构,当前词语只能看到它前面的字,看不到它后面的字。ELMo虽然也是双向的,但是它是left-to-right和right-to-left分开训练再融合。...

2019-01-27 13:22:01 740

原创 半监督学习简介

对半监督学习一直都是一知半解,基本就知道使用了有标签数据和无标签数据,但是怎么使用就没有做过了。正好毕设遇到了标签数据太少的问题,看了看半监督学习。半监督学习半监督学习中用了有标签和无标签两种数据,且无标签数据远大于有标签。但是半监督学习对无标签数据有一定要求,没要求的话我们就不用标数据了,机器学习中数据稀缺的问题直接就解决了。通常来说需要:无标签类别平衡 无标签的分布需要和有标签相...

2019-01-24 02:05:43 823

原创 Leetcode 17: Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is giv...

2019-01-07 13:14:51 129

原创 Leetcode 16:3Sum Closest

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...

2019-01-07 00:03:26 122

原创 Leetcode 15:3Sum

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not cont...

2018-12-23 08:20:16 96

原创 Leetcode 12 13: Integer to Roman, Roman to Integer

 https://leetcode.com/problems/integer-to-roman/description/Integer to RomanRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI ...

2018-12-04 09:41:21 80

原创 最长公共子串

子串与子序列的区别是子串是连续的,而子序列只要相对位置一致。可以看到,和子序列的状态转移方程不同,只有当x,y相等的时候才会+1,不相等的时候后面就没有必要比较了a='cabdec'b='cbdec'c=[[0 for i in range(len(b)+1)] for j in range(len(a)+1)]maxlen=0maxindex=-1for i in ran...

2018-11-15 10:02:01 90

原创 动态规划-01背包问题

背包问题是很经典的动态规划问题,变种问题也很多,最基本的问题是01背包问题问题描述:有n 个物品,它们有各自的体积和价值,现有给定容量的背包,如何让背包里装入的物品具有最大的价值总和?i:物品 1 2 3 4 w:体积 2 3 4 5 v:价值 3 4 5 6 分析:01背包问题可以看做是物品的序列...

2018-11-14 13:01:12 172

原创 最长公共子序列

例:A=['A','B','C','B','D','A','B']B=['B','D','C','A','B','A']最长公共子序列是BCBA或BDAB,子序列可以不是连续的,相对顺序一样就可以。这是一道动态规划题,首先我们需要一个c[a+1][b+1]来记录状态,注意每一维需要比数组长1,为了保存当A,B为空时候的情况。然后我们从[0,0]开始按行填表。按如下公式进行填表...

2018-11-13 13:58:34 95

原创 Leetcode 43: Multiply Strings 大数相乘算法

给定两个以字符串形式表示的非负整数num1和num2,返回num1和num2的乘积,它们的乘积也表示为字符串形式。示例2:输入: num1 = "123", num2 = "456"输出: "56088"class Solution(object): def multiply(self, num1, num2): """ :...

2018-11-11 14:31:04 291

原创 提升方法总结

1. Boosting提升方法通过改变训练样本权重,学习多个分类器,并将分类器线性组合提高分类性能。Boosting需要做到两件事,一是在每一轮如何改变训练数据的权值或概率分布;二是如何将弱分类器组合成一个强分类器。2. AdaBoost为了解决Boosting的两个要求,adaboost在每一轮提高被错分的样本的权值,降低正确分类样本的权值。在组合分类器的时候,给误分率小的分类器较大...

2018-11-11 12:37:29 421

原创 各种排序算法

1. 插入排序def insertsort(a): if len(a)==1: return a for i in range(1,len(a)): j=i-1 insert=a[i] while j>=0 and a[j]>insert: a[j+1]=a[j] ...

2018-11-07 13:19:03 139

原创 各种框架对变长rnn数据的处理

1. padding文本数据在处理的时候,由于各样本的长度并不一样,有的句子长有的句子短。抛开动态图、静态图模型的差异,由于需要进行矩阵运算,句长需要是等长的才可以,这就需要padding操作。padding一般是用最长的句子长度为最大长度,然后其他样本补0到最大长度,这样样本就是等长的了。但是注意padding后的样本如果不作处理只用普通的循环神经网络来做的话其实是有影响的,因为即使输入...

2018-11-02 13:46:55 5356

原创 attention详解

在seq2seq+attention入门里曾经提到一点attention,感觉这个东西很有意思,模型千变万化,也非常符合人类的思想,在这里详细介绍下attention1. 定义剥离开seq2seq模型,Google给了attention模型一个更加形式化的定义attention是由query和一系列<key,value>对组成的,query依次与{key_1,key_2.....

2018-11-01 12:50:22 2060

Cavaj Java Decompiler JAV反编译器

很好用的JAVA反编译器,轻松反编译.class文件。将class文件默认用这个打开,非常方便。

2013-11-07

空空如也

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

TA关注的人

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