Skip to content

Resuming work on the repository #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DS_Store
.idea/shelf
/.idea/
/android.tests.dependencies
/confluence/target
/dependencies/repo
Expand Down Expand Up @@ -29,4 +29,4 @@ node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-nodejs-runner/lib/
.idea/jarRepositories.xml
.idea/misc.xml
.idea/misc.xml
10 changes: 0 additions & 10 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/kotlin/dynamicProgramming/Factorial.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package dynamicProgramming

/**
* This is a tail-recursive implementation of factorial calculation.
* @param n - the number to calculate factorial for
* @param accumulator - accumulates the factorial value (default is 1)
* @return factorial of the input number
*/
tailrec fun factorial(n: Int, accumulator: Int = 1): Int {
if (n == 0) {
return accumulator
Expand Down
7 changes: 6 additions & 1 deletion src/main/kotlin/dynamicProgramming/isPrime.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
package dynamicProgramming

fun Int.isPrime() = this > 1 && (2..(this / 2)).all { this % it != 0 }
/**
* Extension function that checks if an integer is a prime number.
* A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
* @return true if the number is prime, false otherwise
*/
fun Int.isPrime() = this > 1 && (2..(this / 2)).all { this % it != 0 }
36 changes: 0 additions & 36 deletions src/main/kotlin/other/Palindrome.kt

This file was deleted.