21
Jacob Egner
https://github.com/jmegner/CheckioPuzzles
Last seen 4 years ago
Member for 8 years, 11 months, 8 days
Difficulty Normal
I keep a repo of my solutions at:
https://github.com/jmegner/CheckioPuzzles
Home
list comprehension
Non-unique Elements
16
67
10
used zip and slices for easy word triplets
Three Words
211
7
0
make set of pawn locations
Pawn Brotherhood
267
6
0
make grid, check protected left or right
Pawn Brotherhood
703
2
0
used datetime.date
Days Between
1273
0
0
str.join, list comprehension, and str.replace
Right to Left
1875
0
0
len check then sum over conditional list comprehension
Even the Last
2272
0
0
Electronic Station
check if point on any polygon segment; check num intersections of polygon with ray shooting out
Inside Block
45
0
0
simple location stack and set of visited locactions
Can You Pass?
86
0
0
used Counter and conditional generator comprehension
Verify Anagrams
226
4
0
dict with lambdas
Boolean Algebra
293
2
0
used horizontal and vertical multipliers
Find Sequence
330
0
0
functools.reduce and a multiplying lambda
Digits Multiplication
542
2
0
used stack of brackets for main work; used dict to match end-brackets to begin-brackets
Brackets
785
0
0
Scientific Expedition
collections.Counter and creative sort key
The Most Wanted Letter
100
8
0
simple concept means simple code
I Love Python!
157
9
0
used: re, zip
Striped Words
164
3
2
no tricks
Call to Home
192
0
0
yay for bin, replace, and rjust
Morse Clock
315
0
0
sorted(nums, key = abs)
Absolute Sorting
397
4
0
str.join and conditional list comprehension
Secret Message
462
3
0
First
Letter Queue
609
0
0
First
Bird Language
720
0
0
used: set, conditional list comprehension, str.lower and str.isalpha
Pangram
795
0
0
used: set, conditional list comprehension, str.join, sorted
Common Words
1072
0
0
First
Striped Words
1118
0
0
used counter; wish I had better tie-breaker
The Most Wanted Letter
2999
0
0
O'Reilly
two solutions: flattened iterative and natural recursive
Cipher Crossword
33
0
0
used dicts to hold less-than relations
Determine the Order
91
0
0
use itertools.product((0,1), repeat=n) to produce all possible assignments of weights into two loads
Loading Cargo
118
0
0
used enumerate and array slice
Count Inversions
159
2
0
recursion, probably heavily improvable
Flatten a List
290
0
0
ternary operator would have been less readable
Index Power
1909
0
0
simple for rows, zip for cols, by-hand for diags
Xs and Os Referee
2281
0
0
second, zip for cols, by-hand for diags
Xs and Os Referee
2282
0
0
First
Median
4889
0
0
Incinerator
self.connections is a list, but lots of uses of set
Friends
303
0
0
First
Building Base
379
0
0
Mine
First
Moore Neighbourhood
17
16
1
relationsToPersons, mergePartialPersons, fillInMissingTraits
The Einstein Problem-Lite
31
0
0
extract adjacency sets, then depth-first recursive search of colors
Color Map
44
0
0
Laplace expansion and double recursion
Determinant
55
0
0
recursive depth first search
Disposable Teleports
103
0
0
simple algebra
Achilles and the Tortoise
146
0
0
return functools.reduce(fractions.gcd, args)
The Greatest Common Divisor
231
0
0
three ifs, four returns
Fizz Buzz
532
2
0
return bin(number).count('1')
Binary Count
1149
0
0
Ice Base
iterate over quadrant-within-circle
Counting Tiles
48
3
2
direct simulation
Feed Pigeons
51
8
0
use Fraction; subtract if pos, multiply if neg
Oil Pie
92
0
0
handle each power of ten independently; look-up tables for within power of ten
Roman Numerals
353
4
3
dicts for edges, simple recursion that remembers not to re-visit drones
How to Find Friends
496
0
0
return len of foundWords set; also used split, strip, lower, and string.punctuation
Monkey Typing
1181
0
0
after args len check, max(args) - min(args)
The Most Numbers
1587
0
0
Alice In Wonderland
simple breadth first search
The Shortest Knight's Path
43
0
0
commented explanation of "return [list(row) for row in zip(*data)]"
Transposed Matrix
389
0
0
GitHub
First
Solution for Anything
9
16
0
simple A* algo implementation
Open Labyrinth
28
0
0
reused Point and LineSegment classes, yay
Shooting Range
43
0
0
for each new span, remove overlapping existing spans and add new merged span
Painting Wall
66
0
0
choose master point; sum area of consecutive triangles using cross product
Area of a Convex Polygon
95
0
0
str.rfind must match len difference of words
The End of Other
650
0
0
Dropbox
two different solutions: one efficient, one simple
Place Queens
29
0
0
reduce to 2 linear equations, then use Cramer's rule
Three Points Circle
68
3
0
First
Simple Hashlib
122
0
0
find prime digit factors and up-convert to bigger digit factors if possible
Numbers Factory
125
3
0
decimal.Decimal for precision
Friendly Number
159
1
2
First
Speech Module
4114
0
0
PyCon TW
based on each metal is implicitly double-counted
How Much Gold
8
5
2
sort by dist to south wall, then repeatedly split farthest wall into visible pieces
Building Visibility
33
0
0
a cell is only as good as itself plus the better of the two children
Golden Pyramid
135
2
0
simple recursive "path finding" that keeps track of best distance/time to each node; answer is greatest distance
Network Attack
140
0
0
used list for value stack
Digit Stack
156
1
0
simple recursive touch
Calculate Islands
217
0
0
Heron's formula for triangle
Simple Areas
259
0
0
used "any" and "map"
House Password
6343
0
0
Storage
encode and decode basically the same
Playfair Cipher
10
4
0
get cycles of mind-needs-to-get-to-next-body, then use two helpers to "rotate" the cycle
Mind Switcher
37
0
0
list.extend is your friend
English to Braille Translator
42
0
0
top left corner always an odd square; compute coords directly
Square Spiral
68
0
0
A* path algo with land heavily weighted
Digging a Canal
100
0
0
used: bin, string.rjust, join, map, lambda
Word Pattern
107
0
0
straightforward string methods, set operations, and list comprehensions
Moria Doors
127
0
0
used min with custom key; also used zip(*matrix) to get column view of matrix
Weak Point
139
1
0
First
Skew-symmetric Matrix
533
0
0
HubSpot
depth first search, make sure you don't block others, don't "bunch up" on your own path
Supply Stations
5
0
1
try: int(numberStr, radix); except: return -1
Number Base
201
5
0
basically: [xor, bin, slice, int, map, sum]
The Hamming Distance
622
0
0
recursion: sum is first elem plus sum of rest
Restricted Sum
928
0
0
Blizzard
iterative brute force
Sudoku Solver
26
0
0
brute force of all possible rectangles
Spaceship Landing Strip
39
1
0
recursive infection of danger
Safe Coasts
49
0
0
copy and one pass with max
Stair Steps
62
2
0
recursive touch/infect
Radiation Search
94
0
2
do not forget timedelta
Weekend Counter
292
0
0
law of cosines; angleForC = acos((a**2+b**2-c**2)/(2*a*b)
The Angles of a Triangle
312
1
1
used lambdas
Min and Max
439
0
0
Rock
two ways: new=set&counter, old=grid
Life Counter
12
3
0
3 solutions: efficient iterative BFS, inefficient recursive DFS, fun nonminimal guy
Water Jars
25
0
0
anybody else think the prompt was confusing?
CheckSum
41
1
1
for each tick, resize and recenter grid to allow growth
Life Counter
44
0
0
recursive depth first search and helper Loc class
Berserk Rook
57
0
0
binary search
Super Root
85
0
0
Shelter
each lantern follows right-hand wall and builds up wall as it goes
The Lantern Festival
20
0
0
Fleury's algo with simple connectedness checks to make Euler path
One line Drawing
36
0
1
please comment if there is better way to "double use" an iterable
Pattern Recognition
83
0
0
First
Ghosts Age
650
0
0
Codeship
slow recursive DFS and redo of bunnychai
Magic Domino
5
0
0
one function handles all of the multiple-of-rank hands; I think I did okay job with straight and flush stuff
Texas Referee
33
0
2
recursion to brute force all sorted sequences of correct sum
Unfair Dice
36
0
0
each cell neighborhood analyzed independently
Minesweeper
51
0
0
keep sets of which (r,c) points have right-segments and down-segments
The Square Chest
153
0
2
Hermit
eval the expression with 'x' as a Polynomial object that overloads math operators
Simplification
14
0
0
start in north-west, go probe-dist south, then go probe-dest east, then find compatible location with probe-dists
Ore In The Desert
24
2
3
use builtin int() with 2 args; skip over ValueErrors
The Good Radix
32
2
0
recursive depth-first search
Network Loops
36
0
0
always go to location that would give most information in the worst case
Colder-Warmer
41
0
0
brute force loop over all possible break combinations
Break Rings
56
3
0
Watchtower
reject first n/e gifts, then accept first gift better than first n/e gifts
Bag of Santa Claus
4
4
0
2d grid of accumulated best sequences using letters up to each point in the two words
DNA Common Sequence
18
0
0
recursive depth first search
Magic Square
21
0
0
negative cross product means you've found a better next-hull-point
Convex Hull
26
0
0
looking for consecutive full rings followed by empty ring
Bacteria Colonies
27
0
0
simple sieve approach, and recognizing redundancy in divisors
Number Guess
43
0
0
even works when key is ABABC
Vigenere Cipher
76
0
0
simple nested loop
Rotate Hole
173
0
0
first chip stays in same location; chips must share values with neighbors; some canonical form skipping
Numbered Triangles
182
0
0
return sum(data)
Funny Addition
235
1
0