From f8fec81c557ac370fa9f040ecc980999213a3c57 Mon Sep 17 00:00:00 2001 From: RamazanovSham Date: Sun, 21 Dec 2025 16:23:21 +0300 Subject: [PATCH 1/2] Update fizzbuzz.kt --- src/main/kotlin/ru/otus/homework/fizzbuzz.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/otus/homework/fizzbuzz.kt b/src/main/kotlin/ru/otus/homework/fizzbuzz.kt index 6e04be1..3693a25 100644 --- a/src/main/kotlin/ru/otus/homework/fizzbuzz.kt +++ b/src/main/kotlin/ru/otus/homework/fizzbuzz.kt @@ -2,5 +2,18 @@ package ru.otus.homework fun fizzbuzz(n: Int): Array { - TODO("Выполните задание") -} \ No newline at end of file + + val list = mutableListOf() + + for(i in 0..n - 1){ + if ( i % 3 == 0 && i % 5 == 0) + list.add("FizzBuzz") + else if ( i % 3 == 0 ) + list.add("Fizz") + else if ( i % 5 == 0) + list.add("Buzz") + else + list.add(i.toString()) + } + return list.toTypedArray() +} From e72f92ed5abd540eac3e88138a428d7111889166 Mon Sep 17 00:00:00 2001 From: RamazanovSham Date: Sun, 21 Dec 2025 16:23:40 +0300 Subject: [PATCH 2/2] Update sumoftwo.kt --- src/main/kotlin/ru/otus/homework/sumoftwo.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/otus/homework/sumoftwo.kt b/src/main/kotlin/ru/otus/homework/sumoftwo.kt index 70d72e5..8874cfa 100644 --- a/src/main/kotlin/ru/otus/homework/sumoftwo.kt +++ b/src/main/kotlin/ru/otus/homework/sumoftwo.kt @@ -2,5 +2,12 @@ package ru.otus.homework fun sumOfTwo(numbers: IntArray, target: Int): IntArray { - TODO("Выполните задание") -} \ No newline at end of file + val n = numbers.size + for (i in 0..n-1){ + for ( j in i+1..n-1){ + if( numbers[i] + numbers[j] == target) + return intArrayOf(i, j) + } + } + throw IllegalArgumentException() +}