Skip to content

MaxGhi8/Google_code_golf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,209 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Google Code Golf Challenge - Progress Tracker

🎯 Overview

This repository contains solutions for 401 Google Code Golf tasks, numbered from task000.py to task400.py. Each task focuses on writing the shortest possible Python code to solve specific problems.

πŸ† Goals

  • βœ… Complete all 400 tasks
  • 🎯 Optimize for minimal character count
  • πŸ•’ Execution time does not count, 😈 only bytes matters here

πŸš€ Getting Started

The challenge description is available here and the notebook to starts with is here and here there is a notebook with already many solutions available, but probably not optimal.

πŸ“š Additional Resources

Useful Links for code golfing in Python

Useful Links from Kaggle of this particular competition

  • All problem solved start from tigrotto and additionally golfed from someone else.
  • variable renaming trick of renaiming variables for better compression from tigrotto.
  • 9 Hard problems tigrotto 9 of the hardest problem solved and explained by trigrotto.
  • Regex regex can be used in some problems (but we do not still now how ahah).
  • Flateview tool to visualize how well your code compresses, remember to add 60 bytes for the decompression stuffs.

🏷️ Status Legend

Status Icon Description
Pending ⏳ Task not completed
Completed βœ… Task completed and verified
Optimized πŸ† Optimized an already existing solution
We are the champion πŸ’Ž Our solution is better respect the best online one
Needs Review πŸ‘€ Requires code review
Interest πŸ“š Interesting solution with a smart and generalizable practice
GPT-generated πŸ€– Coded with a GPT - Might need a better idea or some review

πŸ“ˆ Task Progress Table

Task Status Bytes Completed by Comments/Notes
task001.py βœ… Completed 61 Max, Ale
task002.py βœ… Completed 112 Max DFS is used here
task003.py βœ… Completed 65 Max
task004.py βœ… Completed 103 Ale, Max
task005.py πŸ‘€ Need Review 276 -
task006.py βœ… Completed 53 Max for 1 line functions with the lambda you do not need to write the return and it saves 4 bytes!
task007.py βœ… Completed 98 Max, Waolo How to unroll a matrix
task008.py βœ… Completed 114 Ale, Max
task009.py βœ… Completed 151 Max
task010.py βœ… Completed 93 Max List comprehension go BRR
task011.py βœ… Completed 166 Max, Ale
task012.py πŸ‘€ Need Review 205 Max
task013.py πŸ‘€ Need Review 246 Max
task014.py βœ… Completed 86 Max interesting
task015.py βœ… Completed 118 Max
task016.py βœ… Completed 49 Max lambda function with 1 constant on a single line
task017.py πŸ‘€ Need Review 161 Ale Simplified/hardcoded implementation of task110.py
task018.py πŸ‘€ Need Review 415 Max
task019.py βœ… Completed 127 Max
task020.py πŸ‘€ Need Review 198 Max
task021.py βœ… Completed 79 Max
task022.py βœ… Completed 127 Ale, Max
task023.py πŸ‘€ Need Review 251 Ale
task024.py βœ… Completed 91 Ale, Max
task025.py πŸ‘€ Need Review 210 Oxke
task026.py βœ… Completed 57 Max
task027.py βœ… Completed 150 Oxke
task028.py πŸ‘€ Need Review 128 Max
task029.py πŸ‘€ Need Review 198 Max, Ale
task030.py βœ… Completed 129 Max
task031.py βœ… Completed 50 Max, Ale
task032.py πŸ† Optimized 39 Max
task033.py βœ… Completed 77 Ale,Max
task034.py πŸ‘€ Need Review 195 Max
task035.py βœ… Completed 104 Max, Waolo, Ale
task036.py βœ… Completed 103 Ale
task037.py βœ… Completed 134 Max
task038.py βœ… Completed 91 Max
task039.py βœ… Completed 72 Max
task040.py βœ… Completed 75 Max
task041.py πŸ† Optimized 49 Max, Oxke Good use of walrus operator ; Switches should be xorred with
task042.py πŸ‘€ Need Review 291 Max, Gio
task043.py βœ… Completed 73 Max
task044.py πŸ‘€ Need Review 450 -
task045.py βœ… Completed 48 Max
task046.py πŸ‘€ Need Review 246 Max, Oxke
task047.py βœ… Completed 59 Max, Oxke
task048.py πŸ‘€ Need Review 180 Ale
task049.py βœ… Completed 106 Max collections.Counter.most_common() can be avoided
task050.py βœ… Completed 115 Max, Gio
task051.py πŸ‘€ Need Review 171 Max, Gio
task052.py πŸ† Optimized 40 Max Sometimes reorder stuff can avoid a pair of brackets
task053.py πŸ† Optimized 21 Max
task054.py πŸ‘€ Need Review 444 -
task055.py πŸ‘€ Need Review 138 Max, Gio
task056.py βœ… Completed 69 Max, Gio
task057.py βœ… Completed 63 Max, Ale Variant of task031.py
task058.py πŸ‘€ Need Review 169 Ale, Max
task059.py βœ… Completed 185 Ale
task060.py βœ… Completed 52 Max
task061.py πŸ† Optimized 63 Ale, Max Holes filling in pattern with grid
task062.py πŸ‘€ Need Review 187 Max
task063.py βœ… Completed 80 Max
task064.py βœ… Completed 183 Max Similar to 333
task065.py βœ… Completed 104 Max
task066.py πŸ‘€ Need Review 309 Max, Oxke
task067.py πŸ† Optimized 33 Max
task068.py βœ… Completed 134 Max List comprehension with set item
task069.py πŸ‘€ Need Review 216 Max
task070.py βœ… Completed 93 Max
task071.py πŸ‘€ Need Review 179 Ale
task072.py βœ… Completed 61 Max
task073.py βœ… Completed 47 Max
task074.py βœ… Completed 112 Oxke
task075.py βœ… Completed 124 Max
task076.py πŸ‘€ Need Review 363 Max
task077.py βœ… Completed 149 Oxke, Max
task078.py βœ… Completed 82 Max
task079.py πŸ‘€ Need Review 174 Max
task080.py βœ… Completed 275 Max, Ale
task081.py βœ… Completed 103 Max
task082.py βœ… Completed 55 Max
task083.py πŸ† Optimized 40 Max
task084.py βœ… Completed 72 Max Anti-diagonal coloring
task085.py βœ… Completed 86 Max, Oxke Similar to task098.py
task086.py πŸ‘€ Need Review 290 Max, Oxke
task087.py πŸ† Optimized 36 Max
task088.py βœ… Completed 135 Max
task089.py πŸ‘€ Need Review 357 Max, Ale Inspired by 133
task090.py πŸ‘€ Need Review 262 Oxke, Ale
task091.py βœ… Completed 97 Max
task092.py βœ… Completed 102 Max
task093.py βœ… Completed 121 Ale
task094.py βœ… Completed 141 Max
task095.py βœ… Completed 86 Ale, Max
task096.py βœ… Completed 315 Ale, Max
task097.py βœ… Completed 138 Ale, Max
task098.py βœ… Completed 112 Max Similar to task120.py
task099.py πŸ‘€ Need Review 172 Max
task100.py βœ… Completed 106 Max
task101.py πŸ‘€ Need Review 358 Ale, Max Inspired by 133
task102.py πŸ‘€ Need Review 205 Ale
task103.py βœ… Completed 30 Ale, Max
task104.py βœ… Completed 107 Max
task105.py πŸ‘€ Need Review 243 Ale, Max
task106.py βœ… Completed 73 Max Same as task194.py
task107.py βœ… Completed 161 Max
task108.py βœ… Completed 83 Max Use upscaling from task223.py
task109.py βœ… Completed 99 Max
task110.py πŸ‘€ Need Review 158 Ale Extended code from task017.py
task111.py βœ… Completed 80 Ale, Max Same code of task022.py, but with less operations
task112.py βœ… Completed 148 Max
task113.py πŸ† Optimized 25 Max
task114.py βœ… Completed 96 Max
task115.py βœ… Completed 75 Max Iterate over element, dict.fromkeys
task116.py πŸ† Optimized 20 Max
task117.py πŸ‘€ Need Review 244 Max
task118.py βœ… Completed 280 -_-
task119.py βœ… Completed 107 Max
task120.py βœ… Completed 112 Max Similar to task075.py
task121.py βœ… Completed 123 Max
task122.py βœ… Completed 100 Max Recursive
task123.py βœ… Completed 102 Max, Ale
task124.py πŸ‘€ Need Review 190 Oxke Probably should do similar thing directly on the 2D grid instead of searching the stride and then calculating the result. NB: if you want to just try, move the walrus out of the loop and before the grid with (s:=...)and[[...]] so that it runs in a sensible time and not 100x that
task125.py πŸ‘€ Need Review 172 Ale, Max Probably it can be turned into a lambda function
task126.py βœ… Completed 59 Max
task127.py βœ… Completed 103 Max
task128.py βœ… Completed 101 Max
task129.py βœ… Completed 48 Max How to find the maximum of a matrix
task130.py βœ… Completed 102 Max
task131.py πŸ‘€ Need Review 211 Max
task132.py βœ… Completed 133 Max
task133.py βœ… Completed 321 Max, Ale Understood from tigrotto
task134.py βœ… Completed 202 Ale, Max Can be improved
task135.py πŸ† Optimized 32 Max, Waolo
task136.py βœ… Completed 120 Ale
task137.py πŸ‘€ Need Review 199 Max
task138.py πŸ‘€ Need Review 214 Max
task139.py βœ… Completed 137 Max
task140.py πŸ† Optimized 36 Ghi, Max
task141.py βœ… Completed 118 Max
task142.py πŸ† Optimized 40 Ghi, Max
task143.py πŸ‘€ Need Review 226 Max
task144.py βœ… Completed 63 Ghi, Max [[... for a,b in zip(*z)]for z in zip(g,g[5:])] >>> [[... for a,b in zip(x,y)]for x,y in zip(g,g[5:])]
task145.py πŸ‘€ Need Review 265 Oxke
task146.py βœ… Completed 70 Max
task147.py βœ… Completed 93 Max
task148.py πŸ‘€ Need Review 231 Ale
task149.py βœ… Completed 83 Max
task150.py πŸ† Optimized 30 Ghi, Max
task151.py βœ… Completed 123 Max
task152.py πŸ† Optimized 40 Ghi, Max
task153.py πŸ‘€ Need Review 198 Ale, Max
task154.py πŸ‘€ Need Review 164 Max
task155.py πŸ† Optimized 18 Max
task156.py πŸ‘€ Need Review 214 Max, Ale, Oxke
task157.py βœ… Completed 247 -_-
task158.py πŸ‘€ Need Review 325 Ale, Max, Waolo Understood from tigrotto
task159.py πŸ‘€ Need Review 183 Ale
task160.py πŸ‘€ Need Review 161 Ale
task161.py βœ… Completed 87 Max
task162.py βœ… Completed 143 Max
task163.py βœ… Completed 158 Max
task164.py πŸ† Optimized 32 Ghi, Max
task165.py πŸ‘€ Need Review 202 Max
task166.py βœ… Completed 65 Max, Oxke Similar to task047.py
task167.py βœ… Completed 89 Max, Ale Try to find a better mapping
task168.py βœ… Completed 122 Ale
task169.py βœ… Completed 140 Max, Gio similar to 330, and 369
task170.py πŸ‘€ Need Review 248 Max
task171.py βœ… Completed 70 Max
task172.py πŸ† Optimized 20 Max
task173.py βœ… Completed 222 Max Study from tigrotto
task174.py βœ… Completed 105 Max
task175.py βœ… Completed 102 Ale, Max Use the transpose
task176.py βœ… Completed 88 Max
task177.py βœ… Completed 63 Max
task178.py βœ… Completed 64 Ale, Max Similar to task218.py and task377.py
task179.py πŸ† Optimized 21 Max
task180.py βœ… Completed 90 Max
task181.py βœ… Completed 86 Max
task182.py πŸ‘€ Need Review 242 Ale How to combine for x in range():+if [condition]: in a single row
task183.py βœ… Completed 107 Max
task184.py βœ… Completed 140 Max, Ale
task185.py πŸ‘€ Need Review 225 Max
task186.py βœ… Completed 76 Max
task187.py βœ… Completed 100 Max DFS, similar to task002.py
task188.py βœ… Completed 93 Max
task189.py βœ… Completed 142 Max
task190.py βœ… Completed 109 Ale
task191.py πŸ‘€ Need Review 343 Ale Can be improved
task192.py πŸ‘€ Need Review 202 Ale
task193.py βœ… Completed 118 Max
task194.py βœ… Completed 84 Max Same as task106.py
task195.py βœ… Completed 145 Max
task196.py βœ… Completed 128 Max, Gio
task197.py πŸ† Optimized 54 Ale, Max
task198.py βœ… Completed 164 Max Here I color first the yellows one and then the green, the viceversa will be interesting to explore.
task199.py πŸ‘€ Need Review 140 Max
task200.py πŸ‘€ Need Review 138 Max
task201.py βœ… Completed 249 Max
task202.py πŸ‘€ Need Review 182 Max
task203.py βœ… Completed 94 Max
task204.py πŸ‘€ Need Review 149 Max
task205.py πŸ‘€ Need Review 255 Ale, Max Coloring from task047.py
task206.py βœ… Completed 151 Ale, Max
task207.py βœ… Completed 104 Ale, Max
task208.py βœ… Completed 246 Ale
task209.py πŸ‘€ Need Review 334 Oxke 1. extract the main part; 2. extract the pattern using task031.py; 3. find the best overlap between (resized) pattern and main part
task210.py πŸ† Optimized 20 Max
task211.py βœ… Completed 49 Max
task212.py πŸ‘€ Need Review 168 Max
task213.py βœ… Completed 125 Max
task214.py βœ… Completed 90 Max I think that I have implemented a good function for rotation clockwise
task215.py βœ… Completed 69 Max
task216.py βœ… Completed 158 Max Same as task365.py (computational really inefficient)
task217.py βœ… Completed 119 Ale, Max Combination of task001.py and task031.py
task218.py βœ… Completed 78 Ale f(g) on g and g transposed
task219.py πŸ‘€ Need Review 344 Oxke, Max
task220.py βœ… Completed 103 Max Similar to task352.py and task095.py
task221.py βœ… Completed 102 Ale, Max Inspired by task001.py and task217.py
task222.py πŸ‘€ Need Review 225 Max
task223.py βœ… Completed 57 Ale, Max Example of pixels (up)scaling
task224.py πŸ‘€ Need Review 233 Max
task225.py πŸ‘€ Need Review 195 Max
task226.py βœ… Completed 183 Ale
task227.py βœ… Completed 61 Ghi, Max
task228.py πŸ‘€ Need Review 194 Max, Ale
task229.py βœ… Completed 74 Max
task230.py βœ… Completed 146 Max, Ale
task231.py πŸ† Optimized 43 Max
task232.py βœ… Completed 92 Max For alternating colors I can make a full line and then color alternating over the previous one (see old version)
task233.py πŸ‘€ Need Review 370 -_-
task234.py βœ… Completed 117 Ale, Max
task235.py βœ… Completed 72 Ghi, Max
task236.py βœ… Completed 63 Max
task237.py βœ… Completed 96 Max, Waolo
task238.py βœ… Completed 261 Max
task239.py βœ… Completed 111 Max
task240.py πŸ‘€ Need Review 225 Max
task241.py πŸ† Optimized 21 Max, Waolo Symmetry respect main diagonal
task242.py βœ… Completed 59 Max
task243.py βœ… Completed 89 Max, Ale
task244.py πŸ‘€ Need Review 125 Max
task245.py πŸ‘€ Need Review 193 Ale
task246.py πŸ‘€ Need Review 188 Max
task247.py βœ… Completed 120 Max
task248.py βœ… Completed 96 Max, Waolo Same as task357.py
task249.py πŸ† Optimized 26 Max
task250.py βœ… Completed 160 Max
task251.py βœ… Completed 111 Ale, Max Adapted from old version of task002.py, brute force approach
task252.py βœ… Completed 99 Max
task253.py πŸ‘€ Need Review 172 Ale
task254.py πŸ‘€ Need Review 147 Max
task255.py πŸ‘€ Need Review 303 -
task256.py βœ… Completed 120 Ale
task257.py βœ… Completed 82 Ghi, Max a or b = {a if a>0, b if a = 0}
task258.py βœ… Completed 79 Max
task259.py πŸ‘€ Need Review 146 Max
task260.py πŸ‘€ Need Review 193 Max, Gio Hoping that someone beats me
task261.py βœ… Completed 51 Max, Ale
task262.py βœ… Completed 46 Max, Ale
task263.py πŸ‘€ Need Review 174 Ale, Max
task264.py πŸ‘€ Need Review 242 Ale
task265.py πŸ‘€ Need Review 199 Oxke
task266.py βœ… Completed 147 Oxke
task267.py βœ… Completed 67 Max
task268.py πŸ‘€ Need Review 322 Max, Oxke
task269.py βœ… Completed 85 Max, Ale Same as task task289.py, but with individual colours in g
task270.py βœ… Completed 159 Ale, Max Resolved with regex
task271.py βœ… Completed 98 Max
task272.py βœ… Completed 103 Max
task273.py βœ… Completed 127 Max, Ale
task274.py βœ… Completed 91 Max
task275.py πŸ‘€ Need Review 197 Max
task276.py βœ… Completed 45 Ghi, Max
task277.py πŸ‘€ Need Review 248 Gio, Max
task278.py πŸ’Ž GGWP 117 Ale
task279.py βœ… Completed 130 Max
task280.py πŸ‘€ Need Review 231 Oxke
task281.py πŸ‘€ Need Review 210 Max, Gio
task282.py πŸ‘€ Need Review 137 Max
task283.py πŸ‘€ Need Review 141 Max, Ale
task284.py πŸ‘€ Need Review 281 Ale
task285.py βœ… Completed 266 Ale Inspired by tigrotto's task 361
task286.py βœ… Completed 136 Max, Gio
task287.py βœ… Completed 98 Ale Holes filling in circular pattern. Variant of 061
task288.py βœ… Completed 119 Max
task289.py βœ… Completed 84 Max, Ale Same as task task269.py
task290.py βœ… Completed 70 Max
task291.py βœ… Completed 110 Max Really interesting
task292.py βœ… Completed 61 Max
task293.py βœ… Completed 108 Max
task294.py βœ… Completed 76 Max
task295.py βœ… Completed 68 Ale, Max
task296.py βœ… Completed 81 Max
task297.py βœ… Completed 69 Max
task298.py βœ… Completed 96 Max
task299.py βœ… Completed 85 Max
task300.py βœ… Completed 116 Max I use task task031.py for resize
task301.py πŸ† Optimized 31 Max
task302.py πŸ‘€ Need Review 144 Max
task303.py βœ… Completed 64 Max
task304.py βœ… Completed 104 Max
task305.py βœ… Completed 64 Max, Oxke
task306.py βœ… Completed 99 Max
task307.py βœ… Completed 52 Max, Ale Same as task223.py
task308.py βœ… Completed 262 Oxke helper function probably can be avoided
task309.py βœ… Completed 44 Max, Ghi
task310.py βœ… Completed 126 Ale, Max
task311.py πŸ† Optimized 32 Ghi, Max
task312.py βœ… Completed 45 Ghi, Max
task313.py βœ… Completed 66 Max
task314.py βœ… Completed 143 Max I'm not really satisfied
task315.py βœ… Completed 75 Max
task316.py βœ… Completed 90 Max
task317.py βœ… Completed 68 Max
task318.py βœ… Completed 63 Ghi, Max
task319.py πŸ‘€ Need Review 293 -
task320.py βœ… Completed 93 Max
task321.py βœ… Completed 69 Ghi, Max
task322.py βœ… Completed 51 Ale, Max
task323.py βœ… Completed 140 Max
task324.py πŸ‘€ Need Review 305 Oxke
task325.py πŸ‘€ Need Review 236 Max
task326.py πŸ† Optimized 30 Ghi, Max
task327.py πŸ† Optimized 67 Max Hope to be improved
task328.py βœ… Completed 175 Max
task329.py βœ… Completed 64 Ghi, Max
task330.py βœ… Completed 143 Max Similar to 169 and 369
task331.py βœ… Completed 116 Max
task332.py βœ… Completed 71 Max
task333.py πŸ‘€ Need Review 144 Max Similar to 064
task334.py βœ… Completed 78 Max
task335.py πŸ‘€ Need Review 161 Max, Ale
task336.py βœ… Completed 120 Max
task337.py βœ… Completed 51 Ghi, Max {x:x,...}[x] >>> {...}.get(x,x)
task338.py πŸ‘€ Need Review 130 Ale, Max First part from 002. Can be improved
task339.py πŸ† Optimized 37 Ghi, Max [*filter(int,sum(g,[]))] >>> [x for x in sum(g,[])if x]
task340.py πŸ‘€ Need Review 185 Max
task341.py βœ… Completed 158 Max
task342.py πŸ‘€ Need Review 180 Max
task343.py βœ… Completed 65 Ale, Max
task344.py βœ… Completed 98 Max
task345.py βœ… Completed 120 Max
task346.py βœ… Completed 68 Ale, Max (Was) inspired by task271.py
task347.py βœ… Completed 54 Ghi, Max
task348.py πŸ‘€ Need Review 153 Ale
task349.py πŸ‘€ Need Review 331 Ale, Max
task350.py βœ… Completed 120 Ale, Max Same as task356.py
task351.py βœ… Completed 75 Max Same as task 400
task352.py βœ… Completed 122 Ale, Max Similar to task95.py and task206.py
task353.py βœ… Completed 127 Max
task354.py βœ… Completed 120 Max
task355.py πŸ‘€ Need Review 166 Ale
task356.py βœ… Completed 120 Ale, Max Same as task350.py
task357.py βœ… Completed 104 Max Same as task task248.py
task358.py βœ… Completed 139 Max
task359.py πŸ† Optimized 64 Max
task360.py βœ… Completed 50 Ale, Max
task361.py βœ… Completed 222 Max, Oxke
task362.py βœ… Completed 75 Ale, Max
task363.py βœ… Completed 247 -
task364.py πŸ‘€ Need Review 282 Max
task365.py βœ… Completed 150 Ale, Max
task366.py βœ… Completed 374 -_-
task367.py πŸ‘€ Need Review 348 Ale, Max
task368.py πŸ‘€ Need Review 221 Ale, Max
task369.py βœ… Completed 147 Max Similar to tasks 330 and 169
task370.py πŸ‘€ Need Review 400 Max Brute force it
task371.py βœ… Completed 144 Max
task372.py βœ… Completed 51 Max How to sum two matrices
task373.py βœ… Completed 39 Max
task374.py πŸ‘€ Need Review 200 Max
task375.py βœ… Completed 60 Max
task376.py πŸ† Optimized 30 Ghi, Max
task377.py βœ… Completed 64 Ale Similar to task218.py and task178.py
task378.py βœ… Completed 162 Ale
task379.py πŸ‘€ Need Review 281 Ale
task380.py πŸ† Optimized 27 Max
task381.py βœ… Completed 97 Max
task382.py πŸ‘€ Need Review 227 Max
task383.py πŸ‘€ Need Review 234 Max
task384.py βœ… Completed 92 Ale Combination of task031.py and task223.py
task385.py πŸ† Optimized 25 Max
task386.py βœ… Completed 57 Max
task387.py πŸ‘€ Need Review 269 -
task388.py βœ… Completed 67 Max
task389.py βœ… Completed 63 Ale, Max
task390.py πŸ‘€ Need Review 164 Max
task391.py βœ… Completed 73 Max
task392.py βœ… Completed 161 -_-
task393.py βœ… Completed 75 Max
task394.py βœ… Completed 102 Ale
task395.py βœ… Completed 66 Max zip go brrr
task396.py βœ… Completed 226 Max, Ale
task397.py βœ… Completed 160 Max
task398.py βœ… Completed 84 Max
task399.py πŸ† Optimized 63 Max
task400.py βœ… Completed 75 Max Same as task task351.py

Happy Coding! πŸš€

*Remember: In code golf, every character counts!*⏳ Pending | - | -

About

Global 23rd place - "If you can read it, you can golf it!"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors