Created
September 15, 2013 14:39
-
-
Save DiveInto/6571329 to your computer and use it in GitHub Desktop.
Revisions
-
DiveInto created this gist
Sep 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ object per extends App{ def permutations(str: String):List[String] = { if(str.size == 0) List("") else{ val res = { for{c <- str per <- permutations(str.replaceFirst(c.toString, "")) }yield c + per } ▫▫ res.toList } } val res = permutations("abc") res.foreach(println) }