You are viewing a single comment's thread. Return to all comments →
C# Solution :
public static void PrintFrontElmtOfQueue(List<string> operations) { var stackList = new List<int>(); foreach (var op in operations) { var splitList = op.Split(" ").Select(x => Convert.ToInt32(x.Trim())).ToList(); var opType = splitList[0]; switch (opType) { case 1: stackList.Add(splitList[1]); break; case 2: stackList.RemoveAt(0); ; break; case 3: Console.WriteLine(stackList[0]);; break; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Queue using Two Stacks
You are viewing a single comment's thread. Return to all comments →
C# Solution :