diff --git a/#442/kotlin/Solution.kt b/#442/kotlin/Solution.kt new file mode 100644 index 0000000..f80235d --- /dev/null +++ b/#442/kotlin/Solution.kt @@ -0,0 +1,18 @@ +/** + * https://leetcode.com/problems/find-all-duplicates-in-an-array/ + */ + +class Solution { + fun findDuplicates(nums: IntArray): List { + val result: MutableList = ArrayList() + val temp: MutableList = ArrayList() + for (i in nums) { + if (temp.contains(i)) { + result.add(i) + } else { + temp.add(i) + } + } + return result + } +}