Skip to main content

Coding Interview Questions

Review this list of 419 Coding interview questions and answers verified by hiring managers and candidates.
  • Apple logoAsked at Apple 
    Add answer
    Data Engineer
    Coding
    +1 more
  • Goldman Sachs logoAsked at Goldman Sachs 
    1 answer

    "standard answer for this."

    Shar N. - "standard answer for this."See full answer

    Software Engineer
    Coding
    +1 more
  • Uber logoAsked at Uber 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Microsoft logoAsked at Microsoft 
    1 answer

    "public class BoggleBoard { public static List findWords(char board, Set dictionary) { int rows = board.length; int cols = board[0].length; boolean visited = new booleanrows; int directions = {{1,0}, {-1,0}, {0,1}, {0,-1}}; List result = new ArrayList(); for(int i=0; i<rows; i++) { for(int j=0; j<cols; j++) { dfs(board, visited, i, j, dictionary, "", result, dire"

    Aniket G. - "public class BoggleBoard { public static List findWords(char board, Set dictionary) { int rows = board.length; int cols = board[0].length; boolean visited = new booleanrows; int directions = {{1,0}, {-1,0}, {0,1}, {0,-1}}; List result = new ArrayList(); for(int i=0; i<rows; i++) { for(int j=0; j<cols; j++) { dfs(board, visited, i, j, dictionary, "", result, dire"See full answer

    Software Engineer
    Coding
    +1 more
  • 1 answer

    "class Node { int val; Node left, right; Node(int v) { val = v; left = right = null; } } class BinaryTree { Node root1, root2; boolean identicalTrees(Node a, Node b) { if (a == null && b == null) return true; if (a != null && b != null) return (a.val == b.val && identicalTrees(a.left, b.left) && identicalTrees(a.right, b.right)); "

    Tushar A. - "class Node { int val; Node left, right; Node(int v) { val = v; left = right = null; } } class BinaryTree { Node root1, root2; boolean identicalTrees(Node a, Node b) { if (a == null && b == null) return true; if (a != null && b != null) return (a.val == b.val && identicalTrees(a.left, b.left) && identicalTrees(a.right, b.right)); "See full answer

    Coding
    Data Structures & Algorithms
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Nvidia logoAsked at Nvidia 
    Add answer
    Software Engineer
    Coding
  • Meta logoAsked at Meta 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
  • Software Engineer
    Coding
  • Apple logoAsked at Apple 
    3 answers

    "Recursion: 0 if NULL, else 1+max(height(left), height(right))"

    Mohith J. - "Recursion: 0 if NULL, else 1+max(height(left), height(right))"See full answer

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

    "function constructTree(n, matrix) { let parent = []; let child = []; let root = null; for (let i = 0; i < n; i++) { for (let j = 0; j < n; j++) { if (matrixi === 1) { parent.push(i); child.push(j); } } } for (let i = 0; i < n; i++) { if (parent.indexOf(i) === -1) { root = i; } } let node = new Node(root); for (let i = 0; i < n; i++) { if (i !== root) { constructTreeUtil(node, parent[i], child[i]); } } return node; }"

    Ugo C. - "function constructTree(n, matrix) { let parent = []; let child = []; let root = null; for (let i = 0; i < n; i++) { for (let j = 0; j < n; j++) { if (matrixi === 1) { parent.push(i); child.push(j); } } } for (let i = 0; i < n; i++) { if (parent.indexOf(i) === -1) { root = i; } } let node = new Node(root); for (let i = 0; i < n; i++) { if (i !== root) { constructTreeUtil(node, parent[i], child[i]); } } return node; }"See full answer

    Coding
    Data Structures & Algorithms
    +1 more
  • Google Cloud (GCP) logoAsked at Google Cloud (GCP) 
    1 answer

    "(Like a Rummy Game) There are 3 colors of tiles. Each tile has a number 1-9 on it. So the 27-tile set makes a deck. There are 4 decks. (Total = 108 tiles) Tile Colors = {Red, Black, Green} The tiles could be grouped together in patterns Types of patterns : The three tiles are identical (R2, R2, R2) The three tiles are of same color and sequential (R2, R3, R4). Sequence cannot be overlapping (R8, R9, R1 is not a pattern) Help : Tile Notations - R2 denotes Red tile having num 2 A player"

    Gopal D. - "(Like a Rummy Game) There are 3 colors of tiles. Each tile has a number 1-9 on it. So the 27-tile set makes a deck. There are 4 decks. (Total = 108 tiles) Tile Colors = {Red, Black, Green} The tiles could be grouped together in patterns Types of patterns : The three tiles are identical (R2, R2, R2) The three tiles are of same color and sequential (R2, R3, R4). Sequence cannot be overlapping (R8, R9, R1 is not a pattern) Help : Tile Notations - R2 denotes Red tile having num 2 A player"See full answer

    Software Engineer
    Coding
  • Andela logoAsked at Andela 
    1 answer

    "let str = 'this is a test of programs'; let obj={}; for (let s of str ) obj[s]?(obj[s]=obj[s]+1):(obj[s]=1) console.log(JSON.stringify(obj))"

    Anonymous Emu - "let str = 'this is a test of programs'; let obj={}; for (let s of str ) obj[s]?(obj[s]=obj[s]+1):(obj[s]=1) console.log(JSON.stringify(obj))"See full answer

    Software Engineer
    Coding
    +2 more
  • Apple logoAsked at Apple 
    Add answer
    Software Engineer
    Coding
    +1 more
  • Apple logoAsked at Apple 
    1 answer

    "filter function usually exists in some high level programming that adopt FP paradigm. It taks a sequence of items and a predicate function, and returns (conceptually) a subset of the items that satisfy the predicate. Adopt this kind of operation (filter, map, reduce, take, pairwise ...) can help writting cleaner code, and reduce the usage of mutable part in the program, lower the possibility of making human mistake. Take Python for example (although const-ness is not exists in Python), assu"

    Weida H. - "filter function usually exists in some high level programming that adopt FP paradigm. It taks a sequence of items and a predicate function, and returns (conceptually) a subset of the items that satisfy the predicate. Adopt this kind of operation (filter, map, reduce, take, pairwise ...) can help writting cleaner code, and reduce the usage of mutable part in the program, lower the possibility of making human mistake. Take Python for example (although const-ness is not exists in Python), assu"See full answer

    Software Engineer
    Coding
    +1 more
  • Apple logoAsked at Apple 
    Add answer
    Software Engineer
    Coding
    +1 more
  • Bolt logoAsked at Bolt 
    1 answer

    "import re def naturalsortkey(s): Split the string into a list of text and numbers "item10" -> ["item", 10] return [int(text) if text.isdigit() else text.lower() for text in re.split(r'(\d+)', s)] def natural_sort(arr): return sorted(arr, key=naturalsortkey) \# Example Usage data = ["item10", "item2", "item1", "item20", "2nd item", "1st item"] sorteddata = naturalsort(data) print(f"Standard Sort: {sorted(data)}") print(f"Natural Sort: {sorted_data}") "

    Yitayal B. - "import re def naturalsortkey(s): Split the string into a list of text and numbers "item10" -> ["item", 10] return [int(text) if text.isdigit() else text.lower() for text in re.split(r'(\d+)', s)] def natural_sort(arr): return sorted(arr, key=naturalsortkey) \# Example Usage data = ["item10", "item2", "item1", "item20", "2nd item", "1st item"] sorteddata = naturalsort(data) print(f"Standard Sort: {sorted(data)}") print(f"Natural Sort: {sorted_data}") "See full answer

    Software Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    Add answer
    Video answer for 'Print all possible solutions to the N-Queens problem.'
    Data Engineer
    Coding
    +2 more
  • "I got it right"

    Rudransh V. - "I got it right"See full answer

    Software Engineer
    Coding
    +1 more
  • LinkedIn logoAsked at LinkedIn 
    Add answer
    Machine Learning Engineer
    Coding
    +1 more
Showing 381-400 of 419