Repository contains Kotlin coding challenges.
-
Write a function that checks whether a string contains unique characters or not. Return the string reversed only if the string characters are unique, otherwise return null.
-
Have the function String.ABCheck() receive String and return the string true if the characters a and b are separated by exactly 3 places anywhere in the string at least once (i.e. "lane borrowed" would result in true because there is exactly three characters between a and b). Otherwise, return the string false.
-
Have the function Int.additivePersistence() receives an int which will always be a positive integer and returns its additive persistence which is the number of times you must add the digits in num until you reach a single digit and the final stop value. For example: if num is 2718 then your program should return 2 because 2 + 7 + 1 + 8 = 18 and 1 + 8 = 9, and you stop at 9 and loop count is 2.