Amazon Interview Question

two algorithm s are about the string