"I studied Exponent's TinyURL system design video. My interviewer was asking many detailed questions on API design, schema, as well as data required to store. I found system design questions are bit high level instead of depth. I think should have detail design of API, schema and some additional flavors."
Yag S. - "I studied Exponent's TinyURL system design video. My interviewer was asking many detailed questions on API design, schema, as well as data required to store. I found system design questions are bit high level instead of depth. I think should have detail design of API, schema and some additional flavors."See full answer
"Even more faster and vectorized version, using np.linalg.norm - to avoid loop and np.argpartition to select lowest k. We dont need to sort whole array - we need to be sure that first k elements are lower than the rest.
import numpy as np
def knn(Xtrain, ytrain, X_new, k):
distances = np.linalg.norm(Xtrain - Xnew, axis=1)
k_indices = np.argpartition(distances, k)[:k] # O(N) selection instead of O(N log N) sort
return int(np.sum(ytrain[kindices]) > k / 2.0)
`"
Dinar M. - "Even more faster and vectorized version, using np.linalg.norm - to avoid loop and np.argpartition to select lowest k. We dont need to sort whole array - we need to be sure that first k elements are lower than the rest.
import numpy as np
def knn(Xtrain, ytrain, X_new, k):
distances = np.linalg.norm(Xtrain - Xnew, axis=1)
k_indices = np.argpartition(distances, k)[:k] # O(N) selection instead of O(N log N) sort
return int(np.sum(ytrain[kindices]) > k / 2.0)
`"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
"Count items between indices within compartments
compartments are delineated by by: '|'
items are identified by: '*'
input_inventory = "*||||"
inputstartidxs = [1, 4, 6]
inputendidxs = [9, 5, 8]
expected_output = [3, 0, 1]
Explanation:
"*||||"
0123456789... indices
++ + # within compartments
^ start_idx = 1
^ end_idx = 9
-- - # within idxs but not within compartments
"*||||"
0123456789... indices
"
Anonymous Unicorn - "Count items between indices within compartments
compartments are delineated by by: '|'
items are identified by: '*'
input_inventory = "*||||"
inputstartidxs = [1, 4, 6]
inputendidxs = [9, 5, 8]
expected_output = [3, 0, 1]
Explanation:
"*||||"
0123456789... indices
++ + # within compartments
^ start_idx = 1
^ end_idx = 9
-- - # within idxs but not within compartments
"*||||"
0123456789... indices
"See full answer
Software Engineer
Data Structures & Algorithms
+1 more
🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.
"Arrays.sort(inputarray)
sliding window with a size of 2.
Check for the sum in the sliding window.
subtract the start when window moves"
Sridhar R. - "Arrays.sort(inputarray)
sliding window with a size of 2.
Check for the sum in the sliding window.
subtract the start when window moves"See full answer
"Understanding the Basics
Choosing Learning Resources
Practicing and Applying Knowledge
Seeking Help and Staying Updated
Leveraging Modern Tools"
An D. - "Understanding the Basics
Choosing Learning Resources
Practicing and Applying Knowledge
Seeking Help and Staying Updated
Leveraging Modern Tools"See full answer
"Functional Requirement
Monitor health, metrics
Alert in case of failure/anomaly
Visualize the live health
Analyse machines on periodic basis
Non Functional
Should not exert load on machines
low latency
Highly scalable
Logs/Metrics Gathering
push - machine gather and send to system and low priority background thread along with batching
pull - heart beat check (for offline machines)
Processing
Real time streaming using Kafka/kinesis + Flink
TimeSeries database for stor"
Sourabh G. - "Functional Requirement
Monitor health, metrics
Alert in case of failure/anomaly
Visualize the live health
Analyse machines on periodic basis
Non Functional
Should not exert load on machines
low latency
Highly scalable
Logs/Metrics Gathering
push - machine gather and send to system and low priority background thread along with batching
pull - heart beat check (for offline machines)
Processing
Real time streaming using Kafka/kinesis + Flink
TimeSeries database for stor"See full answer
"I faced a problem about components re-rendering's and unnecessary requests API's which was causing performance complications in my applicactions. I had a structure that create, edit and delete task, so GET, POST, PUT and DELETE API's methods request was necessary and bring that to compliance without compromissing the performance is hard. I started involving componentes and async functions into the useMemo's and useEffect's to have more control, another improvement was take be careful with global"
Rolemberg J. - "I faced a problem about components re-rendering's and unnecessary requests API's which was causing performance complications in my applicactions. I had a structure that create, edit and delete task, so GET, POST, PUT and DELETE API's methods request was necessary and bring that to compliance without compromissing the performance is hard. I started involving componentes and async functions into the useMemo's and useEffect's to have more control, another improvement was take be careful with global"See full answer
"Our team were developing a HQ trivia for fitness. So at that moment our focus was developing an eye-catching animation for both iOS and Android. By the way, implementing an animation were hard without the progress of it. So we wanted to see an immediate progress. So I decided to use tools or libraries such as Lottie or Kite. Then it increased the quality and the productivity dramatically. So our designer were happy with it and also our dev team could reuse the code from the designed animation fr"
Woongshik C. - "Our team were developing a HQ trivia for fitness. So at that moment our focus was developing an eye-catching animation for both iOS and Android. By the way, implementing an animation were hard without the progress of it. So we wanted to see an immediate progress. So I decided to use tools or libraries such as Lottie or Kite. Then it increased the quality and the productivity dramatically. So our designer were happy with it and also our dev team could reuse the code from the designed animation fr"See full answer
"Follow STAR
Example:
In my most recent role at x, we've been working every quarter to set our quarterly goals or even decide for the year but given in 2022 we've been through a great resignation phase there was a high attrition because of which we have overloaded engineering teams.
During last quarterly planning, I started to question with my manager about giving a focus to our engineering, so we complete one thing absolutely fine which is more impactful for our customers and add immediate val"
Ash I. - "Follow STAR
Example:
In my most recent role at x, we've been working every quarter to set our quarterly goals or even decide for the year but given in 2022 we've been through a great resignation phase there was a high attrition because of which we have overloaded engineering teams.
During last quarterly planning, I started to question with my manager about giving a focus to our engineering, so we complete one thing absolutely fine which is more impactful for our customers and add immediate val"See full answer
"I told a story about having good intentions to help out a superior with a problem but I did so without seeking buy-in (permission) first. While I did solve the problem and provided value to him and my other colleagues, I was reprimanded for crossing boundaries and not respecting his privacy (I accessed his computer without his permission to deliver a resolution to a problem).
While I had good intentions and the outcome was good, my approach left me with a negative mark and a life long lesson r"
Zakery K. - "I told a story about having good intentions to help out a superior with a problem but I did so without seeking buy-in (permission) first. While I did solve the problem and provided value to him and my other colleagues, I was reprimanded for crossing boundaries and not respecting his privacy (I accessed his computer without his permission to deliver a resolution to a problem).
While I had good intentions and the outcome was good, my approach left me with a negative mark and a life long lesson r"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
"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
"Should this question be BST, not just BT? Otherwise it would not be possible to reconstruct the tree solely based on the array regardless of its order"
TreeOfWisdom - "Should this question be BST, not just BT? Otherwise it would not be possible to reconstruct the tree solely based on the array regardless of its order"See full answer
"To recount an experience from my last project . We were at the initial stages of designing a new data platform to enhance our trading analytics capabilities. The conflict arose over the selection of a data processing framework. I was advocating for Apache Spark due to its scalability and performance benefits, especially for handling large volumes of derivatives data. Another senior team member preferred a different technology they had more experience with, which they believed would be easier to"
Scott S. - "To recount an experience from my last project . We were at the initial stages of designing a new data platform to enhance our trading analytics capabilities. The conflict arose over the selection of a data processing framework. I was advocating for Apache Spark due to its scalability and performance benefits, especially for handling large volumes of derivatives data. Another senior team member preferred a different technology they had more experience with, which they believed would be easier to"See full answer