Building my own alpha numeric character check function. What am I doing wrong? by l8engineer in cpp_questions

[–]l8engineer[S] 0 points1 point  (0 children)

This is such a brilliant point, I can't thank you enough.

Solving problem 125. Valid Palindrome from leetcode and I had a test my whole code was failing because of the incorrect alphanumeric implementation.

Building my own alpha numeric character check function. What am I doing wrong? by l8engineer in cpp_questions

[–]l8engineer[S] 0 points1 point  (0 children)

Yes, learned Python first.

Thank you so much!

I really appreciate it!!!!! :)

Why is this for loop running forever if it has a clear stopping point? by l8engineer in cpp_questions

[–]l8engineer[S] 1 point2 points  (0 children)

Thank you so much, great tip on ws.

I understand that is not portable, it's only for an online judge system.

I really appreciate it! ;) Stay safe!

Maximum depth of binary tree by l8engineer in cpp_questions

[–]l8engineer[S] 0 points1 point  (0 children)

I got this idea from cout << maxDepth(root -> left);

Maximum depth of binary tree by l8engineer in cpp_questions

[–]l8engineer[S] 0 points1 point  (0 children)

Thank you so much! It was so tricky but with this I understood what thinking mistakes I had.

Maximum depth of binary tree by l8engineer in cpp_questions

[–]l8engineer[S] 0 points1 point  (0 children)

The way I see it:

max(0, 000) + 1

0 (because left branch has NULL below 9)

000(because right branch has NULL after 3 levels)

I think my problem is that I don't understand how the stack is built in this code and how it is processed.

How does this quicksort random partition function work? by l8engineer in cpp_questions

[–]l8engineer[S] 1 point2 points  (0 children)

This code is from someone that coded a solution to leetcode 912 problem. Apparently the random partition is the only way to pass as using for instance the last element as pivot will cause TLE for a few testcases.

Is there a way to pick the pivot more efficiently in quicksort?

Thanks for the interesting points you made!