"bool isValidBST(TreeNode* root, long min = LONGMIN, long max = LONGMAX){
if (root == NULL)
return true;
if (root->val val >= max)
return false;
return isValidBST(root->left, min, root->val) &&
isValidBST(root->right, root->val, max);
}
`"
Alvaro R. - "bool isValidBST(TreeNode* root, long min = LONGMIN, long max = LONGMAX){
if (root == NULL)
return true;
if (root->val val >= max)
return false;
return isValidBST(root->left, min, root->val) &&
isValidBST(root->right, root->val, max);
}
`"See full answer
"int main()
{
int a1[7]={1,2,3,4,5,6,7};
int a2[7]={1,9,10,11,12,13,14};
vectorv;
v.insert(v.begin(),begin(a1),end(a1));
v.insert(v.begin(),begin(a2),end(a2));
int a3[v.size()];
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
{
a3[i]=v[i];
}
}
`"
Aryan D. - "int main()
{
int a1[7]={1,2,3,4,5,6,7};
int a2[7]={1,9,10,11,12,13,14};
vectorv;
v.insert(v.begin(),begin(a1),end(a1));
v.insert(v.begin(),begin(a2),end(a2));
int a3[v.size()];
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
{
a3[i]=v[i];
}
}
`"See full answer
"WITH previous AS(SELECT
viewer_id,
watch_hours,
LAG(watchhours) OVER(PARTITION BY viewerid ORDER BY year, month) AS previous_hours,
year,
month
FROM watch_time
GROUP BY viewer_id, year, month
),
streaks AS(SELECT
viewer_id,
SUM(CASE WHEN previoushours IS NOT NULL AND previoushours = 3
`"
Alvin P. - "WITH previous AS(SELECT
viewer_id,
watch_hours,
LAG(watchhours) OVER(PARTITION BY viewerid ORDER BY year, month) AS previous_hours,
year,
month
FROM watch_time
GROUP BY viewer_id, year, month
),
streaks AS(SELECT
viewer_id,
SUM(CASE WHEN previoushours IS NOT NULL AND previoushours = 3
`"See full answer
Data Scientist
Coding
+1 more
🧠Want an expert answer to a question? Saving questions lets us know what content to make next.
"To handle the non-uniform sampling, I'd first clean and divide the dataset into chunks of n second interval 'uniform' trajectory data(e.g. 5s or 10s trajectories). This gives us a cleaner trajectory data chunks, T, of format (ship_ID, x, y, z, timestamp) to be formed.
For the system itself, I'd use a generative model, e.g. Variational AutoEncoder (VAE), and train the model's 'encoder' to produce a latent-space representation of input features (x,y,z,timestamp) from T, and it's 'decoder' to pred"
Anonymous Hornet - "To handle the non-uniform sampling, I'd first clean and divide the dataset into chunks of n second interval 'uniform' trajectory data(e.g. 5s or 10s trajectories). This gives us a cleaner trajectory data chunks, T, of format (ship_ID, x, y, z, timestamp) to be formed.
For the system itself, I'd use a generative model, e.g. Variational AutoEncoder (VAE), and train the model's 'encoder' to produce a latent-space representation of input features (x,y,z,timestamp) from T, and it's 'decoder' to pred"See full answer
"WITH suspicious_transactions AS (
SELECT
c.first_name,
c.last_name,
t.receipt_number,
COUNT(t.receiptnumber) OVER (PARTITION BY c.customerid) AS noofoffences
FROM
customers c
JOIN
transactions t ON c.customerid = t.customerid
WHERE
t.receipt_number LIKE '%999%'
OR t.receipt_number LIKE '%1234%'
OR t.receipt_number LIKE '%XYZ%'
)
SELECT
first_name,
last_name,
receipt_number,
noofoffences
FROM
suspicious_transactions
WHERE
noofoffences >= 2;"
Jayveer S. - "WITH suspicious_transactions AS (
SELECT
c.first_name,
c.last_name,
t.receipt_number,
COUNT(t.receiptnumber) OVER (PARTITION BY c.customerid) AS noofoffences
FROM
customers c
JOIN
transactions t ON c.customerid = t.customerid
WHERE
t.receipt_number LIKE '%999%'
OR t.receipt_number LIKE '%1234%'
OR t.receipt_number LIKE '%XYZ%'
)
SELECT
first_name,
last_name,
receipt_number,
noofoffences
FROM
suspicious_transactions
WHERE
noofoffences >= 2;"See full answer
"Clarification questions
What is the purpose of connecting the DB?
Do we expect high-volumes of traffic to hit the DB
Do we have scalability or reliability concerns?
Format
Code -> DB
Code -> Cache -> DB
API -> Cache -> DB - APIs are built for a purpose and have a specified protocol (GET, POST, DELETE) to speak to the DB. APIs can also use a contract to retrieve information from a DB much faster than code.
Load balanced APIs -> Cache -> DB
**Aut"
Aaron W. - "Clarification questions
What is the purpose of connecting the DB?
Do we expect high-volumes of traffic to hit the DB
Do we have scalability or reliability concerns?
Format
Code -> DB
Code -> Cache -> DB
API -> Cache -> DB - APIs are built for a purpose and have a specified protocol (GET, POST, DELETE) to speak to the DB. APIs can also use a contract to retrieve information from a DB much faster than code.
Load balanced APIs -> Cache -> DB
**Aut"See full answer
"SELECT d.departmentname,SUM(o.orderamount) AS total_revenue FROM orders o
JOIN departments d
ON
d.departmentid =o.departmentid
WHERE o.orderdate >= CURRENTDATE - INTERVAL '12 months'
GROUP BY d.department_name
ORDER BY total_revenue DESC;
`"
Derrick M. - "SELECT d.departmentname,SUM(o.orderamount) AS total_revenue FROM orders o
JOIN departments d
ON
d.departmentid =o.departmentid
WHERE o.orderdate >= CURRENTDATE - INTERVAL '12 months'
GROUP BY d.department_name
ORDER BY total_revenue DESC;
`"See full answer
"1) Have a common goal
2) Have a clear and fair accountability between teams
3) Ensure conflicts are resolved in time on common issues
4) Promote common Brain-storming , problem solving sessions
5) Most important , Have clear and effective communication established and practised"
Saurabh N. - "1) Have a common goal
2) Have a clear and fair accountability between teams
3) Ensure conflicts are resolved in time on common issues
4) Promote common Brain-storming , problem solving sessions
5) Most important , Have clear and effective communication established and practised"See full answer
"SELECT upsellcampaignid, COUNT(DISTINCT trans.userid) AS eligibleusers
FROM campaign
JOIN "transaction" AS trans
ON transactiondate BETWEEN datestart AND date_end
JOIN user
ON trans.userid = user.userid
WHERE iseligibleforupsellcampaign = 1
GROUP BY upsellcampaignid
`"
Alina G. - "SELECT upsellcampaignid, COUNT(DISTINCT trans.userid) AS eligibleusers
FROM campaign
JOIN "transaction" AS trans
ON transactiondate BETWEEN datestart AND date_end
JOIN user
ON trans.userid = user.userid
WHERE iseligibleforupsellcampaign = 1
GROUP BY upsellcampaignid
`"See full answer
"I don't have experience working with alot of Biological Scientists. Most of my experience comes with Data Scientists. Described how I used ideation techniques like brainstorming and other creative ways to get people to find common ground. I also mentioned how I like to do survey's before meetings to prompt people and also get unbiased opnions"
Mark M. - "I don't have experience working with alot of Biological Scientists. Most of my experience comes with Data Scientists. Described how I used ideation techniques like brainstorming and other creative ways to get people to find common ground. I also mentioned how I like to do survey's before meetings to prompt people and also get unbiased opnions"See full answer