Frage im Vorstellungsgespräch bei EPAM Systems

Two was coding question at the time of interview, asked on java, C++ and Python