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.

Problem Scalar Products from HackerRank’s Week of Code 19 was quite an interesting one to solve. Despite being labelled “Difficult”, there were more accepted answers than in the previous problem Two Robots, which was supposedly easier to solve.

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: