1.Algorithm LCR 159. 库存管理 III 方法一:排序 class Solution: def inventoryManagement(self, stock: List[int], cnt: int) -> List[int]: stock = sorted(stock) return(stock[:cnt]) 对原数组从小到大排序后取出前 cnt 个数即可。 方法二:堆 我们用一个大根堆实时维护数组的前 cnt
1.Algorithm 283. 移动零 如果该位置为0,则pop该位置的元素 append到最后。 class Solution: def moveZeroes(self, nums: List[int]) -> None: offset = 0 for i in range(len(nums)): i = i - offset if nums[i] == 0: offset += 1 nums.append(nums.pop(i)) 2.Review How we structure our dbt projects dbt m
1.Algorithm 2.Review WDL 1.2.0: Enhancing Workflow Description Language for Bioinformatics One of the key improvements in WDL 1.2.0 is the introduction of the Directorytype. 支持将目录作为输入输出参数 version 1.2 task directory_output { command <<< mkdir out for n in {1..10}; do echo $n > out/file.$n done >>> output { Directory dir = "out/" } } 但是使用目
1.Algorithm 520. 检测大写字母 class Solution: def detectCapitalUse(self, word: str) -> bool: if len(word) >= 2 and word[0].islower() and word[1].isupper(): return False return all(word[i].islower() == word[1].islower() for i in range(2, len(word))) 2.Review Nobody wants to work with our best engineer 任何工作都需要团队协作,单兵作战的“特种兵”难以受到
Creational, Structural, and Behavioural Patterns The Gang of Four’s catalog contains 23 patterns categorized into Creational, Structural, and Behavioral patterns. 根据不同的项目选择不同的设计模式 Creational Patterns 创建型模式 它们帮助一个系统独立于如何创建、组合和表示它的那些对象
Abstraction Encapsultion Decomposition Generalization Access Modifiers Public 允许系统中的任何类来访问、修改属性 Protected The methods or data members declared as protected are accessible within the same package or subclasses in different packages. 受保护的方法、属性允许同一个package或者不同p