ConnectWise interview question

Multiple problems on algo and ds