Codewars
:space_invader::school_satchel::neckbeard: My codewars solutions: Ruby, Java, Python, C++, JavaScript, Crystal, Kotlin, CoffeeScript, PHP, Objective-C.
Install / Use
/learn @esotericpig/CodewarsREADME
codewars
This repo contains my solutions from codewars.
Not all of my solutions are listed. A solution will be listed if it is...
- Interesting and/or difficult or
- I am learning the language, so I want to have a reference to the code, even if it's trivial.
My coding style here is a bit hackier. Oftentimes, I also try to make it smaller, at the expensive of efficiency, so it is not 100% what I would use in production. However, I did try to make the code readable.
For most (or all) solutions, I added the test cases into "main" (or outside) so that it can be run by itself. I also added additional comments and/or modified the code slightly, so it is not 100% what I submitted.
Enjoy :)
Contents
[ Notes | Favorites | By Rank | Running | License ]
Notes
- Sometimes, there is file2, file3, etc. These are multiple solutions I submitted. Oftentimes, 2, 3, etc. are hackier, while the original is less hacky.
- For Java solutions, I sometimes renamed the files/classes so that there would not be conflicts and the names would be more descriptive.
Favorites
- ruby/ten_pin_bowling.rb
- java/SecretDetective.java
- java/PokerHand.java
- ruby/pyramid_slide_down.rb
- ruby/pyramid_slide_down2.rb
- ruby/roman_numerals_helper2.rb
- ruby/roman_numerals_helper3.rb
- java/AssemblerInterpreterPartII2.java
- java/AssemblerInterpreterPartII3.java
- python/hard_sudoku_solver.py [ gif ]
By Rank
Generated by ls_rank.rb (Ruby v2.4+ required).
[ 2 kyu | 3 kyu | 4 kyu | 5 kyu | 6 kyu | 7 kyu ]
-
2 kyu
-
3 kyu
-
4 kyu
- java/Finder.java
- java/Finder2.java
- java/PokerHand.java
- java/SecretDetective.java
- java/Snail.java
- ruby/catching_car_mileage_numbers.rb
- ruby/pyramid_slide_down.rb
- ruby/pyramid_slide_down2.rb
- ruby/roman_numerals_helper.rb
- ruby/roman_numerals_helper2.rb
- ruby/roman_numerals_helper3.rb
- ruby/simplifying_multilinear_polynomials.rb
- ruby/ten_pin_bowling.rb
- ruby/the_observed_pin.rb
- ruby/validate_sudoku_with_size_nxn.rb
-
5 kyu
-
6 kyu
- cpp/build_tower.cc
- cpp/highest_scoring_word.cc
- crystal/buying_a_car.cr
- java/BraceChecker.java
- java/LengthOfMissingArray.java
- javascript/counting_duplicates.js
- javascript/data_compress_using_rle.js
- javascript/data_compress_using_rle2.js
- kotlin/a_plus_b_equals_123.kts
- objective-c/follow_that_spy.m
- php/equal_sides_of_an_array.php
- python/who_likes_it.py
-
7 kyu
Running
This is how I (compile and) run these solutions on my system (Fedora).
The language version is usually just behind the latest version.
If you're familiar with Rake, you can alternatively use this:
$ rake -T
$ rake build -- cpp/build_tower.cc
$ rake run -- cpp/build_tower.cc 33
$ rake build -- java/SimplePigLatin.java
$ rake run -- java/SimplePigLatin.java 'Monkey Burger'
### Dry run.
$ rake clean[t]
### Actually clean.
$ rake clean
- CoffeeScript:
$ sudo npm install --global coffeescript$ coffee <name>.coffee <args>
- Crystal:
$ curl https://dist.crystal-lang.org/rpm/setup.sh | sudo bash$ sudo dnf install crystal- Alternatively:
$ sudo snap install crystal --classic
$ crystal <name>.cr <args>
- C++:
- I use a file extension for .gitignore.
$ sudo dnf install gcc-c++$ g++ <name>.cc -o <name>.out$ ./<name>.out <args>
- Java:
$ sudo dnf install java$ javac <Name>.java$ java <Name> <args>
- JavaScript:
$ sudo dnf install nodejs$ node <name>.js <args>
- Kotlin:
$ sudo snap install --classic kotlin$ kotlinc -script <name>.kts <args>
- Objective-C:
- Don't bother...it's a huge pain....
- PHP
$ sudo dnf install php$ php <name>.php <args>
- Python:
$ sudo dnf install python3$ python3 <name>.py <args>
- Ruby:
$ sudo dnf install ruby$ ruby <name>.rb <args>
License
I did not add the license to the top of each file, because I wanted the files to be small and quickly viewable (like scripts). However, every file in this repo is under this license, so do not be afraid to use any of the code here in a project that is compatible with this license.
codewars (https://github.com/esotericpig/codewars)
Copyright (c) 2018-2021 Bradley Whitedcodewars is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.codewars is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with codewars. If not, see http://www.gnu.org/licenses/.
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
