• May 5, 2026 •CodeCatch
0 likes • 6 views
• Jun 16, 2024 •lagiath
0 likes • 2 views
print('hello, world')
• Nov 19, 2022 •CodeCatch
def max_n(lst, n = 1): return sorted(lst, reverse = True)[:n] max_n([1, 2, 3]) # [3] max_n([1, 2, 3], 2) # [3, 2]
• Dec 18, 2025 •CodeCatch
0 likes • 12 views
def insertion_sort(arr): # Traverse through 1 to len(arr) for i in range(1, len(arr)): key = arr[i] # Move elements of arr[0..i-1], that are greater than key, # to one position ahead of their current position j = i - 1 while j >= 0 and key < arr[j]: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key # Example usage: arr = [12, 11, 13, 5, 6, 7, 8, 10] insertion_sort(arr) print("Sorted array is:", arr)
• Oct 23, 2026 •zsq1364202622-89e7
def remove_repeated_blocks(content_list: list[str], line_count: int) -> list[str]: """删除相邻重复的代码块,保留第一次出现的内容。""" if line_count <= 0: return content_list result = [] seen = set() i = 0 while i < len(content_list): block = tuple(line.strip() for line in content_list[i:i + line_count]) if len(block) < line_count: result.extend(content_list[i:]) break if block in seen: i += line_count continue seen.add(block) result.extend(content_list[i:i + line_count]) i += line_count return result
0 likes • 21 views