zero-to-mastery / coding_challenge-21

A real life interview question from Google

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

coding_challenge-21

This coding challenge is all about doing a real life interview question from Google! This coding challenge only requires maximum a day's worth of work. You will also get a chance to see everyone's answer to the same 1 problem, and compare and contrast different ways to solve it! It's a tough one, but with enough concentration, you can do this!

What is the Challenge?

All you have to do, is to solve the problem below. Keep in mind that there are many ways to solve this question. If you have done the Master the Coding Interview: Data Structures + Algorithms course, you may have a bit of an advantage by trying to minimize Time Complexity O():

Given a array of X number of strings, find the longest common prefix among all strings present in the array.

Input:
An array of different items. For example: ['pea', 'pear', 'apple', 'for', 'april', 'apendix', 'peace', 1]

Output:
Print the longest common prefix as a string in the given array. If no such prefix exists print "-1"(without quotes).

Example:
Input:
['pea', 'pear', 'apple', 'for', 'april', 'apendix', 'peace', 1]

Output:
['pea', 'ap']

Explanation:
Longest common prefix in all the given strings is 'pea'.

Submissions:

submissions will be added here at the end of the coding challenge

The Rules Are:

  1. You have until September 30st at 11:59pm EST to submit your solution (using Github. If you don't know how to do that, check out the lecture in the Git + Github section of the course). You will have to submit the link to the #coding-challenge Discord group with the following message: -challenge URL LINK TO YOUR ENTRY" . The bot will listen for the command and will reply with "thanks for your submission" if it succeeded.

  2. Use whatever tools you have as developers (google, friends, Discord, programming buddy etc...) but I will not be offering any help with this challenge. Just like a developer, you must solve a problem and build something that will be challenging. Nobody will hold your hand during the job so we want to experience that by figuring it all out on your own with your team.

One Last Thing!

Please note: As with all my challenges there is zero benefit or monetary gain I recieve from it. This is just my way of thanking my students and making sure that you are able to continue gaining valuable knowledge outside of just my videos. It would mean a lot to me if you are able to rate my course...5 star reviews make my day :)

About

A real life interview question from Google