Menu
Coddy logo textTech

Symmetric Tree

Lesson 12 of 13 in Coddy's Binary Tree - Data Structures Series #3 course.

The next challenges use the BinaryTree you built. Use the provided implementation to solve them.

challenge icon

Challenge

Easy

Write a function named isSymmetric that gets a string representing a BinaryTree and returns true if the tree is symmetric (mirror image around its root), otherwise false.

Try it yourself

#include <stdio.h>
#include <string.h>
#include "solution.h"

int main() {
    char s[4096];
    if (!fgets(s, sizeof(s), stdin)) s[0] = '\0';
    s[strcspn(s, "\r\n")] = '\0';
    printf("%s\n", isSymmetric(s) ? "true" : "false");
    return 0;
}

All lessons in Binary Tree - Data Structures Series #3