Skip to content

A brute force solution to CoinJam problem in golang

License

Notifications You must be signed in to change notification settings

GwiBo/GoCoinJam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoCoinJam

A random brute force solution to Google Code Jam 2016 :CoinJam problem in golang

The provided solution solves the large problem input in <10 seconds!!.

Remember the style is not necessarily idiomatic Go, however it uses several ( around 200 ) goroutines ( I know Go can easily handle way more... ) for each coin condition checking as well as a single goroutine to generate a random coin of required size.

#####Getting Program

#####Usage instruction

  • The program takes input from stdin (standard input) and outputs to stdout (standard output)
  • the first line takes number of test cases
  • the second line takes 2 (space separated) arguments : size of coins number of coins to generate

#####Hint

  • When running on bash terminal, you can use pipes to get result
    i.e. $ GoCoinJam < input.file > output.file
  • With go properly installed / environment variables setup the full command to run the sample is as follows
    $ $GOPATH/bin/GoCoinJam < $GOPATH/src/github.com/GwiBo/GoCoinJam/C-Large.in > sample.out this will place sample.out output file in your current working directory
  • If the program runs for more than (around) 30 seconds, then probably: either the input cannot be satisfied OR badluck ( run again )

###Test Hardware:

Hardware Details
CPU Intel Core i7 first generation (mobile edition)
Ram 8 GB
Software Details
OS Ubuntu 16.04
Programming Language go 1.6.2 ( currently, originally used go 1.6

####And the BIG question : Why such elaborate README.md for such trivial program? Ans: Just wanted to scratch an itch to write a Markdown text document. :) :) :)

About

A brute force solution to CoinJam problem in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages