JPMorganChase Interview Question

coding questions I got focused on strings