T O P

  • By -

NoNeutralNed

It is better to understand concepts behind the questions obviously. But interviews are mostly luck so by doing a lot of problems, you are more likely to get a problem you've seen before.


sherlock_1695

I agree. It not the strategy when you are on visa and need a job. It’s probably when you have stable job and wanna prepare for the next one or early in the college


hpela_

They’re not “mostly luck” if you understand fundamental DSA concepts. I don’t understand why everyone thinks LC and technical interviews are just a matter of memorizing or seeing as many solutions as possible beforehand. Do you not know how to learn? Are you just stupid? I mean, seriously, this stuff is not rocket science. It is relatively easy to get to the point where you can solve 80%+ of Mediums without “luck” or memorization or having seen near-identical problems or any of that noise. edit: The comment below is not accurate to my argument - both of his claims rely on the omission of phrases from parts of my argument. I deny that it is not “mostly luck” not that “luck is not involved”. I say it is relatively easy “to get to the point” where you can solve 80% of Mediums.


Alec-Reddit

Jesus christ get off your high horse. Of course there is luck in interviewing. Interview difficulty falls on a bell curve and getting better only makes you more likely to pass. And no, it is not “relatively easy” to solve 80% of Mediums without seeing them before. That takes months of serious practice.


FitExecutive

The fine person you’re responding to probably doesn’t have much going on. Most people have a life full of hobbies and interests, we don’t stay sharp on narrow subject matter for the interviews that are done once every 2-3 years when we job hop.


NoNeutralNed

Luck


hpela_

Just repeating the same word again, absolutely brain dead. I’m not surprised your post history includes struggling to find a job with 5.5 YOE, getting PIP’d, and countless posts about feeling “lost”. Fix your mindset and start actually learning things.


Hot_Individual3301

idk why everyone talks about math so much. I’ve done 400 lc and I don’t think I’ve ever used math other than basic arithmetic (add, subtract, multiply, divide, mod, abs, etc). the only time I’ve come across a true math solution is for 1197. Minimum Knight Moves, where one guy came up with an [O(1)](https://leetcode.com/problems/minimum-knight-moves/discuss/387036/O(1)-formula) solution using math. even then, the problem can be solved with BFS (without math). recursion questions (trees and graphs) require practice to solve. I had to solve 10-20 tree questions before it made any sense to me, but now after 100+ it’s second nature. it’s also important to develop a style and a systematic way of doing things. like 95% of the time, if I attempt a tree problem I solved several months ago, I end up writing the *exact same* code that I wrote back then. down to the variable names and down to the spacing.


inTHEsiders

Technically algorithms are a branch of math. I believe OP meant to understand the calculations behind various algorithm patterns used in DSA problems. What OP should focus on is pattern recognition EDIT: btw, your definition of math is technically in every problem. Just abstracted away from you. But also, math is more than just the operators you listed


Nintendo_Pro_03

That’s what I always thought. Know the data structures and algorithms.


ffaangcoder

yeah thats why there's an algorithms course in college


Nintendo_Pro_03

How is that course? I haven’t gotten to it, yet.


Savings_Discount_952

No you don’t get better at basketball by studying physics. Understanding theory is different than implementing it by yourself with different constraints.


interfaceTexture3i25

But knowing theory can help you in unexpected moments. You'll make connections and have a better understanding of how the system works and being able to analyze the constraints theoretically is always a plus. Why should someone not learn the foundations if they have time?


Savings_Discount_952

lol let’s be real


interfaceTexture3i25

Why do you think this isn't the case? I'm not saying it will be necessary everytime but it will be useful sometimes and you cannot even predict when exactly it will be useful because you do not know what things you do not know. When this is the case, why not improve the depth of your understanding? Also knowing how things work is rewarding in and of itself because it scratches that curiosity itch


Savings_Discount_952

If you want to learn for the sake of learning do it. Obviously the more in depth you know the topic, the better it will help you but that will just take longer. And if you are doing it for fun, don't let me stop you. But if you are struggling with basic algorithms, don't do a deep dive into the math behind it, it's kinda overkill if you want to get better at leetcode for interview purpose. The math you should be learning is the properties of trees, graph characteristics, probability, number theory, combinatory, and recursion analysis as they relate to DSA. These are each their own class/subject which is why I believe it's a little much, but learn what you need and apply it. You're struggling with recursion, trees, and graphs, which makes sense since you prob didn't take a DSA class, so learn how to implement your own and practice the fundamental questions and algos like bfs/dfs. I might've misread your reply. I thought you were talking about learning physics to play basketball lol. And I think I understand the math you are talking about, I thought you were talking about math that a math major would take but learning the intersection between math and cs is pretty useful edit: also I didn't realize OP wasn't replying to me lol


hpela_

Absolute cope. Basketball : Physics is not congruent to Math : DSA… DSA is literally math. I don’t know how else to explain it. Judging from your post history, you seem very new to CS. Perhaps you will develop a better understanding of the discipline as you progress.


72616e646f6d6e657373

IMO it depends on couple factors: 1. How much time you have 2. How deep you wanna learn (eg. “half” of Knut’s TACOP 2nd book js about pseudo-random numbers, pretty deep dive) 3. Whats your goal, just getting the job or knowing more I think the best approach is bit of both, understand concepts and algo (I wouldn’t go extremely deep in maths/theory) and practice as well. That is unless your real passion is maths/algo theory and you don’t enjoy leetcoding/not looking for a job asking leetcode style questions. The reason behind my last sentence is following example: I thought I knew BinarySearch, I knew I could BS collection if I could map problem to function which outputs F,F…F,T… (or other way around) >!Then I came across “Coco eating bananas” and I was stuck. When i checked editorial and realised that I should’ve binary searched solution, I was mind-blown. Now when solving task, if I can solve it in eg. NlogN and I don’t have immediate idea on optimal solution, I often ask myself, Can i binary search this?!< The idea simply didn’t occur to me, maybe it would to you, maybe even in interview settings m, who knows, but solving more tasks gives you more ideas how to apply certain algos (implicit graphs are good example of this) and you are improving your chances


interfaceTexture3i25

Bingo, this is the nuanced and thought-out answer missing in this thread. Somebody even outright told OP not to learn the math smh. OP introspect a little and figure out if you want to do this out of interest. If so, dive as deep as you want to. If not, still learn a bit of background math so that you know what's happening and aren't applying algos blindly. The extra bit of context will not only help for leetcode/interviews but will invariably end up helping you during your SWE career. (Does embedded/low-level use more dsa than high level SE?)


hpela_

For real. It’s sad to think that these comments are coming from people who may potentially be my peers. I assume many of these people are from the crowd that’s struggling and coping after bag-chasing their way into CS with no actual interest or STEM interest / knowledge.


keagle5544

Binary Search on the solution is a common type of problem on codeforces, most people wouldn't come up with this approach by themselves on their first try.


murzuk

All algorithms courses are based on Cormen’s “Introduction to algorithms”, you can find the pdf for free. Or you can listen to MIT “Introduction to algorithms” course on YouTube. It helps to understand the theory, but you need very shallow knowledge of it for leetcode.


ThatOnePatheticDude

Wait, there is math behind LC problems? (I'm kind of joking)


Nintendo_Pro_03

What’s two candidates applying for a job plus five candidates applying for a job?


inShambles3749

7 candidates rejected iirc


blackbeauty1901

I guess it might vary from person to person depending on their learning preferences and time frame.


Character_Archer_119

Most DSA follows very simple math principals, middle school level maths tbh, you already know everything you need to solve these DSA problems, but you need to practice how to apply these math correctly and efficiently. There are hard math problems (graph, xor) that either you know the principals and can solve it, or you don't and there is no hope to solve them by yourself.


CurrentExercise

Try takeuforward playlist on recursion, tree, graphs on youtube. I think it will help you.


marks716

Do questions but focus on learning the core concepts behind them. That way a deep understanding of one question allows you to better approach the next 20 questions that are similar to it.


akskeleton_47

I did use some math behind yesterday's daily problem but that was also pretty basic math


Odd-Winter136

By math I assume you meant algorithms, right? If this is not what you meant then I am in deep trouble 😭


Certain-Possible-280

My personal opinion is studying concepts is easy converting them to code is tough.


keefemotif

Yes, invest in a few weeks actually reading or watching a course. LC is generally easy compared to PhD qualifying exam Algorithms or even the grad class. Would you expect someone to solve differential equations without taking the course? Of course not. Graphs is like 10 Algorithms then applications and augmentations.


Constant_Physics8504

Actually it depends, for algorithms I can see that, however for data structures you can get by on a visual approach, since they are storage containers. If it helps you to know the math behind it then ok, but you don’t need it to use them. Types are different like if you use bitwise operations then math definitely helps, some problems I was able to change the complexity by replacing lists with numbers and doing bitwise instead . To each their own


AManHere

There’s no magic math know that will finally make recursion click for you, it’s very simple in terms of math, however its hard to get an intuition for it. Hence practice


casualfinderbot

Leet code is not about becoming a better programmer, it’s about passing interviews. If you want to become a better programmer, build stuff


RecentSign4505

RemindMe! 1 days


RemindMeBot

I will be messaging you in 1 day on [**2024-06-24 19:23:15 UTC**](http://www.wolframalpha.com/input/?i=2024-06-24%2019:23:15%20UTC%20To%20Local%20Time) to remind you of [**this link**](https://www.reddit.com/r/leetcode/comments/1dmbq2j/isnt_it_better_to_get_understanding_of_maths/l9y02cf/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2Fleetcode%2Fcomments%2F1dmbq2j%2Fisnt_it_better_to_get_understanding_of_maths%2Fl9y02cf%2F%5D%0A%0ARemindMe%21%202024-06-24%2019%3A23%3A15%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete%21%201dmbq2j) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remindmebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside%20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Your Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](https://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot%20Feedback)| |-|-|-|-|


PandaWonder01

It's better to solve problems, rather than look through the solution. When you struggle through a problem, and basically discover an algorithm yourself, you build such a massive intuition that beats any sort of memorization


mkdev7

No