- 博客(218)
- 收藏
- 关注
原创 leetcode 532. K-diff Pairs in an Array
leetcode 532. K-diff Pairs in an Array 下面这种解法TLE public class Solution { public int findPairs(int[] nums, int k) { if(nums==null||nums.length==0||k<0) return 0; int len = nums
2017-07-04 23:48:40
324
原创 leetcode 546. Remove Boxes
Solution 讲解: leetcode 546. Remove Boxes很巧妙的分析思路:T(i, j, k) 来表示 k个相同前缀,i-j 之间的最大值自己写的 自底向上的 Bottom-Toppublic class Solution { public int removeBoxes(int[] boxes) { int len = b
2017-07-03 21:54:23
1651
原创 【dp】leetcode 115. Distinct Subsequences
【dp】leetcode 115. Distinct Subsequencesdp 与公共子串匹配的算法思想类似当当前字符s与t匹配时,次数dp[i][j] 可以采用两种方式进行计算,1)s[j]与t[i]匹配 为 dp[i-1][j-1] 2) 不考虑新加入的字符 s[j] ,为dp[i][j-1]. 两种情况相加就可以得到了publi
2017-07-02 17:01:17
352
原创 leetcode 139. Word Break
leetcode 139. Word Break判断存不存在解比找出解容易,但思路是一致的,都使用了memorize来存放搜索结果public class Solution { public boolean wordBreak(String s, List wordDict) { return backws(s,wordDict,new HashMap()
2017-07-02 12:08:11
460
原创 leetcode 140. Word Break II
leetcode 140. Word Break II 这一题是去年面试出门问问的一道题,当时给的写法整理如下,超时了。因为后续的部分重复太多了。public class Solution { public static void main(String[] args){ Solution s = new Solution(); String ss = "catsan
2017-07-02 11:42:37
362
原创 leetcode 97. Interleaving String [动态规划]
leetcode 97. Interleaving String public class Solution { public boolean isInterleave(String s1, String s2, String s3) { if(s1.length()+s2.length()!=s3.length()) return false;
2017-07-02 10:02:43
323
原创 leetcode 67. Add Binary
public class Solution { public static void main(String[] args){ String a = "1"; String b = "1"; Solution s = new Solution(); String t = s.addBinary(a, b); S
2017-06-29 09:33:40
246
原创 leetcode 67. Add Binary
简单题 但对于int 转 character 不熟练 会出现一些错误public class Solution { public static void main(String[] args){ String a = "1"; String b = "1"; Solution s = new Solution();
2017-06-29 09:32:29
218
原创 leetcode 515. Find Largest Value in Each Tree Row
leetcode 515. Find Largest Value in Each Tree Row这是当初去CM面试时面试官出的试题,当初实现的方法效率很低public class Solution { public List largestValues(TreeNode root) { List res = new ArrayList(); St
2017-06-26 22:42:44
228
原创 leetcode 541. Reverse String II 简单题也得多刷刷
leetcode 541. Reverse String IIclass Solution(object): def reverseStr(self, s, k): """ :type s: str :type k: int :rtype: str """ return s
2017-06-24 22:13:39
316
原创 leetcode 87. Scramble String 二分法
leetcode 87. Scramble Stringpublic class Solution { public static void main(String[] args){ String s1 = "ab"; String s2 = "ba"; Solution s = new Solution(); System.out.println(s.isScr
2017-06-24 21:26:23
330
原创 leetcode 174. Dungeon Game 这一题刷得太有意思了
leetcode 174. Dungeon Game 这一题刷得太有意思了矩阵 典型dp 但从左上角开始思考时 要考虑到和以及每一个点所需要的health,每个点维持两个值,比较吃力看了上面链接中的solution,这不就是正难则反的思想吗!很不错!public class Solution { public static void main(String[
2017-06-24 20:29:01
502
原创 leetcode 64. Minimum Path Sum
leetcode 64. Minimum Path Sum终于有一个错误是因为符号优先级而存在的了依然是dp, 要敢于尝试,很多问题并不难,而是因为我们畏难public class Solution { public static void main(String[] args){ Solution s = new Solution(); in
2017-06-24 17:17:44
298
原创 leetcode 63. Unique Paths II
leetcode 63. Unique Paths IIdppublic class Solution { public int uniquePathsWithObstacles(int[][] G) { int m = G.length; if(m==0) return 0; int n = G[0].le
2017-06-24 16:17:12
269
原创 svm 相关整理笔记
拉格朗日乘子法:http://math.fudan.edu.cn/math_anal/jiaoan/Lagrange.pdf
2017-06-23 20:42:08
261
原创 leetcode 221. Maximal Square
leetcode 221. Maximal Square 今天晏老师讲依赖论文,确实我有这个毛病,做题也比较依赖答案,其实重要的不是答案,而是解题的思路,这世上没有标准答案,所谓的标准答案都是多种可能实现的极致,它不是先验存在的,而是被创造出来的。 比如这题,如此简单的题,思路很容易有。 师兄说教育是教人自信,有道理。public class Solution { public int
2017-06-20 20:52:46
270
原创 【论文阅读】Addressing the RareWord Problem in NeuralMachine Translation
论文作者:Minh Tang Luon (Stanford University) Iiya Sutskever (Google) Quoc V.Le (Google) Orial Vinyals (Google) Wojciech Zaremba (New York Univerity) 这篇论文一看就感觉是一个很好的研究工作,对一个很具体又很重要的问题展开。摘要文章的方法是在经过对齐算
2017-06-19 18:40:13
1160
原创 leetcode 85. Maximal Rectangle
85 Maximal Rectanglepublic class Solution { public static void main(String[] args){ } public int maximalRectangle(char[][] matrix) { int m = matrix.length; if(m==0) return
2017-06-18 15:15:12
292
原创 84. Largest Rectangle in Histogram
下面的步骤应是 O(n) 的,但TLE 超时了package my;import java.util.ArrayList;import java.util.List;public class Solution { public class Pair{ int sum; int height; Pair(int a,int b){
2017-06-18 13:59:54
242
原创 leetcode 58. Length of Last Word
Length of Last Word 简单题 python:class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if s.strip()=="": return 0;
2017-06-17 22:00:25
252
原创 Leetcode 513. Find Bottom Left Tree Value
想法很巧妙public class Solution { public int findBottomLeftValue(TreeNode root) { return findBottomLeftValue(root, 1, new int[]{0,0}); } public int findBottomLeftValue(TreeNode root, int
2017-06-15 22:58:02
536
原创 leetcode 504. Base 7
一道简单题,最近实现的效率都不是很高public class Solution { public static void main(String[] args){ } public String convertToBase7(int num) { String res = ""; boolean flag = false; if(n
2017-06-15 22:40:46
210
原创 leetcode 57. Insert Interval
这一题似乎没有 http://blog.csdn.net/hackerzer/article/details/73253017 leetcode 56 难,不用排序,直接list插入就可以。import java.util.ArrayList;import java.util.Collections;import java.util.List;import java.util.Comparat
2017-06-15 22:16:11
258
原创 【论文阅读】Neural Language Correction with Character-Based Attention
作者Ziang Xie, Anand Avati, Naveen Arivazhagan, Dan Jurafsky, Andrew Y. Ng Computer Science Department, Stanford University摘要针对不同类型的自动纠错分类器已经可以取得比较高的准确度,但是不足以处理冗余与搭配不当这样的错误。鉴于基于短语的翻译模型不是针对拼写错误与否来进行的,所以文
2017-06-15 17:18:59
1512
原创 LSTM 与 GRU
LSTM 示意图如下,来自 LSTM 非常出名的博客 : http://colah.github.io/posts/2015-08-Understanding-LSTMs/首先标准的LSTMforgot gate:input gate cell stateoutput gateLSTM 常用的一种变体--GRU input gate、f
2017-06-15 15:01:31
493
原创 【论文待读】Gcforest https://www.zhihu.com/question/56474891
哈 https://arxiv.org/pdf/1702.08835.pdf
2017-06-14 23:02:36
1586
原创 leetcode 56. Merge Intervals
leetcode 56. Merge Intervals这一题思路笔记简单,先采用容器对list进行升序排序,然后在逐一合并前后的区间public class Solution { class mycmp implements Comparator{ @Override public int compare(Object o1, Object o2) {
2017-06-14 22:30:03
402
原创 【论文阅读】Attention Is All You Need
昨天刚学习了在 RNN encode-decode编解码框架上的进行Attention的工作,今天就看到了这篇,只有Attention是你需要的,RNN 序列串的建模根本不是重要的。好,开始读论文。 Ashish Vaswani等 Google Brain,作者单位中还有多伦多大学的,六位作者都是一作?哈。摘要:当前主流的序列建模是在复杂的RNN与CNN的框架之上的,(值得注意的是这篇文章把CN
2017-06-14 12:01:52
6793
原创 【论文阅读】Convolutional Sequence to Sequence Learning (未完待续)
论文github地址 值得阅读与一试: https://github.com/facebookresearch/fairseq以往谈到sequence to sequence,往往会下意识地想到 RNN, 但这篇文章告诉我们,CNN 不仅可以做 sequence to sequence,不仅在大规模机器翻译的训练数据上结果比 RNN 要好,而且模型更加易于优化与加速。好,下面开
2017-06-14 10:01:13
4915
原创 【论文阅读】Neural Machine Translation By Jointly Learning To Align and Translate
Neural Machine Translation By Jointly Learning To Align and Translate二作与三作 Universite de Montreal 鼎鼎有名的蒙特利尔大学,最后一位 Yoshua Bengio. 该文章的引用量: 1478这篇文章在神经网络 采用编码-解码RNN 做端到端的机器翻译的基础上,使得模型可以在预测下一个词的时候,自动地
2017-06-13 22:55:19
14909
4
原创 【论文阅读】 Enhancing Video Event Recognition Using Automatically Constructed Semantic-Visual Knowledge
6.9日 : 听了前瞻实验室毕业生经验交流分享,师兄师姐所做的研究很扎实,干货很多,所以在周末就读了一篇做计算机视觉的博士师姐的文章。论文初读,理解错了忘指正。文章题目: Enhancing Video Event Recognition Using Automatically Constructed Semantic-Visual Knowledge Base文
2017-06-11 17:24:57
475
原创 leetcode 54. Spiral Matrix
螺旋性转圈,还没有编译通过,草稿,设计移动规则public class Solution { public void move(int[][] matrix, List res,int i,int j, boolean m_l, boolean m_r, boolean m_u, boolean m_d){ if(m_r){ for(int k=j;k<matrix.lengt
2017-06-09 00:11:07
285
原创 leetcode 53. Maximum Subarray
leetcode 53. Maximum Subarray动态规划方法:public class Solution { public int maxSubArray(int[] nums) { // dp int len = nums.length; int[] dp = new int[len]; dp[0] = nums[0]
2017-06-08 23:23:23
270
原创 Leetcode 49 Group Anagrams
Leetcode 49 Group Anagrams第一段用python做的题,工具用称手是真好啊。class Solution(object): def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]]
2017-06-07 23:44:19
285
原创 Leetcode 50 Pow(x, n)
Leetcode 50 Pow(x, n)6.7 简单题,分治public class Solution { public static void main(String[] args){ double x = 2.0000; int n = -2147483648; Solution s = new Solution(); s.myP
2017-06-07 22:35:02
274
原创 【AlphaGo】【论文阅读】
前后花了十个小时阅读这篇论文。写得不正确的地方还请指教。论文题目: Mastering the Game of Go with Deep Neural Networks and Tree Search发表在 Nature, 2016, 上作者 : (deepmind) 首先整理一下这篇文章的主要方法:网络架构采用了Pipeline的形式。
2017-06-04 12:16:48
2883
原创 输入法论文阅读一:Effects of Language Modeling and its Personalization on Touchscreen Typing Performance
Effects of Language Modeling and its Personalization on Touchscreen Typing Performance很显然,这篇论文提出的是输入法的评价标准。这篇论文研究的问题: We describe a closed-loop, smart touch keyboard (STK) evaluation
2017-06-03 16:37:27
573
原创 【论文阅读】 输入法相关论文二 LONG SHORT TERM MEMORY NEURAL NETWORK
文章的主要思想即采用 lstm 的网络架构进行手势识别的解码,loss 采用的是CTC loss。 滑动输入的特征,即LSTM的输入是什么? Contain : (x, y) position, time since last gesture and gesture type (move, up, down). Features:
2017-06-03 16:24:39
793
原创 【论文阅读】 计算语言学与深度学习
计算语言学与深度学习 作者是语言学家: 克里斯托弗·D·曼宁 (Christopher D.Manning)有时候文章读后不写点笔记感觉跟没读一样,所以以后读完论文以后觉得有收获的点都记下来吧。深度学习与机器学习大牛们的观点:Yann LeCun : 深度学习的下一个重要目标是自然语言的理解,这将让机器不只具有理解单个字词的能力,还将具备理解句子与段落的能力。
2017-05-10 12:03:48
1320
原创 【nlp论文阅读】Adversal Neural Machine Translation
这是一篇采用GAN的思路应用在机器翻译的文章,文章发表单位包括微软亚洲研究院G 生成式网络采用的架构是 RNNSearch Model 【Bahdanau et al.,2014】, RNN 编码解码框架并且带注意力机制。【1】D CNN (这个网络架构来试试文本匹配似乎也很合理) 训练方法: 采用增强学习的策略更新方式,具体原理还没有弄清楚待继续
2017-05-07 22:39:44
1121
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅