ay2306's blog

By ay2306, history, 6 years ago, In English

I learned square-root decomposition from geeksforgeeks and decided to practice by solving questions. But I am unable to grasp the reason of why my code is making an error

Link to my code

To learn without seeking to blog, I tried to look someone's code and implement it myself. I copied down some code but am unable to look why is my code wrong.

Link to original code

Link to code i wrote copying

Where am I going wrong. Please help me.

Thank you.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You never call the del() function, you're calling add() 4 times.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you so much. I just realized that I am dumb.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +6 Vote: I do not like it

      Everyone make mistakes. It's important to learn from them.