Had my phone screen with FB today. After a 3-4min brief introduction he asked an LC medium Binary tree root to leaf path sum question. Slightly trickier variant than LC.
https://leetcode.com/problems/sum-root-to-leaf-numbers/
There was some back and forth about definition of the question. I told I will use long as output and return error for overflow to which he eventually agreed (lost few min). Coded it, interview nudged me towards simplification (spent 5 min). I answered I would use strings if tree depth was huge. I was hesitant to start wit strings because the arithmetic would take too long to code up. Time complexity I gave was O(N*d) N nodes, d is the number of digits in the number. He diverged into C++ based followup questions, lost couple of mins.
34 -36 min into the interview, he asked me second LC med question and i immediately gave optimal solution in <1min. Then he followed up with the hard variant of that question and I immediately gave the optimal approach in <1min. I wrote the main data structures for my approach i.e. map and vector, wrote code for getrandom. But he cut me of at 42 min and asked me for any questions I had.
Also lost a few min coz he had a strong chinese accent and was hard to understand.
https://leetcode.com/problems/insert-delete-getrandom-o1/
https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed/
Main doubts I have:- Whether he perceived the optimal complexity to be different i.e O(Nh) where h is height of tree and that I didn't have time to finish code for the second question
Want to see the real deal?
More inside scoop? View in App
More inside scoop? View in App
blind
SUPPORT
FOLLOW US
DOWNLOAD THE APP:
FOLLOWING
Industries
Job Groups
- Software Engineering
- Product Management
- Information Technology
- Data Science & Analytics
- Management Consulting
- Hardware Engineering
- Design
- Sales
- Security
- Investment Banking & Sell Side
- Marketing
- Private Equity & Buy Side
- Corporate Finance
- Supply Chain
- Business Development
- Human Resources
- Operations
- Legal
- Admin
- Customer Service
- Communications
Return to Office
Work From Home
COVID-19
Layoffs
Investments & Money
Work Visa
Housing
Referrals
Job Openings
Startups
Office Life
Mental Health
HR Issues
Blockchain & Crypto
Fitness & Nutrition
Travel
Health Care & Insurance
Tax
Hobbies & Entertainment
Working Parents
Food & Dining
IPO
Side Jobs
Show more
SUPPORT
FOLLOW US
DOWNLOAD THE APP:
Sum Root to Leaf Numbers - LeetCode
comments
EDIT: I just did those problems you listed. This is how long it took me. They all passed on first attempt
Problem 1: 9min
Problem 2: 13min
Problem 3: 17min
= 39 min in total. Not sure if it would be possible to complete them in 45 min especially considering the introductions and small talk and all. There would be a lot of pressure to complete them. UNLESS the interviewer didn't want you to do problem 2 and asked you to just go ahead with problem 3...
In that case, the total time is 26 min, which seems a lot more reasonable. I am sorry OP, but it looks like you failed. I hope I am wrong and I wish you the best of luck!