there k time k grid k the square row r column c denote rc two square r_1 c_1 r_2 c_2 consider adjacent lvert r_1 r_2 rvert lvert c_1 c_2 rvert 1an array adjacent pair square call strong possible cut grid grid line connect congruent piece pair piece two piece congruent match translation rotation reflection combination the picture represent test case arrow indicate pair square thick black line represents cut you give array n pair adjacent square find size large strong subsequence an array p subsequence array q p obtain q deletion possibly zero element