Databricks Array Distinct Javascript Interview Question