Skip to content

Instantly share code, notes, and snippets.

View vaibhavsagar's full-sized avatar
🕺
🪩

Vaibhav Sagar vaibhavsagar

🕺
🪩
View GitHub Profile
@vaibhavsagar
vaibhavsagar / sherlock_and_the_beast.hs
Last active September 8, 2016 13:35
Solution for code dojo 30/08/2016 with @miguel-vila
-- Slow solution that fails for n>19 due to integer overflow
import Data.List
import Data.Ord
maxPair n = sortBy (comparing snd) [(x,y) | x <- [0,3..n], y <- [0,5..(n-x)], x+y==n]
gen [] = -1
gen ((x,y):_) = let
noOf5s = (replicate x '5')
noOf3s = (replicate y '3')
in read (noOf5s ++ noOf3s) :: Int

Keybase proof

I hereby claim:

  • I am vaibhavsagar on github.
  • I am vaibhavsagar (https://keybase.io/vaibhavsagar) on keybase.
  • I have a public key whose fingerprint is C358 4D99 C4E3 B6FF AE66 4BFC 1CE0 EE35 7CFB 9A10

To claim this, I am signing this object: