Coding Ninjas Interview Question

oops , two coding problems one from array another from string