Linked Questions

14 votes
15 answers
1k views

Pascal's Triangle as a 2-dimensional list [duplicate]

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 ...
user51747's user avatar
  • 149
3 votes
1 answer
4k 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....
Johannes Maria Frank's user avatar
3 votes
6 answers
330 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 ...
Bob Jarvis - Слава Україні's user avatar
168 votes
65 answers
42k 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 ...
Casey's user avatar
  • 3,619
25 votes
35 answers
3k 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 ...
AdmBorkBork's user avatar
  • 43.5k
24 votes
27 answers
3k views

Is it a row of Pascal's triangle?

Pascal's triangle is a triangular diagram where the values of two numbers added together produce the one below them. This is the start of it: ...
emanresu A's user avatar
  • 44.2k
17 votes
28 answers
2k views

Count occurrences in Pascal's Triangle

Pascal's triangle is a triangular diagram where the values of two numbers added together produce the one below them. This is the start of it: ...
emanresu A's user avatar
  • 44.2k
29 votes
16 answers
2k 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 ...
AdmBorkBork's user avatar
  • 43.5k
21 votes
16 answers
2k 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, ...
flawr's user avatar
  • 43.9k
12 votes
17 answers
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 ...
Luis felipe De jesus Munoz's user avatar
13 votes
12 answers
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 ...
Quixotic's user avatar
  • 2,397
18 votes
10 answers
1k views

Tips for golfing in Pip

Pip is an imperative golfing language with infix operators. It also borrows some features from functional and array programming. What general tips do you have for golfing in Pip? I'm looking for ...
DLosc's user avatar
  • 39.2k
8 votes
15 answers
635 views

Evaluate the Binomial Coefficient [duplicate]

Given two nonnegative integers n,k such that 0 <= k <= n, return the binomial coefficient ...
flawr's user avatar
  • 43.9k
15 votes
8 answers
750 views

Decorate Pascal's Triangle

Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different: Output \$n\$ first lines of the Pascal's triangle as colored bricks. Color number is ...
Alexey Burdin's user avatar
9 votes
8 answers
1k views

Pascal's tree-angle

Print this tree: ...
Nip Dip's user avatar
  • 415

15 30 50 per page