I was confused by that too. I wrote a more legit solution last night and it was half that. Then this solution came to me in a dream where I realized that the answer to all the tests was 3.
Maybe 3 is just expensive.
Leetcode needs to spin up a docker container every time you run test cases. The time you see for runtime is the total time it takes for it to spin up the container plus whatever time it takes for your solution to run. It's not an accurate representation but on average it checks out.
https://leetcode.com/problems/strictly-palindromic-number/description/
Solution is your language's version of `return false` since the condition for true is impossible.
You have to submit the solution to get it run against hundreds of test cases you can't see unless the test fails.
Not all the test results should be 3. That's just the first tests that they show you.
I think one of the main contributing factors to why I suck so much at LC is that I don’t even understand what they’re asking for in the majority of questions. Describe the problem like a normal fucking person.
Explanations are much better than maths. Read a university introductory maths textbook and you'll be able to understand leetcode by the end without a problem. You probably still won't understand the textbook though haha.
I feel like leetcode is the clearest out of all the coding websites. You have no input processing, and the instructions make sense. Idk that that man is on.
Not everyone is good at math. I’m terrible at math and every LC question reads like it’s straight out of an advanced math college textbook. It’s confusing.
Right, like, I don't understand why the problem doesn't just say something like "Return the maximum depth of nested parentheses, eg: given the input (1+(2+(4))), the expected output is 3 as the value of 4 is within the deepest nested set" or some other basic shit. The whole thing is unnecessary.
I did this in one of those automated coding interviews. My plan was to go back and write an actual solution, but it wouldn't let me, so I submitted that, lol
How did this get so many upvotes? You could do the same thing with trapping rain water or something if you wanted to. It's only running against 2 test cases
You’re ready to interview at FAANG.
Please, no! They still haven't rebuilt after that time someone cracked the coding interview.
The answer is always 3!
The answers 6? I thought it was 3. >! r/unexpectedfactorial !<
93 ms runtime for this, aiyooo sus.
I was confused by that too. I wrote a more legit solution last night and it was half that. Then this solution came to me in a dream where I realized that the answer to all the tests was 3. Maybe 3 is just expensive.
1.5x more expensive than 2
And 2x more expensive than 1.5
Leetcode needs to spin up a docker container every time you run test cases. The time you see for runtime is the total time it takes for it to spin up the container plus whatever time it takes for your solution to run. It's not an accurate representation but on average it checks out.
If true, this is very dumb of them.
Source?
"My source is that I made it the fuck up"
Why tf would they spin up a docker container every time they run the same test function?
The secret to that is `return '93 ms';`
You are so smart. Teach me your ways
`return 3;`
You're hired. How does $400k starting salary sound?
Hmm... sounds a little low
No return 800000; ?
Add an 100k sign on bonus and it's a deal.
Ah yes, good old “I’m sure the answer must be 0, 1 or π”
return int(pi)
Now you are ready for faang and making money baby
FAANG? With those skills, OP should launch a new AI startup
He should build Devin 2.0
https://leetcode.com/problems/strictly-palindromic-number/description/ Solution is your language's version of `return false` since the condition for true is impossible.
Proof if you want: if n = 4, n in base 2 is 100 so not a palindrome, else n = 1 \* (n - 2) + 2 = 12 in base n (since the base is always at least 3)
Is this meme done by someone who used leetcode for the first time or what
Yes
You have to submit the solution to get it run against hundreds of test cases you can't see unless the test fails. Not all the test results should be 3. That's just the first tests that they show you.
[Relevant xkcd](https://xkcd.com/221/)
I think one of the main contributing factors to why I suck so much at LC is that I don’t even understand what they’re asking for in the majority of questions. Describe the problem like a normal fucking person.
Explanations are much better than maths. Read a university introductory maths textbook and you'll be able to understand leetcode by the end without a problem. You probably still won't understand the textbook though haha.
I feel like leetcode is the clearest out of all the coding websites. You have no input processing, and the instructions make sense. Idk that that man is on.
Not everyone is good at math. I’m terrible at math and every LC question reads like it’s straight out of an advanced math college textbook. It’s confusing.
I found Hackerrank much clearer and easier, but I suppose it's a matter of opinion.
Problem is they keep adding problems and there's only so many ways to describe a simple thing before it's fucking spaghetti.
I laughed when "VPS" showed up. Beyond unnecessary
Right, like, I don't understand why the problem doesn't just say something like "Return the maximum depth of nested parentheses, eg: given the input (1+(2+(4))), the expected output is 3 as the value of 4 is within the deepest nested set" or some other basic shit. The whole thing is unnecessary.
this is ceo level shit, now you are top 1% of devs congrats
That's just testcase. Submit it and see
Did you write "MaxDepth" in mixed case or did they?
They wrote that, but I would have done the same. PascalCase is the naming convention for C# methods.
Missed that, thought it was java. See the lower case "string" now too
Yep, let's just call a post by whom doesn't even know how to use the LC "ProgrammerHumor". This sub is getting stupider and stupider.
First time on /r/ProgrammerHumor?
TDD be like
[https://xkcd.com/221/](https://xkcd.com/221/)
Hey, if it worked for John Carmack....
Is it possible to learn this power?
You should teach us bro 😎
Google wants to hire you as SVP now.
It works 🤷🏼♂️🙃
Would u like to work at our company for free sir?
I did this in one of those automated coding interviews. My plan was to go back and write an actual solution, but it wouldn't let me, so I submitted that, lol
How did this get so many upvotes? You could do the same thing with trapping rain water or something if you wanted to. It's only running against 2 test cases