"I tried solving this question and here is the recorded video for the entire solution - https://youtu.be/G_LIbTp58XA
Feel free to comment here or on the video for further discussion."
Rjj - "I tried solving this question and here is the recorded video for the entire solution - https://youtu.be/G_LIbTp58XA
Feel free to comment here or on the video for further discussion."See full answer
"Microsoft's mission is to empower every person and every organisation on the planet to achieve more. I am always inspired by helping others to achieve more by participating to different volunteer and mentorship experiences like Microsoft Student Ambassador, and GeeksForGeeks student ambassador, and I have also created and shared a free competitive-programming guide which once reached more than 700 stars on github, that enables students and professionals to join Microsoft like Microsoft, that hav"
Davide P. - "Microsoft's mission is to empower every person and every organisation on the planet to achieve more. I am always inspired by helping others to achieve more by participating to different volunteer and mentorship experiences like Microsoft Student Ambassador, and GeeksForGeeks student ambassador, and I have also created and shared a free competitive-programming guide which once reached more than 700 stars on github, that enables students and professionals to join Microsoft like Microsoft, that hav"See full answer
"
from typing import List
def getnumberof_islands(binaryMatrix: List[List[int]]) -> int:
if not binaryMatrix: return 0
rows = len(binaryMatrix)
cols = len(binaryMatrix[0])
islands = 0
for r in range(rows):
for c in range(cols):
if binaryMatrixr == 1:
islands += 1
dfs(binaryMatrix, r, c)
return islands
def dfs(grid, r, c):
if (
r = len(grid)
"
Rick E. - "
from typing import List
def getnumberof_islands(binaryMatrix: List[List[int]]) -> int:
if not binaryMatrix: return 0
rows = len(binaryMatrix)
cols = len(binaryMatrix[0])
islands = 0
for r in range(rows):
for c in range(cols):
if binaryMatrixr == 1:
islands += 1
dfs(binaryMatrix, r, c)
return islands
def dfs(grid, r, c):
if (
r = len(grid)
"See full answer
"function findPrimes(n) {
if (n < 2) return [];
const primes = [];
for (let i=2; i <= n; i++) {
const half = Math.floor(i/2);
let isPrime = true;
for (let prime of primes) {
if (i % prime === 0) {
isPrime = false;
break;
}
}
if (isPrime) {
primes.push(i);
}
}
return primes;
}
`"
Tiago R. - "function findPrimes(n) {
if (n < 2) return [];
const primes = [];
for (let i=2; i <= n; i++) {
const half = Math.floor(i/2);
let isPrime = true;
for (let prime of primes) {
if (i % prime === 0) {
isPrime = false;
break;
}
}
if (isPrime) {
primes.push(i);
}
}
return primes;
}
`"See full answer
Software Engineer
Data Structures & Algorithms
+4 more
🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.
"from typing import List
def three_sum(nums: List[int]) -> List[List[int]]:
nums.sort()
triplets = set()
for i in range(len(nums) - 2):
firstNum = nums[i]
l = i + 1
r = len(nums) - 1
while l 0:
r -= 1
elif potentialSum < 0:
l += 1
"
Anonymous Roadrunner - "from typing import List
def three_sum(nums: List[int]) -> List[List[int]]:
nums.sort()
triplets = set()
for i in range(len(nums) - 2):
firstNum = nums[i]
l = i + 1
r = len(nums) - 1
while l 0:
r -= 1
elif potentialSum < 0:
l += 1
"See full answer
"Let’s say the matrix is m x n (i.e., m rows and n columns).
Start from the top-right corner of the matrix.
Move left if you see a 1.
Move down if you see a 0.
Keep track of the row index where you last saw the leftmost 1 — that row has the most 1s.
public class MaxOnesRow {
public static int rowWithMostOnes(int matrix) {
int rows = matrix.length;
int cols = matrix[0].length;
int maxRowIndex = -1;
int j = cols - 1; /"
Khushbu R. - "Let’s say the matrix is m x n (i.e., m rows and n columns).
Start from the top-right corner of the matrix.
Move left if you see a 1.
Move down if you see a 0.
Keep track of the row index where you last saw the leftmost 1 — that row has the most 1s.
public class MaxOnesRow {
public static int rowWithMostOnes(int matrix) {
int rows = matrix.length;
int cols = matrix[0].length;
int maxRowIndex = -1;
int j = cols - 1; /"See full answer
"TCP server/client to facilitate high throughput of incoming metrics.(This is the standard used in the industry by Datadog etc).
NoSQL or timeseries database for storing metrics. Timeseries databases are better for aggregating metrics in a given time period.
REST API for serving metrics data to visualization frontend."
Abhi R. - "TCP server/client to facilitate high throughput of incoming metrics.(This is the standard used in the industry by Datadog etc).
NoSQL or timeseries database for storing metrics. Timeseries databases are better for aggregating metrics in a given time period.
REST API for serving metrics data to visualization frontend."See full answer
"Clarifying questions: is this a brand new product, or are we improving an existing one? (i.e. are we going to have to migrate an existing codebase or are we starting from scratch?). are we resource-strapped (e.g. # engineers, time)? are there any specific priorities for the product, or should i leave it open-ended?
Assume: brand new product, well-resourced, no specific priorities.
It seems that there are two sides to this question: 1) technical evaluation of different languages, and 2)"
Laura S. - "Clarifying questions: is this a brand new product, or are we improving an existing one? (i.e. are we going to have to migrate an existing codebase or are we starting from scratch?). are we resource-strapped (e.g. # engineers, time)? are there any specific priorities for the product, or should i leave it open-ended?
Assume: brand new product, well-resourced, no specific priorities.
It seems that there are two sides to this question: 1) technical evaluation of different languages, and 2)"See full answer
"const ops = {
'+': (a, b) => a+b,
'-': (a, b) => a-b,
'/': (a, b) => a/b,
'': (a, b) => ab,
};
function calc(expr) {
// Search for + or -
for (let i=expr.length-1; i >= 0; i--) {
const char = expr.charAt(i);
if (['+', '-'].includes(char)) {
return opschar), calc(expr.slice(i+1)));
}
}
// Search for / or *
for (let i=expr.length-1; i >= 0; i--) {
const char = expr.charAt(i);
if"
Tiago R. - "const ops = {
'+': (a, b) => a+b,
'-': (a, b) => a-b,
'/': (a, b) => a/b,
'': (a, b) => ab,
};
function calc(expr) {
// Search for + or -
for (let i=expr.length-1; i >= 0; i--) {
const char = expr.charAt(i);
if (['+', '-'].includes(char)) {
return opschar), calc(expr.slice(i+1)));
}
}
// Search for / or *
for (let i=expr.length-1; i >= 0; i--) {
const char = expr.charAt(i);
if"See full answer
"class ListNode:
def init(self, val=0, next=None):
self.val = val
self.next = next
def has_cycle(head: ListNode) -> bool:
slow, fast = head, head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
debug your code below
node1 = ListNode(1)
node2 = ListNode(2)
node3 = ListNode(3)
node4 = ListNode(4)
creates a linked list with a cycle: 1 -> 2 -> 3 -> 4"
Anonymous Roadrunner - "class ListNode:
def init(self, val=0, next=None):
self.val = val
self.next = next
def has_cycle(head: ListNode) -> bool:
slow, fast = head, head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
debug your code below
node1 = ListNode(1)
node2 = ListNode(2)
node3 = ListNode(3)
node4 = ListNode(4)
creates a linked list with a cycle: 1 -> 2 -> 3 -> 4"See full answer
"The reason I want to work at Doordash is because I’m a really hard worker, I never give up and I’m good at delivering stuff to my teachers at school whenever they have something to drop off to them, I look at the paper and then I read the directions given to me on the ipad to drop it off."
Amparo L. - "The reason I want to work at Doordash is because I’m a really hard worker, I never give up and I’m good at delivering stuff to my teachers at school whenever they have something to drop off to them, I look at the paper and then I read the directions given to me on the ipad to drop it off."See full answer
"Was given 90 minutes with an exhaustive set of requirements to be implemented as a full-stack coding exercise. It was supposed to have a UX, a server and a database to store and retrieve data.
The IDE was supposed to be self-setup before the interview.
The panel asked questions on top of the implementation around decision making from a technical perspective"
Aman G. - "Was given 90 minutes with an exhaustive set of requirements to be implemented as a full-stack coding exercise. It was supposed to have a UX, a server and a database to store and retrieve data.
The IDE was supposed to be self-setup before the interview.
The panel asked questions on top of the implementation around decision making from a technical perspective"See full answer
"Here is my first shot at it. Please excuse formatting.
To find the maximum depth of the dependencies given a list of nodes, each having a unique string id and a list of subnodes it depends on, you can perform a depth-first search (DFS) to traverse the dependency graph. Here's how you can implement this:
Represent the nodes and their dependencies using a dictionary.
Perform a DFS on each node to find the maximum depth of the dependencies.
Keep track of the maximum depth encountered dur"
Tes d H. - "Here is my first shot at it. Please excuse formatting.
To find the maximum depth of the dependencies given a list of nodes, each having a unique string id and a list of subnodes it depends on, you can perform a depth-first search (DFS) to traverse the dependency graph. Here's how you can implement this:
Represent the nodes and their dependencies using a dictionary.
Perform a DFS on each node to find the maximum depth of the dependencies.
Keep track of the maximum depth encountered dur"See full answer