How to solve this problem using random generation method ?

This is the problem CHEF AND LAND (CHEFIHG OF COOK72)

I wanted to know how can it be solved using the random string method as discussed by many members here. Please provide a detailed explanation so that many beginners like me can understand easily.

THANKS IN ADVANCE :slight_smile:

There is no special trick. You print a random instruction of length 100000, and if you are lucky enough your answer might get AC. Else try resubmitting a few more times to increase the chances of getting AC. There are few solutions, looking at whom you would get an idea of how to solve using random string method. The links to the solutions are as follows:

I agree with @prakhariitd and strictly recommend to solve it using proper approach (i.e. bfs + greedy).