Cognex interview question

coding question related to dsa