Chachako
09/07/2021, 1:17 AMnew.foo.bar.foo.bar.baz
merged to new.foo.bar.baz
foo.bar.foo.bar.qux
merged to foo.bar.qux
but foo.bar.break.foo.bar
does not merge 🤯The Monster
09/07/2021, 4:19 AMmain()
function is marked suspend
? According to this linter rule https://rules.sonarsource.com/kotlin/tag/coroutines/RSPEC-6318 it is not compliant because the main()
function does not have any suspension point. Based on the docs, runBlocking
function should be used on the main
function if we want coroutine in main https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/run-blocking.html
2. There is a lot of coroutine imports in the code, but code in main
does not seem to need any?Chachako
09/07/2021, 4:56 AMMatteo Mirk
09/07/2021, 8:18 AM"""(.*)\1""".toRegex().replace(input, "$1")
but bear in mind that this solution is still O(n^2) in time complexity like your solutionChachako
09/07/2021, 8:58 AMA.B.C.A.B.C.A.B.C
. It is expected to print A.B.C
, but printed A.B.C.A.B.C
. In addition, I don’t understand the regular expression.Syed Ovais Akhtar
09/08/2021, 5:31 AMMatteo Mirk
09/08/2021, 11:57 AM.A.B.C
, so after it’s done it cannot reduce it any further because “A.B.C” isn’t equal to “.A.B.C”