- 博客(21)
- 收藏
- 关注
原创 Leetcode #229. Majority Element II
##题目Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.Note: The algorithm should run in linear time and in O(1) space.Example 1:Input: [3,2,3]Output: [3]Exa...
2020-02-22 11:30:17
157
原创 Leetcode#60. Permutation Sequence
题目The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence for n = 3:“123” “132” “213” “231” “31...
2018-06-12 09:51:48
188
原创 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 ...
2018-06-04 16:15:01
178
原创 Leetcode #128. Longest Consecutive Sequence
题目Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100, 4, 200, 1, 3, 2] Output: ...
2018-06-01 17:11:04
187
原创 Leetcode #82. Remove Duplicates from Sorted List II
题目Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2->3->3->4->4->5 Output: 1...
2018-05-18 17:24:28
142
原创 Leetcode#268. Missing Number
题目Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1Input: [3,0,1] Output: 2 Example 2Input: [9,6,4,2,3,5,7,0,1] Ou...
2018-04-04 10:50:54
189
原创 Leetcode#167. Two Sum II - Input array is sorted
题目Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numb...
2018-03-29 14:48:07
136
转载 Python实现控制台中的进度条
原代码出处:https://www.cnblogs.com/lustralisk/p/pythonProgressBar.html在上面这篇文章里其实作者把很多细节讲得挺清楚的,我在这里只是结合我最后的理解把代码做一下注释,import time,sysclass ProgressBar: def __init__(self, count = 0, total = 0,...
2018-03-29 11:52:58
387
原创 Leetcode #122. Best Time to Buy and Sell Stock II
题目Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy ...
2018-03-28 16:02:14
123
原创 CS231N assignment1——Softmax exercise
Softmax exerciseComplete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the assig...
2018-03-22 14:50:56
430
原创 CS231N assignment1——SVM
Multiclass Support Vector Machine exerciseComplete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For ...
2018-03-22 14:50:25
342
原创 CS231N assignment1——KNN
k-Nearest Neighbor (kNN) exercise题目提示:The kNN classifier consists of two stages:During training, the classifier takes the training data and simply remembers itDuring testing, kNN classifies ...
2018-03-22 14:49:51
353
原创 Leetcode #283. Move Zeroes
题目Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you...
2018-03-22 10:18:00
147
原创 Leetcode #695. Max Area of Island
题目Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are su...
2018-03-17 09:20:05
297
原创 Leetcode #121. Best Time to Buy and Sell Stock
题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock...
2018-03-15 09:06:46
143
原创 Leetcode #766. Toeplitz Matrix
题目A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz.Example 1:Input: matrix...
2018-03-14 20:45:23
164
原创 Leetcode #566. Reshape the Matrix
题意In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.You’re given a matrix represented by a two-d...
2018-03-13 09:24:07
159
原创 Leetcode #682. Baseball Game
题目You’re now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round’s score): Directly represents the number of points you get...
2018-03-12 16:15:02
207
原创 Leetcode #575. Distribute Candies
题目Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute t...
2018-03-10 11:06:44
224
原创 Leetcode #461. Hamming Distance
题目The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note: 0 ≤ x, y &l...
2018-03-09 20:44:48
155
转载 EM算法初探——公式推导和三硬币模型解析
EM算法初探——公式推导和三硬币模型解析 转载借鉴:http://www.cnblogs.com/jerrylead/archive/2011/04/06/2006936.html#!comments这篇博客是在学习了诸多网友后略有所触后记下,大部分内容还是从他们的博客中搬运,诸如推导等,在此基础上增加自己在这个过程的一些理解和注解,希望对大家有帮助,若文中有问题也希望大家指出,共同...
2018-03-09 20:37:06
5731
3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人