Error: bad operand types for binary operator '+'


  • 0
    public class Solution {
        public List<Integer> getRow(int rowIndex) {
            
            List row = new ArrayList<Integer>();
            
            int index = 0;
            
            while(index < rowIndex){
    
                row.add(0, 1);
                
                for(int j = 1; j < row.size()-1; j++){
                    row.set(j, row.get(j)+row.get(j+1));
                }
                
                index++;
            }
            
            return row; 
            
        }
    }
    

    Got and error say "error: bad operand types for binary operator '+'", for the line with "row.set(....)"

    Really don't understand.


Log in to reply
 

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