UiPath Interview Question

(Round 1) Write code to delete nodes which had depth greater than certain given value.