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.
- Prepare
- Algorithms
- Strings
- Two Strings
- Discussions
Two Strings
Two Strings
Sort by
recency
|
2252 Discussions
|
Please Login in order to post a comment
Here is my simple c++ solution, video explanation here : https://youtu.be/xwLiYvExM6I
In my case, using Kotlin, with converting one of the string to hashSet and iterate with the other word where inside it evaluates if is contains was enough.
python
Simple python solution using hash map:::
def twoStrings(s1, s2): # Write your code here word_dict = dict() for each in s1: if each in word_dict: word_dict[each] += 1 else: word_dict[each] = 1 for each in s2: if each in word_dict: return "YES" return "NO"
python