For this problem

sir can I get a code for this problem I am not able to understand the editorial

hello @sraj39273

check this->