Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5725 |

@blackshadows | 5685 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4908 |

@saiujwal13083 | 4156 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3511 |

@sushant_a | 3453 |

@KshamaGupta | 3318 |

@the_coder95 | 3302 |

Complete Leaderboard | |

Handle | Score |

@avaiesshaik782 | 786 |

@arpitsatnalika | 777 |

@tujhekya | 602 |

@prakharxyz | 601 |

@code_it_ | 591 |

@iamronak | 505 |

@imnm | 500 |

@pradeepkumarjad | 488 |

@satyam0460 | 481 |

@nitesha125 | 476 |

@Rahul Jadhav 1 | 466 |

Complete Leaderboard |

Given three strings A, B and C your task is to complete the function **isInterleave** which returns true if C is an interleaving of A and B else returns false. C is said to be interleaving A and B, if it contains all characters of A and B and order of all characters in individual strings is preserved.

**Example 1:**

**Input:
**A = YX, B = X, C = XXY
**Output: **0**
Explanation: **XXY is not interleaving
of YX and X

**Example 2:**

**Input:
**A = XY, B = X, C = XXY
**Output: **1**
Explanation: **XXY is interleaving of
XY and X.

**Your Task:**

Complete the function **isInterleave() **which takes three strings A, B and C as input and returns true if C is an interleaving of A and B else returns false. (1 is printed by the driver code if the returned value is true, otherwise 0.)

**Expected Time Complexity:** O(N * M)

**Expected Auxiliary Space:** O(N * M)

here, N = length of A, and M = length of B

**Constraints:**

1<=length of A, B, C <=100

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Interleaved Strings

...

Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.