The Love-Letter Mystery

Solutions To solve this challenge we need to calculate the “distance” between the first and the last character, the second and the second to last, etc. We can do it only for the first half of the string: 1 2 a b c d => |a-d| + |b-c| That can be coded in C++ as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 size_t T; cin >> T; string s; while (T--) { cin >> s; auto count = 0; auto first = s. [Read More]

The Master of Cryptocurrencies

Crypto Bank provides $n$ crypto currencies, each of which has a fixed conversion rate with respect to dollar. The conversion rate w.r.t dollar is not subject to change over time. But as you may have imagined, the conversion rate between each pair of crypto currencies may change over time, due to economic and political factors. Ron has $m$ bitcoins with him. The conversion rate of a bitcoin w.r.t dollar is $k$. [Read More]