Hackerrank Two Strings Solution
This is the solution to the problem found in the Strings section of the Algorithm Domain. The problem statement is we need to print YES if there is at least a substring of length 1 in both the strings, else we need to print NO. The bellow program is done using python.
Screenshots[Demo]
The Code:
Found Bugs, Report Us !
Screenshots[Demo]
The Code:
def sen(x,y): cnt=0 j=0 for i in range(0,len(x)): for j in range(0,len(y)): if (x[i]==y[j]): cnt=cnt+1 break if(cnt!=0): print "YES" else: print "NO" for i in range(0,input()): x=map(str,set(raw_input())) y=map(str,set(raw_input())) sen(x,y)
Found Bugs, Report Us !
Comments
Post a Comment