No video

Bad Coders vs Good Coders vs Great Coders : A simple for loop problem can tell : The FizzBuzz Test

ATTENTION: THIS VIDEO WAS A SCAM / SOCIAL EXPERIMENT - Watch this video to know how easy it is to dupe people with half-baked educational content : • Arnav's Scam Exposed |...
Arnav Bhaiya shows how the simple fizzbuzz question can help differentiate between bad, good and great coders
#forloop #programming #learncoding #interviewquestions #coding #learntocode
------------------------ About Coding Blocks ---------------------------
Join our #TelegramCommunity at t.me/CodingBlocksIN to get updates on our latest workshops, talks, and announcements.
Get started with our Online Courses with a Free Trial: online.codingblocks.com/
Coding Blocks is India's best Programming and software training institute that offers courses like C++ and Java, Data Structures and Algorithms, Web and Android Development (Java and Kotlin), Competitive Programming, Coding Interview Preparation, Machine Learning, AI and get placed in your Dream Company! ♥️
#CodeYourWayToSuccess #Programming #Coding #Learning #LearnFromHome #COVID19
📌 We are on Social Media!
Facebook: / codingblocksindia
Instagram: / codingblocks
Twitter: / codingblocksin
LinkedIn: / codingblocksindia
GitHub: www.github.com/Coding-Blocks
👍 Support us by hitting the LIKE and the SUBSCRIBE button. You can share your thoughts, questions, doubts in the comment section and our mentors will help you out as soon as possible.
Share our KZread Channel: cb.lk/ytcb

Пікірлер: 475

  • @geeksentertainmentmedia4827
    @geeksentertainmentmedia48273 жыл бұрын

    And I thought you were going to sing “Kyuki tum hi ho” . :)

  • @sohomchowdhury192

    @sohomchowdhury192

    3 жыл бұрын

    The resemblance is uncanny.

  • @CayenneGT

    @CayenneGT

    3 жыл бұрын

    Lmao

  • @abhraneelart371

    @abhraneelart371

    3 жыл бұрын

    😂😂

  • @rupalisingh9632

    @rupalisingh9632

    3 жыл бұрын

    Vola😂

  • @sreeragmsudheesh

    @sreeragmsudheesh

    3 жыл бұрын

    @@sohomchowdhury192 Fact!

  • @sairamkandgule8957
    @sairamkandgule89573 жыл бұрын

    finally!! arijit has come out of depression and solving real world problems. thanks arijit. keep coding and singing.

  • @dysproghoul

    @dysproghoul

    3 жыл бұрын

    😂😂happy for him

  • @lalitkishork73

    @lalitkishork73

    2 жыл бұрын

    channa mereya se fizzbuzz code wala

  • @theaveragecoder6182
    @theaveragecoder61823 жыл бұрын

    Man , Arijit is so multi-talented

  • @yasinfaisal1998

    @yasinfaisal1998

    3 жыл бұрын

    Lol

  • @manaslovesbirds

    @manaslovesbirds

    3 жыл бұрын

    What an original joke. I'm sure nobody commented that before!

  • @kifkifa56
    @kifkifa563 жыл бұрын

    Great coder is one who write simple readable code even to understand when come back after months. Not the one where one have to make his code messy for little performace gain.

  • @teejee2008

    @teejee2008

    3 жыл бұрын

    Exactly. Great coders write simple code. Bad coders write "clever" code which they themselves won't understand after few months.

  • @amans6504

    @amans6504

    3 жыл бұрын

    Actually the solution he gave was way simpler and efficient than the modular one

  • @avibrarbrar

    @avibrarbrar

    3 жыл бұрын

    👏👏

  • @febin2217

    @febin2217

    3 жыл бұрын

    Great Coders actually bookmarks the stackoverflow page for future reference.. 😂

  • @DS-tt6jn

    @DS-tt6jn

    3 жыл бұрын

    @@amans6504 i disagree..think someone else is reading the code after 5 years...the modulo code will be self explanatory..and the counter code will take some effort to understand.

  • @shreyastaware
    @shreyastaware3 жыл бұрын

    I like the fact that the channel was not promoted at the end and time was not wasted doing that, because people do subscribe if they like the content.

  • @ArnavGupta

    @ArnavGupta

    3 жыл бұрын

    I have never done that in a single video of mine :)

  • @zingapotol

    @zingapotol

    3 жыл бұрын

    @@ArnavGupta bro u are working at Target right?

  • @marketcrorepati5729

    @marketcrorepati5729

    3 жыл бұрын

    Ye baby coder hai jisey lagta hai if kotlin main if change करके performance badhayega hahaha

  • @alitheia8684

    @alitheia8684

    3 жыл бұрын

    @@ArnavGupta can you tell me which language is this please

  • @CodingBlocksIndia

    @CodingBlocksIndia

    3 жыл бұрын

    Kotlin it is

  • @mr.l3260
    @mr.l32603 жыл бұрын

    The code you wrote portraying as the "Great Coder" is the one the worst coder will write. Other's will have difficulty understanding this code, with c3 and c5. Additionally, you are declaring an extra string in every iteration which consumes a lot of time.

  • @ManojKumar-jt8tj

    @ManojKumar-jt8tj

    3 жыл бұрын

    Yes exactly. There is no point of c3 and c5 when they are doing same thing as i

  • @ragavpillai2067

    @ragavpillai2067

    3 жыл бұрын

    Exactly that's what im thinking too.

  • @DS-tt6jn

    @DS-tt6jn

    3 жыл бұрын

    Exactly..thats the difference btw an experienced programmer and a college passout

  • @funkenjoyer

    @funkenjoyer

    3 жыл бұрын

    @@ManojKumar-jt8tj they are not doing the same thing tho, "i" is supposed to track the actual number while c3 and c5 are there to replace modulo operation with addition operation which is basically trading lower computing cost for higher data usage. And i'm not saying its strictly better or worse approach ,it depends on what you need from your code. Personally i'd much rather use a modulo way since its much cleaner

  • @subhashpujari

    @subhashpujari

    3 жыл бұрын

    Yes I agree with you. In current era computing at such a low level is not an issue where you go and optimize the for loop. Readability and maintainability of code is a more important part. You need to optimize the algorithms by using appropriate data structures.

  • @BlakeMerriam
    @BlakeMerriam3 жыл бұрын

    I'm learning coding and Hindi at the same time!!

  • @aadershchaubey1399

    @aadershchaubey1399

    3 жыл бұрын

    So instead of hello world you should print "Namaste Sansaar"

  • @GauravSharma-gc7mo

    @GauravSharma-gc7mo

    3 жыл бұрын

    @@aadershchaubey1399 😂

  • @therightpath88

    @therightpath88

    3 жыл бұрын

    @@aadershchaubey1399 not bad

  • @bidyasagarmohapatra4014

    @bidyasagarmohapatra4014

    3 жыл бұрын

    @@aadershchaubey1399 yaa correct 🤣

  • @VarunKumar-ro4ll

    @VarunKumar-ro4ll

    3 жыл бұрын

    Will help you a lot cause coding tutorials on youtube are filled with Indian dudes xD

  • @rahulmutreja
    @rahulmutreja3 жыл бұрын

    I personally have never heard of it earlier, thanks for bringing it in the public knowledge. 🙂

  • @CodingBlocksIndia

    @CodingBlocksIndia

    3 жыл бұрын

    Thank you Rahul! Please share the video for more people to know as well :)

  • @rahulmutreja

    @rahulmutreja

    3 жыл бұрын

    @@CodingBlocksIndia I shared it even before your reply.

  • @zombiekiller7101

    @zombiekiller7101

    3 жыл бұрын

    It was the easiest question I have ever seen. I am a beginner but it was really easy to solve.

  • @namaloompakistani1768

    @namaloompakistani1768

    3 жыл бұрын

    @@CodingBlocksIndia Dude you didn't mention how the 3rd approach is best one. You could have use diagram to in all 3 cases to tell difference

  • @subham-raj
    @subham-raj2 жыл бұрын

    You should research before taking big :) 1. Concatenating strings has much more space and time, if it is not implemented using a char array internally. 2. Comparing strings is also exhausting. 3. Modulo operation is not n^2, this depends on implementation too.

  • @Usurperhk
    @Usurperhk3 жыл бұрын

    Generally speaking this C3 C5 code is written by those coders who don't know that modulo operator and division operator also exist.

  • @vsiddharth365

    @vsiddharth365

    2 жыл бұрын

    😂😂😂😂

  • @aabhishek4911
    @aabhishek49113 жыл бұрын

    If you write production code like this in my app i will reject the PR

  • @williamdowling7718

    @williamdowling7718

    3 жыл бұрын

    There were a few examples given. Which one are you talking about specifically? The "best" one at the end? I'm curious about why exactly you'd flatly reject it? What if this wasnt a fizzbuzz problem, but instead it was something that had to iterate over 100k+ entries? You'd readily give up any efficiency gains just so the code looks more like what you're used to? Not trying to fight.. I just genuinely want to understand. I've been writing code for about 6 years now, but I've always been a solo dev. I don't have anyone to impress but myself, so I know all too well the trap of "this way is familiar so it will be easier to look at later" while simultaneously giving up huge efficiency gains (fortunately for me, the numbers I have to work with are miniscule, so even big efficiency drops are not noticeable).

  • @DerTaran

    @DerTaran

    3 жыл бұрын

    @@williamdowling7718 What happens, if the words changes to "Buzz", "Feed", and "William"? Or the test numbers to 3, 4, and 5? In this sample performanc hurts reuseability. Also the more complex a solution gets, the more error-prone it becomes. And these are not all of my complains.

  • @akshaymetkari
    @akshaymetkari3 жыл бұрын

    The title of the video should be optimizing solution of FizzBuzz problem rather than Bad coder Vs Good Coders Vs Great Coder.

  • @MdSheraj

    @MdSheraj

    3 жыл бұрын

    Exactly. It is not clear what the last way does.

  • @unibrow9384

    @unibrow9384

    3 жыл бұрын

    @@MdSheraj Sorry if I'm being harsh, but if you are not able to clearly understand the last method, you've probably got your answer to the title.

  • @suyash7694

    @suyash7694

    3 жыл бұрын

    @@unibrow9384 😂😂😂😂

  • @rishabmudliar1058

    @rishabmudliar1058

    3 жыл бұрын

    @@unibrow9384 Sorry for barging but I did understand the last one but some people might not as it is not that easy to just understand someone else's code(logic maybe easy ig to understand). When I tried solving an issue in a codebase it took me almost a week to understand what was happening to even fix an issue and that was when the code had meaningful names and comments. So it's not anyone's fault if they can't understand someone's code.

  • @samarth638

    @samarth638

    3 жыл бұрын

    @@unibrow9384 the last solution doesn't work when the numbers are distributed randomly. so it may be the most efficient solution for this particular problem, but it's not generic... so this judging criteria doesn't look like a very good one lol

  • @yogeshkumar-yg3kx
    @yogeshkumar-yg3kx3 жыл бұрын

    I don't think it's a good criteria to judge someone a bad, good or great coder, there are many other ways available to judge.

  • @AmitKumar-je7rn

    @AmitKumar-je7rn

    3 жыл бұрын

    Like what?

  • @Artaxerxes.

    @Artaxerxes.

    3 жыл бұрын

    Yeah. You'd know better right 👍 xD

  • @piyushmehra8950

    @piyushmehra8950

    3 жыл бұрын

    Right

  • @yogionutube

    @yogionutube

    3 жыл бұрын

    our names is not only same, our thinking is somewhat same !😅 on this

  • @amitbisht5803

    @amitbisht5803

    3 жыл бұрын

    @@AmitKumar-je7rn well if the interviewer specifies tht they have to reduce its complexity, then it's understandable tht sol3 is the correct answer. Otherwise sol1's readability is the highest and takes you seconds to understand. When you have a really big programm then you would not want to waste your time reading the whole code. Hence this method is definitely not accurate to judge anybody.

  • @z1lla4
    @z1lla43 жыл бұрын

    Quarterway through the video I realized that I didn't understand a single word.

  • @agfd5659

    @agfd5659

    3 жыл бұрын

    It felt like I was having a stroke, honestly

  • @alexismandelias
    @alexismandelias3 жыл бұрын

    The last one is less readable, less extendable and less maintainable. No "great" coder would write this.

  • @cezin8554

    @cezin8554

    3 жыл бұрын

    It's readability is less but fine . Any good coder can write this. When I didn't knew modulo operator very well then I had done this problem by this method😂

  • @amankumarsingh2692
    @amankumarsingh26923 жыл бұрын

    so I got it, I'm not great coder😂😂

  • @priyeshagarwal2644
    @priyeshagarwal2644 Жыл бұрын

    If you want to optimize the modulo operator, you should directly code in assembly language.

  • @sumitvelaskar
    @sumitvelaskar3 жыл бұрын

    I tried running both approaches on my machine, the regular modulo approach averaged at about 0.750 seconds and the supposed to be efficient approach averaged at 0.835 seconds.

  • @protonx80

    @protonx80

    3 жыл бұрын

    because of the expensive string addition

  • @tejas8211
    @tejas82113 жыл бұрын

    Man!!! I didn't know Arijit Singh has so many talents❤️❤️❤️

  • @angadkumar4183

    @angadkumar4183

    3 жыл бұрын

    Ahahahahaha

  • @bhoot1702

    @bhoot1702

    3 жыл бұрын

    When will New season come for Monster 😂

  • @hello.667

    @hello.667

    Жыл бұрын

    multi talented hai bhai wo

  • @tinofourie7963
    @tinofourie79632 жыл бұрын

    It would have been nice to see memory usage and execution time for each of the FizzBuzz approaches. For quick scan readability, approach 1 is the easiest, whereas approach 3 you need to slow your reading a little.

  • @bdunky
    @bdunky3 жыл бұрын

    At 3:40 "the complexity of doing (i % 15 == 0) is pretty much the same as (i % 5 == 0) && (i % 3 == 0)" is a plain stupidly WRONG statement.

  • @dysproghoul

    @dysproghoul

    3 жыл бұрын

    Would you please elaborate how?

  • @vaibhavpratihar3552
    @vaibhavpratihar35523 жыл бұрын

    What about the complexity of appending strings "Fizz" and "buzz"

  • @Mnkmnkmnk

    @Mnkmnkmnk

    3 жыл бұрын

    It is constant O(1).

  • @vaibhavpratihar3552

    @vaibhavpratihar3552

    3 жыл бұрын

    @@Mnkmnkmnk I don't think so but I might be wrong. Adding two string is computation heavy just like modulo operations. There are utility classes such as String Builder which will heavily optimize your code. People who do CP in Java heavily use this when dealing with strings.

  • @Mnkmnkmnk

    @Mnkmnkmnk

    3 жыл бұрын

    @@vaibhavpratihar3552 It may be computationally expensive, but it is still constant time. It is because, the strings "fizz" and "buzz" are constant. The time taken to append them together doesn't depend on outside input. The append operation will always take the same time, thus constant time O(1).

  • @T___Brown

    @T___Brown

    3 жыл бұрын

    @@Mnkmnkmnk Its not that it is computationally expensive its that the strings are immutable at least in my language they are. I am not sure about all languages. So when you concatenate 2 strings together you are creating a new memory block and copying the two values to that new variable/pointer. If you have a garbage collection language then it has to clean up all the concatenated strings. Maybe best to have a byte and OR the values together. 1 = fizz 2 = buzz and 3 = fizzbuzz just shorthanding here. byte x= 0; if(c3 ...) x|=1 if(c5..) x|=2 if(x==1) print (fizz) if(x==2) print (buzz) if(x==3) print (fizzbuzz) this way you are not concatenating and you have 3 constants.

  • @asdf12341355

    @asdf12341355

    3 жыл бұрын

    @@Mnkmnkmnk Even if it is O(1), that does not mean it costs the compiler time. This is why time complexity needs to be understood correctly. I can create a loop of 10000, but it's still O(1) because it's not variable. O(1) is not always better of O(n) if your computation in O(1) is very expensive. Appending strings is always a costly operation for mostly all languages.

  • @rahulbalan
    @rahulbalan3 жыл бұрын

    "Ye famous question bohot jyada famous hai... " - Arnav, 2021

  • @avishekkumarsharma3594
    @avishekkumarsharma35943 жыл бұрын

    I didn't knew modulo has O(n2) complexity, but when you said so....I was able to do the third solution 😎

  • @earth2k66
    @earth2k663 жыл бұрын

    They laughed saying my code was slow, so I started to use 2^n dimensions only. Now, they are crying.

  • @heatengine9283

    @heatengine9283

    3 жыл бұрын

    Make them bleed by taking it up to n!

  • @khatdubell
    @khatdubell3 жыл бұрын

    Trying to improve or "optimize" fizz buzz is the definition of a bad coder in my book.

  • @williamdowling7718

    @williamdowling7718

    3 жыл бұрын

    The point isn't whether you can or cannot optimize fizzbuzz. It's about whether you're thinking about efficiency when you write code. Do you think it's better to write some code inefficiently on the sole basis that lots of people are more familiar with it in its un-optimized form? Even if the task is to write fizzbuzz for 1..100, shouldn't some thought go into "OK, what if this needs to process 1..100,000,000 next time?" I feel like saying no to that question is to imply that when you write some code, you know exactly how it will be used in perpetuity. And I'm not sure anyone has ever known that for sure about literally any block of code..

  • @khatdubell

    @khatdubell

    3 жыл бұрын

    @@williamdowling7718 "Do you think it's better to write some code inefficiently on the sole basis that lots of people are more familiar with it in its un-optimized form?" YES! To quote martin fowler. Any fool can write code that a computer can understand. Good programmers write code that humans can understand. Martin Fowler, 2008 "Even if the task is to write fizzbuzz for 1..100, shouldn't some thought go into "OK, what if this needs to process 1..100,000,000 next time?"" No. Y.A.G.N.I. The first pass it doesn't matter. If you have to touch the code again, then you refactor it so more flexible. Or to rephrase it a different way, what is the ROI on implementing the most generic, flexible, ultimate solution to a problem that tries to solve every single possible future need? Only it never needed to be touched again. And none of those wizbang feaures were needed? My entire codebase is literally filled with people who thought this way. Everything is overengineered. Everything is overly generic. Everything is overly flexible. I understand where they were coming from, but when you have an inheritance tree 10 levels deep and its a single class using it at each level for the past 30 years, you've gone too far.

  • @williamdowling7718

    @williamdowling7718

    3 жыл бұрын

    @@khatdubell I see your point, and you made several good ones.. But I still have one issue with all of that. You're suggesting that we dumb down the code at the expense of usability and efficiency because, presumably, you think that programmers are as smart as they'll ever be and that programmers will never understand efficient code. How about instead of continuing to write shit code on the basis that we've always wrote shit code and people are too dumb to read good code, how about we change the way we teach programming (including how to add useful comments so that nobody needs to understand the logic of your code directly.. You can lay out exactly what's going on, and if someone still doesn't know what it means, they're likely in the wrong business)? To be sure, I'm not arguing that it doesn't matter whether code is readable or not. But I am arguing that if you think the code displayed in this video was so unreadable that the developer who wrote it is automatically a bad coder, then you might be in over your head as a programmer.. There was really nothing complex going on there.. No confusing syntax or trying to squeeze a full block of code onto one line with nested ternaries or something.. All he did was trade modulus arithmetic for addition and minimize the number of conditionals used. Surely there's a way to write fizzbuzz that is even more verbose and explicit, leading to improved readability. At what point does efficiency eclipse readability in your importance heirarchy? If you rewrote fizzbuzz in a way that made it even more readable and clear, but you lost 25% in efficiency? How about a switch statement with a case for every single number between 1 and 100 indicating what to print. By your above logic, this is preferable to anythijg with a for loop because it's more readable. You could take one look at it and know exactly what would be output for any given value. Does that make an explicit switch statement better than a looped solution? I think not.

  • @khatdubell

    @khatdubell

    3 жыл бұрын

    @@williamdowling7718 I think you're taking "readable" the wrong way. The example you provided would be less readable by my standards. If we follow that logic it would suggest that a 1000 line function is more readable than a 10 line function. Patently Absurd. What makes a block of code more readable is not dumbing it down, or being exceedingly verbose, it about how long it takes you to figure out what the code is doing. The quicker you can understand a code's function, the more readable it is. If someone were to run across the "ultimate coder" version presented in this video vs the first, "newb" version . _Every single person will take longer to realize what the final version is doing, vs the first one._ I stand by that. And to be clear, i'm not saying the code is difficult to comprehend. Its not. It doesn't mean the code is complicated, just _less_ understandable. _Less_ readable. If you can't figure it out at all, i agree with you, they probably need to seek a new profession. If someone did submit any of those 3 versions of the code to my repo, i wouldn't reject any of them. All 3 do exactly what they are supposed to do, which is ultimately the goal. I would raise issues on the PR as i see them and suggested we discuss it as a group

  • @williamdowling7718

    @williamdowling7718

    3 жыл бұрын

    @@khatdubell I guess it boils down to a completely subjective definition of what is readable. IMO, you just have some way of writing code that makes sense to you. And that has been reinforced by years of repetition, both writing and reading that style of code. As such, this would be the most readable code you could imagine.. Because if it weren't, you'd be changing it over the years to make it more readable until it settled into that spot. So when you see code that doesn't look like your code, it is by definition, less readable. And as you mentioned, if you were reviewing the PR and it was a bit unclear to you what was going on, or it just took longer to understand, then there should be a conversation about adding a couple comments to add clarity. We have the gift of being able to explain the code in English without sacrificing anything in the code. So why would we change the code to better match our english, instead of using English to comment the code?

  • @bapi6060
    @bapi60603 жыл бұрын

    Where do i read upon as to how the computer performs modulo operations? Thanks.

  • @abhisheksinghal1746
    @abhisheksinghal17463 жыл бұрын

    Yes I have also faced this question in one of the interview's and written 1 solution the easiest one which comes to mind at that time 😁 3rd approach is awsome without modulo . 👍

  • @ghanshyamjoshi587
    @ghanshyamjoshi5873 жыл бұрын

    plain stupid criteria to judge ...this is something called juvinelle optimization

  • @samarth638

    @samarth638

    3 жыл бұрын

    this happens when you have been doing competitive coding so much.... sitting in the office when you have to deliver, the "great coder" approach would be the last to come to mind lol

  • @het314

    @het314

    3 жыл бұрын

    +1, Can't agree more...

  • @rahulapte2433
    @rahulapte24333 жыл бұрын

    I subscribed for two reasons, one obviously for the content and second for the fact that time was not wasted in begging for likes and subs. Thanks bro, you rock!!

  • @harshhwardhanrai3716
    @harshhwardhanrai37163 жыл бұрын

    Ok so i was worst coder because i did the same mistake in 3 placement exams but never realized, that it was wrong

  • @brdrnda3805

    @brdrnda3805

    3 жыл бұрын

    I work now for more then 20 years in IT. Always with old applications, it was always important to read and understand old code. Clever solutions like version three are almost always a pain and more often than not worth the loss in readability. I would never hire someone who presents this version (at least not without explaining comments and poor variable naming)

  • @tracetv8115
    @tracetv81153 жыл бұрын

    With the second solution I agree, it's much better than the first, but the last one? It's ugly to read, but it's my opinion.

  • @RajdeepSingh-tv5pn
    @RajdeepSingh-tv5pn3 жыл бұрын

    in the last code why c3=0 and not c3=1 because we need to print fizz at every 3 difference but setting c3=0 would mean 0,1,2 after 3 values has passed then it will check but we need to check at the 3rd value.Pls anyone explain last approach

  • @damercy
    @damercy3 жыл бұрын

    Love Arnav bhaiya's no bullshit, to the point attitude. And coding block's video streak is 🔥

  • @CodingBlocksIndia

    @CodingBlocksIndia

    3 жыл бұрын

    Thank you Dayamoy!

  • @asdf12341355
    @asdf123413553 жыл бұрын

    Can you share where you got the concept of 'modulus by 15 = modulus by 5 and modulus by 3' ? Seems pretty counterintuitive, from what I know or could find, it seems that to calculate modulus, the operands are reversed, so A % B = A - B*(A / B). This in no way translates to your statement

  • @manshalkhatri9289
    @manshalkhatri92892 жыл бұрын

    Great video ! Btw why are you using semicolon after c3++ and c5++ statements in kotlin 😅

  • @rittwikchatterjee5347
    @rittwikchatterjee53473 жыл бұрын

    Interesting man! I have been a python programmer for few years and I'm hearing it for the first time!

  • @bhalchandramekewar6015
    @bhalchandramekewar60153 жыл бұрын

    Hi Arnab, Have you tried to run program with Integer. Max and check the time with all three approach what you mentioned 1=> (3,5,15 mod) 2=> (3,5, mod) 3=> (c3,c5 count) I tried out of curiosity (in Java for Integer. Max loop). Got surprised. Non mod approach taking hell lot of time to execute.

  • @bhalchandramekewar6015

    @bhalchandramekewar6015

    3 жыл бұрын

    Check the following timing: 1: now:2021-02-16T04:59:11.673128500Z now:2021-02-16T04:59:11.716584800Z 2: now:2021-02-16T04:59:11.717562700Z now:2021-02-16T04:59:49.541623300Z 3: now:2021-02-16T04:59:49.542597800Z Terminate batch job (Y/N)? y PS C:\Users\..\Desktop\demo\demo> date Tuesday, February 16, 2021 10:31:30 AM

  • @Jerry-fy2gc
    @Jerry-fy2gc3 жыл бұрын

    Wav you are treating mod too much costly but you are using += operation of a string and comparison too. I can't get it. Don't make issues that's string of constant size.

  • @chiragkataria4161
    @chiragkataria41613 жыл бұрын

    great way to judge coding skills..."the knowledge of modulus operator" :P

  • @rakeshnarang8545
    @rakeshnarang85453 жыл бұрын

    Will you reject someone if he uses the first solution? with if-else and two modulos?

  • @samarth638

    @samarth638

    3 жыл бұрын

    considering his judging criteria, I think he would....

  • @KartikSinghal4u98
    @KartikSinghal4u983 жыл бұрын

    Please make more videos like this. Not so tough but interesting question.

  • @keshav1598
    @keshav15983 жыл бұрын

    This guy is probably the only one I've seen making relevant content everytime he makes a video. Thanks for the video , keep making more of these...just love them

  • @vineetmidha
    @vineetmidha3 жыл бұрын

    Excellent information. Never heard about that. But, do you really mean that the writer of first code is really a BAD coder?

  • @tejaskaluva1510
    @tejaskaluva15103 жыл бұрын

    this is was very informatic, thank u. Pls keep making the videos.

  • @faizanmajgaonkar6225
    @faizanmajgaonkar62253 жыл бұрын

    I think the third approach can be improved if we use three if and else if statements... In first we can check if c3+c5 == 8....print fizzbuzz if true and make c3=c5=0 The second and third for 3 and 5 respectively...print accordingly and reinitialize respective counter... . In this way the concatenation of string is not required. Also one variable space can be saved.(d) If u read this let me know ur opinion. Thankyou.

  • @nagagaming176
    @nagagaming1763 жыл бұрын

    Cannot be done this way in C . We need for printing in next line buzz and fizz buzz can be managed by doing \ n while printing at the end of buzz but after fizz the number will be printed

  • @satyamgupta756
    @satyamgupta7563 жыл бұрын

    Whatif we copy the result till 15, put it in an array and print / repeat it. a = [1, 2, fizz, 4, buzz, fizz, 7, 8, fizz, buzz, 11, fizz, 13, 14, fizzbuzz] counter = 0 till = 1000 while till != 0: till -- if counter == 15: counter = 0 println a[counter] counter++ // This is just an algo not specific to a language.

  • @nimlanguage2707
    @nimlanguage27073 жыл бұрын

    Bad coder write for self, good coder write for team members, great coder write for everyone else. Performance is important but not at the cost of Readability & Maintainability.

  • @protonx80

    @protonx80

    3 жыл бұрын

    therefore .... bad coder ... performs the best to his abilities good coder ... underperforms ... to the worst of his team's abilities

  • @Wriiikk
    @Wriiikk3 жыл бұрын

    9:15 samsung right ?? i have same ringtone . I thought my phone is ringing 😂

  • @siddharthkulkarni3709
    @siddharthkulkarni37093 жыл бұрын

    Learnt something new! Although I would disagree that this is a good metric for judging coding skills for the simple reason that usually while learning programming it is inculcated that all these operations are fundamental and essentially equal cost.

  • @sastavideoswala
    @sastavideoswala3 жыл бұрын

    So mordern peocessors do not have dedicated hardware for modulo operations?

  • @krishnarao4290
    @krishnarao42903 жыл бұрын

    I know this is really stupid, but what's that ringtone or song at 9:12 ?? I have heard it soo many times in public and my curiosity is killing me to find what it is.

  • @mantejsingh5438

    @mantejsingh5438

    3 жыл бұрын

    That is the new ringtone in samsung galaxy M series

  • @krishnarao4290

    @krishnarao4290

    3 жыл бұрын

    @@mantejsingh5438 Thank you, but do you know the exact name of the tune ? I'm still unable to find it.

  • @unibrow9384
    @unibrow93843 жыл бұрын

    Wow, this was very entertaining to watch. Thanks.

  • @AmanSingh-yk2yh
    @AmanSingh-yk2yh3 жыл бұрын

    Why is Arijit Singh Teaching coding? Nice Explanation BTW.

  • @Dawnsunflower156

    @Dawnsunflower156

    3 жыл бұрын

    Side business

  • @aviralsood8141

    @aviralsood8141

    3 жыл бұрын

    @@Dawnsunflower156 Lockdown mein concert khatam ho gaye lol

  • @nandansharma6844

    @nandansharma6844

    3 жыл бұрын

    Subah subah maal phukne ka result

  • @CodeWithVinay
    @CodeWithVinay3 жыл бұрын

    Isn't using == on a string expensive than % operator?

  • @priyeshagarwal2644
    @priyeshagarwal26442 жыл бұрын

    If you build a real software, the performance gain by performing such micro optimizations can usually be neglected. So the code must be maintainable and easy to read. More emphasis is given to structuring the code properly using design patterns, and proper use of OOP concepts rather than doing such micro optimizations.

  • @mayank_m_jain_1160
    @mayank_m_jain_11602 жыл бұрын

    Thanks for such a useful content. As a learner will keep this in mind.

  • @sumitvaswani4834
    @sumitvaswani48343 жыл бұрын

    Got to know something interesting !!! Thanks man !

  • @_chaurasiya_rajnish
    @_chaurasiya_rajnish3 жыл бұрын

    sir .....,how to install Jarvis in android.....? plz reply sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @RakeshKumar-bq3mf
    @RakeshKumar-bq3mf3 жыл бұрын

    awesome and great solution. I appreciate for the right approach... Thanks a lot sir ji.........:-)

  • @Anushkathegreat
    @Anushkathegreat3 жыл бұрын

    Which language is this ??

  • @anirudhsharma3879
    @anirudhsharma38793 жыл бұрын

    What is the name of this singer?

  • @ranahamzakhursheed3955
    @ranahamzakhursheed39553 жыл бұрын

    And believe me everybody will solve this problem in first way in real world project because it doesn't affect performance anymore with the powerful frameworks and languages.

  • @amans6504
    @amans65043 жыл бұрын

    I'm falling in love with your explanations!

  • @angadkumar4183
    @angadkumar41833 жыл бұрын

    Respectfully, if u wanted to do so much performance gain modulus would not be the first thing I would remove. I would have only one println statement. And there is a better way to approach this. The pattern repeat itself after 15. And it is radix 10 based numeric system. So the complete pattern repeats itself after 30. What I am doing now is writing a vague algo. You can fix the details later on your own. For specific cases where N is not divisible 30, you can have switch case that repeats the string s1, s2 and s3 based on case. //N is divisible by 30 for this example. MyApproach (int N) { // %x is a variable in string that would be replaced before printing. // something like this exist in kotlin also. String s1 = "%x1 %x2 FIZZ%x4 BUZZ FIZZ%x7 %x8 %x9 " String s2 = "BUZZ %x1 FIZZ %x3 %x4 FIZZBUZZ%x6 %x7 FIZZ %x9 " String s3 = "BUZZ FIZZ %x2 %x3 FIZZ BUZZ %x6 FIZZ %x8 %x9 FIZZBUZZ" StringBuilder strbldr; For (int i = 0 to (N/30) - 1) { int r = i*3 strbldr.append (s1(r)); strbldr.append (s1(r+1)); strbldr.append (s1(r+2)); /* For example S1 now becomes 1 2 FUZZ 4 BIZZ FUZZ 7 8 FUZZ */ } println (strbldr.toString()); } This solution would be noticably faster than most of your solution by constant degree of 30. And yes u can say I have used more space constraint etc. But at this level none of solution are actually making any impact in asmptotic cost. It's still Big O(N) cost function. Cheers

  • @sahibpreetsingh3065
    @sahibpreetsingh30653 жыл бұрын

    Thanks a ton arnav bhaiya. I never had an idea about this % complexity

  • @adityakurdunkar2831
    @adityakurdunkar2831 Жыл бұрын

    Honestly, and I could be wrong here, while writing code at least for the first time shouldn't the focus be on being correct rather than how could I make a great one liner? and also isn't this why we refactor our code?

  • @neingtyyyy
    @neingtyyyy3 жыл бұрын

    KZread bhai .. Interview se pehle recommendation dena chahiye tha na 😂😂😂😂

  • @Aryan-fd9yv
    @Aryan-fd9yv3 жыл бұрын

    Instead of assigning d as blank and then checking if its still blank why dont we just assign it to the number and replace it later like this (btw im writting in python since thats the one im familiar with the most) : c3 = 0 c5 = 0 for x in range(1, 100): d = x if c3 == 3: d += 'Fizz' if c5 == 5: d += 'buzz' print(d) c3 += 1 c5 += 1 this way we dont run a check and just print whatever the value assigned is, and if nothing is assigned just print the number which will be d in either case

  • @anuragdhadse1426

    @anuragdhadse1426

    3 жыл бұрын

    Then It will the number also, Like this -> "3Fizz" "5buzz". and by the way, you forgot to reset c3, c5 if either of the condition is met.

  • @Aryan-fd9yv

    @Aryan-fd9yv

    3 жыл бұрын

    @@anuragdhadse1426 Yeah srry abt the ressetting part but what we could do is insteaad of putting += we could put just an = sign

  • @anuragdhadse1426

    @anuragdhadse1426

    3 жыл бұрын

    @@Aryan-fd9yv But then for numbers like 15, which are divisible by both 3 and 5, only 'buzz' will be printed INSTEAD of 'Fizzbuzz', First, c3 will be triggered [15 - 12(last multiple before 15 of 3) = 3] setting d='Fizz'. Then c5 will be triggered [15 - 10(last multiple before 15 of 5) =5] Setting d='buzz; Discarding 'Fizz'. I hope you get it. Anyway, there are other ways programmers should be classified as good or bad, like knowledge of DBMS, cloud service ,and version history.

  • @neuron8186
    @neuron81863 жыл бұрын

    I'm stuck at 1600 rating what to do ?

  • @anugrahnayar3070
    @anugrahnayar30703 жыл бұрын

    The last example is a classic example of a bad code. Write normal readable code. In most cases, optimization is the last step if there are bottlenecks. If somebody writes this code in an interview I would reject them outright if they have written code > 2 years. You write code for other people not for machines to feel orgasm on performance optimizations. If former was the case then write in asm.

  • @Nebz77
    @Nebz773 жыл бұрын

    In complex code that is becoming more and more multi-modular these days, I think it’s counterproductive to specifically select for someone who would overcomplicate a simple problem like this print statement with a few if/elseif conditions ...

  • @saranshmehra1538
    @saranshmehra15383 жыл бұрын

    Thanks cb for this video. But i wonder why cb always chooses arnav sir for making those funny faces in the thumbnail??😂😂

  • @aminurrahmanashik2786
    @aminurrahmanashik27863 жыл бұрын

    Really thanks for sharing!

  • @waterbender20071
    @waterbender200713 жыл бұрын

    All said and done it is a different story in real life projects , you have to be simple and clean instead of saving ounces of performance . Hence using modulo does not make you a bad coder. And the beauty of software is nothing is set in concrete , you can easily refactor code. So if you are using this scale only to label someone a good coder or bad coder, it is not justified.

  • @ankitshaw2011
    @ankitshaw20113 жыл бұрын

    A short , crisp and important video..👍

  • @ddhruvarora
    @ddhruvarora3 жыл бұрын

    Short but very knowledgeable video Thank you sir for making such videos 😀

  • @anshulgandhi1707
    @anshulgandhi17073 жыл бұрын

    I think this is not a correct implementation as well. I am not sure about the modulo operation having O(n)**2 but instantiating an empty string and then concatenation got us a o(n) operation as strings are immutable in most programming languages except c++. Your algorithm in itself is O(n)**2 and honestly this solution will not even pass all test cases on most platforms and you may get a segmentation or TLE

  • @saxena3718
    @saxena37183 жыл бұрын

    can i have the last solution in java?

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd3 жыл бұрын

    Has he been full time in Scalar NOW??? Arijit pls answer!!

  • @BruceArmstrong09121997
    @BruceArmstrong091219973 жыл бұрын

    actually i was doing it by increasing counts on my conditions on my problems, without having the understanding of complexity stuff well i was doing in a good way all along

  • @chatenilesh
    @chatenilesh3 жыл бұрын

    I had have been asking this question for years :)

  • @harshinredzone
    @harshinredzone3 жыл бұрын

    When I saw thumbnail, I thought it to be stand-up comedy. Anyway, great learning. 😄

  • @saxena3718
    @saxena37183 жыл бұрын

    can anyone explain me the last solution?

  • @BCS_VickyGupta
    @BCS_VickyGupta3 жыл бұрын

    We can do it with devision also.. (i/3)*3==i

  • @eroskuikel9688
    @eroskuikel96883 жыл бұрын

    Why did you put more if statements there then? Use else if for better solution

  • @brdrnda3805

    @brdrnda3805

    3 жыл бұрын

    He used else if in the first version, but not in the others, where it would give wrong results. Seems you are proving that version two and three are less readable / understandable.

  • @AmanVishnani
    @AmanVishnani3 жыл бұрын

    The last solution would miserably fail in real world scenarios since the assumption made in the underlying solution here is that the numbers would be in sequential order and not randomly distributed.

  • @angadkumar4183

    @angadkumar4183

    3 жыл бұрын

    Huh??? If numbers are printed randomly then u can't have for loop.

  • @rohanoopsi

    @rohanoopsi

    3 жыл бұрын

    @@angadkumar4183 Are you sure?

  • @angadkumar4183

    @angadkumar4183

    3 жыл бұрын

    @@rohanoopsi yes, first his statement does not make sense that numbers are randomly distributed. This statement needs Clarification. Second if there is no sequence... Of any sort i.e. U r choosing numbers randomly then there won't be a finite for loop.

  • @angadkumar4183

    @angadkumar4183

    3 жыл бұрын

    And u should check my solution.

  • @rohanoopsi

    @rohanoopsi

    3 жыл бұрын

    @@angadkumar4183 how about iterating an array with random values? Example - [ 7,9,77,11...] and these values will be fetched via DB

  • @manan6166
    @manan61663 жыл бұрын

    still its a bit complex i can write this logic in Swift 5.3 more easy with just if ...else condition in loop no need to take other variables

  • @swordrohit07
    @swordrohit073 жыл бұрын

    Bhai modulus operator ki complexity is n2 ...are u sure?????

  • @amirjafari8314
    @amirjafari83143 жыл бұрын

    Great video 👍👍 learn something new today

  • @ifrazshoaib
    @ifrazshoaib3 жыл бұрын

    I'm not a coder but didn't he use 2 extra variables in the last try. So he's basically trading memory for better performance.

  • @samarth638

    @samarth638

    3 жыл бұрын

    the last solution would anyway fail if the numbers were not sequential......

  • @ujjwalsingh1222
    @ujjwalsingh12222 жыл бұрын

    heyy bro the time complexity of both the solutions are same

  • @alangeorge1090
    @alangeorge10903 жыл бұрын

    Very insightful

  • @manishsharma2211
    @manishsharma22113 жыл бұрын

    Tom scott ka video se dekhe ho sir ?

  • @ankitsahoo8665
    @ankitsahoo86652 жыл бұрын

    // This is also a optimised approch class HelloWorld { public static void main(String[] args) { int tre = 3; int fiv = 5; for (int i = 0; i if (i == tre && i == fiv) { System.out.println("fizzbuzz"); tre += 3; fiv += 5; } else if (i == tre) { System.out.println("fizz"); tre += 3; } else if (i == fiv) { System.out.println("buzz"); fiv += 5; } else System.out.println(i); } } }

  • @ayushprajapati9251
    @ayushprajapati92513 жыл бұрын

    It was a great experience learning to code from Arijit Singh..

  • @hello.667

    @hello.667

    Жыл бұрын

    😂😂

  • @sandeepmukherjee739
    @sandeepmukherjee7393 жыл бұрын

    just awesome

  • @cipherxen2
    @cipherxen23 жыл бұрын

    I'm not convinced that the last one is best code. It's not flexible enough to handle requirement changes viz. for modulo 15 we need completely different output, also string append is a costly operation than modulo. %15 %5 %3 with println is most elegant and flexible solution. Modulo is not that slow.

  • @yourbestie4138
    @yourbestie41383 жыл бұрын

    c++ implementation is given below #include using namespace std; int main(){ int c3 = 0,c5 = 0; for(int i=1;i