public int maxProfit(int[] prices) {
    	
    	/*
    	HashMap<Integer, String> hmMap = new HashMap<Integer,String>();
    	hmMap.put(1,"asdf");
    	hmMap.remove(1);
    	Set<Entry<Integer,String>> s = hmMap.entrySet();
    	Iterator i = s.iterator();
    	while(i.hasNext()){
    		@SuppressWarnings("unchecked")
			Entry<Integer,String> temp = (Entry<Integer,String>)i.next();
    		i.remove();
    	}*/
        if(prices == null || prices.length == 1  ){return 0;}
        
        int[] maxValues = this.setMax(prices);
        int max = 0;
        int temp = 0;
        
        
        for(int i=0;i<prices.length;i++){           //find the maximum 
            if(maxValues[i]!=0 && maxValues[i]!=-1){
                temp = prices[maxValues[i]]-prices[i];
            }
            if(temp>max){
                max = temp;
            }
        }
        return max;
        
    }