Error was not using && instead of || and using len - 1.