Its no dynamic programming


#1

maintain the indices, if occ of any index is > 2 then obviously return 1.
else look for any two with occ==2 and check if they can form subsequence.
if such pair then 0;