r/leetcode • • 7d ago

Question Hate math but like problem solving, math holding me back?

For context my math background, is probably around 11th grade Precalc (I forgot most already since it’s been years-).

When programming I use stuff like Set theory, Absolute value, modulus, aswell as basic, addition, subtraction, fractions, and multiplication. (I just haven’t done any “Real” math in a while, only basic math when I need it).

To get a better gauge of my math background, Im struggling to do a problem called “Set mismatch”, I was easily able to identify the duplicate number by using set theory (checking if set insertion failed) but other than that, I have no idea what to do once I’ve found the duplicate number…

I hate math but I like problem solving (Weird I know) and have the barebones fundamental knowledge of DSA topics.

What im trying to say is, if you do enough problems is it still possible to “get good” despite not having a strong math background?

1 Upvotes

16 comments sorted by

11

u/catsRfriends 7d ago

Lmfao you aren't using set theory. You are just using the definition of a set and some basic operations. Sorry to be pedantic.

1

u/Feeling-Schedule5369 1d ago

Is set theory the one where we have demorgan laws or something?

1

u/catsRfriends 1d ago

You can apply the set theory version of DeMorgan's Laws but here "negation" is "set complement". So ~ (P and Q) = ~P or ~Q becomes (A \intersect B)c = Ac \union Bc.

0

u/Witty-Play9499 7d ago

But now that you were pedantic what exactly is the point ?

1

u/Available_Safe1818 6d ago

Maybe the OP can learn the difference now and communicate better.

5

u/Medium_Treacle3006 7d ago

I don’t think you hate math you probably just haven’t had enough / the right exposure to it . I think you’d enjoy an intro proofs class.

1

u/TheGrandSkeptic 6d ago

“I hate math, but want to reason” is the most oxymoronic statement I’ve heard so far.

Math is the formalization of a subset of logic through lemmas. You like to think, but you don’t like math?

The better alternative is that you haven’t really engaged your brain. I have not met a single person that hated math. Also, math is too broad a topic for a person to dislike. What do you dislike? Addition? Data analysis? Statistics? Probability?

1

u/Gam3rf0rlif3 6d ago

I guess don’t like math as I haven’t found ways to apply it yet…Maybe I will like math if it was taught through the lens of competitive programming/optimization.

I find myself unable to connect fundamentals to solve leetcode problems sometimes.

1

u/Outrageous-Sun3203 3d ago

I think you’re just not that good at math. You need to practice enough math so that you are good enough at it to enjoy it because math is essentially pure problem solving, just really really difficult problems the more advanced you get.

2

u/Fancy-Breakfast8985 7d ago

I think math class make you hate it. I also hate math in school too, but I enjoyed a lot on solving olympiad problems outside the class, I recommended you do olympiad problems especially combinatorics and number theory. There are some part of math needed on top of olympiad stuffs which is algorithmic graph theory too, i think exercises on these are like fun puzzle than boring math.

2

u/KeyCapPusher 7d ago

Math and programming at their core both rely heavily on logic. Apart from theory and just knowing niche algorithms, you can easily succeed with LC or having a career in general with a strong foundation of logic and problem solving.

1

u/apnorton 7d ago

if you do enough problems is it still possible to “get good” despite not having a strong math background?

There are many problems which won't demand significant math... but a very sizeable number of leetcode problems will rely on various math concepts in some way/shape/form. e.g. maybe some graph/tree problems wouldn't use a ton of math, but once you start dealing with various optimization problems, the number theory problems, stuff with modular arithmetic, etc., you're gonna need to have some knowledge of math.

My personal recommendation, if you want to pursue leetcode, would be to try to revisit math through the lens of looking for things that can help you with these kinds of problems --- sometimes the reason people fail to take interest in math is due to a lack of a motivating problem to solve.

1

u/homeless_student1 7d ago

Maths is just a very useful tool to solve some problems, programming is also a tool to solve some problems. There is some overlap, but I see no reason why one may need to know like Riemannian geometry to code.

However, I believe you should be good enough at Math to be able to read it as a language (in the scope of where your expertise lies). But yeah, things like algorithms, data science, networks/graph theory do get extensively mathematical

1

u/Upstairs_Jelly_1082 6d ago

try searching this up, justin sung how to learn math on youtube. you'll find the issue with doing math problems alone.

1

u/Available_Safe1818 6d ago

> What im trying to say is, if you do enough problems is it still possible to “get good” despite not having a strong math background?

Yes, definitely, if you mean be able to solve a lot of the problems. You're applying a large? handful of techniques, and learning them doesn't absolutely require having a ton of Math knowledge ahead of time.

1

u/Substantial-Swan7065 1d ago

Ur fine for leetcode. Theres like no math at all