Software Engineer Coding Interview Questions

Review this list of 175 coding software engineer interview questions and answers verified by hiring managers and candidates.
  • Adobe logoAsked at Adobe 
    Video answer for 'Edit distance'
    +16

    "from collections import deque def updateword(words, startword, end_word): if end_word not in words: return None # Early exit if end_word is not in the dictionary queue = deque([(start_word, 0)]) # (word, steps) visited = set([start_word]) # Keep track of visited words while queue: word, steps = queue.popleft() if word == end_word: return steps # Found the target word, return steps for i in range(len(word)): "

    叶 路. - "from collections import deque def updateword(words, startword, end_word): if end_word not in words: return None # Early exit if end_word is not in the dictionary queue = deque([(start_word, 0)]) # (word, steps) visited = set([start_word]) # Keep track of visited words while queue: word, steps = queue.popleft() if word == end_word: return steps # Found the target word, return steps for i in range(len(word)): "See full answer

    Software Engineer
    Coding
    +3 more
  • "Max distance can be between cat to rat or cat to bread. lets say it is x. I tried to find a path between rat and bread using DFS for every distance from cat(max upto x)."

    Pankaj G. - "Max distance can be between cat to rat or cat to bread. lets say it is x. I tried to find a path between rat and bread using DFS for every distance from cat(max upto x)."See full answer

    Software Engineer
    Coding
    +1 more
  • Video answer for 'Employee Earnings.'
    +35

    "SELECT employees.first_name, managers.salary AS manager_salary FROM employees LEFT JOIN employees AS managers ON employees.manager_id = managers.id WHERE employees.salary > managers.salary `"

    Tiffany A. - "SELECT employees.first_name, managers.salary AS manager_salary FROM employees LEFT JOIN employees AS managers ON employees.manager_id = managers.id WHERE employees.salary > managers.salary `"See full answer

    Software Engineer
    Coding
    +2 more
  • Apple logoAsked at Apple 
    Video answer for 'Find the container with the maximum volume of water.'

    "int getMaxWater(vector& nums) { int n = nums.size(); int mx = INT_MIN; int i=0, j=n-1; while(i<j) { int water = (j - i) * min(nums[i], nums[j]); mx = max(mx, water); if(nums[i] < nums[j]){ i++; } else { j--; } } return mx; } `"

    Richard W. - "int getMaxWater(vector& nums) { int n = nums.size(); int mx = INT_MIN; int i=0, j=n-1; while(i<j) { int water = (j - i) * min(nums[i], nums[j]); mx = max(mx, water); if(nums[i] < nums[j]){ i++; } else { j--; } } return mx; } `"See full answer

    Software Engineer
    Coding
    +3 more
  • Adobe logoAsked at Adobe 
    +28

    "Reversing a linked list is a very popular question. We have two approaches to reverse the linked list: Iterative approach and recursion approach. Iterative approach (JavaScript) function reverseLL(head){ if(head === null) return head; let prv = null; let next = null; let cur = head; while(cur){ next = cur.next; //backup cur.next = prv; prv = cur; cur = next; } head = prv; return head; } Recursion Approach (JS) function reverseLLByRecursion("

    Satyam S. - "Reversing a linked list is a very popular question. We have two approaches to reverse the linked list: Iterative approach and recursion approach. Iterative approach (JavaScript) function reverseLL(head){ if(head === null) return head; let prv = null; let next = null; let cur = head; while(cur){ next = cur.next; //backup cur.next = prv; prv = cur; cur = next; } head = prv; return head; } Recursion Approach (JS) function reverseLLByRecursion("See full answer

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

  • +20

    "Since the problem asks for a O(logN) solution, I have to assume that the numbers are already sorted, meaning the same number are adjacent to each other, the value of the numbers shouldn't matter, and they expect us to use Binary Search. First, we should analyze the pattern of a regular number array without a single disrupter. Index: 0 1 2 3 4. 5 6. 7. 8. 9 Array:[1, 1, 2, 2, 4, 4, 5, 5, 6, 6] notice the odd indexes are always referencing the second of the reoccurring numbers and t"

    Bamboo Y. - "Since the problem asks for a O(logN) solution, I have to assume that the numbers are already sorted, meaning the same number are adjacent to each other, the value of the numbers shouldn't matter, and they expect us to use Binary Search. First, we should analyze the pattern of a regular number array without a single disrupter. Index: 0 1 2 3 4. 5 6. 7. 8. 9 Array:[1, 1, 2, 2, 4, 4, 5, 5, 6, 6] notice the odd indexes are always referencing the second of the reoccurring numbers and t"See full answer

    Software Engineer
    Coding
  • "Batch Packing Problem In Amazon’s massive warehouse inventory, there are different types of products. You are given an array products of size n, where products[i] represents the number of items of product type i. These products need to be packed into batches for shipping. The batch packing must adhere to the following conditions: No two items in the same batch can be of the same product type. The number of items packed in the current batch must be strictly greater than the number pack"

    Anonymous Goat - "Batch Packing Problem In Amazon’s massive warehouse inventory, there are different types of products. You are given an array products of size n, where products[i] represents the number of items of product type i. These products need to be packed into batches for shipping. The batch packing must adhere to the following conditions: No two items in the same batch can be of the same product type. The number of items packed in the current batch must be strictly greater than the number pack"See full answer

    Software Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    +25

    "public static boolean isPalindrome(String str){ boolean flag = true; int len = str.length()-1; int j = len; for(int i=0;i<=len/2;i++){ if(str.charAt(i)!=str.charAt(j--)){ flag = false; break; } } return flag; }"

    Sravanthi M. - "public static boolean isPalindrome(String str){ boolean flag = true; int len = str.length()-1; int j = len; for(int i=0;i<=len/2;i++){ if(str.charAt(i)!=str.charAt(j--)){ flag = false; break; } } return flag; }"See full answer

    Software Engineer
    Coding
    +4 more
  • +8

    "Used Recursive approach to traverse the binary search tree and sum the values of the nodes that fall within the specified range [low, high]"

    Srikant V. - "Used Recursive approach to traverse the binary search tree and sum the values of the nodes that fall within the specified range [low, high]"See full answer

    Software Engineer
    Coding
    +1 more
  • Amazon logoAsked at Amazon 
    +8

    "I firstly discuss the brute force approach in O(n^2) time complexity , than i moved to O(nlogn) tine complexity than i discussed the O(n) time complexity and O(n) space complexity . But interviewer want more optimised solution , in O(n) time complexity without using extra space , The solution wants O(1) space complexity i have to do changes in same array without using any space . This method is something like i have to place positive values to its original position by swapping and rest negativ"

    Anni P. - "I firstly discuss the brute force approach in O(n^2) time complexity , than i moved to O(nlogn) tine complexity than i discussed the O(n) time complexity and O(n) space complexity . But interviewer want more optimised solution , in O(n) time complexity without using extra space , The solution wants O(1) space complexity i have to do changes in same array without using any space . This method is something like i have to place positive values to its original position by swapping and rest negativ"See full answer

    Software Engineer
    Coding
    +1 more
  • "This was a 60 minute assessment. The clock is ticking and you're being observed by a senior+ level engineer. Be ready to perform for an audience. The implementation for the system gets broken up into three parts: Implement creating accounts and depositing money into an account by ID Implement transferring money with validation to ensure the accounts for the transfer both exist and that the account money is being removed from has enough money in it to perform the transfer Implement find"

    devopsjesus - "This was a 60 minute assessment. The clock is ticking and you're being observed by a senior+ level engineer. Be ready to perform for an audience. The implementation for the system gets broken up into three parts: Implement creating accounts and depositing money into an account by ID Implement transferring money with validation to ensure the accounts for the transfer both exist and that the account money is being removed from has enough money in it to perform the transfer Implement find"See full answer

    Software Engineer
    Coding
  • " Compare alternate houses i.e for each house starting from the third, calculate the maximum money that can be stolen up to that house by choosing between: Skipping the current house and taking the maximum money stolen up to the previous house. Robbing the current house and adding its value to the maximum money stolen up to the house two steps back. package main import ( "fmt" ) // rob function calculates the maximum money a robber can steal func maxRob(nums []int) int { ln"

    VContaineers - " Compare alternate houses i.e for each house starting from the third, calculate the maximum money that can be stolen up to that house by choosing between: Skipping the current house and taking the maximum money stolen up to the previous house. Robbing the current house and adding its value to the maximum money stolen up to the house two steps back. package main import ( "fmt" ) // rob function calculates the maximum money a robber can steal func maxRob(nums []int) int { ln"See full answer

    Software Engineer
    Coding
    +4 more
  • Microsoft logoAsked at Microsoft 

    "#simple solution 1.firstly find the node in the bst (O(logn) time complexity it take) 2.now removing the node consists of 3 cases: 1.if the node is leaf (no children): (keep track of parent and do) parent.left or parent.right=NULL simply remove the node () 2.if(has one child) replace the node with its child 3.if has both childs we replace the node with either inorder predesor(max of left tree)or inorder succesor and remove the node wh"

    Sambangi C. - "#simple solution 1.firstly find the node in the bst (O(logn) time complexity it take) 2.now removing the node consists of 3 cases: 1.if the node is leaf (no children): (keep track of parent and do) parent.left or parent.right=NULL simply remove the node () 2.if(has one child) replace the node with its child 3.if has both childs we replace the node with either inorder predesor(max of left tree)or inorder succesor and remove the node wh"See full answer

    Software Engineer
    Coding
  • +2

    "Implemented a recursive function which returns the length of the list so far. when the returned value equals k + 1 , assign current.next = current.next.next. If I made it back to the head return root.next as the new head of the linked list."

    דניאל ר. - "Implemented a recursive function which returns the length of the list so far. when the returned value equals k + 1 , assign current.next = current.next.next. If I made it back to the head return root.next as the new head of the linked list."See full answer

    Software Engineer
    Coding
    +2 more
  • "Use Dutch National Flag Algorithm to solve the problem"

    Sireesha R. - "Use Dutch National Flag Algorithm to solve the problem"See full answer

    Software Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    +16

    "We can use dictionary to store cache items so that our read / write operations will be O(1). Each time we read or update an existing record, we have to ensure the item is moved to the back of the cache. This will allow us to evict the first item in the cache whenever the cache is full and we need to add new records also making our eviction O(1) Instead of normal dictionary, we will use ordered dictionary to store cache items. This will allow us to efficiently move items to back of the cache a"

    Alfred O. - "We can use dictionary to store cache items so that our read / write operations will be O(1). Each time we read or update an existing record, we have to ensure the item is moved to the back of the cache. This will allow us to evict the first item in the cache whenever the cache is full and we need to add new records also making our eviction O(1) Instead of normal dictionary, we will use ordered dictionary to store cache items. This will allow us to efficiently move items to back of the cache a"See full answer

    Software Engineer
    Coding
    +6 more
  • +2

    "Started off with brute force then optimized solution"

    Nikhil R. - "Started off with brute force then optimized solution"See full answer

    Software Engineer
    Coding
    +2 more
  • Meta (Facebook) logoAsked at Meta (Facebook) 
    Software Engineer
    Coding
    +1 more
  • Adobe logoAsked at Adobe 

    "Use a representative of each, e.g. sort the string and add it to the value of a hashmap> where we put all the words that belong to the same anagram together."

    Gaston B. - "Use a representative of each, e.g. sort the string and add it to the value of a hashmap> where we put all the words that belong to the same anagram together."See full answer

    Software Engineer
    Coding
    +4 more
  • +9

    "Would be better to adjust resolution in the video player directly."

    Anonymous Prawn - "Would be better to adjust resolution in the video player directly."See full answer

    Software Engineer
    Coding
    +4 more
Showing 1-20 of 175