West LA Coding reposted this
How to use Big O to ace your technical interviews: Firstly, what is Big O Notation? Big O describes an algorithm's runtime or memory consumption without the interference of contextual variables like RAM and CPU. It gives programmers a way to compare algorithms and identify the most efficient solution. 𝗕𝗶𝗴 𝗢 𝗮𝗻𝘀𝘄𝗲𝗿𝘀 𝗼𝗻𝗲 𝘀𝘁𝗿𝗮𝗶𝗴𝗵𝘁𝗳𝗼𝗿𝘄𝗮𝗿𝗱 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻: "How much does runtime or memory consumption grow as the size of the input increases, in the worst-case scenario?". 𝗧𝗼 𝘂𝘁𝗶𝗹𝗶𝘇𝗲 𝗕𝗶𝗴 𝗢, you'll need to know the possible values and how they compare with each other. Use the attached photo for a quick reference. 𝗦𝗼, 𝗵𝗼𝘄 𝗱𝗼 𝘆𝗼𝘂 𝗮𝗽𝗽𝗹𝘆 𝗕𝗶𝗴 𝗢 𝗶𝗻 𝘆𝗼𝘂𝗿 𝘁𝗲𝗰𝗵𝗻𝗶𝗰𝗮𝗹 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝘀? Here are a few scenarios where Big O can be used: 🔸 Live coding challenges 🔸 Code walk-throughs 🔸 Discussions about projects/solutions you've built 🔸 Discussions about your approach to programming & problem-solving When any of these scenarios come up, be sure to mention the Big O of your solution and how it compares to alternative approaches. This is especially useful in live coding challenges where you have to compare solutions on the spot — remember to think out loud! 𝗧𝗶𝗽: 𝗪𝗵𝗲𝗻 𝗰𝗼𝗺𝗽𝗮𝗿𝗶𝗻𝗴 𝘀𝗼𝗹𝘂𝘁𝗶𝗼𝗻𝘀, 𝗽𝗮𝘆 𝗮𝘁𝘁𝗲𝗻𝘁𝗶𝗼𝗻 𝘁𝗼 𝘁𝗵𝗲 𝗽𝗿𝗼𝗯𝗹𝗲𝗺'𝘀 𝗿𝗲𝗾𝘂𝗶𝗿𝗲𝗺𝗲𝗻𝘁𝘀. For example, linear time complexity may be completely fine when the input can never be too large. But if you’re dealing with big data, you’ll want to opt for something more efficient. Of course, the goal is to get the correct Big O notation that applies to your solution. But don't worry about getting it wrong! Your interviewer will probably correct you when you do. The point is to show that you are thinking about the efficiency and performance of your solution. 𝗗𝗼 𝘁𝗵𝗶𝘀 𝗮𝗻𝗱 𝘆𝗼𝘂'𝗹𝗹 𝗯𝗲 𝗮𝗯𝗹𝗲 𝘁𝗼 𝘀𝗵𝗼𝘄𝗰𝗮𝘀𝗲 𝗮𝗻 𝗶𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝘁𝗿𝗮𝗶𝘁 𝘁𝗵𝗮𝘁 𝘁𝗲𝗰𝗵𝗻𝗶𝗰𝗮𝗹 𝗵𝗶𝗿𝗶𝗻𝗴 𝗺𝗮𝗻𝗮𝗴𝗲𝗿𝘀 𝗹𝗼𝗼𝗸 𝗳𝗼𝗿: The ability to consider a solution's viability beyond whether it works or not. This shows maturity in your decision-making and approach to programming. ~~ Thank you to our partner Postman who keeps our content free to the community. The 2024 State of the API Report just got released. Check it out for key trends and insights in API development: https://lnkd.in/gGYishJz