Apparently, here is the question that was asked. https://leetcode.com/problems/bulb-switcher/description/ After grinding leetcode for months, you get this question in your interview. I honestly want to know what you guys feel. There is no way I will have been able to solve that.. #meta Edit: Don't think XOR or anything like that.. The answer is the square root of the number... seriously, you will have solved that in 20 mins? in an interview setting? Unless you have seen this before, that seems like an impossible task.. FYI the answer is return Math.sqrt(n)
Are you saying you will have solved this in 20 mins? The answer is the square root of the number.. What in DSA does this test?
What are you complaining about?
Read the poll properly and answer.. IMO thats an unfair question... Who said I was complaining... I said I will not have been able to solve that... If you think you can solve it, then you probably don't understand what the answer is... Try getting that accepted on leetcode to understand what this is about...
Do not go to Meta. Why you want to leave our beautiful company rocket ship. Where stock will 10x soon
You know that meta already 5x'd in 1 year right?
Ridiculous to ask that for an swe interview. To solve one needs to realize it's about the number of divisors of a given integer. Then write the formula, realize that's it's only even for full squares. Then count the squares. Non of it has anything to do with software, not even close. Decent math brainteaser for a quant researcher, but not for swe. The interviewer was either trying to prove something to themselves or didn't want to pass for some reason
This! and to everyone who posted that they will have solved it... sure SMH... This right here is the answer...
Did you need to solve it with square root idea or you could have coded it in a for loop?
Were you able to get your code accepted on leetcode with the for loop you had in mind?
This is the worst question to ask on the interview! Honestly, you just had a bad luck.
Why do you think they expected that math solution? Did you code at least brute force solution?
Were you able to get your solution accepted for all the test cases on leetcode?
Brute force solutions don't pass the test cases for time or memory, but if you don't know the real solution you at least do the bf
Pretty fair question in fact
is this supposed to be hard? why?
it feela like lc monkeys practiced too much lc and can not code simple logic. unless i am smoking something this is straight forward simple
The answer is square root of the number... are you serious that you will have solved it in 15 mins? or are you being sarcastic?... Is that an algorithmic question... what does this test in DSA?