Metrodata Interview Question

Explain logic to get wildcard in coding