1. 题目 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its…
分类:LeetCode
【LeetCode】- Kth Smallest Element in a BST(二叉搜索树第k小的数)
1、题目描述 Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: …
896. Monotonic Array
描述 An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is monotone in…
725. Split Linked List in Parts
Medium Given a (singly) linked list with head node root, write a function to split the linked list into k cons…
74. 搜索二维矩阵
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target…
[LeetCode] Search Insert Position 搜索插入位置
Given a sorted array and a target value, return the index if the target is found. If not, return the in…
[LeetCode] Valid Anagram 验证变位词,Minimum Window Substring 最小窗口子串,Isomorphic Strings 同构字符串,Longest Substring Without Repeating Characters 最长无重复子串,1.1 Unique Characters of a String 字符串中不同的字符
Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = R…
LeetCode 278. First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest ver…
LeetCode初级-存在重复
题目: 给定一个整数数组,判断是否存在重复元素。 如果任何值在数组中出现至少两次,函数返回 true。如果数组中每个元素都不相同,则返回 false。 示例 1: 输入: [1,2,3,1] 输出: true 示例 2:…
LeetCode算法题-Intersection of Two Arrays(Java实现-四种解法)
这是悦乐书的第207次更新,第219篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第75题(顺位题号是349)。给定两个数组,编写一个函数来计算它们的交集。例如: 输入:nums1 = [1…
Leetcode 207. Course Schedule
There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have prerequi…
[LeetCode By Go 26]606. Construct String from Binary Tree
题目 You need to construct a string consists of parenthesis and integers from a binary tree with the preorder tr…