Doubt regarding Stock span problem

This is my code .
public static int[] StockSpanUsingStacks(int[] prices, StacksUsingArrays stack) throws Exception {

	int[] ans = new int[prices.length] ;
	ans[0] = 1 ;
	stack.push(prices[0]) ;

	for(int i = 1 ; i < prices.length ; i ++){

		if(prices[i] >= stack.top()){
			stack.push(prices[i]) ;
			ans[i] = stack.size() ;
		}
		else{
			stack.push(prices[i]) ;
			ans[i] = 1 ;
		}
	}

	return ans ;

}

Out of 4 , 1 test case is failing . Can you tell me that 1 extreme case , so I can change my code accordingly

@Lalit2142,
Input:
5
1 7 2 4 5

Correct Answer: 1 2 1 2 3 END
Your answer: 1 2 1 4 5 END

Instead of pushing prices[0], push the index.