Forward deployed software engineer interview questions shared by candidates
Given an nxn matrix of 1's and 0's, figure out if all of the 1's are connected.
Count all 1's in the matrix and store the number in a variable. Then use a dfs or bfs starting from a node with a 1, considering any adjacent 1 entries as neighbors. Count the number of entries reached through the search. If it's equal to the total number of 1's in the array, return true. Otherwise, return false.
Keep a hash set of nodes already visited. Count the number of 1s in the matrix and store that in some int variable count. Iterate through matrix until a node with 1 is found. Use dfs or bfs starting from this node to visit all nodes with 1, checking each time if that node is contained in your hash set to avoid revisiting nodes and then adding to that hash set if the node has not been visited yet. After traversal is done, compare count to size of hashset. If equal, then return true else return false.
Basic tree/caching/class questions. Nothing too hard but the questions all had a right answer and an extra-mile answer. Like I said, see their website for what a decomposition is.
See Interview Questions for Similar Jobs
- Software Engineer
- Software Developer
- Software Engineer Intern
- Software Engineering Intern
- Senior Software Engineer
- Software Development Engineer
- Product Manager
- Software Engineering
- Associate Product Manager
- Data Scientist
- Technology Analyst