Easy Uber Coding Interview Question - Check if a String Is an Acronym of Words - Leetcode 2828

preview_player
Показать описание
FAANG Coding Interviews / Data Structures and Algorithms / Leetcode
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

Was the interview for a driver position?

tangocukedi
Автор

I just wanted a ride home, I didn't wanna have to answer any interview questions

HiImKyle
Автор

Is a candidate master rating level skill of codeforces enough to gurantee passing code interviews?

ceciljoel
Автор

Are we supposed to believe companies are giving questions which can be solved by baby's first for loop?

Ridgwaycer
Автор

I was hoping to see someone suggest the .startswith() string method in python.

brandondenis
Автор

Why do you need to check if a word at that index exists? Aren’t we already checking both lengths at the beginning itself?

rahuldwivedi
Автор

From where are you picking up these leetcode questions?

harshsinha
Автор

How about if having an array of 4 words, but any of them could be empty, which could result the acronym have less chars compared to the number of words?

budimanmh
Автор

Always thumbs up. Just need some time to implement them. I did implement the perfect sq using binary search

hlubradio
Автор

I wish I get this question in an interview 😂

PhonesUnboxing
Автор

programmer: 3!=4.
Mathematician: What?!

vadymvyhovskyi
Автор

how about:

try:
return s == "".join(word[0] for word in words)
except IndexError:
return False

Should still be O(n), I can understand relying on Exceptions might be criticizable but I feel like the added readability of it makes up for it

ryugane
Автор

To be pedantic. That does not check if it is acronym. It checks if it is an abbreviation. Also one liner in Python with zip, all and list comprehension.

movaxh
Автор

So uber driver will ask this instead of otp

TradingBull
Автор

I would like at least to pass to the technical interview. Can you share your advices for a stunning resume?

jvcss
Автор

Submission works without the len(words[i]) == 0

Kaviarasu_S
Автор

Where can we find details for your 1 on 1 tutoring?

atomix
Автор

That extra check len(words[i]) === 0 is actually unnecessary. Following would do fine.


var isAcronym = function(words, s) {
if(words.length !== s.length) return false;

for(var i=0; i<s.length; i++){
if(s[i] !== words[i][0]) return false;
}

return true;
};

rahuldwivedi
Автор

Using the length to determine the validity of an acronyms, would be technically fail. There are acronyms that borrow the second of the word.

Example:
loran = LOng-RAnge Navigation.
SONAR
RADAR
WiFi ?!?! Literally one of the most common, two word list != string length of four

andrewbeaver