fbpx

#kotlinDevChallenge – 14

Your task is to design a User class The email property should be implemented in such a way that each time it is modified (assigned a new unique value), the howManyTimesEmailEdited property increments. The initial setting of the email in the constructor should not count as a modification. ps. Again – there are few ways […]

#kotlinDevChallenge – 13

Implement a string compressor Write a function that takes a string and returns a compressed version, where consecutive duplicate characters are replaced with a single character followed by the number of repetitions. For example, “aabccc” becomes “a2bc3”.

#kotlinDevChallenge – 12

NetworkResponse class is given. Which of the following statements is true regarding this NetworkResponse class? Mark all correct answers and submit form.

#kotlinDevChallenge – 11

Write a Kotlin function to parse CSV data provided as a string, and return the data in a structured format. The CSV data will be provided as a single string, where each line represents a row and each value is separated by a comma. The function should parse this string and convert it into a […]

#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

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

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

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

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

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 […]