地址:https://leetcode.cn/problems/majority-element/ 解法: class Solution: def majorityElement(self, nums: List[int]) -> int: coll = {} half = len(nums) // 2 for […]
地址:https://leetcode.cn/problems/majority-element/ 解法: class Solution: def majorityElement(self, nums: List[int]) -> int: coll = {} half = len(nums) // 2 for […]
地址:https://leetcode.cn/problems/happy-number/ 解法: class Solution: def isHappy(self, n: int) -> bool: loop = {n: 1} def check_is_happy(n): sum = 0 for i in st […]
在操作MongoDB时 发现有很多常用的命令,比如mongostat、mongodump、mongorestore等都没有, 到mongodb的bin目录查看才发现 cd /usr/local/mongodb/bin;ll 这种情况不要慌,只需在官网下载即可 下载地址:database-tools 下载解压后,将文件夹 […]
地址链接:1684. 统计一致字符串的数目 - 力扣(LeetCode) 解法: 直接暴力操作,重拳出击 class Solution: def countConsistentStrings(self, allowed: str, words: List[str]) -> int: result = 0 for […]
地址链接: https://leetcode.cn/problems/longest-common-prefix 解法 巧用python中的zip, Built-in Functions — zip class Solution: def longestCommonPrefix(self, strs: List[str […]
linupy
这个人很懒,什么都没留下