4 Freeman_zxp



TA的排名 4w+


295. Find Median from Data StreamDescription:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two m...

2019-04-15 15:47:22


23. Merge k Sorted ListsDescription:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Difficulty:hardExample:Input:[ 1->4->5, 1->3-&...

2019-04-12 15:38:43

【LeetCode】145. 二叉树后续遍历

102. Binary Tree Postorder TraversalDescription:Given a binary tree, return the postorder traversal of its nodes’ values.Difficulty:hardExample:Input: [1,null,2,3] 1 \ 2 / 3...

2019-04-12 13:14:33

C++ heap堆的使用

堆的基本操作make_heap() == 默认最大堆,最小堆加参数greater< int >() ==pop_heap() == 先pop,然后在容器中删除 ==push_heap() == 先在容器中加入,再push ==sort_heap()#include<iostream>#include<vector>#include<alg...

2019-04-12 11:25:34


1. 简介奇异值分解(Singular Value Decomposition,简称SVD)是在机器学习领域广泛应用的算法,它不仅可以用于降维算法中的特征分解,还可以用于推荐系统,以及自然语言处理等领域。本文通过分析原理,推导公式,以及具体实例演示来总结一下SVD。必备线性代数基础:方阵:行数等于列数的矩阵对角阵:只有对角线上有非0元素的矩阵对称阵:元素以主对角线为对称轴对应相等的矩阵...

2019-02-02 17:39:08

【LeetCode】122. Best Time to Buy and Sell Stock II

122. Best Time to Buy and Sell Stock IIDescription: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 co...

2019-02-01 23:00:38

【LeetCode】371. Sum of Two Integers

371. Sum of Two Integers Description:Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Difficulty:Easy方法:位操作class Solution {public: int getSum(i...

2019-02-01 21:39:04

【LeetCode】236. Lowest Common Ancestor of a Binary

236. Lowest Common Ancestor of a Binary Description:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The ...

2019-01-31 17:58:36

【LeetCode】69. Sqrt(x)

69. Sqrt(x)Description:Implement int sqrt(int x).Difficulty:EasyExample:Input: 8Output: 2Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, ...

2019-01-30 21:52:26

【LeetCode】139. Word Break

139. Word BreakDescription:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more d...

2019-01-30 16:46:54

【LeetCode】208. Implement Trie (Prefix Tree)

208. Implement Trie (Prefix Tree)Description:Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.All inputs are ...

2019-01-30 15:22:33

【LeetCode】207. Course Schedule

207. Course ScheduleDescription:There are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take cours...

2019-01-29 14:53:04

【LeetCode】200. Number of Islands

200. Number of IslandsDescription:Given a 2d grid map of '1’s (land) and '0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizo...

2019-01-28 21:06:37

【LeetCode】17. Letter Combinations of a Phone Number

17. Letter Combinations of a Phone NumberDescription:Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit ...

2019-01-28 16:53:26

【LeetCode】300. Longest Increasing Subsequence

300. Longest Increasing SubsequenceDescription:Given an unsorted array of integers, find the length of longest increasing subsequence.Difficulty:MediumExample:Input: [10,9,2,5,3,7,101,18]Output:...

2019-01-27 19:39:14

【LeetCode】240. Search a 2D Matrix II

240. Search a 2D Matrix IIDescription:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascendi...

2019-01-27 18:42:24

【LeetCode】114. Flatten Binary Tree to Linked List

114. Flatten Binary Tree to Linked ListDescription:Given a binary tree, flatten it to a linked list in-place.Difficulty:MediumExample: 1 / \ 2 5 / \ \3 4 61 \ 2 \ 3...

2019-01-27 17:16:23

【LeetCode】309. Best Time to Buy and Sell Stock with Cooldown

309. Best Time to Buy and Sell Stock with CooldownDescription: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....

2019-01-27 16:31:24

【LeetCode】394. Decode String

394. Decode StringDescription: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 guaranteed to be a posit...

2019-01-27 14:21:55

【LeetCode】96. Unique Binary Search Trees

96. Unique Binary Search TreesDescription:Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?Difficulty:MediumExample:Input: 3Output: 5Explanation:Given...

2019-01-27 13:27:33


勋章 我的勋章
  • GitHub
  • 持之以恒
  • 勤写标兵Lv1