代码面试集锦 2 - Google

Posted wonner

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了代码面试集锦 2 - 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'

以上是关于代码面试集锦 2 - Google的主要内容,如果未能解决你的问题,请参考以下文章

代码面试集锦 1 - Uber

面试集锦

Android面试题基础集锦总结《二》

Android面试题基础集锦总结《二》

(面试题)python面试题集锦-附答案

程序员面试必看!百度阿里腾讯……面试题和面试技巧集锦!