say I have String x= "algorithm" , and Stringy= "mgth"
String x contains all the letters in String y, I can split String y into a list of letters, and loop through this list to see if String x contains the letter y[index] ,,
but I wonder If there's a more efficient way
Edit:
in kotlin there's a simple intersect function,, for example:
val x="algorithm".toList()
val y="mgth".toList()
val interesct=x.intersect(y) //returns a Set of matching chars
if (y.size == interesct.size){
println("match")
}