ByteDance interview question

Modified 3sum leet code question, database design in a family tree