We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
funanagram(s:String):Int{// Write your code hereif(s.length%2!=0)return-1varres=0valmiddle=s.length/2varsub1=s.subSequence(0,middle)varsub2=s.subSequence(middle,s.length)vars1=StringBuilder(sub1)vars2=StringBuilder(sub2)for(cins1){if(s2.contains(c)){valindex=s2.indexOf(c)s2.deleteCharAt(index)}elseres++}returnres}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →