Compile Time Error for no input function


  • 0
    P

    My code:

    	public List<Integer> generate(int numRows) {
    	List<Integer> row = new ArrayList<Integer>();
    	HashMap<Integer, Integer> prevRow = new HashMap<Integer, Integer>();
    	HashMap<Integer, Integer> currRow = null;
    
    	if (numRows <= 0)
    		return Collections.EMPTY_LIST;
    	else {
    		int level = 1;
    		while (level <= numRows) {
    			if (level == 1) {
    				prevRow.put(1, 1);
    				currRow = new HashMap<Integer, Integer>();
    				currRow = new HashMap<Integer, Integer>(prevRow);
    				level++;
    			} else {
    				int first = prevRow.get(1);
    				int last = prevRow.get(level - 1);
    				for (int i = 1; i <= level; i++) {
    					if (i == 1)
    						currRow.put(1, first);
    					else if (i == level) {
    						currRow.put(i, last);
    					} else
    						currRow.put(i, prevRow.get(i - 1) + prevRow.get(i));
    				}
    				prevRow = (HashMap<Integer, Integer>) currRow.clone();
    				level++;
    			}
    		}
    		TreeMap<Integer, Integer> htemp = new TreeMap<Integer, Integer>(currRow);
    		for (Map.Entry<Integer, Integer> i : htemp.entrySet()) {
    			row.add(i.getValue());
    			System.out.print(i.getValue());
    		}
    		return row;
    	}
    }
    

    Error: Line 15: error: cannot find symbol: method getRow(int)
    I get this error when I have my code pasted in and even when there's no code in the box. I find this extremely weird. Apologies if I am making a mistake.

    Screenshot1: with code pasted Pic1
    Screenshot2: No code! Pic2


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.