solved the challenge question...need to get more score
reduce the time complexity from o(n3) to lesser.