Machine Learning Engineer Interview Questions

Review this list of 210 machine learning engineer interview questions and answers verified by hiring managers and candidates.
  • Apple logoAsked at Apple 
    +9

    "class ListNode: def init(self, val=0, next=None): self.val = val self.next = next def has_cycle(head: ListNode) -> bool: slow, fast = head, head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return True return False debug your code below node1 = ListNode(1) node2 = ListNode(2) node3 = ListNode(3) node4 = ListNode(4) creates a linked list with a cycle: 1 -> 2 -> 3 -> 4"

    Anonymous Roadrunner - "class ListNode: def init(self, val=0, next=None): self.val = val self.next = next def has_cycle(head: ListNode) -> bool: slow, fast = head, head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return True return False debug your code below node1 = ListNode(1) node2 = ListNode(2) node3 = ListNode(3) node4 = ListNode(4) creates a linked list with a cycle: 1 -> 2 -> 3 -> 4"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +4 more
  • 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
  • "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
  • Adobe logoAsked at Adobe 
    +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
  • 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) 
    Machine Learning Engineer
    Behavioral
    +1 more
  • Pinterest logoAsked at Pinterest 
    Machine Learning Engineer
    System Design
  • Google logoAsked at Google 

    "Yes, I need to compare the first half of the first string with the reverse order of the second half of the second string. Repeat this process to the first half of the second string and the second half of the first string."

    Noor M. - "Yes, I need to compare the first half of the first string with the reverse order of the second half of the second string. Repeat this process to the first half of the second string and the second half of the first string."See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +1 more
  • Adobe logoAsked at Adobe 
    +37

    "a. Sort the array elements. b. take two pointers at index 0 and index Len-1; c. if the sum at the two pointers is target; break and return the pair d. if the sum is smaller, then move left pointer by 1 e. else move right pointer by 1; run the logic till the target is met or right pointer crosses the left pointer."

    Komal S. - "a. Sort the array elements. b. take two pointers at index 0 and index Len-1; c. if the sum at the two pointers is target; break and return the pair d. if the sum is smaller, then move left pointer by 1 e. else move right pointer by 1; run the logic till the target is met or right pointer crosses the left pointer."See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +5 more
  • Nvidia logoAsked at Nvidia 

    "Over-fitting of a model occurs when model fails to generalize to any new data and has high variance withing training data whereas in under fitting model isn't able to uncover the underlying pattern in the training data and high bias. Tree based model like decision tree and random forest are likely to overfit whereas linear models like linear regression and logistic regression tends to under fit. There are many reasons why a Random forest can overfits easily 1. Model has grown to its full depth a"

    Jyoti V. - "Over-fitting of a model occurs when model fails to generalize to any new data and has high variance withing training data whereas in under fitting model isn't able to uncover the underlying pattern in the training data and high bias. Tree based model like decision tree and random forest are likely to overfit whereas linear models like linear regression and logistic regression tends to under fit. There are many reasons why a Random forest can overfits easily 1. Model has grown to its full depth a"See full answer

    Machine Learning Engineer
    Concept
    +2 more
  • Adobe logoAsked at Adobe 
    Video answer for 'Generate Parentheses'
    +5

    "function generateParentheses(n) { if (n < 1) { return []; } if (n === 1) { return ["()"]; } const combinations = new Set(); let previousCombinations = generateParentheses(n-1); for (let prev of previousCombinations) { for (let i=0; i < prev.length; i++) { combinations.add(prev.slice(0, i+1) + "()" + prev.slice(i+1)); } } return [...combinations]; } `"

    Tiago R. - "function generateParentheses(n) { if (n < 1) { return []; } if (n === 1) { return ["()"]; } const combinations = new Set(); let previousCombinations = generateParentheses(n-1); for (let prev of previousCombinations) { for (let i=0; i < prev.length; i++) { combinations.add(prev.slice(0, i+1) + "()" + prev.slice(i+1)); } } return [...combinations]; } `"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
  • Tesla logoAsked at Tesla 
    Video answer for 'Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in clockwise spiral order.'
    Machine Learning Engineer
    Data Structures & Algorithms
    +3 more
  • Google logoAsked at Google 
    +3

    "import time class Task: def init\(self, description, interval=None): self.description = description self.interval = interval self.next_run = time.time() class SimpleTaskScheduler: def init\(self): self.tasks = [] def add_task(self, description, interval=None): self.tasks.append(Task(description, interval)) def run(self, duration=60): end_time = time.time() + duration while time.time() < end_time: curr"

    Yash N. - "import time class Task: def init\(self, description, interval=None): self.description = description self.interval = interval self.next_run = time.time() class SimpleTaskScheduler: def init\(self): self.tasks = [] def add_task(self, description, interval=None): self.tasks.append(Task(description, interval)) def run(self, duration=60): end_time = time.time() + duration while time.time() < end_time: curr"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +1 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
    +1 more
  • OpenAI logoAsked at OpenAI 

    "Reinforcement Learning is a type of machine learning where an agent learns to make decisions by trying out different actions and receiving rewards or penalties in return. The goal is to learn, over time, which actions yield the highest rewards. There are three core components in RL: The agent — the learner or decision-maker (e.g., an algorithm or robot), The environment — everything the agent interacts with, Actions and rewards — the agent takes actions, and the environmen"

    Constantin P. - "Reinforcement Learning is a type of machine learning where an agent learns to make decisions by trying out different actions and receiving rewards or penalties in return. The goal is to learn, over time, which actions yield the highest rewards. There are three core components in RL: The agent — the learner or decision-maker (e.g., an algorithm or robot), The environment — everything the agent interacts with, Actions and rewards — the agent takes actions, and the environmen"See full answer

    Machine Learning Engineer
    Concept
    +1 more
  • Adobe logoAsked at Adobe 
    Machine Learning Engineer
    Data Structures & Algorithms
    +4 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    System Design
  • Adobe logoAsked at Adobe 
    +3

    "function addChildren(root, val, inorder) { const rootInOrderIndex = inorder.indexOf(root.value); const childrenInOrderIndex = inorder.indexOf(val); if (childrenInOrderIndex < rootInOrderIndex) { if (!root.left) { root.left = new TreeNode(val); } else { addChildren(root.left, val, inorder); } } else { if (!root.right) { root.right = new TreeNode(val); } else { addChildren(root.right,"

    Tiago R. - "function addChildren(root, val, inorder) { const rootInOrderIndex = inorder.indexOf(root.value); const childrenInOrderIndex = inorder.indexOf(val); if (childrenInOrderIndex < rootInOrderIndex) { if (!root.left) { root.left = new TreeNode(val); } else { addChildren(root.left, val, inorder); } } else { if (!root.right) { root.right = new TreeNode(val); } else { addChildren(root.right,"See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +2 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Machine Learning Engineer
    Behavioral
    +1 more
Showing 81-100 of 210