• #kotlinDevChallenge – 10

    #kotlinDevChallenge – 10

    Implement a function that sums the first 5 even numbers from each of three given integer Flows and returns their total sum. Properly handle empty Flows. If a Flow is empty or if all its elements are filtered out, it should contribute 0 to the final sum.

  • #kotlinDevChallenge – 9

    #kotlinDevChallenge – 9

    Write a function that takes a list of lists of integers and returns a single list containing all unique elements. Ensure that the resulting list contains only unique elements. For example, given the input [[1, 2, 3], [3, 4, 5], [5, 6]], the function should return [1, 2, 3, 4, 5, 6]. Complete the code…

  • #kotlinDevChallenge – 8

    #kotlinDevChallenge – 8

    data class A is given. We create an instance of this class and then call the .copy() function. What will be printed out? Mark correct answer and submit form.

  • #kotlinDevChallenge – 7

    #kotlinDevChallenge – 7

    Write a function that takes a string and returns a modified version where each word is reversed, and additionally, the case of each letter is inverted (uppercase to lowercase and vice versa). Punctuation marks and spaces should remain unchanged. For example, given the string "Hello Kotlin!", the function should return "OLLEh NILTOk!". Complete the code…

  • #kotlinDevChallenge – 6

    #kotlinDevChallenge – 6

    Write a function that takes a string and returns a map where each key is a character and its value is the number of its occurrences in the given string. For example, for the string “kotlin”, the function should return the map: {k=1, o=1, t=1, l=1, i=1, n=1}. Complete the code of the countCharacters function.

  • #kotlinDevChallenge – 5

    #kotlinDevChallenge – 5

    Your task today is to implement a toggle mechanism using Kotlin Flow. How should it work? Each time the flow source emits “something” – in this case, Unit – you should emit the negated previous value. For the input: false, flowOf(Unit, Unit) you should create a flow: flowOf(false, true, false) In this snippet, the entire…

  • #kotlinDevChallenge – 4

    #kotlinDevChallenge – 4

    A Coordinates class and an infix extension operator function that operates on these Coordinates are given. Take a good look. Several funny operations can be performed on the vals a and b. What does the function infix operator fun Coordinates.plus allow us to do?

  • #kotlinDevChallenge – 3

    #kotlinDevChallenge – 3

    Write a function that takes a natural number and returns its successive digits as a list (e.g., for the number 1234, it returns listOf(1, 2, 3, 4). Input: Long is a natural number – meaning it is non-negative. ps. Again – there are few ways to achieve that 🙂

  • #kotlinDevChallenge – 2

    #kotlinDevChallenge – 2

    Second day of our challenge… This time you will face collections. Specifically, a list that has acquired duplicates. We don’t like duplicates. Let’s get rid of them! ps. Again – there are few ways to achieve that 🙂

  • #kotlinDevChallenge – 1

    #kotlinDevChallenge – 1

    Your task is to modify the function so that it returns e.x <strong><em><span style="text-decoration: underline;">Kotlin is awesome and so called "birds" fly key</span></em></strong> if the input is birds. Note that the word “birds” is placed in quotation marks. How do you handle such a case with special characters? ps. There are few ways to achieve…

  • How to mock data class?

    How to mock data class?

    Short answer: you don’t. Instead…

  • 4 Ways to Leverage Kotest Specs for More Robust Testing

    4 Ways to Leverage Kotest Specs for More Robust Testing

    When it comes to testing in Kotlin, we often default to jUnit as the go-to framework. However, there’s an alternative that offers a variety of powerful features – Kotest. Kotest provides a variety of spec styles, each with its unique capabilities, that make writing tests a breeze.

  • Are unit tests worth it?

    Are unit tests worth it?

    In the realm of software, unit tests are like unsung heroes. They quietly play a crucial role, ensuring that each part of the code, or each “atomic unit,” behaves as it should.  Let’s dive a bit deeper into this concept, keeping things simple and relatable. Imagine we’re talking about a car. Unit Tests: Checking the Basics…

  • StateFlow vs SharedFlow

    StateFlow vs SharedFlow

    What’s the difference between SharedFlow and StateFlow? That’s actually a very common interview question. And here’s how you can answer it: Both SharedFlow and StateFlow are hot streams, but they serve slightly different purposes. Let’s answer with practical examples to better understand their use cases. SharedFlow SharedFlow is like a broadcast channel. It can emit…

  • How to refactor your code (without turning the project inside-out)

    How to refactor your code (without turning the project inside-out)

    Are you stuck in a loop of having an old codebase that’s not testable, but not being able to refactor it because there’s no test coverage? This is a common challenge that many software development teams face, but there’s a way out. In this article, we’ll explore a 5-step process to break the cycle and improve…