This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = '''6744638455 | |
3135745418 | |
4754123271 | |
4224257161 | |
8167186546 | |
2268577674 | |
7177768175 | |
2662255275 | |
4655343376 | |
7852526168'''.splitlines() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |