- 博客(20)
- 收藏
- 关注
原创 多路平衡归并+置换选择+最佳归并树
多路平衡归并+置换选择+最佳归并树 最近忙着考研,在学习复习数据结构(严慧敏版)外部排序那一章的时候简直开始怀疑人生了。以前我是怎么过来的?!败者树能吃吗??置换选择不就是操作系统页面换进换出的概念??TO YOUNG TOO SIMPLE SOMETIMES NAIVE !! 本文是个人对以上归并排序的三个算法的理解,如有错误请指出。好了废话少说,下面是正题。 众所周知,快速排序...
2018-04-15 21:10:56 5649 4
原创 Edit Distance
Edit Distance(leetcode)Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 oper
2018-01-07 11:02:51 211
原创 Search a 2D Matrix(leetcode)
Search a 2D Matrix(leetcode)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 from left
2018-01-07 09:47:35 247
原创 Combinations(leetcode)
Combinations(leetcode)Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3],
2018-01-07 09:44:10 323
原创 Regular Expression Matching(leetcode)
Regular Expression Matching(leetcode)Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.Th
2018-01-06 12:16:07 227
原创 Unique Binary Search Trees II(leetocde)
Unique Binary Search Trees II(leetocde)Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should
2018-01-06 12:07:36 220
原创 Permutation Sequence(leetcode)
Permutation Sequence(leetcode)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 (ie, for n =
2018-01-06 12:03:21 196
原创 Word Search(leetcode)
Word Search(leetcode)Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those hor
2018-01-06 12:01:16 301
原创 Remove Nth Node From End of List(leetcode)
Remove Nth Node From End of List(leetcode)Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. Afte
2018-01-06 11:58:44 211
原创 Permutations II(leetcode)
Permutations II(leetcode)Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [
2018-01-06 11:55:30 264
原创 Group Anagrams(leetcode)
Group Anagrams(leetcode)Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"],
2018-01-06 11:51:58 220
原创 First Missing Positive(leetcode)
First Missing Positive(leetcode)Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should ru
2018-01-06 11:47:08 224
原创 Longest Valid Parentheses(leetcode)
Longest Valid Parentheses(Leetcode)Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest va
2018-01-06 11:09:50 228
原创 Best Time to Buy and Sell Stock III(Leetcode)
Best Time to Buy and Sell Stock III(Leetcode)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 comp
2018-01-05 10:22:19 223
原创 Distinct Subsequences(Leetcode)
Distinct SubsequencesGiven a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the original
2018-01-03 15:14:11 378
原创 Binary Tree Level Order Traversal(leetcode)
Binary Tree Level Order Traversal(leetcode)Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree
2017-12-31 13:25:39 278
原创 Predict the Winner(leetcode)
Predict the WinnerGiven an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Ea
2017-10-20 08:10:27 229
原创 Freedom Trail(leetcode)
Freedom TrailIn the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring", and use the dial to spell a specific keyword in order
2017-09-23 16:20:12 539
原创 K Inverse Pairs Array (leetcode)
K Inverse Pairs Array Given two integers n and k, find how many different arrays consist of numbers from 1 ton such that there are exactly k inverse pairs.We define an inverse
2017-09-10 16:47:36 313
原创 Strange Printer (leetcode)
There is a strange printer with the following two special requirements:The printer can only print a sequence of the same character each time.At each turn, the printer can print new characters star
2017-09-07 14:30:02 379
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人