write a unix command to get the filenames of those files from a directory or subdirectory which contain email addresses.
count the words from a given file and display the count. Also write down the test cases for it or different test scenarios.
Given a set of words and phrases, and a key, implement an efficient autocomplete algorithm to find all the words and phrases that should be suggested.
I would do it with a Trie together with a Priority Queue or some sorted structure. Depending on what the threshold is for the recommendation, say if it depends on frequency of the terms, store all words and the frequencies of words in a Trie, then sort words by their frequency in the priority queue. Every time a recommendation is requested, respond with the top N elements in the queue. To improve the algorithm (for a larger scaled system), apply Lossy Counting to drop the least frequent terms.
binary tree zig level traverse, LC 上面的;
Time Interval merge, 也是 LC上面的, 都是高频,
第一题,给一个字符串和一个字典,看能不能用字典里面的词拼出来这个字符串,最少用几个词。用动态规划。第二题,给一个哈希表,键是一个元素,值是这个键元素依赖的所有元素。输入是一个元素,要求按照依赖顺序把所有这个输入元素依赖的东西都输出出来。用深搜写。
f 表示字符串前i个字符能否存在一种拼法,存在为True 否则为False f[0] = 1 如果存在j<i, s[j+1...i] 在字典里 并且 f[j] = True那么 f = True 否则False 补充内容 (2016-11-1 03:15): f【i】 表示字符串前i个字符能否存在一种拼法,存在为True 否则为False f[0] = 1 如果存在j<i, s[j+1...i] 在字典里 并且 f[j] = True那么 f【i】= True 否则False 补充内容 (2016-11-1 03:15): f【i】 表示字符串前i个字符能否存在一种拼法,存在为True 否则为False f[0] = 1 如果存在j<i, s[j+1...i] 在字典里 并且 f[j] = True那么 f【i】= True 否则False
题目,给你一个 path,数文件里面有多少个word 然后,我连java读文件的语句都不知道,他就说你自己编一个假设吧,或者google。我查了一下,一下没有查出来,就说假如open吧。读进来是个string。他说好,但是这里有个问题我们一会儿再讨论。然后我的定式思维数多少个word就是不能用built-in function的,我就开始写 i = 0.....然后他说提醒一下,java有个split function。然后我就用 split写了。 完了过后他说这里没问题,但是有个问题就是读文件那里,如果文件很大会怎么样? 我说overflow。 那怎么解决? 一行一行的读? 一行也很大呢? 额。。。。 你知道buffer吗? 额。。。 他就提醒可以每次读取固定的字节。然后我改了一下代码。然后他又说,你没有注意到有个问题吗?会重复数word。然后我才反应过来,如果一个word在中间打断了,有可能被算成2个。我之前这里没有处理,然后处理了一下,就是看前一个读取的最后和下一个读取的开头是不是空格。
[i for i in string.split() if i.isalnum()] isalpha()
with open('filename') as f:
lines = [line.rstrip('\n') for line in open('filename')]
with open(...) as f:
for line in f:
file=open("D:\\zzzz\\names2.txt","r+")
wordcount={}
for word in file.read().split():
if word not in wordcount:
wordcount[word] = 1
else:
wordcount[word] += 1
for k,v in wordcount.items():
print k, v
word_count = 0
file_name = "D//in.txt"
with open(file_name,'r') as file:
for line in file:
word_count += len(line.split())
print ("number of words : ",word_count)
Audience Bias: Characteristics of the users in the experiment can differ signficiant in terms of demogrphics, engagement leves, etc...
- Dont look exclusively on percentage gains.
- Try to use absolute numbers when reporting results.
- Help measure true business impact of experiments.
Push Notifications:
Develop a strategy:
1. Define product's core value proposition
- push notification should be an extension of the product's core value proposition.
- For users who don't "get" the product.
- Help them understand the value.
- For user who "get" the product
- Help them further engage with it.
2. Figure out what to send that is tied to that core values:
- 3 main categories for notification content
1. Marketing Driven: to all users
- pros:
- Coverage can reach all users
- Minimal engineering effort, great for early stage startups.
- cons:
- Not personalized content, low engagement rates.
- Low user tolerance to these types of notifications, have to use sparingly.
2. Transactional: triggerd by users' actions.
- pros:
- Good engagement since content is relevant to the users.
- High level of tolerance.
- cons: Require enough engagement on the site, or be connected to enough users, to receive them frequently.
3. Content Driven: Connect users with relevant and interesting content. Require personalization for recommendation.
- pros:
- Good engagement if content is highly personalized and relevant.
- Can get good coverage by sending popular content to users which you don't have enough signal to persoanlise recommendations.
- cons:
- Engagement rates get worse the less the user has engaged with the site.
- Expensive to build out recommendation algorithms from an engineering effort perspective.
3. Figure out who to send the content to
- Classify users into new, enggaged and unengaged groups.
- New users: Send notification that help reinforce product's value and help them find out how to get more value.
- Engaged users: Only send them the best, most useful notifications that help them engage further.
- Unengaged Users - Send a mix of personalized notifications and broder non-personalized notifications to try re-engage them.
4. Make your notification unique:
1. Timeliness - push notifications allow you to reach users quicker than email.
2. Location based - Geofenced notifications to notify users when they are near a certain location.
3. Badging - A less intrusive way to notify users about new events that triggers engagemetn.
4. Find out how to dovetail those attributes with your prouct's value. E.g. geofencing is only great for location based apps.
Growth team responsbilities: Signups, logins, NUX, emails, push notifications, invites, app upsells and SEO.
What makes a good growth engineer/engineering team?
- Must-have Motivations:
- working on hard technical problems
- crafting the pixel perfect product experience.
- \(MOST IMPORTANT\) making a business impact.
- be engaged with their projects.
- come up with ideas to even frther increase their projects impact.
- Culture of Ownership:
- Instill a sense of ownership to allow engineers act as a mini-PM for their projects.
- Start by writing the doc about why running the experiment, implementing it, doing the final analysis and findally, making the recommendation to ship or not.
- Come up with ideas to further increase the impact of their projects. \(Went above and beyond on a project to make it successful\)
- Stability and Quality:
- ensure proper unit testing, alerting, and extensive monitoring are in place to protect existing growth.
- Alerts should be set up to catch a sudden drop in signups \(talking points for mission control\), an on-call rotation should be assigned.
- A post-mortem process should be in place to review and prevent future outages.
"Building a culture of ownership where engineers own and are empowered on the experiments they work on and are actively encouraged to come up with new ideas to improve the impact of their projects."
I was assigned a task to improve the integration system. In the event industry, we primaily work with event planners to help them manage events in the form of mobile and web apps. Many event planners use a third party system to manage their attendee signups, and in order for the attendees to use our app, we need to import their data into our system, otherwise we won't be able to do business with those customers. When I first joined the company, they were in the process of build a new Python backend to retire a legacy PHP code base which has a basic integration system built that was quite slow. And my team was tasked to build a better version of the integrtion features in the new Python backend. Our goal was to reduce the sync time by at least 50% while supporting at least 20 integrations each with at most 10000 attendees running the same time. It took us about a month to finish a MVP, which basically works like getting a paginated list of userids, and make individual request to fetch the full detail about each user's information. So the first MVP can finis the sync for ten thousand attendees in about 25 minutes, the PM was happy with result, and we were going to polish it and ship it to production. However, when I was working on the monitoring our new service with new relic, I realized the request per second coming from the new service is suprisingly low, then I decided to trace the time during a whole sync lifecycle, and found out most of the time was spent on waiting for network requests. So then I realized the reason for the long sync time and low request per second was due to all the get requests were being sent and process synchronously. So that's not very good even though the performance met our initial target. For any project that I work on, I'd like to take ownership of the project and maximize its BUSINESS IMPACT, and since the project is about synchroizing new user signups from external sources, then having quick sync time is crucial espcially during event start date which new signups can happen very frequently. So I decided to investigate how I can improve this project. This is when the language Go comes in, since I have been playing with it since I was in university and imo it's really great lanauge with type safty, natural concurrency support an good performance, plus the fact that I know two other team members also have experiences with it. So then I built a mini-demo and drafted a experienment proposal to our PM and tech lead explaining the benefits of building this project as a new service written in Go. The higher ups were very supportive and put a lot of faith in me, so we spent another month to make a second versin of the MVP. And we saw a signficant performance increase, average sync was reduced to 3-4 minutes. However, when we were trying to mimic the production load, we found another problem, which was that the system would raise memory errors when it tries to handle more than 5000 attendees. ANd the reason was that we were spawning way too many threads for the system to handle. So then we ran a few rounds of trial and errors, and eventually I stumble upon this amazing concurrecy pattern called worker pool. Which essentially there are 3 parts, a queue which you queue all the jobs, and in our case it will be the requests that need to be sent, and a pool which will fetch the jobs from the queue and pass it on to the workers, and workers which can be dynamically allocated based on the system needs to actually perform the fetching and processing. With this system, it offers a lot more flexbility in terms of concurrency control and resouce management since we can fine tune the best number of concurrencies for each third party data source, while providing very good performance.
"When I joined Pinterest, I was eager to learn how to scale a company internationally since my previous Growth work at Shopkick had only been based in the US. What I’ve learned is that success growing internationally requires taking many of the lessons from scaling in your native market and then figuring out how to adapt them to different countries and cultures. It requires nailing comprehension, making sure you have product/market fit for each country, and figuring out how to adapt your growth channels for individual markets.
"
"Usually what we look for is not someone who is necessarily super familiar with growth tactics, but someone who is a strong product thinker and can think through the problems people are encountering. We have an interview that’s almost like a mini-growth PM interview. I ask a candidate about an app they use and we’ll talk through how, if they were put in charge of growth for that app, they would figure out how to improve acquisition, group activation, etc.”
"have an intuitive focus on things that are top-of-funnel, and not just an amazing experience that only 5% of users get."
“The biggest qualities I look for are being impact-driven and metrics-driven,” he says. “The engineers that are most successful don’t just try to get the job done. They’re driven by trying to maximize their impact. They understand user mindset and user psychology, and figure out what is going to resonate with people.”
Talking points to John Eagan:
- I really like a story I read about how Pinterest was willing the sacrifice some engagement metrics for a better UX by displaying the content of the Pin in a Send A Pin email. I think really shows how the people at Pinterest really cares about the long term growth about the product instead of tunneling on short term gains. In one of the startups I worked at called LOkafy we also attempted to do something like that. Lokafy is a platform for tourists to book tour guides with locals. And I helped them built the trasactional email system. Initially, once a customer paid and booked a trip, we would send them a email saying "thanks for booking a trip with us, to view the details about your trip, please click this button". The goal was to drive engagement rate and hopefully they would explore our other offerings in different cities while on the booking details page. And obviusly when we look at the click rates on the booking details page, there were barely any clicks at all. So I showed our CEO the data from Google analytics, as well as trascational emails from similiar websites like expedia, and convinced her to not just changed the email templates, but the mindset of putting user experience and long term product growth at first.
- Later on, I can see that the CEO was actually trying to making decision that are befitial to the product instead of some numbers for the sake of impressing investors.
Sorry! You've hit a block \(mentions\) we have in place to combat spam. Please try again later.
How would you improve Pinterest?
In the IOS app, when you try to comment on a Pin, there will be a text popup covering the entire screen for you to type. I persoanlly believe that's quite introsive, and on the contray, I think the desktop side handled it a lot better, which you can click and type.
I also noticed on the desktop side, every time you type the timestamp on all existing comments would get updated, but that happens only while you are typing, and I am not sure what was the reasoning behind that? I think more consistent approach would be either not update it, or be like twitter which it will automatically update whether you are typing a new comment or not.
Questions for Pinterest:
- So I usually like to ask product related quesitons, I hope you don't mind, because ultimately I want to not only solve challenging problems but more so how to engineer great product.
- So my first question is about trimming features. When people are building a new product, it always seems natural to add new or improve existing features, but rarely I see features being outright removed, especially for a relatively mature product like Pinterest. So I am wondering if you know how decisions like for instance removing the like button started in Pinterest? And wat kind of research was being conducted to decide whether to remove the like button or the save button instead? Were there more users using the save button?
- I am also very curious about the comments section of each Pin, not sure if you have any experience working on it? In terms of comments, I noticed based on my research, there are quite few comments \(not event spams!\) in compairson to the number of pins. I know Pinterest is not suppsoed to be a social network, it's all about you and your own interests, but given this comment section still exist and it's rarely being used, waht's reason behind implmeneting and keeping it?
How to deal with disagreement of ideas at work?
- We define a bottom line metric to evaluate each idea on.
- Almost always related to business impact
- For project related disagreements:
- the metric could be how many more deals we can close by building this new feature? \(because customers have walked away due to said feature\) / engineering hour
- For more technical related disagreements \(situational\):
- How many people in the team are familiar with the tech?
- How mature is the tech and its community?
- Which one is simpler?
What failure have u done, what would you change if do it again?
- Be causious about new technologies, even though such topic has been discussed for many times but somehow it can still find a way to bit u if u dont have displicne.