Passes2 out of 3 testcases.
@pangatt4 in line 24, it should be val3.
Silly me, would take care of such things ahead.