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


Pishty and Triangles

Can anyone tell me why this solution of mine gives tle and other is ac although they have same complexity. The only difference between then is one of them is implements seg tree in recursive fashion and other in iterative fashion? Question link Pishty and Triangles

asked 12 Mar '18, 17:31

phantomhive's gravatar image

accept rate: 0%

As you know recursive calls are more costly than iterative methods, thats the reason why you get a TLE. Your iterative method takes 5.58secs in the last test and so its fair that the recursive method easily takes more than 6secs which causes the TLE.


answered 12 Mar '18, 19:17

horsbug98's gravatar image

accept rate: 21%

toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 12 Mar '18, 17:31

question was seen: 413 times

last updated: 12 Mar '18, 19:17