Software Engineer Interview Questions

Review this list of 438 software engineer interview questions and answers verified by hiring managers and candidates.
  • Apple logoAsked at Apple 

    "A red-black tree is a self-balancing binary search tree. The motivation for this is that the benefits of O(logN) search, insertion, and deletion that a binary tree provides us will disappear if we let the tree get too "imbalanced" (e.g. there are too many nodes on one side of the tree or some branches have a depth that is way out of proportion to the average branch depth). This imbalance will occur if we don't adjust the tree after inserting or deleting nodes, hence our need for self-balancing c"

    Alex M. - "A red-black tree is a self-balancing binary search tree. The motivation for this is that the benefits of O(logN) search, insertion, and deletion that a binary tree provides us will disappear if we let the tree get too "imbalanced" (e.g. there are too many nodes on one side of the tree or some branches have a depth that is way out of proportion to the average branch depth). This imbalance will occur if we don't adjust the tree after inserting or deleting nodes, hence our need for self-balancing c"See full answer

    Software Engineer
    Data Structures & Algorithms
    +1 more
  • "Implemented the Java code to find the largest island. It is similar to count the island. But in this we need to keep track of max island and compute its perimeter."

    Techzen I. - "Implemented the Java code to find the largest island. It is similar to count the island. But in this we need to keep track of max island and compute its perimeter."See full answer

    Software Engineer
    Data Structures & Algorithms
    +2 more
  • Airbnb logoAsked at Airbnb 

    "Colleague moved to a different role, so I decided to fill in and did outshine in showing results within the group."

    Raunak K. - "Colleague moved to a different role, so I decided to fill in and did outshine in showing results within the group."See full answer

    Software Engineer
    Behavioral
    +2 more
  • Spotify logoAsked at Spotify 

    Balanced Tree

    IDE
    Medium
    +5

    "function visitChildren(node) { let leftSubtreeHeight = 0; let rightSubtreeHeight = 0; let isChildrenBalanced = true; if (node.left) { const { isBalanced, height } = visitChildren(node.left); isChildrenBalanced = isChildrenBalanced && isBalanced; leftSubtreeHeight += height + 1; } if (isChildrenBalanced && node.right) { const { isBalanced, height } = visitChildren(node.right); isChildrenBalanced = isChildrenBalanced && isBalan"

    Tiago R. - "function visitChildren(node) { let leftSubtreeHeight = 0; let rightSubtreeHeight = 0; let isChildrenBalanced = true; if (node.left) { const { isBalanced, height } = visitChildren(node.left); isChildrenBalanced = isChildrenBalanced && isBalanced; leftSubtreeHeight += height + 1; } if (isChildrenBalanced && node.right) { const { isBalanced, height } = visitChildren(node.right); isChildrenBalanced = isChildrenBalanced && isBalan"See full answer

    Software Engineer
    Data Structures & Algorithms
    +1 more
  • "Initially I asked clarifying questions like whether the tree can be empty or not and asked the interviewer to explain what is meant by left view and the explanation for the sample inputs. Then I came up with the level order traversal approach where we visit each level in the binary tree at once using a queue and at each level print the value of the first node. Interviewer seemed satisfied with the approach and asked me to code it up. Finally gave the time and space complexity of the solution."

    Ds S. - "Initially I asked clarifying questions like whether the tree can be empty or not and asked the interviewer to explain what is meant by left view and the explanation for the sample inputs. Then I came up with the level order traversal approach where we visit each level in the binary tree at once using a queue and at each level print the value of the first node. Interviewer seemed satisfied with the approach and asked me to code it up. Finally gave the time and space complexity of the solution."See full answer

    Software Engineer
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • +5

    "function knapsack(weights, values, cap) { const indicesByValue = Object.keys(weights).map(weight => parseInt(weight)); indicesByValue.sort((a, b) => values[b]-values[a]); const steps = new Map(); function knapsackStep(cap, sack) { if (steps.has(sack)) { return steps.get(sack); } let maxOutput = 0; for (let index of indicesByValue) { if (!sack.has(index) && weights[index] <= cap) { maxOutput ="

    Tiago R. - "function knapsack(weights, values, cap) { const indicesByValue = Object.keys(weights).map(weight => parseInt(weight)); indicesByValue.sort((a, b) => values[b]-values[a]); const steps = new Map(); function knapsackStep(cap, sack) { if (steps.has(sack)) { return steps.get(sack); } let maxOutput = 0; for (let index of indicesByValue) { if (!sack.has(index) && weights[index] <= cap) { maxOutput ="See full answer

    Software Engineer
    Data Structures & Algorithms
    +2 more
  • "Depend on the array size and number of 0's theere."

    Nasit S. - "Depend on the array size and number of 0's theere."See full answer

    Software Engineer
    Data Structures & Algorithms
    +1 more
  • Amazon logoAsked at Amazon 

    "Situation - A time I saw a peer struggling was while I was at Google working in Mountain View. A fellow colleague of mine was consistently not meeting standards in his performance reviews and wasn’t sure why. He was upset because Google was his dream company and he wasn’t sure how to improve based on his feedback. Task - I was tasked to design a based VUI framework for our discovery space on smart displays. This colleague was acting as the VUI lead for the project while I acted as t"

    Ben G. - "Situation - A time I saw a peer struggling was while I was at Google working in Mountain View. A fellow colleague of mine was consistently not meeting standards in his performance reviews and wasn’t sure why. He was upset because Google was his dream company and he wasn’t sure how to improve based on his feedback. Task - I was tasked to design a based VUI framework for our discovery space on smart displays. This colleague was acting as the VUI lead for the project while I acted as t"See full answer

    Software Engineer
    Behavioral
    +3 more
  • Apple logoAsked at Apple 
    Software Engineer
    System Design
  • Salesforce logoAsked at Salesforce 
    Software Engineer
    Data Structures & Algorithms
    +1 more
  • "This problem can be solved with two approaches Iterative approach Recursive approach Quite easy to think about the iterative approach, you can make use of a while loop in that case. But what if you want to make use of previously computed values? That case going for the recursive solution is quite useful. class Collatz: def init(self) -> None: self.cache = {} self.steps = 0 def steps_from(self, n) -> int: # base case if n == 1: "

    Frederick A. - "This problem can be solved with two approaches Iterative approach Recursive approach Quite easy to think about the iterative approach, you can make use of a while loop in that case. But what if you want to make use of previously computed values? That case going for the recursive solution is quite useful. class Collatz: def init(self) -> None: self.cache = {} self.steps = 0 def steps_from(self, n) -> int: # base case if n == 1: "See full answer

    Software Engineer
    Coding
  • Software Engineer
    Behavioral
  • Notion logoAsked at Notion 
    Software Engineer
    System Design
  • "Understood the problem statement by confirming details with interviewer. Approached by listing down all the basic features being provided by the platform. Platform -> Organizations can register themselves. One org can have more than one recruiters. Recruiters create jobs on the org portal. Candidate can apply to the jobs. Recruiters can accept and reject the applications. Categorized 4 parent tables by taking hints in between. The tables were USER -> ID, Name, Phone No, mail ID, Profile Des.("

    Jaya S. - "Understood the problem statement by confirming details with interviewer. Approached by listing down all the basic features being provided by the platform. Platform -> Organizations can register themselves. One org can have more than one recruiters. Recruiters create jobs on the org portal. Candidate can apply to the jobs. Recruiters can accept and reject the applications. Categorized 4 parent tables by taking hints in between. The tables were USER -> ID, Name, Phone No, mail ID, Profile Des.("See full answer

    Software Engineer
    System Design
  • Lyft logoAsked at Lyft 
    Software Engineer
    Data Structures & Algorithms
    +1 more
  • Amazon logoAsked at Amazon 

    "no"

    Hamilton D. - "no"See full answer

    Software Engineer
    Technical
    +1 more
  • "Whenever I find resistance to my idea, my general approach is to : Validate my idea Identify if it is a political reason or is it a valid engineering tech reason Assuming it is not political but it is resource/difference of opinions that are causing resistance. Then I would try to do a quick POC and show a value proposition for the idea to get the buy-in. One similar situation happened The situation was that stakeholders were promised a feature that would decrease their number of ticket"

    Jaim - "Whenever I find resistance to my idea, my general approach is to : Validate my idea Identify if it is a political reason or is it a valid engineering tech reason Assuming it is not political but it is resource/difference of opinions that are causing resistance. Then I would try to do a quick POC and show a value proposition for the idea to get the buy-in. One similar situation happened The situation was that stakeholders were promised a feature that would decrease their number of ticket"See full answer

    Software Engineer
    Behavioral
    +1 more
  • Amazon logoAsked at Amazon 
    Software Engineer
    Behavioral
  • "Get data from database CDC to Kafka; Write from Kafka to a Bucket; Send the batch file to Visa from time to time;"

    Roger R. - "Get data from database CDC to Kafka; Write from Kafka to a Bucket; Send the batch file to Visa from time to time;"See full answer

    Software Engineer
    System Design
  • Adobe logoAsked at Adobe 
    +5

    "bool isValidBST(TreeNode* root, long min = LONGMIN, long max = LONGMAX){ if (root == NULL) return true; if (root->val val >= max) return false; return isValidBST(root->left, min, root->val) && isValidBST(root->right, root->val, max); } `"

    Alvaro R. - "bool isValidBST(TreeNode* root, long min = LONGMIN, long max = LONGMAX){ if (root == NULL) return true; if (root->val val >= max) return false; return isValidBST(root->left, min, root->val) && isValidBST(root->right, root->val, max); } `"See full answer

    Software Engineer
    Coding
    +4 more
Showing 241-260 of 438