darwinrlo / public

0 stars 0 forks source link

Mock Interviews #27

Open darwinrlo opened 4 years ago

darwinrlo commented 4 years ago

5/8/2020

Similar Problem: LeetCode: 4Sum

Observations & Insights

What Went Well

Missteps

Learnings and Opportunities for Improvement

Possible Next Steps

My Advice for My Practice Partner

Appendix: defaultdict

Don't do:

d = {}

for e in arr:
  if e in d.keys():  # Instead of doing this, use a defaultdict.
    d[e] = 0
  d[e] += 1

Do:

from collections import defaultdict

d = defaultdict(int)  # int is a factory method

for e in arr:
  d[e] += 1. # If e is not already present in d, it is created and mapped to 0.
d = defaultdict(list)  # Maps unmapped keys to the empty list.

Appendix: enumerate

To pair each element of an iterable with its index, use enumerate, which returns an iterator that gives the next element in a tuple with its index. (To get the next element of an iterator, use next().)

words = ["apple", "banana", "carrot"]
for i, w in enumerate(words):
  # w is an element of the words list. i is its corresponding index.
  pass
darwinrlo commented 4 years ago

5/8/2020

Practice session with Adil

What Went Well

Areas for Improvement

darwinrlo commented 4 years ago

5/13/2020

Context

LeetCode: Move Zeroes

Morning session on Pramp

Solution

What Went Well, What I Should Keep Doing

Missteps

Opportunities for Improvement

darwinrlo commented 4 years ago

5/12/2020

Mock Interview

LeetCode: Maximum Subarray

darwinrlo commented 4 years ago

Round #2 with SN

darwinrlo commented 4 years ago

5/15/2020

Missteps

pgbovine:

When the interviewer presents a question to you, immediately sketch out a bunch of examples and ask a ton of clarifying questions to make sure you understand exactly what the interviewer is asking you to do.

Draw several examples and ask your interviewer questions of the form, "for this case, you want the result to be X, right?" Do not make any assumptions without first checking them over with your interviewer.

LeetCode: Maximal Rectangle Geeks for Geeks: Maximum sum rectangle in a 2D matrix

Other

Maximum Sum Subarray

LeetCode: Maximum Sum Subarray

darwinrlo commented 4 years ago

5/19/2020

Session with Anthony on Pramp LeetCode: Decode Ways

What Went Well

Missteps

Areas of Weakness

Opportunities for Improvement

darwinrlo commented 4 years ago

May 26 Mock Interview with Anonymous Facebook Software Engineer

Summary

Missteps

Next Steps

darwinrlo commented 4 years ago

May 26 Mock Interview with Anthony

darwinrlo commented 4 years ago

May 28 Mock Interview With Facebook engineer

darwinrlo commented 4 years ago

To pop from the left of a deque, use popleft. pop pops from the right side of the deque.

darwinrlo commented 4 years ago

May 31 Morning

Facebook Similar: LeetCode: Spiral Matrix

Don't do:

output = [[None]*C]*r

Instead, do:

output = [[None] for _ in range(C)] for _ in range(R)]

Opportunities for Improvement

darwinrlo commented 4 years ago

6/23/2020

Pramp: Shortest Cell Path

To add to the right of the queue, use append (not appendright). To add to the left side, use appendleft.

To remove an element from the right side of the queue, use pop. Use popleft to remove an element from the left side of the queue.

Use BFS to find the shortest path as opposed to DFS.