Groq Interview Question

DFS based to create input and output nodes