NaN.

Zco 2018

Zco 2018 questions:

1) You have C cakes and N children and k. Each child has a range between Si and Ei inclusive. A child will eat all the cakes lying between the range.

If k = 0, you have answer if any of the students' ranges clash or not.

If k = 1, then, you are allowed to move at max 1 child from his place. Let's say you have 5 cakes, and the range of 2 kids are [2,2] and [2,5], then the kids will fight over the second cake. To avoid this you are allowed to move at max one child from its place and allot him another range. If you can remove all the clashes by shifting 1 child then print Good, otherwise print Bad.

**Example: **

**Input:**

3 (testcases)

5(N) 2(C) 0(K)

2 2

3 5

5 2 1

2 2

2 5

5 2 1

2 3

2 5

**Output:**

Good

Good

Bad

**Explanation:**

In test case 2, the child with range [2,2] can be moved from his place to [1,1]

2) You have string of length N consisting of X, Y and Z. A string is good if it starts with X, ends with Z and has a length divisible by 3.

The importance of a string is the number of good string it intersects with.

Given the string and a length k, find a string of length exactly K and minimize it's importance. You have to print its importance.

**Example:**

**Input:**

2 (testcases)

9(N) 3(K)

X Y Z Z Y X X Y Z

4 2

Y X Y Z

**Output:**

1

1

**Explanation:**

In test cases 1, the good strings are from [0,2], [0,8], [6,8]. The string of minimum importance of length 3 is present at [3,5].

In test case 2, the only good string is from [1,3]. Any string of length 2 will at least have an importance of 1. So the answer is 1.

Read more…(324 words)

About the author:

Rishik Sood

Loading…

Join the discussion. Add a reply…

Post

About the author

Rishik Sood

Ready to join our community?

Sign up below to automatically get notified of new courses, get **reminders** to finish ones you subscribe to, and **bookmark** lessons to read later.

Continue with Facebook

— OR —

Your Full Name

Email address

I have an account. Log in instead

By signing up, you agree to our Terms and our Privacy Policy.

Popular Courses

New Courses

About Us

Get in touch

Copyright 2016-18, Compose Labs Inc. All rights reserved.