There was an error while loading. Please reload this page.
1 parent a0c1c71 commit 3943347Copy full SHA for 3943347
1 file changed
src/main/kotlin/mate/academy/ProcessAndFilterNumbers.kt
@@ -1,5 +1,17 @@
1
package mate.academy
2
3
-fun processAndFilterNumbers(numbers: List<Int>): List<Int> {
+const val ZERO = 0
4
+const val TWO = 2
5
+const val TWENTYFIVE = 2
6
7
+fun processAndFilterNumbers(numbers: List<Int>): List<Int> {
8
+ val result = mutableListOf<Int>()
9
+ numbers.forEach {
10
+ if (it % TWO == ZERO) {
11
+ result.add(it / TWO)
12
+ } else {
13
+ result.add(it * TWO)
14
+ }
15
16
+ return result.filter { it > TWENTYFIVE }
17
}
0 commit comments