Brilliant (CA) interview question

Questions about trees and graphs and one Difficult string manipulation question