Meta (Facebook) Machine Learning Engineer Interview Questions

Review this list of 60 Meta (Facebook) machine learning engineer interview questions and answers verified by hiring managers and candidates.
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Video answer for 'Move all zeros to the end of an array.'
    +40

    "Initialize left pointer: Set a left pointer left to 0. Iterate through the array: Iterate through the array from left to right. If the current element is not 0, swap it with the element at the left pointer and increment left. Time complexity: O(n). The loop iterates through the entire array once, making it linear time. Space complexity: O(1). The algorithm operates in-place, modifying the input array directly without using additional data structures. "

    Avon T. - "Initialize left pointer: Set a left pointer left to 0. Iterate through the array: Iterate through the array from left to right. If the current element is not 0, swap it with the element at the left pointer and increment left. Time complexity: O(n). The loop iterates through the entire array once, making it linear time. Space complexity: O(1). The algorithm operates in-place, modifying the input array directly without using additional data structures. "See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +4 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Video answer for 'Explain Bayes' theorem.'

    "Is it bad to get the answer a different way? Will they mark that as not knowing Bayes Theorem or just correct as it is an easier way to get the answer? The way I went is to look at what happens when the factory makes 100 light bulbs. Machine A makes 60 of which 3 are faulty, Machine B makes 40 of which 1.2 are faulty. Therefore the pool of faulty lightbulbs is 3/4.2 = 5/7 from machine A and 1.2/4.2 = 3/7 from Machine B."

    Will I. - "Is it bad to get the answer a different way? Will they mark that as not knowing Bayes Theorem or just correct as it is an easier way to get the answer? The way I went is to look at what happens when the factory makes 100 light bulbs. Machine A makes 60 of which 3 are faulty, Machine B makes 40 of which 1.2 are faulty. Therefore the pool of faulty lightbulbs is 3/4.2 = 5/7 from machine A and 1.2/4.2 = 3/7 from Machine B."See full answer

    Machine Learning Engineer
    Concept
    +2 more
  • "Write a function which Caesar ciphers all the strings so that the first character is "a". Use ascii code points and the modulo operator to do this. Use this function to create a hashmap between each string and the CC-a string. Then go through each key:value pair in the hashmap, and use the CC-a ciphered value as the key in a new defaultdict(list), adding the original string to the value field in the output."

    Michael B. - "Write a function which Caesar ciphers all the strings so that the first character is "a". Use ascii code points and the modulo operator to do this. Use this function to create a hashmap between each string and the CC-a string. Then go through each key:value pair in the hashmap, and use the CC-a ciphered value as the key in a new defaultdict(list), adding the original string to the value field in the output."See full answer

    Machine Learning Engineer
    Coding
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 

    "Problem: Given an input string txt consisting of alphanumeric characters and the parentheses characters '(' & ')', write a function which removes the minimum number of characters to return a version of the string with properly balanced parenthesis. Answer: You can do this with a counter. Psuedo-Python Start with counter = 0 output = [] Iterate through the string, every time you encounter a '(', increment the counter. Add the character to the output. If you encounter a ')', decrement the coun"

    Michael B. - "Problem: Given an input string txt consisting of alphanumeric characters and the parentheses characters '(' & ')', write a function which removes the minimum number of characters to return a version of the string with properly balanced parenthesis. Answer: You can do this with a counter. Psuedo-Python Start with counter = 0 output = [] Iterate through the string, every time you encounter a '(', increment the counter. Add the character to the output. If you encounter a ')', decrement the coun"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
    +1 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Video answer for 'Implement k-means clustering.'

    "i dont know"

    Dinesh K. - "i dont know"See full answer

    Machine Learning Engineer
    Coding
    +5 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    +5

    "A few months ago I joined a micro-services platform engineering team as their manager, at that time my team was struggling to deliver towards an upcoming production deadline for a customer facing product. Production date had been moved 5 times already and there were about 40% of product features which were remaining to be tested and signed off to move to production . I was made responsible to deliver the release of this product within the deadline and turnaround the software delivery throughput."

    Shuchi A. - "A few months ago I joined a micro-services platform engineering team as their manager, at that time my team was struggling to deliver towards an upcoming production deadline for a customer facing product. Production date had been moved 5 times already and there were about 40% of product features which were remaining to be tested and signed off to move to production . I was made responsible to deliver the release of this product within the deadline and turnaround the software delivery throughput."See full answer

    Machine Learning Engineer
    Behavioral
    +2 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Video answer for 'What is your leadership style?'
    +7

    "My leadership style is flexible and adaptive, it varies depending on the team members and the needs of the company. My leadership goal is to empower the team and inspire and grow leaders. In order to achieve that, I combine transformational, democratic and coaching leadership styles. Usually when we are facing a new type of challenge, or at the early stage of a project, I like to adapt the transformational leadership which allows me to listen to all the suggestions from the team members and sta"

    onering2ruleall - "My leadership style is flexible and adaptive, it varies depending on the team members and the needs of the company. My leadership goal is to empower the team and inspire and grow leaders. In order to achieve that, I combine transformational, democratic and coaching leadership styles. Usually when we are facing a new type of challenge, or at the early stage of a project, I like to adapt the transformational leadership which allows me to listen to all the suggestions from the team members and sta"See full answer

    Machine Learning Engineer
    Behavioral
    +4 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
  • "Use an index, two pointers, and a set to keep track of elements that you've seen. pseudo code follows: for i, elem in enumerate(array): if elem in set return False if i > N: set.remove(array[i-N])"

    Michael B. - "Use an index, two pointers, and a set to keep track of elements that you've seen. pseudo code follows: for i, elem in enumerate(array): if elem in set return False if i > N: set.remove(array[i-N])"See full answer

    Machine Learning Engineer
    Coding
  • Meta (Facebook) logoAsked at Meta (Facebook) 

    "Functional requirement's: partial search while searching for users, products any keywords in the search. additional keywords in the filter Black listed words in the search. Non functional requirements: low latency, search through 2 Billion records recent search should be cached. Design: high reads, we should have caching enabled over the primary db storages. caching cluster can be added when the search load increases. read ahead. - check in cache (periodic cache refresh), lfu, lru "

    Sandeep Y. - "Functional requirement's: partial search while searching for users, products any keywords in the search. additional keywords in the filter Black listed words in the search. Non functional requirements: low latency, search through 2 Billion records recent search should be cached. Design: high reads, we should have caching enabled over the primary db storages. caching cluster can be added when the search load increases. read ahead. - check in cache (periodic cache refresh), lfu, lru "See full answer

    Machine Learning Engineer
    System Design
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    Behavioral
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    +1

    "const ops = { '+': (a, b) => a+b, '-': (a, b) => a-b, '/': (a, b) => a/b, '': (a, b) => ab, }; function calc(expr) { // Search for + or - for (let i=expr.length-1; i >= 0; i--) { const char = expr.charAt(i); if (['+', '-'].includes(char)) { return opschar), calc(expr.slice(i+1))); } } // Search for / or * for (let i=expr.length-1; i >= 0; i--) { const char = expr.charAt(i); if"

    Tiago R. - "const ops = { '+': (a, b) => a+b, '-': (a, b) => a-b, '/': (a, b) => a/b, '': (a, b) => ab, }; function calc(expr) { // Search for + or - for (let i=expr.length-1; i >= 0; i--) { const char = expr.charAt(i); if (['+', '-'].includes(char)) { return opschar), calc(expr.slice(i+1))); } } // Search for / or * for (let i=expr.length-1; i >= 0; i--) { const char = expr.charAt(i); if"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +3 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 

    "Problem: Given a modified binary tree, where each node also has a pointer to it's parent, find the first common ancestor of two nodes. Answer: As it happens, the structure that we're looking at is actually a linked list (one pointer up), so the problem is identical to trying to find if two linked lists share a common node. How this works is by stacking the two chains of nodes together so they're the same length. chain1 = node1 chain2= node2 while True: chain1 = chain1.next chain2=chain"

    Michael B. - "Problem: Given a modified binary tree, where each node also has a pointer to it's parent, find the first common ancestor of two nodes. Answer: As it happens, the structure that we're looking at is actually a linked list (one pointer up), so the problem is identical to trying to find if two linked lists share a common node. How this works is by stacking the two chains of nodes together so they're the same length. chain1 = node1 chain2= node2 while True: chain1 = chain1.next chain2=chain"See full answer

    Machine Learning Engineer
    Coding
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    +37

    " Brute Force Two Pointer Solution: from typing import List def two_sum(nums, target): for i in range(len(nums)): for j in range(i+1, len(nums)): if nums[i]+nums[j]==target: return [i,j] return [] debug your code below print(two_sum([2, 7, 11, 15], 9)) `"

    Ritaban M. - " Brute Force Two Pointer Solution: from typing import List def two_sum(nums, target): for i in range(len(nums)): for j in range(i+1, len(nums)): if nums[i]+nums[j]==target: return [i,j] return [] debug your code below print(two_sum([2, 7, 11, 15], 9)) `"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +5 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    Behavioral
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Video answer for 'Merge k sorted linked lists.'
    +6

    "A much better solution than the one in the article, below: It looks like the ones writing articles here in Javascript do not understand the time/space complexity of javascript methods. shift, splice, sort, etc... In the solution article you have a shift and a sort being done inside a while, that is, the multiplication of Ns. My solution, below, iterates through the list once and then sorts it, separately. It´s O(N+Log(N)) class ListNode { constructor(val = 0, next = null) { th"

    Guilherme F. - "A much better solution than the one in the article, below: It looks like the ones writing articles here in Javascript do not understand the time/space complexity of javascript methods. shift, splice, sort, etc... In the solution article you have a shift and a sort being done inside a while, that is, the multiplication of Ns. My solution, below, iterates through the list once and then sorts it, separately. It´s O(N+Log(N)) class ListNode { constructor(val = 0, next = null) { th"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +4 more
Showing 21-40 of 60