[Ans] Which author is credited with writing the first detective story?

Which author is credited with writing the first detective story? – Edgar Allan Poe is credited with writing the first detective story and is most renowned for his horror stories, but he is also credited with creating the first detective story. Poe’s story “The Murders in the Rue Morgue,” first published in 1841, follows main … Read more

[Solution] Binary String Game solution codechef

Binary String Game solution codechef – There is a binary string SS. Alice and Bob are playing a game on it. Each turn, the following happens: Alice selects a 0101 subsequence in SS and removes it from SS. (a 0101 subsequence is a length 22 subsequence whose first character is 00 and second character is 11) Bob selects a 0101 subsequence in SS and removes it from SS. After both players have … Read more

[Solution] Smallest Element In Progression solution codechef

 Smallest Element In Progression solution codechef – You are given a prime number PP and two integers A,BA,B. Your task is to find the minimum value of (AT⋅B)modP(AT⋅B)modP over all nonnegative integers TT. [Solution] Smallest Element In Progression solution codechef The only line of input contains three space-separated integers P,A,BP,A,B. It’s guaranteed that PP is prime. Output Format Output the minimum value of (AT⋅B)modP(AT⋅B)modP over … Read more

[Solution] Rearrange Ranges solution codechef

Rearrange Ranges solution codechef – Let f([x1,x2,⋯,xk])f([x1,x2,⋯,xk]) be the minimum number of subarrays such that each xixi belongs to exactly one subarray, and it’s possible to arrange the subarrays in a way that makes xx increasing. For example, f([5,4,1,2,3])=3f([5,4,1,2,3])=3 since we can divide xx into three subarrays: [5],[4],[1,2,3][5],[4],[1,2,3] then rearrange them to [1,2,3],[4],[5][1,2,3],[4],[5]. [Solution] Rearrange Ranges solution codechef You are given a permutation PP of length NN. You are also given QQ queries … Read more

[Solution] Balanced 0-1 Tree solution codechef

Balanced 0-1 Tree solution codechef – You have a tree of NN vertices rooted at vertex 11, where NN is even. The ii-th vertex has a binary value AiAi written on it (i.e, each AiAi is either 00 or 11). [Solution] Balanced 0-1 Tree solution codechef A tree is said to be balanced if and only if the number of zeros written on its vertices equals the number of ones … Read more

[Ans] What language uses inverted question marks?

[Ans] What language uses inverted question marks? The upside-down or inverted question marks are unique to the Spanish language. The idea makes a lot of sense: when you’re reading in Spanish, you can identify long before the end of a sentence whether you’re dealing with a question, something that isn’t always obvious in English. The … Read more

[Solution] Yet Another Palindromic Problem solution codechef

Yet Another Palindromic Problem solution codechef – Chef is given a rooted tree with NN nodes numbered 11 to NN where 11 is the root node.Each node is assigned a lowercase english alphabet between a to z (both included). [Solution] Yet Another Palindromic Problem solution codechef Given two nodes AA and BB: Let LCA(A,B)LCA(A,B) denote the lowest common ancestor of nodes AA and BB. Let DIS(A,B)DIS(A,B) denote the string containing all the characters associated with the nodes in … Read more

[Solution] Crazy Substrings solution codechef

Crazy Substrings solution codechef – Gotham City is the home of Batman, and Batman likes to keep his people together. There are NN houses in the city. The resident of the ithith house is of type AiAi. It is known that people of the same type are friends and people of different types are not friends. [Solution] Crazy Substrings solution … Read more

[Solution] Even Subarray XOR solution codechef

 Even Subarray XOR solution codechef – Given a positive integer NN, construct two arrays AA and BB, each of size NN such that: Ai≠AjAi≠Aj for all (1≤i<j≤N)(1≤i<j≤N); Bi≠BjBi≠Bj for all (1≤i<j≤N)(1≤i<j≤N); Ai≠BjAi≠Bj for all (1≤i,j≤N)(1≤i,j≤N); 1≤Ai,Bi≤3⋅1051≤Ai,Bi≤3⋅105 for all (1≤i≤N)(1≤i≤N); ⊕A[1,i]=⊕B[1,i]⊕A[1,i]=⊕B[1,i] for all (1≤i≤N)(1≤i≤N) such that ii is even. Here ⊕A[L,R]⊕A[L,R] corresponds to the bitwise XOR of all elements of the subarray [L,R][L,R] of array AA. Similarly, ⊕B[L,R]⊕B[L,R] corresponds to the bitwise XOR of all elements of the subarray [L,R][L,R] of array BB. If multiple answers are … Read more

[Solution] Compress the Video solution codechef

Compress the Video solution codechef – Chef recorded a video explaining his favorite recipe. However, the size of the video is too large to upload on the internet. He wants to compress the video so that it has the minimum size possible. [Solution] Compress the Video solution codechef Chef’s video has NN frames initially. The value of … Read more