"we can use two pointer + set like maintain i,j and also insert jth character to set like while set size is equal to our window j-i+1 then maximize our answer and increase jth pointer till last index"
Kishor J. - "we can use two pointer + set like maintain i,j and also insert jth character to set like while set size is equal to our window j-i+1 then maximize our answer and increase jth pointer till last index"See full answer
"In the Transformer architecture, the decoder differs from the encoder primarily in its additional mechanisms designed to handle autoregressive sequence generation. Here's a breakdown of the key differences:
Self-Attention Mechanism:
Encoder: The encoder has a standard self-attention mechanism that allows each token to attend to all other tokens in the input sequence.
Decoder: The decoder has two types of self-attention. The first is the same as in the encoder, but the second is mas"
Ranj A. - "In the Transformer architecture, the decoder differs from the encoder primarily in its additional mechanisms designed to handle autoregressive sequence generation. Here's a breakdown of the key differences:
Self-Attention Mechanism:
Encoder: The encoder has a standard self-attention mechanism that allows each token to attend to all other tokens in the input sequence.
Decoder: The decoder has two types of self-attention. The first is the same as in the encoder, but the second is mas"See full answer
"there's no audio the last ~10 minutes from the interviewer so we can't get a sense of the feedback from the interviewer.
I did think it took the interviewee a little too long to figure out the issue itself and could have benefited from taking some time to think and gather thoughts before jumping into drivers of the issue."
Sabi M. - "there's no audio the last ~10 minutes from the interviewer so we can't get a sense of the feedback from the interviewer.
I did think it took the interviewee a little too long to figure out the issue itself and could have benefited from taking some time to think and gather thoughts before jumping into drivers of the issue."See full answer
"SELECT
u.user_id,
u.user_name,
u.email,
ROUND(AVG(CASE WHEN b.status = 'Unmatched' THEN 1.0 ELSE 0 END), 2) AS avgunmatchedbookings
FROM
users u
LEFT JOIN
bookings b ON u.userid = b.userid
GROUP BY
u.user_id,
u.user_name,
u.email;
`"
Akshay D. - "SELECT
u.user_id,
u.user_name,
u.email,
ROUND(AVG(CASE WHEN b.status = 'Unmatched' THEN 1.0 ELSE 0 END), 2) AS avgunmatchedbookings
FROM
users u
LEFT JOIN
bookings b ON u.userid = b.userid
GROUP BY
u.user_id,
u.user_name,
u.email;
`"See full answer
"#inplace reversal without inbuilt functions
def reverseString(s):
chars = list(s)
l, r = 0, len(s)-1
while l < r:
chars[l],chars[r] = chars[r],chars[l]
l += 1
r -= 1
reversed = "".join(chars)
return reversed
"
Anonymous Possum - "#inplace reversal without inbuilt functions
def reverseString(s):
chars = list(s)
l, r = 0, len(s)-1
while l < r:
chars[l],chars[r] = chars[r],chars[l]
l += 1
r -= 1
reversed = "".join(chars)
return reversed
"See full answer
Data Scientist
Data Structures & Algorithms
+4 more
🧠Want an expert answer to a question? Saving questions lets us know what content to make next.
"Required output in the solution not the one requested from the question. only customerid, firstname, last_name and years were required. Please this needs to be very clear.
Otherwise my answer is
with totalorderyear as (
SELECT
o.customer_id,
c.first_name,
c.last_name,
EXTRACT(YEAR FROM o.orderdate) AS orderyear,
COUNT(o.orderid) AS totalorders
FROM orders o
LEFT JOIN customers c
ON c.customerid = o.customerid
GROUP BY o.customerid, c.firstname, c.last"
Gloriose H. - "Required output in the solution not the one requested from the question. only customerid, firstname, last_name and years were required. Please this needs to be very clear.
Otherwise my answer is
with totalorderyear as (
SELECT
o.customer_id,
c.first_name,
c.last_name,
EXTRACT(YEAR FROM o.orderdate) AS orderyear,
COUNT(o.orderid) AS totalorders
FROM orders o
LEFT JOIN customers c
ON c.customerid = o.customerid
GROUP BY o.customerid, c.firstname, c.last"See full answer
"Mission: Tiktok's mission is to inspire creativity and Joy.
Any business wants to make sure that they are serving the value to their customers:
For TikTok customers are:
Viewers 2. Content Creators 3. Advertisers
So few metrics we could measure are:
Time spent/day
Total no of videos created/day
engagement rate = users who interacted in one of the meaningful action on Tiktok / total users at a day level
either likes, share, watched vide for at least 5 mins, created video
"
Nikita B. - "Mission: Tiktok's mission is to inspire creativity and Joy.
Any business wants to make sure that they are serving the value to their customers:
For TikTok customers are:
Viewers 2. Content Creators 3. Advertisers
So few metrics we could measure are:
Time spent/day
Total no of videos created/day
engagement rate = users who interacted in one of the meaningful action on Tiktok / total users at a day level
either likes, share, watched vide for at least 5 mins, created video
"See full answer
"Clarifying questions and Assumptions
ChatGPT search means the search function inside the chat app? OR ChatGPT search Chrome extension? Assumption: Search inside the chat app.
Is there any location restriction in this analysis? Assumption: USA only.
Is there any user segment restriction in this analysis? Assumption: All user segments.
Are we assuming the ChatGPT search already exists or going back in time before the ChatGPT search existed? Assumption: Go back in time"
Darpan D. - "Clarifying questions and Assumptions
ChatGPT search means the search function inside the chat app? OR ChatGPT search Chrome extension? Assumption: Search inside the chat app.
Is there any location restriction in this analysis? Assumption: USA only.
Is there any user segment restriction in this analysis? Assumption: All user segments.
Are we assuming the ChatGPT search already exists or going back in time before the ChatGPT search existed? Assumption: Go back in time"See full answer
"WITH RECURSIVE RecursiveHierarchy AS (
SELECT
Emp_ID,
First_Name,
Middle_Name,
Last_Name,
country,
Manager_ID,
1 AS Level
FROM tbl_Employee
WHERE Emp_ID = 2
UNION ALL
SELECT
e.Emp_ID,
e.First_Name,
e.Middle_Name,
e.Last_Name,
e.Country,
e.Manager_ID,
rh.Level + 1
FROM tbl_Employee e
INNER JOIN RecursiveHierarchy rh
ON e.EmpID = rh.ManagerID
WHERE rh.Level < 4
)
, SalariesInUSD AS (
SELECT
rh.Level,
`rh.FirstName || ' ' || rh.MiddleN"
G B. - "WITH RECURSIVE RecursiveHierarchy AS (
SELECT
Emp_ID,
First_Name,
Middle_Name,
Last_Name,
country,
Manager_ID,
1 AS Level
FROM tbl_Employee
WHERE Emp_ID = 2
UNION ALL
SELECT
e.Emp_ID,
e.First_Name,
e.Middle_Name,
e.Last_Name,
e.Country,
e.Manager_ID,
rh.Level + 1
FROM tbl_Employee e
INNER JOIN RecursiveHierarchy rh
ON e.EmpID = rh.ManagerID
WHERE rh.Level < 4
)
, SalariesInUSD AS (
SELECT
rh.Level,
`rh.FirstName || ' ' || rh.MiddleN"See full answer
"Any cycle would cause the prerequisite to be greater than the course. This passes all the tests:
function canFinish(_numCourses, prerequisites) {
for (const [a, b] of prerequisites) {
if (b > a) return false
}
return true
}
`"
Jeremy D. - "Any cycle would cause the prerequisite to be greater than the course. This passes all the tests:
function canFinish(_numCourses, prerequisites) {
for (const [a, b] of prerequisites) {
if (b > a) return false
}
return true
}
`"See full answer
"P(A) = 0.6
P(B) = 0.4
P(D|A) = 0.05
P(D|B) = 0.03
Question asks to solve for P(A|D)
P(A|D) = (P(D|A) x P(A))/P(D) = (0.05 x 0.6)/(P(D|A) x P(A) + P(D|B) x P(B)) = (0.05 x 0.6)/(0.05 x 0.6+0.03 x 0.4) = 30/42 = 5/7 = 0.714
Notice above that P(D) = P(D|A) x P(A) + P(D|B) x P (B)"
Saurabh K. - "P(A) = 0.6
P(B) = 0.4
P(D|A) = 0.05
P(D|B) = 0.03
Question asks to solve for P(A|D)
P(A|D) = (P(D|A) x P(A))/P(D) = (0.05 x 0.6)/(P(D|A) x P(A) + P(D|B) x P(B)) = (0.05 x 0.6)/(0.05 x 0.6+0.03 x 0.4) = 30/42 = 5/7 = 0.714
Notice above that P(D) = P(D|A) x P(A) + P(D|B) x P (B)"See full answer
"There are couple of reasons for it -
Kind of role : Its a product manager role loaded with analytical work, So working with data in stringent regulatory guideline make it more exciting and thrilling.
Location & industry is like - Cherry on the cake, Bangalore weather and BFI is at its all time peak as people spending behavior is changing continuously, it will be interesting to see big giants like visa are managing it."
Nidhi S. - "There are couple of reasons for it -
Kind of role : Its a product manager role loaded with analytical work, So working with data in stringent regulatory guideline make it more exciting and thrilling.
Location & industry is like - Cherry on the cake, Bangalore weather and BFI is at its all time peak as people spending behavior is changing continuously, it will be interesting to see big giants like visa are managing it."See full answer
"I would use A/B testing to see if the new feature would be incrementally beneficial. To begin the testing, we should define what's the goal of this testing. Let's say the new feature would increase the average number of trade by X. Then randomly assign the clients to two groups, control and test group. Control group doesn't see the new feature and the test group see the new feature. We could also stratified sampling if we want to make sure cover different customer segmentation. During this desig"
Jiin S. - "I would use A/B testing to see if the new feature would be incrementally beneficial. To begin the testing, we should define what's the goal of this testing. Let's say the new feature would increase the average number of trade by X. Then randomly assign the clients to two groups, control and test group. Control group doesn't see the new feature and the test group see the new feature. We could also stratified sampling if we want to make sure cover different customer segmentation. During this desig"See full answer