Menu
Coddy logo textTech

Interleaving Result

Lesson 9 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.

challenge icon

Challenge

Medium

Write a function named isInterleaving that gets 3 strings s1, s2, s3 and returns true if s1 is interleaving of s2 and s3.

s1 is interleaving by s2 and s3 if it is formed by all the characters from s2 and s3 and the order of characters is preserved.

Examples,

  • isInterleaving("ACDB", "AB", "CD")  ->  true
  • isInterleaving("ACDB", "A", "CD")  ->  false
  • isInterleaving("123456", "136", "245")  ->  true

Try it yourself

#include <stdbool.h>
#include <string.h>

bool isInterleaving(char* s1, char* s2, char* s3) {
    // Write code here
    return false;
}

All lessons in Recursion Challenges - Master The Recursive Thinking