I don't waste my time trying to build a leetcode / hackerank profile. Edit: Compative coding has very little to do with industrial strength software development.
I had to quit coffee earlier this year because a single cup in the morning was keeping me up at night.
But, let's be honest: One of the questions that I solved was basically "detect if a string is an anagram of another string."
So cat -> act: true, cat -> dog: false.
This was just a matter of treating the string as a series of characters, sorting them, and putting them back into a string. Then, if it's an anagram, the two sorted strings match.
Can you solve that in under an hour? Specifically, can you solve that in under an hour when you can choose from 20 popular programming languages and unit tests are provided?
More specifically, if you've been professionally programming every day for ~20 years, can you solve that in an hour?
Likewise, if you profile, there's no guarantee that a hashmap is faster or slower, or even more readable. It gets into the nitty-gritty of how memory allocation works and the overhead of maintaining a hashmap versus whatever optimized character sorting algorithms are part of your runtime.
Anyway, I've found that companies that want to ding me for those kinds of things aren't worth working for. IMO, we're better off having an industry-standard licensing board. Plenty of other industries do the same thing.
Edit: I've also spent an afternoon with a FAANG's set of practice programming challenges. I won't go into details out of respect for confidentiality, but they weren't unreasonably difficult. I only want to work with people who can solve "most" of them. (No one's perfect.)
The best analogy is like being a musician or an athlete. Anyone can learn to play an instrument or play a sport, but to be a professional musician or athlete requires something that takes more than practice. No one's excluded from those industries due to lack of talent, but the people without the talent have to take the jobs that support the musicians and athletes.