Sha256: 01db00f9468ec826defbac33767d6247b65f81e1a036386f559f049d0e0addfb
Contents?: true
Size: 315 Bytes
Versions: 166
Compression:
Stored size: 315 Bytes
Contents
package pascal const testVersion = 1 func Triangle(n int) (t [][]int) { if n < 1 { return } t = make([][]int, n) r := []int{1} t[0] = r for i := 1; i < n; i++ { last := r r = make([]int, i+1) r[0] = 1 r[i] = 1 for j := 1; j < i; j++ { r[j] = last[j-1] + last[j] } t[i] = r } return t }
Version data entries
166 entries across 166 versions & 1 rubygems