- 博客(9)
- 收藏
- 关注
原创 排序算法总结(选择、冒泡、插入、希尔、归并、快排、堆排序、桶排序、基数排序、计数排序)
排序算法总结(选择、冒泡、插入、归并、快排、堆排序、桶排序、希尔排序、基数排序、计数排序)选择排序冒泡排序插入排序归并排序快速排序堆排序希尔排序基数排序计数排序算法性能比较(时间复杂度、空间复杂度及稳定性)选择排序算法描述在一个长度为N的无需数组中,将第1个数的下标设为min。遍历后面N-1个数与min比较,若比min小将其下标重新设为min。遍历结束后将下标为min的数与第一个数交换。将第2个数的下标设为min。遍历后面N-2个数。遍历结束后将下标为min的数与第二个数交换。重复以上操作直至
2021-12-27 14:10:04
452
原创 5. 最长回文子串 Longest Palindromic Substring - 中等
最长回文子串 Longest Palindromic Substring题目描述解题方法方法一:中心扩展法方法二:动态规划法题目描述Given a string s, return the longest palindromic substring in s.Example 1:Input: s = “babad”Output: “bab”Note: “aba” is also a valid answer.Example 2:Input: s = “cbbd”Output: “bb
2021-11-16 22:29:32
75
原创 409. 最长回文串(Longest Palindrome)- 简单
最长回文串 Longest Palindrome题目描述解题方法题目描述Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.Letters are case sensitive, for example, "Aa" is not considered a pal
2021-11-13 01:24:32
372
原创 234. 回文链表 Palindrome Linked List - 简单
回文链表(Palindrome Linked List) 题目描述解题方法递归法快慢指针法题目描述Given the head of a singly linked list, return true if it is a palindrome.Example 1:Input: head = [1,2,2,1]Output: trueExample 2:Input: head = [1,2]Output: falseConstraints:The number of nodes
2021-11-11 09:36:23
57
原创 25. k个一组翻转链表 (Reverse Nodes in k-Group)
k个一组翻转链表 Reverse Nodes in k-Group题目描述解题方法方法一:迭代+递归方法二:迭代法题目描述Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the numb
2021-10-18 12:04:44
105
原创 92.反转链表 II (Reverse Linked List II)- 中等
反转链表 II (Reverse Linked List II)题目描述解题方法递归法迭代法方法一:穿针引线方法二:一次遍历「穿针引线」(头插法)题目描述Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to position right, and return the
2021-10-16 22:53:42
69
原创 206. 反转链表 (Reverse Linked List) - 简单
反转链表题目描述解题方法迭代法递归法可能出现的问题题目描述Given the head of a singly linked list, reverse the list, and return the reversed list.Example 1:Input: head = [1,2,3,4,5]Output: [5,4,3,2,1]Example 2:Input: head = [1,2]Output: [2,1]Example 3:Input: head = []Outp
2021-10-12 17:04:04
64
原创 322. 零钱兑换(Coin Change)- 中等
零钱兑换(Coin Change)题目描述解题方法题目描述You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.Return the fewest number of coins that you need to make up that amount. If that am
2021-10-11 19:43:24
124
原创 509. 斐波那契数列( Fibonacci Number)- 简单
斐波那契数列 Fibonacci Number题目描述题解解法一:动态规划解法二:动态规划(优化空间复杂度)解法三: 递归(暴力解法)题目描述题解解法一:动态规划解法二:动态规划(优化空间复杂度)解法三: 递归(暴力解法)...
2021-10-09 06:01:03
168
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人