aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-100/frankivo/scala/TriangleSum.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-100/frankivo/scala/TriangleSum.scala b/challenge-100/frankivo/scala/TriangleSum.scala
new file mode 100644
index 0000000000..3ee251de13
--- /dev/null
+++ b/challenge-100/frankivo/scala/TriangleSum.scala
@@ -0,0 +1,21 @@
+object TriangleSum {
+ val examples = Seq(
+ "[1], [2,4], [6,4,9], [5,1,7,2]",
+ "[3], [3,1], [5,2,3], [4,3,1,3]"
+ )
+
+ // def parseExample(e: String) : Array[Array[Int]] = {
+ def parseExample(e: String) : Unit = {
+ e
+ .split(" ")
+ .map(_.replaceAll("""([\[\]])""", ""))
+ .map(_.split(", ").toString)
+ .foreach(println)
+ }
+
+ def main(args: Array[String]): Unit = {
+ examples
+ .take(1).map(parseExample)
+ // .foreach(println)
+ }
+} \ No newline at end of file