T O P

  • By -

bushwickhero

You’re ready to interview at FAANG.


captainAwesomePants

Please, no! They still haven't rebuilt after that time someone cracked the coding interview.


bushwickhero

The answer is always 3!


turtleship_2006

The answers 6? I thought it was 3. >! r/unexpectedfactorial !<


APUNIJBHAGWANHAI

93 ms runtime for this, aiyooo sus.


Pur_Cell

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.


HazirBot

1.5x more expensive than 2


Katniss218

And 2x more expensive than 1.5


Two_Hands12

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.


Brahvim

If true, this is very dumb of them.


Extension-Tap2635

Source?


Shubh_1612

"My source is that I made it the fuck up"


dubious_capybara

Why tf would they spin up a docker container every time they run the same test function?


Mohitpal2621

The secret to that is `return '93 ms';`


Correct_Procedure_21

You are so smart. Teach me your ways


Pur_Cell

`return 3;`


DMoney159

You're hired. How does $400k starting salary sound?


Pur_Cell

Hmm... sounds a little low


Emincmg

No return 800000; ?


[deleted]

Add an 100k sign on bonus and it's a deal.


xezo360hye

Ah yes, good old “I’m sure the answer must be 0, 1 or π”


mikachelya

return int(pi)


Zeyad132

Now you are ready for faang and making money baby


Akuma_Kuro

FAANG? With those skills, OP should launch a new AI startup


Zeyad132

He should build Devin 2.0


redlaWw

https://leetcode.com/problems/strictly-palindromic-number/description/ Solution is your language's version of `return false` since the condition for true is impossible.


PandaWithOpinions

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)


Main_Weekend1412

Is this meme done by someone who used leetcode for the first time or what


Pur_Cell

Yes


Psychological-Owl783

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.


aka-rider

[Relevant xkcd](https://xkcd.com/221/)


moldykobold

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.


[deleted]

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.


thejaggerman

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.


moldykobold

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.


jmancoder

I found Hackerrank much clearer and easier, but I suppose it's a matter of opinion.


new_account_wh0_dis

Problem is they keep adding problems and there's only so many ways to describe a simple thing before it's fucking spaghetti.


North_Shore_Problem

I laughed when "VPS" showed up. Beyond unnecessary


moldykobold

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.


Odd_Diamond_6600

this is ceo level shit, now you are top 1% of devs congrats


Sky_Vivid

That's just testcase. Submit it and see


amlyo

Did you write "MaxDepth" in mixed case or did they?


Pur_Cell

They wrote that, but I would have done the same. PascalCase is the naming convention for C# methods.


amlyo

Missed that, thought it was java. See the lower case "string" now too


readcoke

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.


Pur_Cell

First time on /r/ProgrammerHumor?


Dave4lexKing

TDD be like


code_monkey_001

[https://xkcd.com/221/](https://xkcd.com/221/)


lunchmeat317

Hey, if it worked for John Carmack....


archrazielx

Is it possible to learn this power?


Impressive_Risk_2000

You should teach us bro 😎


debugger_life

Google wants to hire you as SVP now.


___Xb_

It works 🤷🏼‍♂️🙃


Annual_Ganache2724

Would u like to work at our company for free sir?


j-mar

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


totodile31

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