49
Awesome Team
Philippe Cholet
https://github.com/Philippe-Cholet
Last seen 11 minutes ago
Member for 6 years, 2 months, 16 days
Difficulty Advanced
I was a math teacher in France for two years. I'm currently reconverting to IT, I'm here to improve my Python skills, and practice English.
Initiation
itertools recipe from python docs
All the Same
6
6
0
First
Multiply (Intro)
7
38
4
zip
Goes Right After
38
7
0
First
Time Converter (12h to 24h)
46
0
0
1-liner: set(string.ascii_lowercase).isdisjoint
All Upper I
111
6
3
List/Iterator versions
All the Same
165
6
0
try word.index
Goes Right After
222
1
0
lambda with counter.most_common
Sort Array by Element Frequency
260
3
0
try except
Between Markers
278
3
6
not set(text) & low_letters
All Upper I
396
1
0
generator and simple generalization
Split Pairs
531
0
0
My flat_list program
Flatten a List
560
1
0
collections.Counter and list comprehension
Non-unique Elements
658
6
1
sum "safe bools"
Pawn Brotherhood
3112
0
1
Home
Generate ugly numbers in a priority queue to get them in order
Ugly Numbers
1
21
5
v3: Dynamic Programming, more memory-friendly for large numbers
Ugly Numbers
1
13
3
List key possibilities for each clue and cautiously merge them into one full key
Playfair Cipher Attack
1
11
1
1-liner (clear version in 3rd party)
Rotating Grille Cipher
1
10
2
Find first/last occurence of a sub-string, rotations to filter candidates
Grille Cipher Attack
1
8
2
groups of signed diffs
Changing direction
1
5
5
numpy for easy rotations, itertools.compress and zip (length-check py3.10+)
Rotating Grille Cipher
1
5
3
.translate(table) done with operator.methodcaller
Atbash Cipher
2
24
3
::diameter
Scytale Encryption
2
7
0
[py3.8+] 50 chars with walrus
Split List
5
9
1
class XY(NamedTuple)
Find Enemy
5
7
1
[py3.8+] 1-liner: 115 chars
Time Converter (24h to 12h)
6
7
1
Dynamic programming - indexes of the next multiples of 2, 3, 5
Ugly Numbers
6
0
0
islice
Split List
10
5
1
lines generator
Xs and Os Referee
11
40
11
Best-first search with heapq and POO
8 Puzzle
12
2
1
Count recursively because of intersections; intersection function doctested
Mountain Scape
13
2
1
update dimensions with rotations
Life Counter
18
1
0
more-itertools import + 1-liner
Changing direction
19
2
1
sort, get next with diff != min_diff
Missing Number
29
0
0
4-lines: ''.join(generator)
Bird Language
30
2
3
Obvious generator
Sort by Removing
34
1
0
[py3.8+] 1-liner: 117 chars
Sun Angle
38
1
0
pop words until it's short enough
Cut Sentence
42
5
1
Ancestor(s?), check last generations
What Is Wrong With This Family?
47
3
3
20 random searches
Open Labyrinth
78
0
1
First
Time Converter (24h to 12h)
78
0
0
First
Bird Language
88
12
0
re.sub(r'_[a-z]', repl lambda function, name.capitalize())
Conversion into CamelCase
178
3
0
First
Sun Angle
183
0
0
index of next non-zero char
Beginning Zeros
412
1
0
Electronic Station
8-liner: Even-odd rule with origin point simplifications
Inside Block
1
20
2
3-liner: 177 chars
Similar Triangles
1
16
1
7-liner: Queue of dicts to determine the decimal, decode from hex
Cipher Dict (decryption)
1
0
3
Obfuscated milp
Blood distribution
1
0
1
[scipy 1.9+] milp: Mixed-integer linear programming
Blood distribution
1
0
0
filename.rpartition('.'), partial(sorted, key=...)
Sort by Extension
2
76
6
dict.setdefault
Surjection Strings
2
27
1
re.sub(r'[A-Z]', repl lambda function, name)
Conversion from CamelCase
2
11
1
Determine the decimal, group digits, queue of empty dicts
Cipher Dict
2
2
0
Two versions: Max-heap, Min-heap, 4 lines each
The Final Stone
4
10
7
(Print version) Recursively generate parenthesization on split digits and operations
Mathematically Lucky Tickets
6
10
1
min-heap of negative weigths & heapq.heapreplace
The Final Stone
6
0
0
and 'password' not in password.lower()
Acceptable Password V
7
11
1
(Shorter code) Recursively generate parenthesization on split digits and operations
Mathematically Lucky Tickets
7
10
1
neighbors generator, sort decorator
Chess Knight
10
6
1
From neighbors to neighbors with memorisation of previous steps...
Can You Pass?
13
6
1
not password.isdigit()
Acceptable Password III
14
10
1
[Generalized] All equal distance² fractions
Similar Triangles
20
8
1
[py3.8+] 1-liner: 82 chars with rpartition
Sort by Extension
21
1
0
len(password) >= 10 or
Acceptable Password IV
29
6
0
obvious 1-liner
Acceptable Password I
31
9
0
any(map(str.isdigit, ...))
Acceptable Password II
37
6
0
With chain rows/cols/diags generators
Find Sequence
42
11
1
translation dict and zip
Surjection Strings
49
6
6
replace; fullmatch
Unix Match. Part 1
67
3
1
compose(product, trues, ints, str)
Digits Multiplication
126
1
2
and len(set(password)) >= 3
Acceptable Password VI
200
0
0
lambda reduce mul
Digits Multiplication
1005
1
0
My first
Verify Anagrams
1651
0
0
Scientific Expedition
suppress ZeroDivisionError caused by eval
Aggregate by Operation
1
8
1
take zipped while all equal
Longest Common Prefix
2
3
2
3-liner
Combining Celebrity Names
2
0
0
basic 1-liner
Common Words
4
9
1
Naive but cached
Remove Brackets
5
23
5
composition of methods/types
Pangram
9
5
2
operator
Aggregate by Operation
9
4
0
groupby, del [...:], lstrip
Combining Celebrity Names
9
0
0
list
Letter Queue
22
7
1
capture stdout decorator
Caps Lock
35
0
0
v2: using slicing, sets, generator and translation of punctuation =)
Striped Words
59
8
0
Total cost of some calls
Call to Home
69
3
0
decorated for doc
I Love Python!
86
21
2
Simple generator of characters (decorated to ''.join output)
Caps Lock
104
2
4
Man, I can find hidden words in poetry! :-)
The Hidden Word
111
2
1
My morse clock
Morse Clock
114
4
0
basic 1-liner
Pangram
116
8
0
First
Secret Message
120
20
0
lambda function generalization
Sum by Type
157
2
0
So simple...
Follow Instructions
197
2
2
Read the password from cipher map
Cipher Map
1455
0
0
sorted with abs key
Absolute Sorting
2781
0
0
O'Reilly
Three solutions + 1 in comments
Replace Last
1
164
10
max(start_watching or end, end)
Lightbulb Start Watching
1
72
5
We can sum booleans (False == 0 and True == 1)
Majority
1
67
7
try return slice except
Remove All After
1
65
8
yield from reversed(ascending list)
Reverse Every Ascending
1
65
2
sympy.topological_sort
Determine the Order
1
12
1
Bruteforce with previous solution
Staircase
1
3
0
List segments
Cut Into Squares
1
0
0
add end time to els; min(end_watching or end, ...)
Lightbulb End Watching
2
38
2
1-liner: sympy.topological_sort
Determine the Order
2
7
2
Cached recursion and GCD
Cut Into Squares
2
0
0
Operating cut
Lightbulb Operating
4
7
0
Merge datetime intervals
Multiple Lightbulbs
5
6
0
Ugly-ish but short enough
Bridge Routine
5
0
0
product, filterfalse
All Roads Lead to Rome!
7
0
0
Enumerate string digits
"Lunar" Multiply
7
0
0
Row by row
All Roads Lead to Rome!
8
0
0
Digit by digit
"Lunar" Multiply
8
0
0
takewhile workaround, and not just lists
Remove All After
9
1
0
re
Chemical Analysis
12
0
0
Compare, deduce, choose with lexicographic order
Determine the Order
14
10
2
Sum comprehension in lambda function
Count Inversions
15
13
0
[wrong code] unions of sets and resolve all conflicts
Determine the Order
18
2
1
6-lines: min, itertools.combinations
Loading Cargo
21
6
0
sum timedelta.total_seconds()
Lightbulb Intro
22
6
0
My "flat dictionary" program
The Flat Dictionary
25
6
4
[typed, py3.10+] timelines, intervals, cut moments, count
Lightbulb More
32
0
0
1-liner + imports: O(n²) but faster than with "for"
Count Inversions
35
8
2
Two solutions
Chunk
59
3
1
short, recursive, max with default argument
How Deep
107
0
1
Sort with a key
Frequency Sorting
119
3
1
obviously itertools.groupby
Compress List
147
1
0
any_iterable, func = statistics.median, n = 3
Median of Three
158
0
0
count true
Majority
201
2
0
Fully typed generalization
Sort Except Zero
230
1
1
lambda
Index Power
308
5
1
import it
Median
396
5
2
Incinerator
Army with 3 properties : is_alive, warrior, pop
Army Battles
1
97
16
dataclass, functools.singledispatchmethod and decorated methods
Voice TV Control
1
23
5
First
Capital City
1
6
2
Deprecated version
The Warlords
1
2
0
v2 (from flpo veky and myself): Party(Named, set), Friends(str) with lambda show_invite
Party Invitations
2
14
0
Equipements class for list weapons, and new init_... attributes for manage weapons.
The Weapons
2
10
1
With (new) hit method returning damage, adapted for vampires.
The Vampires
3
25
0
With zip(army_1, army_2) and remove_the_dead property in Army class
Straight Fight
3
7
1
Short
Army Units
5
18
0
12-lines with lambda methods (except init)
Building Base
5
9
2
With Ngone class
Geometry Figures
7
6
1
Robot = Human(str)
Dialogues
12
10
1
My 3 chefs
3 Chefs
22
5
0
Dataclasses and a property
Microwave Ovens
22
4
2
[clear v2] dataclasses, army deque, properties
The Warlords
23
2
7
First
Hacker Language
29
2
6
New battle.fight method, and a different management of attributes/method.
The Lancers
32
1
1
My healers
The Healers
36
2
1
first with copy.copy and SavedText(list)
Text Editor
42
2
0
My party invitations
Party Invitations
54
1
0
_health attribute, health property, @health.setter to manage the defense attribute
The Defenders
62
2
6
Be lenient, it's my first class ever
Friends
70
3
2
Simple dataclass
Every Person is Unique
80
1
1
IOs
Hacker Language
121
0
0
First
Multicolored Lamp
128
2
2
My warriors with super().__init__()
The Warriors
247
2
0
Both partial, cycle
Multicolored Lamp
367
0
0
Mine
9-liner: BFS
Fast Train
1
24
1
max(..., key, default)
The Longest Word
1
19
2
match changes
One Switch Strings
1
18
1
str method
Replace All Occurrences
1
11
1
Backtracking
Peaceable Queens
1
9
1
[sympy] Intersections and reflections of rays with jar segments
Escape
1
8
1
sympy can handle permutations
15-puzzle Solvability
1
6
1
itertools.groupby, what else?!
Count And Say
1
5
0
Row by row (cryptic)
The Hollow Diamond
1
0
0
math trick
Close Enough
1
0
0
speedy 1-line
Close Enough
1
0
0
Minimize differences
Tricky String
1
0
0
First
Leap Year Checking
2
11
1
str
Reverse Integer
2
9
0
Generate perfect powers near n for reasonable exponents
Checking Perfect Power
2
0
0
log floor/ceil
Close Enough
2
0
0
Basic formula
Sum of Integers
3
6
0
yield
Quadratic Equation Roots
3
3
1
basic 1-liner
Caesar Cipher (decryptor)
3
1
0
Use the OEIS sequence
Peaceable Queens
3
0
0
Simply import
Count Divisibles in Range (simplified)
4
4
1
First
String-2-Matrix
4
4
0
First
e+pi
4
0
0
First
Matrix-2-String
5
0
1
Mostly deduce, consider all remaining possibilities
Garland
5
0
0
Sorted joined perms
All Permutations
5
0
0
yield:=breaks
Beat The Previous
6
4
0
Side by side
The Hollow Diamond
6
1
0
next(filter(balance, indexes), -1)
Can Balance
7
12
0
functools.cmp_to_key
Bigger Together
8
20
2
[py3.9+] just import math.gcd
The Greatest Common Divisor
10
14
1
Row by row
The Hollow Diamond
10
0
0
Optional ascending information
Sort Sorted Groups
10
0
0
max
Maximum Among Three
11
1
2
Lambda function with sympy.matrices package
Determinant
12
6
4
re (sub, fullmatch), translate/maketrans for exchange ',' and '.'
Currency Style
12
6
2
sum(map(int, str(num))) while 2+ digits
Sum of Digits
13
5
0
lambda
Moore Neighbourhood
14
18
3
min(routes generator, key=len)
Disposable Teleports
14
5
3
Counter
Count Vowels
16
1
1
1-liner: functools.partial(re.sub, regex, lambda repl)
Currency Style
16
0
0
basic 1-liner
Caesar Cipher (encryptor)
18
3
0
1-liner: itertools
Champernowne Word
18
0
0
First
Convert and Aggregate
20
3
1
Bruteforce
Domino Chain
22
0
0
in (UPPER, lower, Capitalize)
Correct Capital
23
2
1
isupper, islower or == capitalize
Correct Capital
40
0
1
lambda d: max(d, key=d.get)
Best Stock
41
10
0
Sets/dicts reunions, deduct the missing values
The Einstein Problem-Lite
50
0
0
I solved the equation, that's all.
Achilles and the Tortoise
63
4
3
Borrowed code for colour graph, then adapted
Color Map
70
0
0
I just wanted to try for a change
The Greatest Common Divisor
161
1
2
First
Binary Count
343
4
2
Ice Base
stack
Adjacent Letters
1
24
5
1-liner, no import
Ordinary Cardinals
1
5
0
(.)\1
Adjacent Letters
1
3
0
Backtracking
Stepping Stones Puzzle
1
2
0
I
Frogs Collision
1
0
0
DFS on colored network graph without crashed nodes
Node Disconnected Users
2
19
0
Priority queue: minimize used brushes and uncolored positions
Grid Painting
2
0
0
Colored connected components
Count Chains
4
20
4
Look for sure things thanks to comparisons
Cipher Crossword
4
10
0
This is the key 🔑
Ordinary Cardinals
4
3
0
math.prod
The Brick Factory Problem
5
0
0
Match operators
Postfix Evaluation
7
0
0
First
Count Divisibles in Range
8
0
0
Thinking about indexes
Matrix "Hatching"
9
0
0
DFS on colored (integers) networks (without a crash) for connected components
City's Happiness
11
5
0
symmetry & (solid, partial or break)
Counting Tiles
12
11
1
To the moon
Armstrong Number Checking
12
3
0
Dynamic programming with minimal storage (EAFP style)
Making Change
12
0
0
With fractions module
Oil Pie
13
5
2
Percentages then diff then lesser angle
Clock Angle
18
5
0
[v2] Simple BFS with collections.defaultdict & deque
How to Find Friends
23
13
0
DFS on colored (integers) net without crashes, return max color int
New Cities
23
3
4
groups and lengths
Long Pressed
27
0
1
Generate histograms with a "simple" iteration on heights
Largest Rectangle in a Histogram
27
0
0
max with default argument
Berserk Rook
29
2
1
All blocks considered at top left, and dictionary of blocks built with rotations of an example of each type.
Identify Block
31
1
0
Sets of friends
How to Find Friends
44
9
0
Feed previous pigeons, and maybe feed some new pigeons
Feed Pigeons
105
5
0
re.findall
Find Quotes
159
1
0
lambda function
Morse Encoder
169
1
0
lambda
The Most Numbers
259
5
1
sum booleans
Monkey Typing
269
3
2
My "long repeat" letter program
Long Repeat
729
0
0
Alice In Wonderland
1-liner: quick naming and weird slicing
Zigzag Array
1
15
4
enumerate(text.split()) and increasing indexes
Words Order
1
10
2
2-liner: 140 chars
Tree Walker
1
8
1
Powers of the adjacency matrix of a graph to find a path between numbers
Digits Doublets
1
8
1
Recursive max
The Cookie Monster
1
4
1
Cached tiling counts
Count Domino Tilings
1
1
1
Any sweep line
Overlapping Disks
1
0
0
Matrix of probabilities, generalized
Cleaning Robot
1
0
0
yield holes
Duplicate Zeros
2
30
4
Lambda function with sum/list comprehension, eval "&", "|" and "^".
Multiplication Table
2
8
1
[scipy] Precompute all distances with Floyd Warshall
The Shortest Knight's Path
2
0
0
partial, regex substitution, composition
Unique Email Addresses
2
0
0
Count cube coordinates
Ulam-Warburton Automaton Hex
3
13
1
basic 1-liner
Days Between
3
12
2
heapq: nlargest, nsmallest
Shorter Set
3
12
0
[Crystal clear] Powers of the adjacency matrix
Digits Doublets
3
0
0
DFS
Bishop vs Aliens
3
0
0
Replace ',' and '.' by ' ', one split and it's over.
First Word
4
40
4
7-liner without modules
IP Network: Route Summarization
5
15
0
9-liner: generator with itertools.accumulate for altitudes
Flood Area
5
7
1
First, improvable
YAML. List and Comments
5
3
0
reduce
Excel Column Number
5
2
2
[v2] enumerate, try line.index, max(..., key=len)
Long Non Repeat
6
21
6
[py3.8+] 1-liner 169 chars: not windows-friendly
Date and Time Converter
6
6
2
timedelta(max(0, 5 - weekday))
Birthday Party
6
1
0
O(n)
Stock Profit
7
3
1
rotate?, count groups of X, fill with zeros first, rotate back?
Nonogram Encode
7
2
0
BFS
The Shortest Knight's Path
8
4
0
Grid, naive
Ulam–Warburton Automaton
9
3
1
Second "reduce" with 0 as initial
Excel Column Number
9
1
1
A139250
Toothpicks
10
1
1
with sens function
Zigzag Array
11
8
0
next(generator, 0)
The Good Radix
11
5
0
heapq again 🙂
Huffman Encode
12
0
0
Simple stack
Backspace Apply
12
0
0
Always take the biggest digit, ignoring the "last" digits
Greedy Number
12
0
0
My "Digits Doublets" solution
Digits Doublets
13
4
1
collections.Counter for letters, min with key
The Most Wanted Letter
14
23
2
enumerate iterable
Swap Nodes
18
9
1
[typed] 3 simple functions
Tree Walker
20
2
2
My "long non repeat"
Long Non Repeat
22
6
0
next, datetime module
When is Friday?
25
6
0
[v3] Tested on big texts
Long Non Repeat
26
6
0
1-liner: simple min with key
Nearest Value
27
11
0
First
Date and Time Converter
27
1
0
datetime.strftime : "%-d" or "%#d"
Date and Time Converter
29
10
1
counter
When "k" is Enough!
29
0
0
py3.10+ itertools.pairwise
Ascending List
40
8
1
min & max with key
The Fastest Horse
40
4
0
py3.10+ my_compose(all, partial(starmap, lt), pairwise)
Ascending List
43
0
0
One line of course
Transposed Matrix
46
5
1
1-liner: sorted(key and reverse)[:limit]
Bigger Price
47
1
1
morse_decoder lambda function
Morse Decoder
50
8
0
lambda all zip
Ascending List
58
6
1
try next / except / finally
Swap Nodes
66
2
0
two solutions
Easy Unpack
124
6
0
3-liner: divmod(... ,2), slicing
Middle Characters
155
0
0
operator.itemgetter
Easy Unpack
168
5
2
Three solutions
End Zeros
168
4
0
except (ValueError, AssertionError)
Words Order
275
0
0
range intersection for fun
Long Non Repeat
335
0
0
split and join ; partial(re.sub, r'\S+', inversion repl)
Backward Each Word
497
0
3
Second
Correct Sentence
573
0
0
GitHub
~i
Common Tail
1
29
3
6-liner relatively clear/creative
Broken Clock
1
11
0
1-liner
Evenly Spaced Trees
1
8
1
reversed, take while equal
Common Tail
1
3
1
Dijkstra with priority queue
The Cheapest Flight
2
40
10
21-liner: Dynamic programming to get scopes, heapq to minimize unsupplied cities
Power Plants
2
13
5
group rays
Reversi: Othello Moves
2
0
0
First
Merge Intervals
4
19
1
scipy.ndimage for delete useless paper, numpy for movements and shape (a bit too complicated)
Paper Dice
4
0
1
[9-liner] complex numbers / math formula and python3.8 for radius
Searchlights
6
4
0
simple
Power Supply
7
6
0
Rotate/turn. Dimensions? Spaces? Sum 7?
Paper Dice
7
2
1
Two solutions
Create Intervals
9
19
3
2-lines: SuperPhil15
Solution for Anything
19
9
1
iterative without regex, repeatable parts
Long Repeat Inside
20
0
0
First
Shooting Range
26
2
1
union set of intervals, zip for union, enumerate(op, 1)
Painting Wall
27
3
0
Area of a convex N-gon is area of N-2 triangles (with Heron's formula)
Area of a Convex Polygon
31
4
3
reduce, gcd and clear names
Evenly Spaced Trees
32
1
2
[EAFP way] markers, forward/backward, right/left/first digits, checksum
Barcode Reader
32
0
0
datetime.date of course
The Most Frequent Weekdays
35
6
0
My "long repeat inside" program
Long Repeat Inside
35
3
2
[Typed OOP] Minimax strategy
Xs and Os Champion
38
0
0
Obvious 1-liner
Expand Intervals
66
3
0
split('; ') and startswith(name+'=')
Cookies
67
2
0
Max of a list of tuples with a key
The Highest Building
99
0
0
Third [py3.10+]
Evenly Spaced Trees
102
0
1
My solution
The End of Other
980
0
0
Dropbox
defaultdict(set)
Switch Keys to Values
1
19
1
First
Integer Sign Determination
1
13
0
Complex
Count Squares
1
10
2
Columns 0,1 OR naively
Exploring Wythoff Array
1
3
1
sum(square_exist for each segment and orientation) // 4
Count Squares
1
0
0
sum(map(str.isdigit, ...))
Count Digits
2
68
5
islice(cycle)
Fibonacci Spiral's End
2
8
0
[4-liner] 170 chars
On the same path
2
5
2
Bruteforced combinations(2)
Longest Substring of Unique Characters
2
5
0
Filter reversed text, join formatted text
Revorse the vewels
2
0
0
With dict of hashlib functions, utf-8 encode, hexdigest
Simple Hashlib
3
22
1
sympy with creative itertools
Hubspot Amulet
3
5
1
quick and dirty regexes
Reveal the Number
3
0
0
base = 10 or not ; divmod to find digits ; stop if encounter the maximal digit
Max Digit
4
8
0
[15-lines] Timing a single recursive DFS
On the same path
4
7
5
sum divisors == 2 * ...
Perfect Number Checking
4
3
2
textwrap, operator.methodcaller, str.replace with all 3 arguments
Text Formatting
5
12
2
import, or reduce(mul, range, 1)
Number With Exclamation
5
5
0
Dispatch
Collatz Ztalloc
5
0
2
2(L+W)
Rectangle Perimeter
6
6
1
fullmatch
Is String a Number? (Part II)
6
5
0
DFS (+ queen generalization)
Checkers Capture
6
0
0
Simply import
Find Remainder
7
4
0
isdigit method
Is String a Number?
8
3
4
Compute volume and area of a spheroid
Humpty Dumpty Form
10
9
0
sum(starmap(!=, zip_longest))
Fuzzy String Matching
10
2
0
str method
Convert To Title Case
11
3
0
islices
Fibonacci Poem
11
3
0
Bruteforce with improvements
Nonogram Row
12
0
0
Recursion
Count Morse
13
3
2
main[i:].startswith(sub)
Count Substring Occurrences
14
0
0
Bruteforce with taken rows, columns, and descending/ascending diagonals
Place Queens
15
1
0
xs and ys both intersect
Interesting, intersecting
20
0
0
Decimal
Is String a Number? (Part II)
22
0
3
sum(map(operator.ne
Not in Order
23
0
1
First
Three Points Circle
41
5
1
First
URL Normalization
41
0
0
Rajesh decorator: SOS I SEE 69 ...
The Best Number Ever
44
6
3
next palindromic substring by decreasing length
The Longest Palindromic
106
4
0
1-liner: max(map(int, string number))
Max Digit
137
5
0
Max with a key, with a worth dict
Worth of Words
198
0
0
Simply my speech module
Speech Module
350
3
0
Counter, re.findall
Popular Words
398
2
0
Two solutions
Sum Numbers
721
0
0
any, all boolean functions, string split
Three Words
3926
0
3
PyCon TW
sympy.linsolve
How Much Gold
3
3
0
[OOP] Map class (a bit too long)
Dark Labyrinth
3
0
0
Basic
Simple Areas
4
22
1
lambda next zip
Ryerson Letter Grade
4
20
1
Dijkstra
Express Delivery
5
5
1
[typed] Cuboid class and volumes of the connected components of the graph
Fused Cubes
5
2
0
itertools.groupby to group consecutives, sum to sum
Sum Consecutives
7
12
0
Hide parts of faces by cutting a rect into up to 4 sub-rects
Building Visibility
12
3
0
try next
Robot Sort
15
3
0
Generate all electoral splits into districts, take the first good one
Unfair Districts
17
0
0
blankplank's version, modified
Double Substring
34
0
0
Recursive solution with arguments row and col initialized to 0.
Golden Pyramid
44
7
1
Dijkstra
Network Attack
65
2
0
Basic
Digit Stack
75
3
1
Compare line[i:i+n] and line[j:j+n] for descending n and possibles (i,j).
Double Substring
75
2
2
match case
Simple Areas
87
3
0
First
House Password
175
8
1
4-liner: scipy.ndimage.label
Calculate Islands
340
0
0
Storage
max, with a key
Latest ISO datetime
1
24
2
That's it?!
Latest ISO datetime
1
8
3
with re.findall and generators
Moria Doors
1
7
2
heapq, cut the search
Flip of Time
2
0
0
Itertools combinations, axis intersection and slope.
The Rows of Cakes
3
11
6
With natural coordinate system
Square Spiral
5
5
1
First
Earth Distances
7
5
3
str[pf]time, catch value errors
Convert Date
7
4
2
Distance in one hexagonal coordinate system
Hexagon Spiral
7
2
1
[v2] Dynamic programming, verbose OOP
Battle Dice
9
0
0
My english to braille translator
English to Braille Translator
11
3
1
My playfair cipher
Playfair Cipher
13
4
0
operator.itemgetter(1) itertools.groupby
Group Equal consecutive
18
12
0
1-liner: itertools.groupby
Group Equal consecutive
20
10
2
Swaps dict, list of disjoints cycles, and finally permutations to do
Mind Switcher
21
3
1
Counter power recursively cached
Battle Dice
21
0
0
Basic loop
Group Equal consecutive
30
6
1
3-lines: zips and slices
Group Equal consecutive
31
6
1
(1-2)-liner: numpy and math generalization
Skew-symmetric Matrix
33
1
6
[Typed OOP cached] Minimax strategy
Haunted House
43
0
0
My "Saw the Stick" program
Saw the Stick
45
3
1
Dijkstra distance
Digging a Canal
55
0
0
Compute minima with key (sum of resistances)
Weak Point
78
4
0
count '.'*... / yield numbers
Restricted Prime
100
0
0
lambda
Word Pattern
218
0
0
First check the diagonal, then the bottom of the matrix.
Skew-symmetric Matrix
219
1
1
Maya
[typed] Apply the rule and a simple reasoning
Unruly
1
15
5
[actually inefficient] Maximize lit area with a priority queue
Light Up
1
10
6
v2: BFS to find gems, avoiding dead ends (detected by Kosaraju)
Inertia
1
10
0
Unique neighbors and small paths search
Signpost
1
5
5
[typed] Light paths and backtrack on the position of the monsters
House of Mirrors
1
5
0
1-liner: Cryptic version of my clear code (py3.10)
House of Mirrors
1
0
0
[Typed, bit of OOP] Rectangle intersections
Find Rectangles
2
1
0
Backtracking to avoid dead ends, BFS to find gems
Inertia
3
6
0
[Typed OOP] Grid of switch & watcher cells
Visibilities
3
0
0
[typed] Look at row/column counts, avoid cycles/articulation points/bridges, store "candidate/on track/secured" positions and partial tracks
Train Tracks
7
0
0
[Typed OOP] Grid parts of labelled cells (1.3 seconds)
Net Game
11
0
0
HubSpot
Three solutions + 1 in comments
Replace First
1
468
47
divmod%
Square Board
1
59
6
[py3.8+] 1-liner/98 chars with walrus/shifts operators
Univocalic davasaan
1
30
7
DFS with neighbors function; math.isqrt
Triangular Islands
1
16
1
[py3.8+] 1-liner: walruses and datetime
Weekly Calendar
1
7
0
1-liner: naive max
Home Coming
1
2
1
[py3.8+] 6-liner: DFS with 1-liner neighbors
Triangular Islands
1
0
2
[py3.8+] 4-liner: binary search (3 lines) + workout lambda
Workout
1
0
0
1-liner / 178 chars: scipy & walrus operator
Connect Stars
1
0
0
Easy with scipy
Connect Stars
2
0
0
Generalization to any base 2-36 (and to negative fractions)
Repeating Decimals
2
0
0
ast module and collections.Counter
Count Comprehensions
3
2
0
With collections.Counter and cutting generator
Most Efficient Cutting
5
8
0
4-liner: heapq.nlargest
Team Play
5
7
0
[8lines+old code] Rectangles based on edges from convex hull, change complex coordinates to have bounding boxes
Inscribe a Contour
5
3
6
[numpy] 9-liner: Math magic with Markov chain
Expected Dice
5
0
2
BFS resolution order and backtracking
Crossword Solver
6
5
2
Dynamic programming and itertools.accumulate
Family Dinner
6
1
1
text.split(maxsplit=1)[0]
First Word (simplified)
8
17
4
Compute 'lengths' before compute decimals
Repeating Decimals
8
5
0
Binary search, explicit number of sessions required
Workout
8
1
1
Minimal distance from Dijkstra on the war game map graph
Supply Line
9
4
4
try birthdate.replace(year=...)
Next Birthday
9
4
1
Naive and short max
Home Coming
9
1
0
1-liner: array[bool][bool]
Fizz Buzz
10
20
1
[typed] Generate routes simultaneously, and a priority queue
Supply Stations
10
0
0
Priority queue to maximize total length
Park Benches
11
1
0
First
Stressful Subject
14
15
6
4-liner: date and timedelta from datetime module
Weekly Calendar
17
2
0
Tricky reversed use
The Hamming Distance
24
2
1
@join(',') on generator with Counter
Auto Painting
26
2
1
take the nth of the iterator of all answers
Fizz Buzz
42
4
0
sum bool(striped line)
Non Empty Lines
48
1
0
is_divisible_by(2)
Is Even
51
8
0
sum, splitlines, strip
Non Empty Lines
58
0
0
sets of lower/upper letters
All Upper II
97
4
5
dropwhile
Remove All Before
103
0
0
My "min" and "max" built-in functions
Min and Max
167
5
0
try return slice except
Remove All Before
221
3
0
1-liner: join and replace
Right to Left
325
5
0
recursively pop, length 42
Restricted Sum
336
3
1
try except
Number Base
377
3
1
string length
Number Length
407
1
0
Non recursive generalization (EAFP style)
Second Index
421
2
0
[::-1]
Backward String
542
1
0
[basic] text.index and slice
Between Markers (simplified)
802
0
0
1-liner: [::2]
Even the Last
891
2
1
Hamming Distance
The Hamming Distance
1250
0
2
Blizzard
fromisoformat (with python 3.7)
The First Working Day
1
42
3
6-liner: Generator, divmod, list.pop, math.factorial
Reversed Permutation Index
1
24
3
2-lines: Bruteforce with integers
Rectangles Union
1
9
3
[scipy 1.9+] milp: Mixed-integer linear programming
Knapsack Problem
1
9
0
"php\";
Palindromic Palindrome
2
5
0
[py3.8+] 1-liner: 103 chars
Permutation Index
2
1
0
[200th mission] DFS and great neighbors function
Safe Coasts
3
9
1
All pairs of cities, all flights of minimal prices, multiple Dijkstra
Useless Flights
3
6
1
generator
Move Zeros
4
8
2
Dynamic programming
Knapsack Problem
4
3
1
'[%s]' ; sep.join ; f'{n: >{w}'
List Beautify
4
3
0
recursive with decreasing upperbounds
Sum of Distinct Cubes
4
0
0
10-lines: np.array, decreasing dimensions, next
Spaceship Landing Strip
4
0
0
Wagner-Fischer algorithm
String Conversion
5
11
2
([], [])[is_zero].append
Move Zeros
5
6
0
n-th permutation and dichotomy
Permutation Index
6
5
0
no fromisoformat?
The First Working Day
7
9
0
divmod
Weekend Counter
11
9
0
DFS, itertools.count(1), collections.Counter
Radiation Search
16
0
0
It works
Stair Steps
28
5
0
Backtracking
Sudoku Solver
51
0
2
datetime
Unlucky Days
128
1
0
My "The Angles of a Triangle" program
The Angles of a Triangle
176
4
2
Rock
match case sympy expand
Write Quadratic Equation
1
16
0
sympy expand
Write Quadratic Equation
2
8
1
Boring string manipulation
Write Quadratic Equation
5
5
1
First
Web Log Sessions
6
0
0
[23 useful lines] '@:', cube coords & components with DFS
Hexagonal Islands
7
3
1
class BlackHole(sympy.Circle) & matplotlib visualization
Black Holes
7
0
0
Mixed methods: Hamiltonian decompositions (extensions/reductions) & random seaches
Family Gifts
7
0
0
[OOP, typed, doctests] Easy cases or BFS: list all boat loads
River Crossing
8
0
0
[typed] BFS avoiding each other
Chicken Hunt
15
0
0
Newton's method for the search of the root of f(x) = x*log(x)-N.
Super Root
17
5
2
NamedTuple
Rolling 🎲!
18
0
0
max(right_elements, default=-1)
Replace with Biggest
23
0
0
accumulate maxima
Replace with Biggest
24
0
0
Brute force a little bit smart
Water Jars
48
0
0
join decorator on a generator
Parity Bit Generator
174
0
0
Shelter
Look at as few points as possible by dividing the rectangle until it is too small
Four To The Floor
1
25
5
1-liner
Delivery Drone
1
1
1
Ugly speedy
Four To The Floor
2
6
2
scipy.ndimage.label, multiple BFS and itertools.permutations (clear and relatively short)
Climbing Route
3
0
6
8-liner: pure numpy
Pattern Recognition
4
1
0
3 lines wrote by a monster (363 chars)
Halloween Monsters
4
0
0
sets and sum of bools
Seven Segment
5
16
0
Eulerian path
One line Drawing
6
9
0
25 lines: dot product with cube coords
Fortress Cannons
7
2
1
My first use of zip, zip_longest and accumulate. And useful slicing.
ADFGVX Cipher
10
5
0
[v2] scipy.ndimage for simple peaks detection, multiple bfs to find explicit path
Climbing Route
10
0
0
collections.Counter and a bit of itertools
Halloween Monsters
11
5
1
try iterate from it except TypeError
Completely Empty
13
8
1
Neighboring neighboring... area of obstacles and border
Landing Site
16
0
1
Scary solution : come here to give me a vote or I take your sordid life
Ghosts Age
23
3
1
First
The Nearest Square Number
25
0
0
flow lru cached with zip and EAFP
The Lantern Festival
29
0
0
Encode the list [0,1,2, ..., len(message)-1] to decode the message.
AMSCO Cipher
85
0
0
1-liner: Code (py3.10) of Pouf's Boo, no space
Ghosts Age
156
0
0
Codeship
6-liner: scipy.integrate and probabilities power
Probably Dice
1
11
0
date time timedelta
Working Hours Calculator
1
9
0
[creative] Scientific imports + 1-liner: Markov chain
Pearls in the Box
1
6
1
OOP, Counter, combinations, lambdas
Texas Referee
2
14
1
Dijkstra, equation and round functions
Bats Bunker
4
8
3
Bruteforced recursion
The Centrifuge Problem
4
0
0
Markov chain, numpy, scipy.sparse.spdiags
Pearls in the Box
6
1
3
Color Black/White stones graphs to get B/W territories, look B/W borders, sum lengths of B/W eaten territories
Eaten Go Stones
7
2
0
Random backtracking with time limitation
Magic Domino
8
0
0
My solver with obvious and real searches
Minesweeper
9
3
1
Markov chains
Pearls in the Box
17
0
0
Priority queue (heapq) to find cherry, BFS to not be stuck
Snake Lite
17
0
0
BFS
The 88th Puzzle
18
1
1
Color unoccupied points graph to get territories, look Black/White borders, sum lengths.
The Territory of Go
19
0
0
v2: unoriented lines, generate square lines
The Square Chest
27
5
4
Define right move, deduce others moves
Behind 2048
58
0
0
My first real yield generator: recursively generates partitions/dices until we have solution (if it exists).
Unfair Dice
61
0
1
unoriented lines, generate square lines
The Square Chest
344
0
1
Hermit
[v3] 1-liner: count odd divisors (the naive way)
Count Consecutive Summers
1
145
17
lambda and math upper bound
Count Consecutive Summers
1
14
0
[4th version] fast (and limited memory)
Count Consecutive Summers
3
7
0
Generate big stacks with a bit of OOP
Stacking Cubes
3
5
2
[typed] Coroutine, filters, cached expressions
Reverse Engineer
3
0
1
Proud of my math skills to prove that ^^
Strawberry Fields
6
6
1
b/o/d/x format or handle as int
Integer Palindrome
6
0
0
[OOP] "To infinity, and beyond !" for determine coefficients
Simplification
7
1
0
4 clear lines: next(possible points generator)
Ore In The Desert
7
0
1
Coroutine
Colder-Warmer
8
1
2
[5th] 1-liner: count odd divisors, complexity: O(sqrt(n))
Count Consecutive Summers
10
1
0
Use infos to filter grid cells and pick any cell
Colder-Warmer
13
5
3
max(cycles generator, key=len, default=[])
Network Loops
14
3
1
heapq, stacks memory, only 10 02 12 21 (not really good but it works)
Anagrams By Stacks
15
1
0
Itertools & random powers
Reverse Engineer
15
0
0
With fractions module, and divmod
Fractions Addition
16
3
1
1234321
Integer Palindrome
17
3
0
str
Integer Palindrome
21
2
1
minimize errors
Mono Captcha
27
1
0
not str but math module
Integer Palindrome
27
0
0
Keep or break the ring with a maximum of rings connected to it, that's the question
Break Rings
164
0
3
[v2] count odd divisors with math formula
Count Consecutive Summers
172
0
1
My 100th mission revisited with set methods
Break Rings
179
0
0
Watchtower
Short thanks to scipy.ndimage.label
Boundary Blocks
1
14
10
With continued fractions
Exploring Calkin-Wilf Tree
1
0
0
scipy.ndimage power
Bacteria Colonies
2
3
0
Generate all solutions: sympy to solve linear equation system, itertools for bruteforce.
Magic Square
2
0
0
3 guesses max: divisor with max futures remainders to divide possibilities
Number Guess
4
5
1
v2: Short thanks to scipy.ndimage.label
Boundary Blocks
4
0
0
[13 clear lines] Numpy array mod 2
Wall Keeper
5
0
0
Dynamic Programming: (lcs set, common length) table
DNA Common Sequence
7
4
0
[1-liner 257 chars] sympy.Matrix, reduced row-echelon form mod 2, last column
Wall Keeper
9
0
0
Find the right key...
Vigenere Cipher
17
3
1
1/e
Bag of Santa Claus
20
1
0
try except, slope, min/max with key, bad complexity
Convex Hull
21
1
1
Best solution for a M x N grid, using matrices (modulo 2)
Wall Keeper
42
0
1
Trust the random on filtered possibilities
Bulls and Cows
43
0
0
[typed] Simplier than I thought
Ethernet Ring Dimensioning
53
0
0
Descending score, exclude cases, positionning and flip chips
Numbered Triangles
72
0
0
Escher
sum bool
The Secret Room
1
23
4
with items coordinates dictionary (so seaside traveled once)
Compass, Map and Spyglass
1
19
1
3-lines: Counter
The Tower
1
11
2
@maxi(paths generator)
Graphical Key
2
12
12
Buttons generator (with DFS) and a reverse_sorting decorator
The Buttons
2
11
2
min(enumerate(cols(wall)), count '#' lambda key)[0]
The Stone Wall
2
8
0
with collections.Counter
Wild Dogs
3
16
1
Try to remove from deck with sorted hand
Card Game
3
16
1
next(generator, -1), eval and re
Safe Code
7
8
0
With lru_cache/setrecursionlimit and without
The Stones
8
9
1
I wanted to use itertools.filterfalse alongside with filter
The Ship Teams
10
4
0
Neighboring coordinates?
Hypercube
15
2
1
with python 3.8+
Keys and Locks
16
5
0
color counter and rearrangements
The Tower
17
0
0
strip and split with \n, zip(*rows)
Ground for the House
29
6
1
lambda function [sorted(gen), sorted(gen)]
The Ship Teams
42
6
0
First
Treasures
45
0
0
Not On Map
with collections.Counter
Most Wanted Letter
1
13
0
Composition/functools: three uses of itertools, one counter
Aggregate and Count
1
5
0
First
Word Search
2
0
0
1-liner: three uses of itertools, one counter
Aggregate and Count
3
10
1
divmod to list digits
Base change - Position System
6
0
0
String method "__len__"
Length of the String
12
3
3
just the built-in function "len" really
Length of the String
34
0
1