- 博客(59)
- 收藏
- 关注
原创 leetcode amazon 面试题(三)
leetcode 21. merge two sorted lists大概的意思就是 给两个list, 然后把它们按照所有元素的 从小到大的顺序排序。这里分享一个比较简洁的写法:class Solution(object): def mergeTwoLists(self, l1, l2): dummy = cur = ListNode(0) while l...
2018-03-20 04:10:34
1166
原创 Leetcode amazon 面试题(二)
242. valid anagram给定两个字符串,问是否是 anagram(同字母异序)python 的做法很简单,一行就好了def isAnagram(self, s, t): return sorted(s) == sorted(t)这个是时间复杂度是 O(nlogn)想要提高 速度的话 可以用 hash table用两个list 存每个字符出现次数,然后比较。时间复杂度是O...
2018-03-01 09:54:26
1000
原创 Leetcode amazon 面试题系列(一)
最近在刷亚麻的面试题,然后顺便想练一练python的技巧,所以就用python刷了一边。然后mark一下以后可以复习。leetcode 771.大概就是给定两个字符串a 和b,问b 中出现了多少次a 的字符。记录一个python的用法:def numJewelsInStones(self, J, S): return sum(map(J.count, S))这里利用了 python 的几个...
2018-02-23 04:54:33
4859
原创 Leetcode 647. Palindromic Substrings
找到字符串中的回文子序列的个数 比如 给定一个字符串“aaa”, 它的子序列的个数就是 a, a, a, aa, aa, aaa 如果给定的是“abc”, 那么它的子序列就是a, b, cstring[i]到 string[j] 这个子串是回文的可能性只有当 string[i] == string[j] 而且string[i + 1] 到 string[j - 1] 是回文。 但是考虑到如果中间
2017-08-29 01:25:03
529
原创 Leetcode 65. Valid Number
判断是否为一个数 注意: 1. .35,00 可以算做小数, 只有一个”.” 不算 2. 要注意 空格 3. 可以有正负号 4. 如果有e 的话,那么一定要是AeB 这样的形式,而且B 是整数, 可以带正负号。 A 可以是整数也可以是小数,带正负号算法就是把字符串分成A 和B 两个子字符串,按照A 和B 的规则是找在discussion 里面看到了一个python的解法:class Sol
2017-08-28 23:25:02
467
原创 Leetcode 459. Repeated Substring Pattern
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Englis
2017-05-19 10:56:02
406
原创 Leetcode 394. Decode String
Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaran
2017-05-18 15:09:26
331
原创 [leetcode 583] Delete Operation for Two Strings
Description: Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in either string.Example 1: I
2017-05-17 16:18:10
1071
原创 [LEETCODE]230. Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: What if the BST is mod
2016-07-30 20:05:20
418
转载 [leetcode] 368. Largest Divisible Subset
题目链接: https://leetcode.com/problems/largest-divisible-subset/Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satis
2016-07-30 11:53:50
399
原创 【LEETCODE】328. Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in plac
2016-07-30 11:36:23
343
转载 绑定cpu 核
As multi-core CPUs become increasingly popular on server-grade hardware as well as end-user desktop PCs or laptops, there have been growing efforts in the community (e.g., in terms of programming model
2016-07-27 13:01:55
791
原创 mac opencv 找不到库解决办法
opencv 在mac 上面的使用非常的麻烦 mark 下以备不时之需要编译的的filter.cpp 其中添加的库有:#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/core/core.hpp"#include "opencv2/video/video.
2016-07-26 13:06:01
1982
原创 [LEETCODE] 287. Find the Duplicate Number
[LEETCODE] 287. Find the Duplicate NumberGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume tha
2016-07-24 13:08:54
1157
原创 [LEETCODE]318. Maximum Product of Word Lengths
[LEETCODE]318. Maximum Product of Word Lengths
2016-07-24 12:47:20
988
原创 [LEETCODE]52. N-Queens II
[LEETCODE]52. N-Queens IIFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.
2016-07-24 09:58:55
1013
原创 [leetcode] 319.Bulb Switcher
[leetcode] 319.Bulb SwitcherThere are n bulbs that are initially off.
2016-07-23 23:27:53
1085
原创 [LEETCODE] 268. Missing Number
[LEETCODE]268. Missing NumberGiven an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.
2016-07-23 21:06:11
330
原创 [LEETCODE] 372. super pow
【LEETCODE】372.super powYour task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.Example1:a = 2 b = [3]Result: 8
2016-07-23 20:41:01
361
原创 [LEETCODE] 376. Wiggle Subsequence
376.Wiggle Subsequence 解题报告 A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if o
2016-07-23 20:02:32
498
原创 leetcode 375. Guess Number Higher or Lower II
leetcode 375. Guess Number Higher or Lower II
2016-07-20 16:59:09
517
原创 leetcode 347. Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].
2016-07-16 11:38:39
270
原创 leetcode 350. Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].
2016-07-16 10:47:12
309
原创 leetcode Find K Pairs with Smallest Sums
leetcode 373find K pairs with Smallest Sums
2016-07-15 23:06:52
413
原创 DeepLab: Semantic Image Segmentation
DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs 论文学习笔记
2016-07-15 11:10:23
5867
2
原创 Learning Deconvolution Network for Semantic Segmentation
Learning Deconvolution Network for Semantic Segmentation 论文笔记
2016-07-13 14:23:10
1899
转载 Caffe学习系列:模型各层数据和参数可视化
先用caffe对cifar10进行训练,将训练的结果模型进行保存,得到一个caffemodel,然后从测试图片中选出一张进行测试,并进行可视化。In [1]:#加载必要的库import numpy as npimport matplotlib.pyplot as plt%matplotlib inlineimport sys,os,caffe
2016-07-13 10:33:48
3181
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人