![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法练习
MidnightDJ
这个作者很懒,什么都没留下…
展开
-
算法练习——前K小数
题目描述:给定一个数组,输出该数组前K小数(无需排序)示例:Input: nums = {38, 61, 7, 87, 81, 18, 50, 55, 90, 26} K = 7Output: result = {7, 18, 26, 38, 50, 55, 61}题解:这道题目有两种解题方法,一是使用排序的算法让数组从小到大排好序,然后依次输出数组的前K个整数。这原创 2017-12-16 17:31:13 · 739 阅读 · 0 评论 -
Leetcode代码学习周记——Longest Palindromic Substring
题目链接:https://leetcode.com/problems/longest-palindromic-substring/题目描述:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.给定一个字原创 2018-01-13 21:48:52 · 164 阅读 · 0 评论 -
Leetcode代码学习周记——Palindrome Number
题目链接:https://leetcode.com/problems/palindrome-number/description/题目描述:Determine whether an integer is a palindrome. Do this without extra space.判断一个整数是否为回文整数。题解:先排除复数和非0的10的倍数。随后从该整数原创 2018-01-20 16:20:48 · 170 阅读 · 0 评论 -
Leetcode代码学习周记——Longest Common Prefix
题目链接:https://leetcode.com/problems/longest-common-prefix/description/题目描述:Write a function to find the longest common prefix string amongst an array of strings.编写一个函数以查找一个字符串数组中所有字符串的最长公共前原创 2018-01-20 17:14:28 · 234 阅读 · 0 评论 -
Leetcode代码学习周记——3Sum
题目链接:https://leetcode.com/problems/3sum/description/题目描述:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array wh原创 2018-01-20 18:16:36 · 197 阅读 · 0 评论 -
Leetcode代码学习周记——Find Anagram Mappings
题目链接:https://leetcode.com/problems/find-anagram-mappings/description/题目描述:Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the or原创 2018-01-20 19:07:48 · 242 阅读 · 0 评论 -
Leetcode代码学习周记——Merge Two Binary Trees
题目链接:https://leetcode.com/problems/merge-two-binary-trees/description/题目描述:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees原创 2018-01-20 19:18:40 · 186 阅读 · 0 评论 -
Leetcode代码学习周记——Number Complement
题目链接:https://leetcode.com/problems/number-complement/description/题目描述:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary repres原创 2018-01-20 19:30:02 · 216 阅读 · 0 评论 -
算法 习题8.22 题解
ProblemIn task scheduling, it is common to use a graphrepresentation with a node for each task and a directed edge from taskito task j if i is a precondition for j. This directedgraph depicts the原创 2018-01-20 19:40:55 · 321 阅读 · 0 评论