added isPermutation algo