Last active
December 15, 2015 04:50
-
-
Save kazua/5204399 to your computer and use it in GitHub Desktop.
世界で闘うプログラマ本の1-1
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 characters
| //write kazua | |
| import scala.collection.mutable._ | |
| object worldproblem1_1 { | |
| def UniqueCheck(chkstr : String) : Boolean = { | |
| if (chkstr.length == 0 && chkstr.length > 256) return false | |
| val chrmp = Map[Char, Boolean]() | |
| for (i <- 0 to chkstr.length - 1) { | |
| val ch = chkstr.charAt(i) | |
| if (chrmp.contains(ch)) return chrmp(ch) | |
| else chrmp(ch) = false | |
| } | |
| true | |
| } | |
| def main(args : Array[String]) { | |
| println(UniqueCheck("abcgdjwp")) | |
| println(UniqueCheck("abcadjwp")) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment