public int[] calcStockSpan(int[] prices) {
		int[] spans = new int[prices.length];
		Stack<Integer> indexes = new Stack<Integer>();
		
		indexes.push(0);
		spans[0] = 1;
		
		for(int i = 1; i < prices.length; i++) {
			while(!indexes.isEmpty() && prices[i] >= prices[indexes.peek()]) {
				indexes.pop();
			}
			
			spans[i] = indexes.isEmpty() ? i + 1 : i - indexes.peek();
			indexes.push(i);
		}
		
		return spans;
	}