面试题 现在还没写出来
想请教一下大家
interface INode {
key: string;
value: string;
children: INode[];
}
[
{
key: '1',
value: 'xxx',
children: [
{
key: '11',
value: 'yyy',
children: [
{
key: '111',
value: 'zzz',
}
]
}
]
},
{
key: '2',
value: 'aaa',
children: [],
}
]
=>
{
'1': 'xxx',
'1-11': 'yyy',
'1-11-111': 'zzz',
'2': 'aaa'
}😭😭😭😭😭#面试题目#
interface INode {
key: string;
value: string;
children: INode[];
}
[
{
key: '1',
value: 'xxx',
children: [
{
key: '11',
value: 'yyy',
children: [
{
key: '111',
value: 'zzz',
}
]
}
]
},
{
key: '2',
value: 'aaa',
children: [],
}
]
=>
{
'1': 'xxx',
'1-11': 'yyy',
'1-11-111': 'zzz',
'2': 'aaa'
}😭😭😭😭😭#面试题目#