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
In questa pagina del sito puoi guardare il video online Google Coding Interview Question: Serialize & Deserialize A Binary Tree (Java Solution) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daily Coding Problem 07 giugno 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 398 volte e gli è piaciuto 4 spettatori. Buona visione!