My Algorithm  Code