1522.Diameter of N-Ary Tree
Problem description:
Given a root
of an N-ary tree, you need to compute the length of the diameter of the tree.
Given a root
of an N-ary tree, you need to compute the length of the diameter of the tree.
Run-length encoding is a compression algorithm that allows for an integer array nums
with many segments of consecutive repeated numbers to be represented by a (generally smaller) 2D array encoded
. Each encoded[i] = [vali, freqi]
describes the ith
segment of repeated numbers in nums
where vali
is the value that is repeated freqi
times.