Problem 16

This commit is contained in:
2026-03-19 15:39:32 +01:00
parent 1a2a78b747
commit 1e9c69cd76
2 changed files with 34 additions and 0 deletions
@@ -0,0 +1,17 @@
package ninetyNineScalaProblems
import scala.compiletime.ops.boolean
class Problem16Suite extends munit.FunSuite:
List(
((0, List(1, 2, 3, 4)), List(1, 2, 3, 4)),
((0, List()), List()),
((1, List(1, 2, 3, 4)), List()),
((1, List(1)), List()),
((2, List(1, 2, 3, 4, 5, 6, 7)), List(1, 3, 5, 7)),
((3, List(1, 2)), List(1, 2)),
((3, List()), List()),
).foreach:
case ((n, list), expected) =>
test(s"dropEveryNthElement returns [$expected]"):
assertEquals(Problem16.dropEveryNthElement(n, list), expected)