codefreshers

[Solved] Fibonacci concatenation solution codechef 

Fibonacci concatenation solution codechef Let’s define Fibonacci concatenation sequence as follows: f[0]=0f[0]=0, f[1]=1f[1]=1 f[i]=f[i−1]+f[i−2]f[i]=f[i−1]+f[i−2], for every i≥2i≥2 Here f[i]f[i] denotes the ithith Fibonacci concatenation number and ++ represents concatenation. For example, f[2]=f[1]+f[0]=1+0=10f[2]=f[1]+f[0]=1+0=10, f[3]=f[2]+f[1]=f[3]=f[2]+f[1]= 10+1=10+1= 101101. Given an integer nn, you have to determine the sum of digits of all subsequences of the nthnth Fibonacci concatenation number f[n]f[n], modulo 109+7109+7. A subsequence of a number is a sequence of digits that can be derived from …

[Solved] Fibonacci concatenation solution codechef  Read More »

[Solved] Friend Groups In A Line solution codechef 

Friend Groups In A Line solution codechef There are NN positions in a queue. Given a binary string SS of length NN, where Si=Si= ’11’ denotes, there is a person standing in the ithith position. The distance between two people standing in the ithith and jthjth positions respectively in the queue is ∣i−j∣∣i−j∣, where ∣x∣∣x∣ denotes the absolute value of xx. Now, two people are considered to be friends if they are at a …

[Solved] Friend Groups In A Line solution codechef  Read More »