Leetcode contests 95 题解
876. Middle of the Linked List 简单题,我的做法是先数下个数,然后知道中间节点是第几个了。 ~谢谢打赏~ 赏
876. Middle of the Linked List 简单题,我的做法是先数下个数,然后知道中间节点是第几个了。 ~谢谢打赏~ 赏
868. Binary Gap 简单题,就是求一个数字二进制形式中两个1的最大间隔位置,比如22的二进制0b10110,最大距离就是2,0b100001,最...
题目链接295. Find Median from Data Stream 在一个有序数组中找中位数,但需要支持再数组中添加新的元素。本来是有序里的,可以很...
题目链接 236. Lowest Common Ancestor of a Binary Tree 根据LCA的定义,二叉树中最小公共祖先就是两个节点p和q...
题目链接 Leetcode 4. Median of Two Sorted Arrays 题目描述很简单,就是找到两个有序数组合并后的中位数,要求时间复杂度...
题目链接:19. Remove Nth Node From End of List 删除单链表中的倒数第n个节点,链表中删除节点很简单,但这道题你得先知道要...
题目链接 Leetcode 24. Swap Nodes in Pairs 给你一个链表,交换相邻两个节点,例如给你 1->2->3->4...
原题链接:6.ZigZag Conversion 题目名称『曲折变换』,但给的样例只有三行,看不出到底怎么样曲折变化,所以这里我再补充一个样例,大家肯定一下...
题目链接 Given a string s, find the longest palindromic subsequence's length in s. Y...
Leetcode 582. Kill Process 好久没刷题,今天来一道比较简单的题目,如果此题作为一道面试题,可以延伸出树的遍历,栈和队列,hashm...
Leetcode 114. Flatten Binary Tree to Linked List 题目意思很简单,就是把一棵二叉数转换为链表,虽然题目中没说...
Water and Jug Problem You are given two jugs with capacities x and y litres. The...
好久没刷题了,今天来俩道简单题。 Leetcode 62. Unique Paths Leetcode 63. Unique Paths II ~谢谢打赏~ 赏
题目链接:Unique Substrings in Wraparound String 这里加段英文,不是为了凑字数,而是为了让别人搜索题目的时候能搜到我的博客...
题目链接:368. Largest Divisible Subset Given a set of distinct positive integers, fi...
题目链接:53.Maximum Subarray Find the contiguous subarray within an array (containin...
题目链接:Super Pow Your task is to calculate ab mod 1337 where a is a positive integ...
题目链接:Combination Sum IV Given an integer array with all positive numbers and no ...
题目链接:Search a 2D Matrix II Write an efficient algorithm that searches for a valu...
题目链接:Search a 2D Matrix Write an efficient algorithm that searches for a value i...
Given a binary search tree, write a function kthSmallest to find the kth smalles...
Write a program to find the nth super ugly number. Super ugly numbers are positi...
Given n non-negative integers a1, a2, ..., an, where each represents a point at ...
Given a string, find the length of the longest substring without repeating chara...