Python
文章平均质量分 66
Python处理
优惠券已抵扣
余额抵扣
还需支付
¥9.90
¥99.00
购买须知?
本专栏为图文内容,最终完结不会低于15篇文章。
订阅专栏,享有专栏所有文章阅读权限。
本专栏为虚拟商品,基于网络商品和虚拟商品的性质和特征,专栏一经购买无正当理由不予退款,不支持升级,敬请谅解。
杨鑫newlfe
算法就是我的灵魂
展开
-
LeetCode --- 1995. Count Special Quadruplets 解题报告
两种解法处理移动下标算法问题原创 2023-11-11 11:22:36 · 162 阅读 · 0 评论 -
LeetCode --- CodeTestcaseTestcaseTest Result1991. Find the Middle Index in Array 解题报告
Given a 0-indexed integer array , find the leftmost (i.e., the smallest amongst all the possible ones).A is an index where .If , the left side sum is considered to be . Similarly, if , the right side sum is considered to be .Return the leftmost that sat原创 2023-11-05 23:27:30 · 94 阅读 · 0 评论 -
LeetCode --- 1984. Minimum Difference Between Highest and Lowest of K Scores 解题报告
You are given a 0-indexed integer array , where represents the score of the student. You are also given an integer .Pick the scores of any students from the array so that the difference between the highest and the lowest of the scores is minimized.Retu原创 2023-11-03 08:48:14 · 76 阅读 · 0 评论 -
LeetCode --- 1979. Find Greatest Common Divisor of Array 解题报告
Given an integer array , return the greatest common divisor of the smallest number and largest number in .The greatest common divisor of two numbers is the largest positive integer that evenly divides both numbers.Example 1:Input: nums = [2,5,6,9,10]Outp原创 2023-10-23 00:18:16 · 242 阅读 · 0 评论 -
LeetCode --- 1974. Minimum Time to Type Word Using Special Typewriter 解题报告
There is a special typewriter with lowercase English letters to arranged in a circle with a pointer. A character can only be typed if the pointer is pointing to that character. The pointer is initially pointing to the character .Each second, you may perf原创 2023-10-20 00:12:17 · 580 阅读 · 0 评论 -
LeetCode --- 1971. Find if Path Exists in Graph 解题报告
并查集处理无向图联通问题原创 2023-10-09 23:19:16 · 565 阅读 · 0 评论 -
LeetCode --- 1967. Number of Strings That Appear as Substrings in Word 解题报告
Given an array of strings and a string , return the number of strings in that exist as a substring in .A substring is a contiguous sequence of characters within a string.Example 1:Input: patterns = ["a","abc","bc","d&q原创 2023-09-25 01:06:53 · 471 阅读 · 0 评论 -
LeetCode --- 1961. Check If String Is a Prefix of Array 解题报告
Given a string and an array of strings , determine whether is a prefix string of .A string is a prefix string of if can be made by concatenating the first strings in for some positive no larger than .Return if is a prefix string of , or otherwis原创 2023-09-25 00:51:33 · 280 阅读 · 0 评论 -
LeetCode --- 1957. Delete Characters to Make Fancy String 解题报告
A fancy string is a string where no three consecutive characters are equal.Given a string , delete the minimum possible number of characters from to make it fancy.Return the final string after the deletion. It can be shown that the answer will always be u原创 2023-09-24 10:55:41 · 130 阅读 · 0 评论 -
LeetCode --- 1952. Three Divisors 解题报告
Given an integer , return if has exactly three positive divisors. Otherwise, return .An integer is a divisor of if there exists an integer such that .Example 1:Input: n = 2Output: falseExplantion: 2 has only two divisors: 1 and 2.Example 2:Inpu原创 2023-09-24 10:33:02 · 116 阅读 · 0 评论 -
LeetCode --- 222. Count Complete Tree Nodes 解题报告
Given the of a complete binary tree, return the number of the nodes in the tree.According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as possible. It原创 2023-09-23 20:10:58 · 204 阅读 · 0 评论 -
LeetCode --- 145. Binary Tree Postorder Traversal 解题报告
Given the of a binary tree, return the postorder traversal of its nodes' values.Example 1:Input: root = [1,null,2,3]Output: [3,2,1]Example 2:Input: root = []Output: []Example 3:Input: root = [1]Output: [1]Constraints:Follow up: Recursive so原创 2023-09-23 19:34:38 · 124 阅读 · 0 评论 -
LeetCode --- 1945. Sum of Digits of String After Convert 解题报告
You are given a string consisting of lowercase English letters, and an integer .First, convert into an integer by replacing each letter with its position in the alphabet (i.e., replace with , with , ..., with ). Then, transform the integer by replacin原创 2023-09-23 16:58:28 · 135 阅读 · 0 评论 -
LeetCode --- 1941. Check if All Characters Have Equal Number of Occurrences 解题报告
Given a string , return if is a good string, or otherwise.A string is good if all the characters that appear in have the same number of occurrences (i.e., the same frequency).Example 1:Input: s = "abacbc"Output: trueExplanation: The chara原创 2023-09-23 02:36:32 · 65 阅读 · 0 评论 -
LeetCode --- 1935. Maximum Number of Words You Can Type 解题报告
There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.Given a string of words separated by a single space (no leading or trailing spaces) and a string of all distinct letter keys that are brok原创 2023-09-10 10:58:05 · 550 阅读 · 0 评论 -
LeetCode --- 1929. Concatenation of Array 解题报告
Given an integer array of length , you want to create an array of length where and for (0-indexed).Specifically, is the concatenation of two arrays.Return the array .Example 1:Input: nums = [1,2,1]Output: [1,2,1,1,2,1]Explanation: The array ans原创 2023-09-10 10:39:15 · 316 阅读 · 0 评论 -
LeetCode --- 1925. Count Square Sum Triples 解题报告
A square triple is a triple where , , and are integers and .Given an integer , return the number of square triples such that .Example 1:Input: n = 5Output: 2Explanation: The square triples are (3,4,5) and (4,3,5).Example 2:Input: n = 10Output: 4原创 2023-09-05 01:59:00 · 286 阅读 · 0 评论 -
LeetCode --- 1920. Build Array from Permutation 解题报告
Given a zero-based permutation (0-indexed), build an array of the same length where for each and return it.A zero-based permutation is an array of distinct integers from to (inclusive).Example 1:Input: nums = [0,2,1,5,3,4]Output: [0,1,2,4,5,3]Exp原创 2023-09-05 01:36:23 · 286 阅读 · 0 评论 -
LeetCode --- 1913. Maximum Product Difference Between Two Pairs 解题报告
The product difference between two pairs and is defined as .Given an integer array , choose four distinct indices , , , and such that the product difference between pairs and is maximized.Return the maximum such product difference.Example 1:Input: nu原创 2023-09-03 03:07:36 · 386 阅读 · 0 评论 -
LeetCode --- 1909. Remove One Element to Make the Array Strictly Increasing 解题报告
Given a 0-indexed integer array , return if it can be made strictly increasing after removing exactly one element, or otherwise. If the array is already strictly increasing, return .The array is strictly increasing if for each index Example 1:Input: n原创 2023-09-03 02:40:04 · 130 阅读 · 0 评论 -
LeetCode --- 1903. Largest Odd Number in String 解题报告
You are given a string , representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of , or an empty string if no odd integer exists.A substring is a contiguous sequence of characters within a string.Ex原创 2023-08-29 08:10:53 · 330 阅读 · 0 评论 -
LeetCode --- 1897. Redistribute Characters to Make All Strings Equal 解题报告
You are given an array of strings (0-indexed).In one operation, pick two distinct indices and , where is a non-empty string, and move any character from to any position in .Return if you can make every string in equal using any number of operations,原创 2023-08-21 00:42:42 · 606 阅读 · 0 评论 -
LeetCode --- 1893. Check if All the Integers in a Range Are Covered 解题报告
You are given a 2D integer array and two integers and . Each represents an inclusive interval between and .Return if each integer in the inclusive range is covered by at least one interval in . Return otherwise.An integer is covered by an interval原创 2023-08-15 23:52:53 · 246 阅读 · 0 评论 -
LeetCode --- 1886. Determine Whether Matrix Can Be Obtained By Rotation 解题报告
Given two binary matrices and , return if it is possible to make equal to by rotating in 90-degree increments, or otherwise.Example 1:Input: mat = [[0,1],[1,0]], target = [[1,0],[0,1]]Output: trueExplanation: We can rotate mat 90 degrees clockwis原创 2023-08-15 23:28:31 · 205 阅读 · 0 评论 -
LeetCode --- 1880. Check if Word Equals Summation of Two Words 解题报告
【代码】LeetCode --- 1880. Check if Word Equals Summation of Two Words 解题报告。原创 2023-08-09 22:49:11 · 935 阅读 · 0 评论 -
LeetCode --- 1876. Substrings of Size Three with Distinct Characters 解题报告
【代码】LeetCode --- 1876. Substrings of Size Three with Distinct Characters 解题报告。原创 2023-08-09 22:37:36 · 307 阅读 · 0 评论 -
LeetCode --- 1869. Longer Contiguous Segments of Ones than Zeros 解题报告
Given a binary string , return if the longest contiguous segment of 's is strictly longer than the longest contiguous segment of 's in , or return otherwise.Note that if there are no 's, then the longest continuous segment of 's is considered to have a l原创 2023-07-28 21:53:30 · 503 阅读 · 0 评论 -
LeetCode --- 1863. Sum of All Subset XOR Totals 解题报告
【代码】LeetCode --- 1863. Sum of All Subset XOR Totals 解题报告。原创 2023-07-28 21:38:35 · 362 阅读 · 0 评论 -
LeetCode --- 1859. Sorting the Sentence 解题报告
【代码】LeetCode --- 1859. Sorting the Sentence 解题报告。原创 2023-07-25 01:12:05 · 279 阅读 · 0 评论 -
LeetCode --- 1854. Maximum Population Year 解题报告
【代码】LeetCode --- 1854. Maximum Population Year 解题报告。原创 2023-07-17 23:58:56 · 340 阅读 · 1 评论 -
LeetCode --- 1848. Minimum Distance to the Target Element 解题报告
【代码】LeetCode --- 1848. Minimum Distance to the Target Element 解题报告。原创 2023-07-17 23:43:18 · 308 阅读 · 0 评论 -
LeetCode --- 1844. Replace All Digits with Characters 解题报告
【代码】LeetCode --- 1844. Replace All Digits with Characters 解题报告。原创 2023-07-16 10:08:48 · 366 阅读 · 0 评论 -
LeetCode --- 1837. Sum of Digits in Base K 解题报告
【代码】LeetCode --- 1837. Sum of Digits in Base K 解题报告。原创 2023-07-16 09:39:07 · 358 阅读 · 0 评论 -
Python3实现画小提琴图(包含分组)
如何用Python画一个小提琴图呢?原创 2023-07-16 00:17:13 · 878 阅读 · 0 评论 -
LeetCode --- 1832. Check if the Sentence Is Pangram 解题报告
【代码】LeetCode --- 1832. Check if the Sentence Is Pangram 解题报告。原创 2023-07-15 23:45:23 · 372 阅读 · 0 评论 -
LeetCode --- 1827. Minimum Operations to Make the Array Increasing 解题报告
【代码】LeetCode --- 1827. Minimum Operations to Make the Array Increasing 解题报告。原创 2023-07-15 23:19:36 · 409 阅读 · 0 评论 -
LeetCode --- 1822. Sign of the Product of an Array 解题报告
【代码】LeetCode --- 1822. Sign of the Product of an Array 解题报告。原创 2023-06-29 00:50:36 · 172 阅读 · 0 评论 -
LeetCode --- 1812. Determine Color of a Chessboard Square 解题报告
【代码】LeetCode --- 1812. Determine Color of a Chessboard Square 解题报告。原创 2023-06-28 02:20:41 · 172 阅读 · 0 评论 -
Python运行报错ImportError: dlopen(/Users/biubiubiu/PythonDir/PythonBase/venv/lib/python3.7/site-packages
原因是因为这个matplotlib安装错了位置,python运行时调用不到,因此需要重新安装。正常安装后,默认Pycharm或者其他编译器默认会重新载入安装包,或者重启即可。1.找到python位置,上面的报错可以看到是python3.7。再利用这个Python3.7的位置拼接重新安装的命令。其他安装包报错也是一样的解决方案。安装新的 matplotlib 包运行报错如下,原创 2023-06-27 00:46:11 · 1656 阅读 · 0 评论 -
LeetCode --- 1805. Number of Different Integers in a String 解题报告
【代码】LeetCode --- 1805. Number of Different Integers in a String 解题报告。原创 2023-06-26 23:34:59 · 238 阅读 · 0 评论