GoDaddy Interview Question

Determine if a string of parentheses is valid

Interview Answers

Anonymous

Oct 10, 2019

Use a counter and increase by 1 for every opening parenthesis and decrease by 1 for every closing parenthesis. If counter ever reaches -1, return False (not valid) and the counter at the end of the string is not 0, return False, else return True.

Anonymous

Feb 18, 2020

Use a stack, push open parentheses on the stack and pop when closing parentheses is processed. If closing parentheses and stack is empty, invalid. If end of strong and stack is not empty, invalid. Else valid

Anonymous

Jan 28, 2021

In these sorts of interviews you really need to drill down and understand what the interviewer is looking for. A good way to simulate a real interview experience is to do a mock with one of the GoDaddy Software Engineer(Internship) experts on Prepfully, rated super strongly on TrustPilot... prepfully.com/practice-interviews