Following up from my previous post, where I attempted Solving Project Euler Problem 13 – Large Sum, I took up Problem 42 – Coded Triangle Numbers

While the original problem is a bit more complex, Hackerrank had broken it down a bit more simpler.

**Note**: This solution times out after the first 2 test cases out of a total of 7 test cases. So, while the solution is technically correct, it’s not the most optimal way to go about it.

#### Problem Statement

The nth term of a sequence of triangle numbers is given by,

tn= 0.5 n (n+1)

So the first ten triangle numbers are:

1,3,6,10,15,21,28,36,45,55,⋯

You are given an integer. If it is a triangular number tn, print the term n corresponding to this number, else print −1

For my next problem, I decided to take one of the popular routes and experimented with few of the simpler problems from Project Euler

The first problem that I tried was Problem 13 – Large Sum

#### Problem Statement

Work out the first ten digits of the sum of N 50-digit numbers.

The first line contains N, next N lines contain a 50 digit number each.

Print only first 10 digits of the final sum

#### Constraints

1 ≤ N ≤ 10^3

Following up from the earlier post, I first started with a very simple mathematical problem of finding the symmetrical point, given a set of coordinates.

The problem statement is as follows:

Given two points P and Q, output the symmetric point of point P about Q.

The first line contains an integer T representing the number of test cases

Each test case is a line containing four space-separated integers Px Py Qx Qy representing the (x,y) coordinates of P and Q.