BMW Group Interview Question

regarding ad alogirthm. data structure