MODIFIED SEARCH

Given two arrays of strings A of size N and B of size M.

Return a binary string C where C[i] = ‘1’ if B[i] can be found in dictionary A using exactly one modification in B[i], Else
C[i] = ‘0’.

Note: modification is defined as converting a character into another character.


Input Format

The first argument given is the string array A.
The second argument given is the string array B.

Output Format

Return a binary string C where C[i] = '1' if B[i] can be found in dictionary A[i] using one modification in B[i], Else C[i] = '0'.	

Constraints

1 <= N, M <= 1000
1 <=Sum of length of all strings in A<=1000
1 <=Sum of length of all strings in B<=1000
strings contains only lowercase alphabets

For Example

Input 1:
    A = [data, circle, cricket]
    B = [date, circel, crikket, data, circl]
Output 1:
    C = "10100"
Explaination 1:
1. date = dat*(can be found in A)
2. circel =(cannot be found in A using only one modification)
3. crikket = cri*ket(can be found in A)
4. data = (cannot be found in A using only one modification)
5. circl = (cannot be found in A using only one modification)


Input 2:
    A = [hello, world]
    B = [hella, pello, pella]
Output 2:
    "110"
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving MODIFIED SEARCH on Interview Code Editor
Sign Up
to access hints and editorial solutions for MODIFIED SEARCH

Discussion


Loading...
Click here to start solving coding interview questions