Skip to content

Commit f61e63a

Browse files
committed
Fix Kotlin files
1 parent 5ee9304 commit f61e63a

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/kotlin/ExponentiationRecursive.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
*
1010
* @return will return the *base* number raised by the *exponent*. The function returns a value of type *Long*.
1111
*/
12-
fun exponentiationRecursive(base: Int, exponent: Int): Long {
13-
return if (exponent === 0) {
12+
fun exponentiationRecursive(
13+
base: Int,
14+
exponent: Int,
15+
): Long =
16+
if (exponent === 0) {
1417
1
15-
}; else {
18+
} else {
1619
base * exponentiationRecursive(base, exponent - 1)
1720
}
18-
}
1921

2022
fun main() {
2123
println(exponentiationRecursive(2, 3))

src/kotlin/FibonacciRecursive.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
*
99
* @return will return a logical condition if *number* is less than or equal to 1, returns 1 otherwise, the sum of itself using the concept of *recursion* to execute this sum.
1010
*/
11-
fun fibonacci(number: Int): Int {
12-
return if (number <= 1) {
11+
fun fibonacci(number: Int): Int =
12+
if (number <= 1) {
1313
1
14-
}; else {
14+
} else {
1515
fibonacci(number - 1) + fibonacci(number - 2)
1616
}
17-
}
1817

1918
fun main() {
2019
println(fibonacci(5))

src/kotlin/MergeSort.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ fun mergeSort(arr: IntArray): IntArray {
1010
return merge(mergeSort(left), mergeSort(right))
1111
}
1212

13-
fun merge(left: IntArray, right: IntArray): IntArray {
13+
fun merge(
14+
left: IntArray,
15+
right: IntArray,
16+
): IntArray {
1417
var result = IntArray(left.size + right.size)
1518
var leftIndex = 0
1619
var rightIndex = 0

0 commit comments

Comments
 (0)