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