// Solution 1: A hard problem indeed. If there're redundant (s, what you gonna do? Remove it. If it's )s, what then? We can't remove them, because they might be needed later. This is the first challenge. The problem requests we find all possible solutions, that's the second ch...
随着做过的题越来越多,我觉得我需要一个目录来让我飞快的找到题目。
class Solution(object): def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]...
int loop = itrv; while (cur != null && loop > 0) { cur = cur.next; loop--; } if (loop > 0) break; // 无 l2 // 1.2 找到合并链表的 l1 头节点 ListNode l2 = cur; loop = itrv; while (cur != null && loop > 0) { cur = cur.next; loop--; } // 2. 合并 int len...
LeetCode 刷题随手记 - 第一部分 前 256 题(非会员),仅算法题,的吐槽 https://leetcode.com/problemset/algorithms/...
{int[] value = recall.get(index);int s1cntPrime = value[0];int s2cntPrime = value[1];// 前 s1cnt' 个 s1 包含了 s2cnt' 个 s2preLoop = new int[]{s1cntPrime, s2cntPrime};// 以后的每 (s1cnt - s1cnt') 个 s1 包含了 (s2cnt - s2cnt') 个 s2inLoop = new int[]{s1cnt ...
//#203Description: Remove Linked List Elements | LeetCode OJ 解法1:删呗。 // Solution 1: Do it. 代码1 //Code 1 204 Count Primes // #204 数质数 描述:统计小于n的质数个数。 //#204Description: Count Primes | LeetCode OJ 解法1:筛法。
301. Remove Invalid Parentheses Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may contain letters other than the parentheses(and). Examples:
[LeetCode] 19. Remove Nth Node From End of List Given theheadof a linked list, remove thenthnode from the end of the list and return its head. Follow up: Could you do this in one pass? Example 1: Input: head = [1,2,3,4,5], n = 2...
//#109Description: Convert Sorted List to Binary Search Tree | LeetCode OJ 解法1:和之前一样,只不过这次改链表了。你可以凑活,也可以先转成数组。 // Solution 1: Same as before, only in that it's a list this time. You can either make do with it or convert it to array first. ...