Time Limit Exceeded (TLE) - Why ❓ and how to Figure our Right Time Complexity ❓

Поділитися
Вставка
  • Опубліковано 28 лис 2017
  • Frustated with a TLE Error. Watch this video why does an Online Judge throws TLE and how to write algorithms that follow the given constraints what complexities get accepted and when.
    Like our FaceBook Page - / codingblocksindia
    Follow us on Instagram - / codingblocks
    Follow us on Twitter - / codingblocksin
    Source code available on -github.com/coding-blocks
    For more interesting tutorials - / @codingblocksindia

КОМЕНТАРІ • 76

  • @CodingBlocksIndia
    @CodingBlocksIndia  4 роки тому +5

    Become a professional programmer with Coding Blocks' Online Courses. Visit cb.lk/2T7WP to explore all courses. Use Coupon Code "UA-cam" to avail 25% Off on Our Courses.

    • @mohitsharma-pv7md
      @mohitsharma-pv7md 2 роки тому +1

      sir, i have a doubt if some code has complexity of O(n^2). and in the question highest possible value of n given is 10^4. so how the complexity of O(n^2) can work??? because in 1 sec, in total 10^8 operations are allowed. But if the highest possible value of n is (10^4). then our code has more no of operations than 10^8 , because in actual some constant k also multiplies with n^2:-
      if value of n =10^4
      K*n^2=k*10^8 > total no of operations allowed in 1 sec , i.e. 10^8.
      so how the complexity of n^2 is allowed for the question which has range of n as below:-
      1

  • @marvel438
    @marvel438 3 роки тому +23

    This is one of the most important video in competitive programming community

  • @shahjadansari8771
    @shahjadansari8771 3 роки тому +3

    Finally I get it .why we use time constraints . Thanks you

  • @aasthamehtatech
    @aasthamehtatech 4 роки тому +7

    The table is good to quickly know abt Worst case complexity ur code can have

  • @leolowe22
    @leolowe22 4 роки тому +8

    Great Explanation Prateek Sir. Keep up the good work

  • @naganikhilbijjala1000
    @naganikhilbijjala1000 6 років тому +25

    These many day i got frustrated. You cleared my doubt 🤷‍♂️. Thank you very much sir.

    • @mohitsharma-pv7md
      @mohitsharma-pv7md 2 роки тому +2

      i have a doubt if some code has complexity of O(n^2). and in the question highest possible value of n given is 10^4. so how the complexity of O(n^2) can work??? because in 1 sec, in total 10^8 operations are allowed. But if the highest possible value of n is (10^4). then our code has more no of operations than 10^8 , because in actual some constant k also multiplies with n^2:-
      if value of n =10^4
      K*n^2=k*10^8 > total no of operations allowed in 1 sec , i.e. 10^8.
      so how the complexity of n^2 is allowed for the question which has range of n as below:-
      1

    • @mohitsharma-pv7md
      @mohitsharma-pv7md 2 роки тому +2

      can u pls help me

  • @rhytham5427
    @rhytham5427 5 років тому +2

    Is it inclusive of test cases or not?

  • @danishuddin9752
    @danishuddin9752 2 роки тому

    just now you introduced me to something exciting!

  • @bits.0311y2k
    @bits.0311y2k 4 роки тому +10

    Is there any ide or online compiler that let me known about the time of compilation of my code...

  • @ravulaakhilsurya8569
    @ravulaakhilsurya8569 2 роки тому

    My favourite video on UA-cam 🙏🙏❤️🔥🔥

  • @arpitparmar2121
    @arpitparmar2121 5 років тому +2

    Thanks for the beautiful explanation!

  • @aquibansari3941
    @aquibansari3941 4 роки тому

    can anyone please tell me which tool is he using to draw and sketch

  • @sanjayreddy2949
    @sanjayreddy2949 9 місяців тому

    I use python for dsa , do i get more time exceeded errors while running the code compared to cpp or java

  • @devmandal6426
    @devmandal6426 4 роки тому +3

    Globephone Mera Ek Number Ko Nahin Lagta Hai aur switch off bataya jata hai jabki aur mobile khula rahata hai Kisi dusre ke sath Baat chal raha Hota Hai usko Kaise band kiya jaaye Mere Naam Ka sim hai please answer me

  • @dimpleverma3436
    @dimpleverma3436 6 років тому +10

    Keep adding such videos, Prateek sir u explain so well!

    • @CodingBlocksIndia
      @CodingBlocksIndia  6 років тому +1

      Thank you Dimple for your feedback :D Glad you enojoyed it.

  • @hokage5619
    @hokage5619 6 років тому +2

    Great explanation. Thanks a lot.

  • @LuaneCarolineAquinoCavalcanti
    @LuaneCarolineAquinoCavalcanti 5 років тому +3

    very useful, thank you!

  • @mohit7717
    @mohit7717 3 роки тому

    Can you please tell me fast input output for python?

  • @sahilsaxena8374
    @sahilsaxena8374 3 роки тому

    Is fast I/o necessary for Java

  • @ajaymalik4653
    @ajaymalik4653 4 роки тому +5

    just would have mentioned that whatever the complexity you use, don't go beyond 5e8 - 1e9 operation

  • @jishnusen1470
    @jishnusen1470 Рік тому +1

    My question is, I've used the same algorithm in different programming languages, but Java tends to always have the TLE. I've been coding in Java since I learnt coding. How do I fix it?

    • @prithvirajput8531
      @prithvirajput8531 Рік тому +1

      Java zyada time leta hai compile n all mei.. codeforces mei i wrote a code in java and wrote the same code in c.. c took 30 ms while java took more than 300ms for the same code..

  • @eyerahulk
    @eyerahulk 4 роки тому +13

    I like the way you say 'and'....😂😂

  • @helloyou4233
    @helloyou4233 6 років тому +1

    thank you. keep making videos
    👌👌👌

  • @sayyedaaman5719
    @sayyedaaman5719 Рік тому

    it's very help video

  • @jashhinger442
    @jashhinger442 Рік тому

    Thanku so much sir 🚀🚀🚀🚀🚀🚀

  • @shri9229
    @shri9229 3 роки тому

    Thanks

  • @nishithakur424
    @nishithakur424 6 років тому +1

    good

  • @bigfan2258
    @bigfan2258 Рік тому

    What does he mean when he said c and c++ more closer to the hardware

  • @rakeshrajput537
    @rakeshrajput537 4 роки тому +3

    When i see the thumbnail of video i thing there we will do something with the processor but it is all about optimization.

  • @alokkumarpatro1395
    @alokkumarpatro1395 3 роки тому

    How to avoid run time error

  • @sriharshaananthoju8671
    @sriharshaananthoju8671 4 роки тому

    Use fast i/o at starting of main() i.e.
    ios_base::sync_with_stdio(0);
    cin.tie(0);

  • @chandrashekhar9470
    @chandrashekhar9470 4 роки тому

    Best Explanation.Thanks for the video

  • @adityapandey9639
    @adityapandey9639 3 роки тому +1

    It is guaranteed that the sum of n over all test cases does not exceed 105.
    What that the above means.. anyone????

  • @rajnishgiri6252
    @rajnishgiri6252 5 років тому +43

    What was the trick here. It was all optimization 💩

  • @humaneBicycle
    @humaneBicycle Рік тому

    I can here your cpu noice. excellent.

  • @ayushnautiyal9469
    @ayushnautiyal9469 3 роки тому

    What a operation means here

  • @urvishjoshi6640
    @urvishjoshi6640 5 років тому +1

    bhai solution bata turboC me, explanation nahi chahiye.. 1850+ lines ka compilation kaise karu

  • @soumyadipbasak6380
    @soumyadipbasak6380 5 років тому +2

    why cin and cout are slower than scanf and printf?

    • @harishvadaparty
      @harishvadaparty 5 років тому +9

      cuz in printf scan f u acually tell what type of data it is

    • @CodeCraftWithQubais
      @CodeCraftWithQubais 3 роки тому

      because that you are providing address of the data type which is really faster when comparing just only with data which in in cin and cout

  • @AV-yz2cf
    @AV-yz2cf 6 років тому +1

    thank you.

  • @ShubhamSharma1100
    @ShubhamSharma1100 5 років тому +3

    Please use a good quality microphone!!

  • @hiteshkhatri3809
    @hiteshkhatri3809 6 років тому +44

    Wasted 11:33 mins

    • @AV-yz2cf
      @AV-yz2cf 6 років тому +12

      coding m koi jaadu ni hota ki cheatsheet lgai or test cases pass hgae. He just gave you a way to move in a right direction.

    • @mehbubrashid6760
      @mehbubrashid6760 5 років тому +3

      Go and sell groceries

  • @udayptp
    @udayptp 4 роки тому

    How log(10^18)=60 ???????

    • @darshantawte7435
      @darshantawte7435 4 роки тому

      Log here is with base 2 so
      log(10^18)=18 log base 2(10) =59.something~60

    • @udayptp
      @udayptp 4 роки тому

      @@darshantawte7435 log10(base2) = 3.32___ and here log(10^18)base2= 18 * 3.32__~=59.__==60

  • @ashugarg3196
    @ashugarg3196 6 років тому

    mast tutorial tha bhai

  • @hishamalaa6001
    @hishamalaa6001 3 роки тому

    the quality of voice has to be better

  • @ghostkr3676
    @ghostkr3676 6 років тому

    awesome!!
    thanks

  • @jdchristo
    @jdchristo 5 років тому +3

    i didnt understand anything

  • @sriharsha8650
    @sriharsha8650 6 років тому +1

    Claps👏👏👏

  • @hat_awesome21
    @hat_awesome21 4 роки тому +1

    why your competitive programming course in hinglish i don't know hindi

  • @gduhfgsgdhgsudhg5595
    @gduhfgsgdhgsudhg5595 3 роки тому

    1:02c