Valid Palindrome (Python)
Valid Palindrome (Python Interview)
Watch someone try to determine if a string is a valid palindrome in a mock interview with a Meta engineer. Explore this problem and others in the world's largest library of interview videos.
Interview Summary
Problem type
Valid Palindrome
Interview question
Determine if this string, after removing any one character, can become a palindrome. If possible return true, otherwise return false.
Given the string of parentheses and possibly some characters as well, balance the parentheses.
Given a grid of characters and an array of string inputs, find if each of these words exists in this grid. To find it look at adjacent characters, using each character only one time.
Interview Feedback
Feedback about Aerodynamic Raven (the interviewee)
Would you want to advance this person to the next round?
Yes
How were their technical skills?
4/4
How was their problem-solving ability?
4/4
What about their communication ability?
4/4
Great communication, problem analysis, problem solving, coding, and testing. I really liked how you explained your test plan, and organizing code into helper functions. Asking for clarifying questions such as constraints and edge cases will help with solving problems. Most interviewers will ask you 2 problems so you have about 20 minutes to solve each of them. Suggest practicing a few problems for every kind of DS & algo: string, array, 2-pointer (palindrome Q), stack, linked list, hash, DFS/BFS, tree/trie/BST, queue, heap. Good luck!
Feedback about Clandestine Hamburger (the interviewer)
Would you want to work with this person?
Yes
How excited would you be to work with them?
4/4
How good were the questions?
4/4
How helpful was your interviewer in guiding you to the solution(s)?
4/4
Thanks for the practice with a third question!
Interview Transcript
Aerodynamic Raven: Hey Hamburger how are you?
Clandestine Hamburger: Yeah, I'm doing good Raven. Nice to meet you.
Aerodynamic Raven: Yeah, good to meet you.
Clandestine Hamburger: Yeah. So today it's a Facebook practice interview. The session is one hour, but the actual interview for Facebook, it actually takes 45 minutes. But we can use the whole time for about 45 minutes and then at the end to discuss anything regarding if you have any questions, or we can discuss feedback.
Aerodynamic Raven: Okay, so I'm going to think about my strategy here for a moment...
Clandestine Hamburger: So what is the specified time complexity?
Aerodynamic Raven: The time complexity is going to be linear, reason being is that in our loop, it's going to be linear time there. And then we're going to call is palindrome which is also going to be linear.
Clandestine Hamburger: Can you make the linear space better?
Aerodynamic Raven: Yeah, that is definitely possible.
Clandestine Hamburger: It seems good, at least, yeah, at least you understand that the is palindrome is important. And you can do it. So that's great. Like I said, I'm going to move on to the second question.
Aerodynamic Raven: Yeah. Alright, so about the parentheses, we can do this in a way that uses a helper function.
Clandestine Hamburger: That's awesome! Okay, go ahead.
Aerodynamic Raven: I will write our helper function. And this will remove unnecessary parentheses.
Clandestine Hamburger: Sounds good! So what would be your space and time complexity on this one?
Aerodynamic Raven: The time complexity here is going to be linear because each of our removing unnecessary characters functions is going to iterate throughout the whole string. The space complexity is also going to be linear because of the partial results variable.
Clandestine Hamburger: Great! You did a wonderful job! Congratulations.
Aerodynamic Raven: Thank you. Appreciate it.