ByteDance interview question

1). 2 dimensional graph algorithm