16
a_ntv
1 13 26
1294/ 1445
Last seen 3 years ago
Member for 4 years, 3 months, 23 days
Difficulty Normal
Missions (68) / Solutions (65)
Best solutions / Newest solutions
Initiation
return (not num%2)
Is Even
bool
int
Using reduce
All the Same
Any
typing.Any
functools.reduce
reduce
functools
Home
two lines
Sun Angle
or
inline-if
int
4
with filter and count
Non-unique Elements
filter
lambda
count
list
using dictionary as ordered set to keep trace of relative position
Sort Array by Element Frequency
dict-comp
sort
lambda
count
True
not elegant, but it works
Bigger Price
remove
max
lambda
append
range
using classes: Cell, Pawn, Pieces
Pawn Brotherhood
class
yield
add
index
bool
Electronic Station
I find algorithm my myself, not elegant but it passed the tests
Inside Block
class
collections.namedtuple
namedtuple
collections
sort
using getattr
Boolean Algebra
class
getattr
not
or
and
2
with classes
Brackets
class
all
pop
not
if-comprehension
Scientific Expedition
Uding unicodedata
Remove Accents
combining
unicodedata.combining
normalize
unicodedata.normalize
unicodedata
nothing special
YAML. More Types
splitlines
strip
ValueError
chr
dict
using a dict
Follow Instructions
for
For..else
Striped Words
re.split
r-string
upper
continue
re
with class Cipher which may be used again
Cipher Map
class
map
lambda
join
if-comprehension
Nothing Special
YAML. Simple Dict
splitlines
strip
ValueError
dict
continue
2
return name.replace('_',' ').title().replace(' ','')
Conversion into CamelCase
title
replace
Using isinstance
Sum by Type
Tuple
typing.Tuple
isinstance
typing
list
Using collections.defaultdict(lambda: 0)
Call to Home
collections.defaultdict
defaultdict
values
collections
lambda
trasforming hour to int and again to str
Time Converter (24h to 12h)
or
inline-if
else
int
str
without re,
Bird Language
next
yield
continue
None
break
return sorted(numbers_array, key=lambda x: abs(x))
Absolute Sorting
tuple
abs
lambda
sorted
list
2
return ''.join(l for l in text if l.isupper())
Secret Message
isupper
join
if-comprehension
comprehension
str
1
O'Reilly
recursive
Flatten a List
isinstance
extend
append
list
else
with class Node, each node with 4 linked nodes
Xs and Os Referee
class
yield
List
typing.List
min
easy solution, using floor from math
Median
math.floor
floor
float
List
typing.List
Incinerator
Simple, because the logic of damages was already into a method of class Warrior
The Defenders
class
super
extend
None
not
18
all works inside Warrior
The Weapons
class
next
super
yield
extend
With "order" as attribute of Warrior
The Warlords
class
next
super
yield
extend
Simple, keep the logic of damage/health into Warrior class
The Vampires
class
super
extend
pass
None
I dont see the point of this task
Every Person is Unique
class
format
replace
int
With new unit type "Dead(Warrior) "
Straight Fight
class
raise
iter
next
super
With class Front (the first 2 warriors) which acts as Warrior, to keep fight() unchanged
The Healers
class
raise
iter
next
super
With all properties into the classes
The Lancers
class
raise
iter
next
super
with itertools.cycle and using a simple state design pattern
Multicolored Lamp
cycle
itertools.cycle
class
next
itertools
simple and open to further development
Army Battles
class
super
extend
None
not
1
using a list to store the connections
Friends
class
set-comp
add
remove
if-comprehension
1
code into the classes
The Warriors
class
super
not
while
False
2
Ice Base
using a dict to store rectangles (key=high, value=length)
Largest Rectangle in a Histogram
get
items
map
max
lambda
simple with function inside
Roman Numerals
reversed
join
append
range
int
iterating over line just one time
Long Repeat
else
int
str
for
if
Alice In Wonderland
Create orizontal water basins, and merge the basins in the above bacins
Flood Area
class
yield
sort
enumerate
min
Recursive
Tree Walker
isinstance
values
dict
sum
list
to practice generators
Zigzag Array
StopIteration
reverse
next
yield
List
With classes Cell, Knight, Board (for further expansion)
The Shortest Knight's Path
class
yield
extend
index
False
for i in range(0, 2*(len(a)//2), 2): new_a.extend([a[i+1],a[i]])
Swap Nodes
extend
pop
append
range
len
2
Working on bits
IP Network: Route Summarization
break
sum
join
append
list-comp
return [[data[k][i] for k in range(len(data))] for i in range(len(data[0]))]
Transposed Matrix
List
typing.List
typing
list-comp
range
GitHub
It gets the shorter possible path. Using classes for Cell and Map, readable
Open Labyrinth
class
List
typing.List
continue
enumerate
Dropbox
Using classes: Cell, Queen, Board and for...else cycles
Place Queens
class
difference
combinations
itertools.combinations
update
using reduce
Worth of Words
functools.reduce
reduce
functools
index
max
1
PyCon TW
Getting, step after step, the whole labyrinth, and using Dijkstra's algorithm to find cells near "?" and then "E"
Dark Labyrinth
class
clear
yield
extend
continue
Using classes Line, Cell, Map; considering the boxes as normal cells; open to further developement
Express Delivery
class
combinations
itertools.combinations
yield
extend
HubSpot
Calculating in advance the zoc for each cell, in order to be quicker
Supply Line
class
yield
extend
continue
index
simple recursive
Restricted Sum
not
if
Blizzard
With classes Cell and Map
Safe Coasts
dataclass
dataclasses
dataclasses.dataclass
class
yield
Shelter
with a generator of fibonacci numbers
Ghosts Age
next
yield
while
True
range
Codeship
Using Dijkstra's algorithm, with classes Line, Cell, Field
Snake Lite
class
Exception
raise
next
yield
using classes, calculating in advance the Zone of Influence of each cell.
Eaten Go Stones
class
yield
extend
continue
None
Using classes, calculating in advance the Zone of Influence of each cell, open to further developments
The Territory of Go
class
yield
extend
continue
None
Hermit
With binaries, xor and popcount
Mono Captcha
class
yield
dict
List
typing.List
working on a table of binaries to use brute force
Break Rings
class
reversed
tuple
enumerate
min
Watchtower
Using classes: Light and Grid, self explanatory, algorithm as per Wikipedia page
Wall Keeper
class
tuple
None
break
not
Calculating for each cell the coefficient with the numbers of bacteria in each direction
Bacteria Colonies
class
yield
sort
not
lambda
Not On Map
return ''.join(DIGITS[x] for x in reversed(remainders)).lstrip('0')
Base change - Position System
reversed
lstrip
break
join
while
8