Given 一個string expression, 我們要去計算result of expression.
1.是string裡面只有+-(), 沒有乘除. (See LC 224)
2.再來是有+-*/但沒有() (See LC 227)
3.最難版本是+-*/和()都有(See LC 772)
Related Problems in LC:
224. Basic Calculator
227. Basic Calculator II
772. Basic Calculator III
什麼是Feed Based Feed System?
經典的就是Tweeter’s Feed, Facebooks Timeline, IG’s story.
和一般的推薦系統相比, 除了given user的資訊, 我們多了user的social graph(一種relationship between others)! Followers and Following!
Rule-Based:把given user的所有follower的tweet根據時間反向排序(reverse chronological order)
Some pattern about continuous subarray related problem. Usually, naive solution is generate all possible subarray, which takes O(n²) times at least. And optimal solution is the one with special data structure such as prefix sum, monotone stack, in most of cases. And, this is tricky. So, I try to summarize what I learned in this post.
1.包含當前element cur, 有多少個subarray的公式?
Q1:What’s the total number of subscribers on the platform?
Q2:How many daily active users?
Hence, you have to build a system for a large number of users who require good recommendations on a daily basis.
“Given a user and context (time, location, and season), predict the probability of engagement for each movie and order movies using that score.”
和search ranking system 最大的差別的沒有利用使用者輸入query的資訊!
我們有一堆用戶信息, 物品信息, 和場景訊息(context)
This posts focus on those ML fundamentals.
There’re two steps to prepare for ML interview.
Step1: Understanding those fundamentals and theories to ensure we can answer those questions very well in the interview
Step2: To implement those code to ensure we can explain in detailed way!
Q1: Could you explain dropout?
What is data stream?
It’s constant stream of data. For example, twitter messages and online news article.
Usually, for data stream related problem, there’s add function which will keep adding data from data stream into data structure you choose once it’s called. So, initially, we need a good data structure as a container to store past data stream.
Basically, for problem that we need to maintain a sorted unique array, we come up below workarounds:
Some pattern about split string/array related problem. Usually, naive solution is generate all possible split, which takes exponential running time. And optimal solution is greedily split in most of cases. And, this is tricky. So, I try to summarize what I learned in this post.
This is a very classical problem, so-called K-th problem.
Basically, given a user, our problem can boil down to finding most recent K data/ top k data with a certain priority given a data stream
Sorting+get top k data points
So, the naive approach is we can use sorting. Find all tweets of a user’s followers, then sort them by creating time in descending order and return top K out of them.
In this way, the advantage is intuitive and easy to implement. But, disadvantage is not very efficient in terms of time complexities, which is O(NlogN). …