Skip to content

Instantly share code, notes, and snippets.

https://www.hackerrank.com/profile/Tusenka
@Tusenka
Tusenka / 2d_matrix_transformation.py
Created October 21, 2024 07:40
Python 2d matrix transformation
#!/bin/python3
import math
import os
import random
import re
import sys
import copy
import pprint
What is wrong with the code. Why it writes 5<4?
```
#!/bin/python3
import math
import os
import random
import re
import sys
@Tusenka
Tusenka / grid_search.py
Last active November 16, 2024 17:26
My version of grid search
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'gridSearch' function below.
def _iter_swap(m,i,j):
for [x, y] in [(i,j), (len(m)-i-1, j), (i, len(m)-j-1), (len(m)-i-1, len(m)-j-1)]:
yield m[x][y]
def _get_max(m, i, j):
return max(_iter_swap(m, i, j))
def _iter_corner(m):