I need help with Q1. I solved that problem with O(2^n) complexity on Microsoft Codility OA. But i did not pass . So i m looking for someone to help me solve this problem more efficiently