From 19474780a2b5c94633b7c545bd95a0f00834791f Mon Sep 17 00:00:00 2001 From: xbz Date: Wed, 22 Oct 2014 16:04:05 +0800 Subject: [PATCH] Update Generate.java 1. a typo: class name should be Solution :) 2. There is no need to check "if (numRows <= 0)" --- dp/Generate.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/dp/Generate.java b/dp/Generate.java index 03483a4..4c39681 100644 --- a/dp/Generate.java +++ b/dp/Generate.java @@ -3,14 +3,9 @@ import java.util.ArrayList; import java.util.List; -public class Generate { +public class Solution { public List> generate(int numRows) { List> ret = new ArrayList>(); - - if (numRows <= 0) { - return ret; - } - for (int i = 0; i < numRows; i++) { ArrayList list = new ArrayList(); for (int j = 0; j < i + 1; j++) { @@ -28,4 +23,4 @@ public List> generate(int numRows) { return ret; } -} \ No newline at end of file +}