Motorq interview question

mostly array and DP based questions