Cashfree interview question

Min sum path tree question