[Ans] Which brand of soda was created for Nazi Germany during WWII?

Which brand of soda was created for Nazi Germany during WWII? – Fanta was invented in Nazi Germany during World War II due to a trade embargo on importing Coca-Cola syrup. The head of Coca-Cola Deutschland decided to create a new product for the German market during the war, using ingredients available in Germany at … Read more

[Solution] Adjacent Xors solution codechef

Adjacent Xors solution codechef – JJ has an array AA of length NN and an integer XX. JJ can perform the following operation at most once: Select a subsequence of AA and add XX to all the elements of that subsequence. [Solution] Adjacent Xors solution codechef For example, if A = [2, 1, 6, 3, 5]A=[2,1,6,3,5] and X = 7X=7, we can select the subsequence [2, 3, 5][2,3,5] and add XX to all … Read more

[Solution] Copy and Paste solution codechef

Copy and Paste solution codechef – Chef has binary string AA of length NN. He constructs a new binary string BB by concatenating MM copies of AA together. For example, if A = \texttt{“10010”}A=“10010”, M = 3M=3, then B = \texttt{“100101001010010”}B=“100101001010010”. [Solution] Copy and Paste solution codechef Chef calls an index ii (1 \le i \le N \cdot M)(1≤i≤N⋅M) good if: pref_i = suf_{i + 1}prefi​=sufi+1​. Here, pref_j = B_1 + … Read more

[Solution] Different Medians solution codechef

Different Medians solution codechef – Chef is given an integer NN. Chef wants to construct a permutation A = [A_1, A_2, \ldots, A_N]A=[A1​,A2​,…,AN​] of \{1, 2, 3, \ldots, N \}{1,2,3,…,N} that satisfies the following condition: Let P_iPi​ denote the prefix of AA of length ii, i.e, P_i = [A_1, A_2, \ldots, A_i]Pi​=[A1​,A2​,…,Ai​]. Then, for every 1 \leq i \lt N1≤i<N, it must hold that \text{median}(P_i) \neq \text{median}(P_{i+1})median(Pi​)=median(Pi+1​) [Solution] … Read more

[Solution] Dominant Element solution codechef

Dominant Element solution codechef – You are given an array AA of length NN. An element XX is said to be dominant if the frequency of XX in AA is strictly greater than the frequency of any other element in the AA. [Solution] Dominant Element solution codechef For example, if A = [2, 1, 4, 4, 4]A=[2,1,4,4,4] then 44 is a dominant element since its frequency is higher than the … Read more

[Solution] Final Population solution codechef

Final Population solution codechef – There were initially XX million people in a town, out of which YY million people left the town and ZZ million people immigrated to this town. [Solution] Final Population solution codechef Determine the final population of town in millions. Input Format The first line of input will contain a single integer TT, denoting the number of … Read more

[Solution] Split N solution codechef

Split N solution codechef – Kulyash is given an integer NN. His task is to break NN into some number of (integer) powers of 22. [Solution] Split N solution codechef TO achieve this, he can perform the following operation several times (possibly, zero): Choose an integer XX which he already has, and break XX into 22 integer parts (YY and ZZ) such that X = Y + … Read more