Skip to main content

Machine Learning Engineer Coding Interview Questions

Review this list of 89 Coding Machine Learning Engineer interview questions and answers verified by hiring managers and candidates.
  • Adobe logoAsked at Adobe 
    4 answers
    +1

    "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"

    Divya R. - "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"See full answer

    Machine Learning Engineer
    Coding
    +4 more
  • Meta logoAsked at Meta 
    1 answer

    "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
  • Apple logoAsked at Apple 
    3 answers

    "class Trie { private TrieNode root; public Trie() { root = new TrieNode(); } public void insert(String word) { TrieNode temp=root; for(int i=0; i<word.length(); i++) { if(!temp.children.containsKey(word.charAt(i))) { temp.children.put(word.charAt(i), new TrieNode()); } temp=temp.children.get(word.charAt(i)); } temp.isEndOfWord=true; } public boolean search(String word) { TrieNode temp=root; for(int i=0; i<word.length(); i++) { if(!temp.children.containsKey(word.charAt(i))) { return false; } temp"

    Divya R. - "class Trie { private TrieNode root; public Trie() { root = new TrieNode(); } public void insert(String word) { TrieNode temp=root; for(int i=0; i<word.length(); i++) { if(!temp.children.containsKey(word.charAt(i))) { temp.children.put(word.charAt(i), new TrieNode()); } temp=temp.children.get(word.charAt(i)); } temp.isEndOfWord=true; } public boolean search(String word) { TrieNode temp=root; for(int i=0; i<word.length(); i++) { if(!temp.children.containsKey(word.charAt(i))) { return false; } temp"See full answer

    Machine Learning Engineer
    Coding
    +4 more
  • Machine Learning Engineer
    Coding
    +1 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Adobe logoAsked at Adobe 
    1 answer

    "create a queue push all cells with 0 into queue Mark all 1s as unvisited (-1 or large value) Run BFS for each cell, explore 4 directions If neighbor is unvisited:distance = current + 1 push into queue "

    Areeba M. - "create a queue push all cells with 0 into queue Mark all 1s as unvisited (-1 or large value) Run BFS for each cell, explore 4 directions If neighbor is unvisited:distance = current + 1 push into queue "See full answer

    Machine Learning Engineer
    Coding
    +2 more
  • Adobe logoAsked at Adobe 
    2 answers

    "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["

    Reno S. - "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["See full answer

    Machine Learning Engineer
    Coding
    +3 more
  • Visa logoAsked at Visa 
    1 answer

    "// Helper function to calculate the Euclidean distance between two points function distance(p1, p2) { return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2)); } // A helper function to find the closest pair in a given set of points within the strip function closestPairInStrip(strip, d) { let minDist = d; // Start with the current minimum distance strip.sort((a, b) => a[1] - b[1]); // Sort the strip by y-coordinate for (let i = 0; i < strip.length; i++) { "

    Vishnu V. - "// Helper function to calculate the Euclidean distance between two points function distance(p1, p2) { return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2)); } // A helper function to find the closest pair in a given set of points within the strip function closestPairInStrip(strip, d) { let minDist = d; // Start with the current minimum distance strip.sort((a, b) => a[1] - b[1]); // Sort the strip by y-coordinate for (let i = 0; i < strip.length; i++) { "See full answer

    Machine Learning Engineer
    Coding
    +1 more
  • Meta logoAsked at Meta 
    Add answer
    Video answer for 'Find the common ancestors in a tree.'
    Machine Learning Engineer
    Coding
    +1 more
  • Nvidia logoAsked at Nvidia 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Meta logoAsked at Meta 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Apple logoAsked at Apple 
    9 answers
    +5

    "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"

    Vaibhav D. - "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"See full answer

    Machine Learning Engineer
    Coding
    +4 more
  • Apple logoAsked at Apple 

    Coin Change

    IDE
    Medium
    12 answers
    +9

    "The example given is wrong. The 2nd test case should have answer 3, as we can get to 6 by using 3 coins of denomination 2."

    Anmol R. - "The example given is wrong. The 2nd test case should have answer 3, as we can get to 6 by using 3 coins of denomination 2."See full answer

    Machine Learning Engineer
    Coding
    +4 more
  • Meta logoAsked at Meta 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    2 answers

    "The rule doesn't work the other way around. If the array is smaller than n, it can still have duplicates. Eg: n=10 , arr = [3,3]"

    Murali M. - "The rule doesn't work the other way around. If the array is smaller than n, it can still have duplicates. Eg: n=10 , arr = [3,3]"See full answer

    Machine Learning Engineer
    Coding
    +2 more
  • Meta logoAsked at Meta 
    1 answer

    "HashMap supports insert, search, delete and retrieve in O(1). It stores data as key value pairs."

    Ina K. - "HashMap supports insert, search, delete and retrieve in O(1). It stores data as key value pairs."See full answer

    Machine Learning Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    9 answers
    +6

    "Less efficient version, yet effective for the interview: def is_palindrome(s: str) -> bool: dim = len(s) if dim str: dim = len(s) if dim < 2: return s left = 0 longest = "" while left < dim: righ"

    Gabriele G. - "Less efficient version, yet effective for the interview: def is_palindrome(s: str) -> bool: dim = len(s) if dim str: dim = len(s) if dim < 2: return s left = 0 longest = "" while left < dim: righ"See full answer

    Machine Learning Engineer
    Coding
    +3 more
  • LinkedIn logoAsked at LinkedIn 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Meta logoAsked at Meta 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
Showing 61-80 of 89