Skip to content

Day 4 / May 19 (Thu)

Live Coding Session

Working together on Exercise: Dockerized Kafka Cluster

Scala Exercises

n Last Elements

Write a function that takes n last elements out of a collection of strings.

No use of Seq's built-in methods but foldLeft allowed. Just one pass over a collection is allowed.

Intertwine Two Collections

Write a function that intertwines two collections of possibly different sizes and concatenates them character by character.

val left = Seq(1,2,3,4,5)
val right = Seq("a", "b")

def concat(ns: Seq[Int], ss: Seq[String]): Seq[String] = ???

concat(left, right) shouldBe Seq("1a2b345")
Back to top