using System.Collections.Generic;
public static void Main(string[] args)
Grasshopper g = new Grasshopper(5,4);
Console.WriteLine(g.WhereAmI());
Console.WriteLine(g.WhereAmI());
Console.WriteLine(g.WhereAmI());
public int Root { get; set; }
public int Nodes { get; set; }
public List<int> LeavesList = new List<int>();
public Grasshopper(int node, int root)
public void EatAndHopLeft()
public void EatAndHopRight()
if(Nodes <=5 && LeavesList.Count >=3 )
for(int i = LeavesList.IndexOf(Root); i <= LeavesList.Count;)
if (++i < 3 && LeavesList.Count > 2)
else if(i > LeavesList.Count && LeavesList.Count > 2)
public void GenerateLeaves()
for (int i = 1; i <= Nodes; i++)
if(LeavesList.Count != 0)