<commit_before>package pascaltriangle;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * https://oj.leetcode.com/problems/pascals-triangle/
 * Given numRows, generate the first numRows of Pascal's triangle.
 * 
 */
public class Solution {
	
	
	// 1 0 0 0
	// 1 1 0 0
	// 1 2 1 0
	// 1 3 3 1
	private List<Integer> generateNextRow(List<Integer> row) {
		List<Integer> currentRow = new ArrayList<Integer>();
		for (int i = 0; i < row.size() + 1; i++) {
			if (i == 0) {
				currentRow.add(1);
			}
			else {
				if (i < row.size()) {
					currentRow.add(row.get(i) + row.get(i - 1));
				}
				else {
					currentRow.add(1);
				}
			}
		}
		return currentRow;
	}
	
	public List<List<Integer>> generate(int numRows) {
		List<List<Integer>> result = new ArrayList<List<Integer>>();
		
		if (numRows > 0) {
			List<Integer> nextRow = Arrays.asList(1);
			result.add(nextRow);<commit_msg>Solution for pascal's triangle problem<commit_after>package pascaltriangle;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * https://oj.leetcode.com/problems/pascals-triangle/
 * Given numRows, generate the first numRows of Pascal's triangle.
 * 
 * This solution got accepted, and uses recursion to generate the next row
 * out of the previous one.
 * 
 */
public class Solution {
	// 1 0 0 0
	// 1 1 0 0
	// 1 2 1 0
	// 1 3 3 1
	private List<Integer> generateNextRow(List<Integer> row) {
		List<Integer> currentRow = new ArrayList<Integer>();
		for (int i = 0; i < row.size() + 1; i++) {
			if (i == 0) {
				currentRow.add(1);
			}
			else {
				if (i < row.size()) {
					currentRow.add(row.get(i) + row.get(i - 1));
				}
				else {
					currentRow.add(1);
				}
			}
		}
		return currentRow;
	}
	
	public List<List<Integer>> generate(int numRows) {
		List<List<Integer>> result = new ArrayList<List<Integer>>();
		
		if (numRows > 0) {
			List<Integer> nextRow = Arrays.asList(1);
			result.add(nextRow);
{'fraction_non_alphanumeric': 0.15071283095723015, 'fraction_numerical': 0.024439918533604887, 'mean_word_length': 2.961693548387097, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490964', 'n_tokens_mistral': 846, 'n_tokens_neox': 696, 'n_words': 186}