Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is all I remember now :

An array represents a binary tree like this :

        1
       / \
      2   3
       \ /
       4 5
      /
     6
is represented as : 1 2 3 * 4 5 * 6

so apart from the last level, any missing child nodes are represented as *. You need to find the set of unconnected nodes whose sum is maximum. Child-parent relationship means they are connected.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: