Meta intern recently opened Software Engineer Intern, there are some requirements for the position that you need to pay attention to: ‘This internship has a minimum twelve (12) week duration with 2025 start dates only’, you must graduate in 2025 and the internship is at least 12 weeks. Recently, many friends have received interviews from Meta intern, and the offer has been obtained. The start date is February 3, 2025. Now I will share the recent real interview questions of Meta intern.
Meta Intern VO 1
Give two strings judge if one is a subsequence of another
Example:input: s = "abc", t = "ahbgdc"
output: true
Follow up question.
Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s
Example:input: s = "abc", words = ["a", "bb", "acd", "ace"]
output: 2
Problem-solving ideas
Basic problem solving
two-pointer method (computing):
- Iterate over two strings with two pointers each.
- If the current character matches, both pointers move; otherwise, only the main string pointer moves.
- If the pointer to a substring can be traversed, it means it is a subsequence.
Time complexity: O(n), where n is the length of the main string.
Follow up solution
brute force:
- right
wordsin each string, use the double-pointer method to determine whether theSThe subsequence of the - Time Complexity: O(m * n), where m is
wordsThe length of n is the length of theSThe length of the
Optimization methods:
- Preprocessing the Master String
S:- Create a hash table or array
charIndex, stores the position of each character occurrence in the main string. - Use binary lookup to quickly find a match.
- Create a hash table or array
- Quick positioning using the dichotomy method:
- For each character in the string, the characters in order in the
SFind the next position in the center using bisection. - Time complexity: O(n + m * k * log(n)), where
KbewordsThe average length of the strings in the
- For each character in the string, the characters in order in the
Meta Intern VO 2
An array array of length n where each element x satisfies 0 ≤ x ≤ n-1. Find all duplicate elements in the array.
Example
input: [3, 1, 2, 3, 0]
output: [3]
Follow up question
No extra space, no recursive calls or func calls.
Core idea: modify the array in place, iterate over each element in the array, place the element in the correct position, swap the element to the correct position, if the position is already occupied, the element is a duplicate
Time complexity O(n), space complexity O(1)
Meta internship schedule
- Internship schedule (assuming 12 weeks):
- Weeks 1-3: Induction
- Weeks 5-6: Mid-cycle review
- Weeks 10-11: Final decision on offer (return offer is decided here)
- Weeks 11-12: Relax and have fun. Only your performance in weeks 1-10 will count towards your internship assessment!
Say goodbye to interview troubles and get your ideal Offer straight away!
After our powerful VO assist Through the analysis and communication of these interview questions, the interviewer not only understands the candidate's programming ability, but also sees my clear thinking and effective communication skills in the process of problem solving. These not only help to deal with Meta's interview, but also improve our ability to solve real programming problems. I wish you all good luck in your interviews!