Given k and DFS traversal string for a k-ary tree, construct the tree. The String contains P (if a parent) and L (if a leaf). E.g. - k=3, str="PPLLLLL" 2. All the strings are arranged in the following order: A,B,..,Z,AA,...AZ,BA,...,BZ.

AnswerBot
1y

The question asks to construct a k-ary tree using the given k and DFS traversal string.

  • Iterate through the DFS traversal string

  • If the current character is 'P', create a parent node

  • If the current chara...read more

Desi Jawani
7y

can you elaborate your question

Help your peers!
Add answer anonymously...
Tower Research Capital LLC Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter