Skip to content

Instantly share code, notes, and snippets.

View 9helix's full-sized avatar

Dino Gržinić 9helix

View GitHub Profile
@9helix
9helix / 7.py
Created December 21, 2022 13:03
[2022 Day 7 (Part 1)] [PYTHON]
with open("7.txt", 'r') as l:
li = l.readlines()
suma = 0
commands = []
dirs = []
dirval = {}
for i in range(len(li)):
li[i] = li[i].replace("\n", "")
if "$ cd" in li[i]:
commands.append(li[i][5:])
@9helix
9helix / main.dart
Created April 6, 2022 14:06
custom sort dart
void main() {
getFreq(n) {
return int.parse(n.substring(n.indexOf(';') + 1, n.length));
}
final List<String> words = <String>['krak;56', 'mrak;1500', 'brak;480'];
words.sort((a, b) => getFreq(a).compareTo(getFreq(b)));
print(words);
}
@9helix
9helix / 11.py
Created December 12, 2021 08:48
input = '''6744638455
3135745418
4754123271
4224257161
8167186546
2268577674
7177768175
2662255275
4655343376
7852526168'''.splitlines()
@9helix
9helix / flood_fill.py
Created December 10, 2021 11:38
Flood Fill Python
def floodfill(grid, row, col, newColor):
oldColor = grid[row][col]
if newColor == oldColor:
return grid
recurse(grid, row, col, newColor, oldColor)
return grid
def recurse(grid, row, col, newColor, oldColor):