Algorithm/Leetcode, Lintcode, HackerRank, etc.(29)
- 
                
                  97. Interleaving Stringclass Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: if len(s1) + len(s2) > len(s3): return False def dfs(i, j, merged): if (i, j) in mem: return mem[(i, j)] if merged and merged[-1] != s3[len(merged) - 1]: return False if i == len(s1) and j == len(s2): return s3 == mer.. 2025.10.14
- 
                
                  2806. Account Balance After Rounded Purchaseclass Solution: def accountBalanceAfterPurchase(self, purchaseAmount: int) -> int: purchaseAmount = int(purchaseAmount / 10 + 0.5) * 10 return 100 - purchaseAmount 2025.10.13
- 
                
                  2525. Categorize Box According to Criteriaclass Solution: def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str: state = 0 if length >= 10000 or width >= 10000 or height >= 10000: state |= 1 if length * width * height >= 10 ** 9: state |= 1 if mass >= 100: state |= 2 if state == 0: return 'Neither' elif state == 3: .. 2025.10.13
- 
                
                  2933. High-Access Employeesclass Solution: def findHighAccessEmployees(self, access_times: List[List[str]]) -> List[str]: def to_minutes(time_str): return int(time_str[0:2]) * 60 + int(time_str[2:]) freqs = collections.defaultdict(int) last_time = collections.defaultdict(lambda: collections.deque([])) res = set() access_times.sort(key=lambda p: p[1]) for name, time_s.. 2025.10.13
- 
                
                  3446. Sort Matrix by Diagonalsclass Solution: def sortMatrix(self, grid: List[List[int]]) -> List[List[int]]: def sort_diagonal(sy, sx, reverse=True): y = sy x = sx elems = [] while y 2025.10.07
- 
                
                  884. Uncommon Words from Two Sentencesdef uncommonFromSentences(self, s1: str, s2: str) -> List[str]: freq = collections.Counter(s1.split()) + collections.Counter(s2.split()) return [word for word, cnt in freq.items() if cnt == 1] 2025.10.07



