String characters balance Test
Write a program to check if two strings are balanced. For example, strings s1 and s2 are balanced if all the characters in the s1 are present in s2. The character’s position doesn’t matter.
Given:
Case 1:
s1 = "Yn"
s2 = "PYnative"
Expected Output:
True
Case 2:
s1 = "Ynf"
s2 = "PYnative"
Expected Output:
False
Hint:
Iterate each character from a string s1 and check if the current character is present in the string s2.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer