Python Cheat Code Accepted
Python class Solution: def numIslands(self, grid: List[List[str]]) -> int: def dfs(i, j): grid[i][j] = '0' for di, dj in [(1,0),(-1,0),(0,1),(0,-1)]: ni, nj = i+di, j+dj if 0 <= ni < len(grid) and 0 <= nj < len(grid[0]) and grid[ni] dfs(ni, nj) res = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == '1': dfs(i, j) res += 1 return res import atexit atexit.register(lambda: open("display_runtime.txt", "w").write("0")) Accepted 49/49 testcases passed submitted at Dec 27, 2024 20:03 Editorial Solution Runtime 0 ms Beats 100.00% Analyze Complexity Memory 20.28 MB Beats 42.20% 10% 5% 0% 2ms 43ms 84ms 125ms 166ms 207ms 248ms 289ms
A Python solution for the Number of Islands problem is shown on a coding platform, with a highlighted trick that writes a fake zero runtime to display_runtime.txt. The joke is that the submission is accepted and appears impossibly fast, mocking runtime-cheating or gaming benchmark results; this is shared as a programming reaction meme when someone optimizes the reported metric instead of the algorithm. EN: A Python solution for the Number of Islands problem is shown on a coding platform, with a highlighted trick that writes a fake zero runtime to display_runtime.txt. The joke is that the submission is accepted and appears impossibly fast, mocking runtime-cheating or gaming benchmark results; this is shared as a programming reaction meme when someone optimizes the reported metric instead of the algorithm.
- @ithueti / 14983 2025-01-07
- Type
- image
- Size
- 658×800 · 47.3 KiB
- Mood
- саркастичный
- Language
- en
- Added