Company: Bounteous × Accolite_22oct
Difficulty: medium
Ant's Journey Home Problem Description In a forest there lives a little ant named Andy. The forest runs along the x-axis, and Andy's anthill sits at position x . Andy always begins the evening at position 0 , and as dusk falls he must find his way home. Andy travels in only two ways: he can march forward by exactly a positions, or he can scurry backward by exactly b positions. His journey is bound by three rules: Andy cannot scurry backward twice in a row — it makes him dizzy and confused. Certain positions are marked with large red flags and are prohibited . Andy may never land on one of them. Andy may never move to a position before the start of the forest , that is, to any negative position. Andy may march past his own anthill and come back to it later, as long as every position he lands on obeys the rules above. Given the prohibited positions and the three numbers a , b and x , find the least number of jumps Andy needs to land exactly on position x . If no legal sequence of jumps e