Linked Questions

2
votes
1answer
3k views

shortest possible python pascal triangle code [duplicate]

the contest is already finished, so I don't think it's cheating to ask: I am trying to optimize this small contest: pascal triangle I started with 4.72 and worked myself up to 7.48. The best made a 9....
3
votes
6answers
273 views

Pascal's Trapezoid [duplicate]

Write a function which for any given input array of numbers and a row number r, returns the r-th vector or array where each subsequent vector or array is constructed from the previous following the ...
0
votes
0answers
55 views

Print Pascal's Triangle [duplicate]

Overview Pascal's triangle is the series of rows of numbers, starting with 1, where each cell is formed by summing the two above it. Here's an example. Challenge and Scoring The challenge is simple:...
137
votes
50answers
23k views

Tips for golfing in C

What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an ...
24
votes
29answers
2k views

Pascal's Triangle (Sort of)

Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first ...
29
votes
13answers
1k views

Pascal's Column Sums

Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first ...
19
votes
14answers
1k views

Discrete Convolution or Polynomial Multiplication

Given two non empty lists of integers, your submission should calculate and return the discrete convolution of the two. Interestingly, if you consider the list elements as coefficients of polynomials, ...
11
votes
14answers
1k views

Draw a descendant pyramid (addition)

Challenge Given a sequence of non-negative integers, create a function that output a descendant pyramid where the children are the sum of both parent numbers. The result is outputted as an string ...
11
votes
12answers
1k views

Code golf: Distributing the balls (I)

Challenge In this task you have compute the number of ways we can distribute A balls into B cells with with every cell having at-least one ball. The inputs A and B are given in a single ...
8
votes
15answers
374 views

Evaluate the Binomial Coefficient [duplicate]

Given two nonnegative integers n,k such that 0 <= k <= n, return the binomial coefficient ...
11
votes
9answers
762 views

Pascal's Triangle as a 2-dimensional list

Create a Pascal's Triangle that is a nested list and contains zeros in the unused spots. In the output array, the numbers of Pascal's Triangle are separated by zeroes and padded by zeroes on each ...
2
votes
8answers
269 views

Calculate the middle number of a row of the pascal triangle [duplicate]

Write a function that calculates a row of the pascal triangle and returns the middle number, if there are 2 it should return their sum. Example: 5 would return ...
2
votes
4answers
464 views

Evaluate the binomial theorem!

Your mission, even if you don't accept it, is to input three numbers from STDIN or file: 5 0.5 6 What you must do is evaluate this: (5a + 0.5b)^6 This basically means that the first two ...