@returnans hi returnans, i've read your reply. I think i understand you. when visiting the last'0' in the second row, this solution will still visit all following '0's and get stack overflow.. Learned a lot from you. THX. so what's your solution for this problem? could you share with us?