Longest common prefix was tough. It took a lot of Googling and Youtube to figure out exactly what I needed. For starters we need something to compare to. For this I set a variable of prefix to an empty string.

let prefix = ‘ ’

To take care of the event were we receive an empty string I set an if statement to return prefix if strs.length === 0

Next step is the for let loop to iterate through the strs variable.

--

--