diff --git a/src/main/kotlin/p30xx/Problem3046.kt b/src/main/kotlin/p30xx/Problem3046.kt new file mode 100644 index 00000000..d219c0e4 --- /dev/null +++ b/src/main/kotlin/p30xx/Problem3046.kt @@ -0,0 +1,20 @@ +package p30xx + +import util.expect + +fun main() { + class Solution { + fun isPossibleToSplit(nums: IntArray): Boolean { + val set1 = hashSetOf() + val set2 = hashSetOf() + + return nums.all { set1.add(it) || set2.add(it) } + } + } + + expect { + Solution().isPossibleToSplit( + intArrayOf(1, 1, 0, 0, 0, 1, 1, 0, 0, 1), 3 + ) + } +}