Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input:…
分类:LeetCode
[LeetCode] Repeated String Match 重复字符串匹配
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a subst…
LeetCode | Text Justification
题目: Given an array of words and a length L, format the text such that each line has exactly L c…
LeetCode 166 Fraction to Recurring Decimal
题目描述 Given two integers representing the numerator and denominator of a fraction, return the fraction in strin…
[Leetcode] Word Ladder 单词爬梯
Word Ladder Given two words (beginWord and endWord), and a dictionary, find the length of shortest transformat…
LeetCode算法题-Implement Queue Using Stacks(Java实现)
这是悦乐书的第195次更新,第201篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第57题(顺位题号是232)。使用栈实现队列的以下操作。 push(x) – 将元素x推送到队列…
一题多解答Merge K sorted List
三种解法 Solution 1 Merge two sorted Lists 两两归并 Time: O(nlogk) 每个单独的listNode参与到归并的话是O(1)(比如一个长度为m的ListNode和一个长度n的L…
19. Remove Nth Node From End of List
19. Remove Nth Node From End of List 题目 Given a linked list, remove the nth node from the end of list and retu…
[LeetCode] Contains Duplicate II 包含重复值之二
Given an array of integers and an integer k, return true if and only if there are two distinct indices …
[LeetCode] Closest Binary Search Tree Value 最近的二分搜索树的值
Given a non-empty binary search tree and a target value, find the value in the BST that is closest to t…
LeetCode | Remove Duplicates from Sorted Array
题目: Given a sorted array, remove the duplicates in place such that each element appear only once and…
LeetCode之Stack题目汇总
Basic Calculator Implement a basic calculator to evaluate a simple expression string. The expression string ma…