Hello All, I was solving the following question on codeforces .. But the thing is I am getting memory limit exceeded on test 2 on online judge .. here is my code. ..... can anyone suggest any better way out ? thanks... problem : Problem K My Code : Code