Google Coding Interview Question: Serialize & Deserialize A Binary Tree (Java Solution)
Not employed by dailycodingproblem.com, just a fan.
You can (and should) sign up to receive an email with a coding problem everyday here: https://www.dailycodingproblem.com
You can subscribe to my channel here: / @dailycodingproblem8346
Daily Coding Problem: Problem #3 [Medium]
Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree.
For example, given the following Node class
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
The following test should pass:
node = Node('root', Node('left', Node('left.left')), Node('right'))
assert deserialize(serialize(node)).left.left.val == 'left.left'
Solution involves recursion and pre-order traversal of a tree
En esta página del sitio puede ver el video en línea Google Coding Interview Question: Serialize & Deserialize A Binary Tree (Java Solution) de Duración hora minuto segunda en buena calidad , que subió el usuario Daily Coding Problem 07 junio 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 398 veces y le gustó 4 a los espectadores. Disfruta viendo!