Code Golf: Round 1
Code Golf is a competition where given a programming prompt, the shortest source code (measured in bytes) to fully implement the prompt wins the challenge.
Write a program that adds together several small positive integers. Your program may not use the
The integers are provided through
stdin. They are seperated by a single space
$ echo 42 13 | node my-solution.js 55 $ echo 128 256 512 | python3 my-solution.py 896 $ echo 9 8 7 6 5 4 3 2 1 | ruby my-solution.rb 45
- You may not use libraries.
- Your submission is limited to a single file.
- That file cannot contain the
Please submit a single file (.js, .py, or .rb). The included node script
code-golf.sh will be used to score your file. To run this script, you must have Node.js installed.
Docker Host (any OS running docker - so you don't have to install node/ruby/python)
$ docker build -t golf . $ docker run -it -v "$PWD":/tmp/src golf bash $ ./code-golf.sh my-solution.js Your score is 456
$ ./code-golf.sh my-solution.js Your score is 456
C:\> node code-golf.sh my-solution.js Your score is 456