# Solution to Problem 15 on ProjectEuler.net

The problem: ——- Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid? ——- My Solution #include <stdio.h> int main(){   int i,j,x,y;   long long int mat;   i=0;   for (j=0;j<21;j++)     mat[i][j]=1;   j=0;   for (i=0;i<21;i++)     mat[i][j]=1;   for […]

# Facebook Hacker Cup 2013: Beautiful Strings Solution

This weekend the qualification round of the Facebook Hacker Cup 2013 took place. Below you’ll find the first problem: ———- When John was a little kid he didn’t have much to do. There was no internet, no Facebook, and no programs to hack on. So he did the only thing he could… he evaluated the […]

# Solution to Problem 14 on ProjectEuler.net

Here’s the problem: ———— The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can be seen […]

# CodeChef.com Easy Problem: Transform the Expression

He’s an interesting albeit relatively easy problem from CodeChef.com: ———- Reverse Polish Notation (RPN) is a mathematical notation where every operator follows all of its operands. For instance, to add three and four, one would write “3 4 +” rather than “3 + 4”. If there are multiple operations, the operator is given immediately after […]

# CodeChef Easy Problem: Sums in a Triangle

Still practicing for Facebook Hacker Cup 2013. The problem below is a classic, although I wouldn’t necessarily classify it as “easy” as the guys from CodeChef did. Anyway here you go: ———- Let’s consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three […]

# Solution to Problem 12 on Project Euler

The problem: ———- The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, … Let […]

# CodeChef Easy Problem: Turbo Sort

Here’s the problem: ————- Given the list of numbers, you are to sort them in non decreasing order. Input t – the number of numbers in list, then t lines follow [t

# Solution to Problem 11 on Project Euler

You can see the original problem here: ———– In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 […]

# CodeChef Easy Problem: Odd

Still practicing for Facebook Hacker Cup 2013: ———- The captain of the ship TITANIC is a little …. off the track. He needs to select the crew for the ship. But everyone seems to be eligible. So to test their intelligence, he plays a game. The contestants have to stand in a line. They are […]