Uncategorized

This problem is about finding the distance between two nodes of a strictly binary tree. Oh, is that too easy?! Ok, the tree is potentially infinite now. Keep it up and we will start going up the aleph numbers. In this problem, a tree is either a single node XX , or a node XX with two trees attached to it: a left subtree and a right subtree. In both cases, XX is the root of the tree. If the tree is not a single node, the roots of both the left and right subtrees are the only children of XX .

Infinitree codejam solution For Solution Click Here! This problem is about finding the distance between two nodes of a strictly binary tree. Oh, is that too easy?! Ok, the tree is potentially infinite now. Keep it up and we will start going up the aleph numbers. In this problem, a tree is either a single …

This problem is about finding the distance between two nodes of a strictly binary tree. Oh, is that too easy?! Ok, the tree is potentially infinite now. Keep it up and we will start going up the aleph numbers. In this problem, a tree is either a single node XX , or a node XX with two trees attached to it: a left subtree and a right subtree. In both cases, XX is the root of the tree. If the tree is not a single node, the roots of both the left and right subtrees are the only children of XX . Read More »

We have a string SS consisting of decimal digits. A division of SS is created by dividing SS into contiguous substrings. For example, if SS is 0145217, two possible divisions are 014 5 21 7 and 0 14 52 17. Each digit must be used in exactly one substring, and each substring must be non-empty. If SS has LL digits, then there are exactly 2L−12L−1 possible divisions of it.

divisible divisions codejam solution For Solution Click Here! We have a string SS consisting of decimal digits. A division of SS is created by dividing SS into contiguous substrings. For example, if SS is 0145217, two possible divisions are 014 5 21 7 and 0 14 52 17. Each digit must be used in exactly one substring, and each substring must be non-empty. If SS has LL digits, then there are exactly 2L−12L−1 possible divisions …

We have a string SS consisting of decimal digits. A division of SS is created by dividing SS into contiguous substrings. For example, if SS is 0145217, two possible divisions are 014 5 21 7 and 0 14 52 17. Each digit must be used in exactly one substring, and each substring must be non-empty. If SS has LL digits, then there are exactly 2L−12L−1 possible divisions of it. Read More »

divisible divisions solution codejam

divisible divisions codejam solution For Solution Click Here! We have a string SS consisting of decimal digits. A division of SS is created by dividing SS into contiguous substrings. For example, if SS is 0145217, two possible divisions are 014 5 21 7 and 0 14 52 17. Each digit must be used in exactly one substring, and each substring must be non-empty. If SS has LL digits, then there are exactly 2L−12L−1 possible divisions …

divisible divisions solution codejam Read More »

slide circuits solution codejam

slide circuits codejam solution For Solution Click Here! Gooli is a huge company that owns BB buildings in a hilly area. Five years ago, Gooli built slides that allowed employees to go from one building to another (they are not bidirectional), starting a tradition of building slides between buildings. Currently, SS slides exist. Melek is Gooli’s Head of Transportation and a …

slide circuits solution codejam Read More »

Alternating LG Queries codechef solution

Alternating LG Queries solution codechef For Solution Click Here! You are given an array AA consisting of NN integers. You have to answer QQ queries of the following two types: 11 LL RR (R>L)(R>L) which asks you to find gcd(AL,lcm(AL+1,gcd(AL+2,…,((R−L)mod2==1?gcd(AL,lcm(AL+1,gcd(AL+2,…,((R−L)mod2==1? gcd(AR−1,AR):lcm(AR−1,AR))…)))gcd(AR−1,AR):lcm(AR−1,AR))…))). 22 LL RR (R>L)(R>L) which asks you to find the same as above but lcmlcm swapped with gcdgcd and vice-versa. Here lcm(a,b)lcm(a,b) and gcd(a,b)gcd(a,b) denotes the least common multiple and greatest common divisor of two integers aa and bb respectively. Example: Consider the …

Alternating LG Queries codechef solution Read More »

Fat Hut codechef solution

Fat Hut solution codechef For Solution Click Here! There are NN breakfasts in the restaurant “Fat Hut” where the Chef works. The ii-th breakfast has an attractiveness AiAi and cost CiCi. The Chef has noticed that nobody takes the jthjth breakfast if there exists at least one breakfast ii such that Ai≥AjAi≥Aj and Ci<CjCi<Cj. In other words, if a breakfast is less attractive and more expensive than any of the …

Fat Hut codechef solution Read More »

Chef and Digits of Large Numbers solution codechef

Chef and Digits of Large Numbers solution codechef For Solution Click Here! Chef and Abhishek are two friends. Abhishek really appreciates Chef’s skills and wants to learn the secret formula behind Chef’s tasty dishes. Chef will tell his secret formula only to a competent person. So to check Abhishek’s competency, Chef asked him to solve …

Chef and Digits of Large Numbers solution codechef Read More »