Pedro Matias

About Archive

HackerRank – Shashank and List

Problem Shashank and List is a math problem that asks for computing the sum $P = \sum_{i=1}^{2^N-1} 2^{S_i}$, where $S_i$ is the sum of all the elements of the $i^{th}$ non-empty sublist of a list A of $N$ elements. Since this value can be huge, we need to report $P \% (10^9+7)$ instead.

... Read more


HackerRank Week of Code 19 (Part I)

This is the first of a series of posts I plan to write about one of the first programming contests I have competed in, HackerRank’s Week of Code 19. The set of problems was quite interesting and they were released one at a time every day throughout the week, in increasing order of difficulty.

I will skip the first problem, because it’s a warmup kind of question. The second problem is called Two Robots and goes like this:

... Read more