applying floyd. but wrong answer