Skip to content

Commit

Permalink
Rename files (igorwojda#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorwojda authored Feb 7, 2023
1 parent e84b798 commit 3f44c65
Show file tree
Hide file tree
Showing 221 changed files with 208 additions and 208 deletions.
4 changes: 2 additions & 2 deletions .test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ This subproject is designed to verify the root project. Checks are running with

Verify correctness of the provided solutions.

Every coding challenge in this repo consists of a container (`challenge.kt` file) that has tests and
Every coding challenge in this repo consists of a container that has tests and
empty placeholder for a user-coded solution. Since the placeholder is non-implemented method
all tests in the root project will fail by design. This subproject allows to generate a test suite for each challenge
by combining challenge container (`challenge.kt` file) with every solution present in the `solution.kt` file.
by combining challenge container (`Challenge.kt` file) with every solution present in the `Solution.kt` file.

To generate tests go into `.test` subproject and run the `generateTests` command:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.igorwojda.challenge.utils

enum class ChallengeFile(val fileName: String) {
SOLUTIONS_KT("solution.kt"),
DESC_MD("readme.md"),
CHALLENGE_KT("challenge.kt"),
SOLUTIONS_KT("Solution.kt"),
DESC_MD("README.md"),
CHALLENGE_KT("Challenge.kt"),
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.igorwojda.challenge.utils

enum class ChallengeFile(val fileName: String) {
SOLUTIONS_KT("solution.kt"),
DESC_MD("readme.md"),
CHALLENGE_KT("challenge.kt"),
SOLUTIONS_KT("Solution.kt"),
DESC_MD("README.md"),
CHALLENGE_KT("Challenge.kt"),
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ help you to become a better programmer and improve your chance of getting a new
Each challenge is located in separate package, and it contains 3 main
files ([screen](./misc/image/challenge-structure.png)):

- `readme.md` - the task description.
- `challenge.kt` - file containing an empty method/class where challenge should be solved. This file also contains
- `README.md` - the task description.
- `Challenge.kt` - file containing an empty method/class where challenge should be solved. This file also contains
set of test and occasionally helper methods. You can run all tests directly from this file (click green arrow next to
`Test` class).
[JUnit](https://junit.org/junit4/) tests which verify that task was solved correctly.
- `solution.kt` - a file containing one or more solutions.
- `Solution.kt` - a file containing one or more solutions.

Keep in mind that each challenge will usually have more than one solution. Even simple challenges like
[String reversal](src/test/kotlin/com/igorwojda/string/reverse) can be solved in
Expand Down
206 changes: 103 additions & 103 deletions misc/ChallengeGroups.md

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

???

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Limitations

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Given positive integer `n` implement a function which calculates sum of all numbers from `1` up to (and including)
number `n`.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given positive integer `n` implement a function which returns a list containing all steps from `n` to `0`.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Nice to solve before

[Count down](../countdown/readme.md)
[Count down](../countdown/README.md)

## Instructions

Given positive integer `n` implement a function which returns a list containing all steps up from `0` to `n` and down to
`0`.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given two integers implement a function which determines if they have the same frequency of digits.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Given positive integer `n` implement a function, which returns a [factorial](htt
that integer. Factorial (of positive integer) is number that is created by multiplying all numbers from 1 to `n` eg.
factorial of `3` (`3!`) is equal to `6` (`3 * 2 * 1`)

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ private data class MethodCache(val n: Int, val result: Int)
If the function is called again with the same arguments, return the precomputed result rather than running the function
again.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)


Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Given positive integer `n` implement a function which returns a list numbers fro
three list should contain word `Fizz` instead of the number and for the multiples of five list should contain
word `Buzz`. For numbers which are multiples of both three and five list should contain `FizzBuzz` word.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given positive Int `n` implement a function which returns a list of containing pairs with all combinations of numbers
from `0` to `n`. Use Kotlin [Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/) class.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Nice to solve before

- [Count down](../countdown/readme.md)
- [Count down](../countdown/README.md)

## Instructions

Given a list of integers return a list that contains only odd integers (only integers which are not a multiple of `2`).

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given positive integer `base` and positive integer `exponent` implement a function which calculates power of base of
exponent. This function should mimic functionality of [Math.pow](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/pow.html).

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given positive integer `n` implement a function which returns a list representing all numbers from `n` to `1`. If `n`
value is zero then empty list should be returned.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given positive integer `n` and integer `step` implement a function which returns a list representing all numbers from
`n` to `1` taking `step` into consideration. If `n` value is zero then empty list should be returned.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Given a positive integer `n` implement a function which returns a list represent
levels. The function should console log a generatePyramid shape with N levels using the `#` character. Make sure the
generatePyramid has spaces on both the left and right hand sides.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given an integer `n`, return an integer that is the reverse ordering of digits.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given a positive integer `n` implement a function which returns a list representing the generated steps with `n` levels
using the `#` character. Make sure the step has appropriate number of spaces on the right hand side!

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Nice to solve before

[Singly linked List](../../singly/base/readme.md)
[Singly linked List](../../singly/base/README.md)

### Instructions

Expand All @@ -14,7 +14,7 @@ mistakes. That's why each step has one or more tests associated with it. Tests a
staring each step we will have to enable all tests related to given step by uncommenting it. To quickly uncomment the
test select all lines containing test method and press `Cmd + /` keys (`Comment with line Comment` action).

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

### 1. constructor `DoublyLinkedList<E>()`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mistakes. That's why each step has one or more tests associated with it. Tests a
staring each step we will have to enable all tests related to given step by uncommenting it. To quickly uncomment the
test select all lines containing test method and press `Cmd + /` keys (`Comment with line Comment` action).

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

### 1. constructor `SinglyLinkedList<E>()`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Nice to solve before

[Singly linked List](../base/readme.md)
[Singly linked List](../base/README.md)

## Instructions

Given a linked list, return true if the list is circular, false if it is not.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## Nice to solve before

- [Singly linked list](../base/readme.md)
- [Midpoint](../midpoint/readme.md)
- [Circular check](../circularcheck/readme.md)
- [Singly linked list](../base/README.md)
- [Midpoint](../midpoint/README.md)
- [Circular check](../circularcheck/README.md)

## Instructions

Given a linked list, return the element n positions from the last node in the list. Assume that `endIndex` will always
be less than the length of the list.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Limitations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ We are using version of linked list that implements Kotlin
[Iterator](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterator/index.html) interface, so we can
use `forEach` instead of `while` loop.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Limitations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

Given list of strings implement a **recursive** function which will capitalize first letter of each string in the list.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

```kotlin
capitalizeFirst(listOf("igor")) // listOf("Igor")

capitalizeFirst(listOf("igor", "wojda")) // listOf("Igor", "Wojda")
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given an amount of money and an array of coins write a method that computes the number of ways to make the amount of
money with coins of the available coins.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given a sorted list of integers implement a function which counts the unique values.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Given list containing items (integer, lists, sub-lists) implement **recursive** function which returns list with all
values flattened. This function mimics behaviour of Kotlin build in ` flatten` method.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Limitations

Expand All @@ -29,4 +29,4 @@ flatten(listOf(1), listOf(listOf(2), listOf(listOf(3)))) // 1, 2, 3
<details>
<summary>Hint 1</summary>
Use helper recursive function.
</details>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Given list of strings representing train station names implement a function whic
- If list contains single train station name, then return `Train is calling at stationName`
- If list contains multiple train station names, then return comma separated station names, but the last two names are separated by `and` word.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given a list and chunk size, divide the list into multiple sub lists where each sub-list is of length of chunk size.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ elements in the `list` (sum of `n` digits next to another that have the largest

You can use helper `max` function to deal with Kotlin nullability.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand All @@ -25,4 +25,4 @@ maxSubListSum(listOf(4, 2, 7, 5, 8, 9, 5, 1), 3) // 22
<details>
<summary>Hint 1</summary>
Use sliding window
</details>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ where sum all elements is equal or greater than `n`

You can use helper `min` function to deal with Kotlin nullability.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Given sorted list of integers and target average implement a function which determine if there is a pair of values in
the list where their average equals target average.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Given a list of integers implement a function which returns the product of all numbers in the list.

[challenge](challenge.kt) | [solution](solution.kt)
[Challenge](Challenge.kt) | [Solution](Solution.kt)

## Examples

Expand Down
Loading

0 comments on commit 3f44c65

Please sign in to comment.