Skip to content

Instantly share code, notes, and snippets.

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):
@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.
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 / 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
https://www.hackerrank.com/profile/Tusenka
CREATE TABLE post_partitioned (
pk int GENERATED ALWAYS AS IDENTITY,
title TEXT,
content TEXT,
author INTEGER,
category INTEGER,
reply_to INTEGER,
created_on TIMESTAMP WITH TIME ZONE,
last_edited_on TIMESTAMP WITH TIME ZONE,
editable BOOLEAN,
https://www.postgresql.org/docs/current/manage-ag-tablespaces.html
@Tusenka
Tusenka / gist:b5c7fe51fb37dd47229f733395d05bfe
Created October 15, 2024 05:50
search and replace world under cursor
https://vim.fandom.com/wiki/Search_and_replace#substitute_last_search
@Tusenka
Tusenka / simple_graph.py
Created October 15, 2024 05:44
simple_graph
import pandas as pd
import matplotlib.pyplot as plt
MIN_DATA_LENGTH=3;
def to_range(y):
return to_strings(list(range(y.count())))
def to_strings(y):
@Tusenka
Tusenka / good explanation
Created October 14, 2024 05:31
good explanation
https://math.stackexchange.com/questions/2353141/what-is-the-possible-number-of-commutative-binary-operations-that-can-be-defined