Appian Interview Question

In DSA, a question on a modified BFS algorithm was asked