Created
September 30, 2021 14:38
-
-
Save e-tverdokhleb/e08a14cdef958793f375a953cbc0bfca to your computer and use it in GitHub Desktop.
TASK_EQUALS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
const val t = "TEST" | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
checkString() | |
} | |
private fun checkString(s: String = "bsTmEvdbSSSSSSgvTfdsf") { | |
println("s: $s") | |
var j = 0 | |
for (i in 0..s.length - 1) { | |
println("s[$i]=${s[i]}") | |
if (s[i] == t[j]) { | |
println("EQUALS s[$i]:${s[i]} == t[$j]:${t[j]}") | |
if (j < t.length - 1) { | |
println("t[$j]=${t[j]}") | |
j++ | |
continue | |
} else if (j >= t.length - 1) { | |
println("SUCCESS") | |
break | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment