Skip to content

LeetCode 297: Serialize and Deserialize Binary Tree #63

@github-actions

Description

@github-actions

LeetCode 297: Serialize and Deserialize Binary Tree

Category: Tree
Difficulty: See LeetCode
Solution File: src/tree/serialize_and_deserialize_binary_tree.py
Test File: tests/test_serialize_and_deserialize_binary_tree.py

Problem Description

Serialization is the process of converting a data structure or object into a sequence of bits
so that it can be stored in a file or memory buffer, or transmitted across a network connection
link to be reconstructed later in the same or another computer environment.

Design an algorithm to serialize and deserialize a binary tree.

Example 1:
Input: root = [1,2,3,null,null,4,5]
Output: [1,2,3,null,null,4,5]

Example 2:
Input: root = []
Output: []

Constraints:

  • The number of nodes in the tree is in the range [0, 10^4].
  • -1000 <= Node.val <= 1000

Tasks

  • Implement the solution in src/tree/serialize_and_deserialize_binary_tree.py
  • Ensure all test cases pass
  • Analyze time complexity
  • Analyze space complexity

Metadata

Metadata

Assignees

No one assigned

    Labels

    blind-75Blind 75 - Blind-75 problemstreeBlind 75 - Tree problems

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions