×

# D. Array Restoration Getting TLE

 0 My Approach - Answer is no if there exist $i < j$ in range minIndx of j to maxIdx of j. For This I have used segment tree. Time Complexity according to me - $O((n+q)*logn)$ Which Should pass TL. asked 18 Aug '18, 04:27 2.3k●1●5●16 accept rate: 11%

 0 what is your approach?? how you have used segment tree? i think solution possible without segment tree . answered 18 Aug '18, 10:42 42●5 accept rate: 7% I'm using segment tree. But I have not inserted 0 in tree. Instead using INF. And for given range l,r. I'm returning smallest no in this range. And using condition @vishesh345 's answer. (18 Aug '18, 12:02)
 0 Can you elaborate your condition for no solution. According to me it was that if there exist i
 0 Thank you friends. I have got AC on 33rd submission xD. I just removed one linear loop for inserting q by using some more variables. And removed handling of special case of 1. answered 18 Aug '18, 12:03 2.3k●1●5●16 accept rate: 11%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×2,699
×655

question asked: 18 Aug '18, 04:27

question was seen: 136 times

last updated: 18 Aug '18, 12:05