SmartQ Interview Question

1- Pattern based question in js