Leetcode 0037.sudoku-solver(python)
37. Sudoku Solver题目Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of t...
Leetcode 0036.valid-sudoku(python)
36. Valid Sudoku题目Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must con...
Leetcode 0032.longest-valid-parentheses(python)
32. Longest Valid Parentheses题目Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) ...
Leetcode 0031.next-permutation(python)
31. Next Permutation题目A permutation of an array of integers is an arrangement of its members into a sequence or linear order. For example, for arr = [1,2,3],...
Leetcode 0030.Substring with Concatenation of All Words(python)
30. Substring with Concatenation of All Words一、问题描述给定一个字符串 s 和一个字符串数组 words,找出 s 中所有恰好由 words 中所有单词串联形成的子串的起始索引。 注意:words 中的单词可以以任意顺序串联。 示例 1: 示例 2: 示例...
Leetcode 0035.search-insert-position(python)
35. Search Insert Position题目Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index w...
Leetcode 0034.find-first-and-last-position-of-element-in-sorted-array(python)
34. Find First and Last Position of Element in Sorted Array题目Given an array of integers nums sorted in non-decreasing order, find the starting and ending pos...
Leetcode 0033.search-in-rotated-sorted-array(python)
33. Search in Rotated Sorted Array题目There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, ...
Leetcode 0029.Divide Two Integers(python)
29. Divide Two Integers你选用何种方法解题?本题的核心是不使用乘法、除法和取模运算实现整数除法。 方法选择理由: 位运算(位移法):通过左移实现快速乘法,时间效率高 负数倍增法:使用负数处理避免溢出问题,更安全 解题过程问题分析输入:被除数 dividend,除数 divisor输...
Leetcode 0028.Implement strStr()(python)
28. Implement strStr()你选用何种方法解题?本题的核心是实现字符串匹配算法。 方法选择理由: 暴力匹配:代码简单,适合短字符串 KMP 算法:时间效率更高,适合长字符串 解题过程问题分析输入:主串 haystack,模式串 needle输出:needle 在 haystack 中第一...
Leetcode 0027.Remove Element(python)
27. Remove Element你选用何种方法解题?本题的核心是原地移除数组中等于给定值的元素。 方法选择理由: 快慢指针:只需一次遍历,空间复杂度 O(1) 解题过程问题分析输入:数组 nums,目标值 val输出:移除目标值后的数组长度 关键约束: 原地修改数组,不能使用额外空间 不需要保持元...
Leetcode 0026.Remove Duplicates from Sorted Array(python)
26. Remove Duplicates from Sorted Array你选用何种方法解题?本题的核心是原地删除有序数组中的重复元素。 方法选择理由: 快慢指针:只需一次遍历,空间复杂度 O(1) 解题过程问题分析输入:有序数组 nums输出:删除重复元素后的数组长度 关键约束: 原地修改数组,...
Leetcode 0025.Reverse Nodes in k-Group(python)
25. Reverse Nodes in k-Group题目Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integ...
Leetcode 0024.Swap Nodes in Pairs(python)
24. Swap Nodes in Pairs题目Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in t...
Leetcode 0023.Merge k Sorted Lists(python)
23. Merge k Sorted Lists题目You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one ...

