Skip to content

Instantly share code, notes, and snippets.

@zhelezoglo
Created September 26, 2015 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhelezoglo/5bf9320d5329896ba21e to your computer and use it in GitHub Desktop.
Save zhelezoglo/5bf9320d5329896ba21e to your computer and use it in GitHub Desktop.
val n = 5
val ss: Seq[String] = 0 to math.pow(2, n).toInt - 1 map((x: Int) => x.toBinaryString)
ss.map(String.format(s"%${n}s", _).replace(' ', '0')).foreach(println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment