You are not logged in. Please login at www.codechef.com to post your questions!

×

Is Question Understanding Is Wrong Or Solution Of ZCO Matched Brackets 2?

I am solving ZCO Matched Brackets 2.

Question Link : ZCO12003

My Explanation To My Solution:

First i am checking for Maximum Alternative Depth in the first for loop.
I am checking it by taking the observation of brackets.
If i encounter bracket ( after [ or bracket [ after ( then i increment my conter by 1 and storing the maximum ans to a variable.
In second loop i am checking for the maximum number of brackets between ( ) (Inclusive) and maximum number of brackets between [ ] (Inclusive) and printing the answer.


My Solution: My Code

asked 31 Jan, 23:21

crackercode's gravatar image

3★crackercode
156
accept rate: 0%

edited 03 Feb, 12:34


I looked at your code. I don't think there is any issue with queries of type 2 and 3. The issue is with computation of alternating depth. Instead of giving away the error to you and spoiling the fun, let's give you a test case for which your solution fails ;)

View Content

For this, your solution prints an alternating depth of 0. while the answer should be 2.
Happy debugging :)

If you still have any issues, feel free to ask them.

link

answered 03 Feb, 13:35

akashbhalotia's gravatar image

4★akashbhalotia
68112
accept rate: 14%

edited 03 Feb, 13:36

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,070
×10
×3
×3

question asked: 31 Jan, 23:21

question was seen: 118 times

last updated: 03 Feb, 14:24