remove duplicate, recursion version

remove duplicate, recursion version