All pastes #922182 Raw Edit

Someone

public text v1 · immutable
#922182 ·published 2008-02-28 16:59 UTC
rendered paste body
	public static void Org(Stack<int> a)
	{
		Stack<int> result = new Stack<int>();
		while(a.Count != 0)
			result.Push(Max(a));
		while(result.Count != 0)
			a.Push(result.Pop());
	}
	public static int Max(Stack<int> a)
	{
		Stack<int> result = new Stack<int>();
		int max = int.MinValue;
		while(a.Count != 0)
		{
			if(a.Peek() > max)
				max = a.Peek();
			result.Push(a.Pop());
		}
		while(result.Count != 0)
			a.Push(result.Pop());
		return max;
	}