```python
def common_elements(lst1, lst2):
new_list = []
for num1 in lst1:
for num2 in lst2:
if num1 == num2:
new_list.append(num1)
return new_list
l1 = [1]
l2 = [1,1,1,1,1]
def common_elements_list(list1, list2):
# List based solution
result_list = []
for element in list1:
if element in list2:
result_list.append(element)
# dict solution
storage_dict = {}
for element in list1:
storage_dict[element] += 1
# EX: list1 = [1, 1, 2, 3] --> {1: 2, 2: 1, 3: 1}
output_list = []
for element in list2:
if element in storage_dict.keys():
# Is the element in the storage dictionary
# that means there is a common element between list 1 and 2
if storage_dict[element] > 0:
# If there is a match betwen list 1 and 2, and count is greater than 0
output_list.append(element)
storage_dict[element] -= 1
# EX for dict solution
list1 = [1, 4, 2, 6, 1, 7]
list2 = [2, 7, 5, 42, 87, 1 ,1, 1]
storage_dict = {1: 2, 4: 1, 6: 1, 7: 1}
```
Intro
MS CS
previous health science
family was CS and inspired him to CS
want to work in data science/management
Proud
Text based adventure
input direction, action, combat
most reminiscent of who i am
Be careful with that verbiage, it may come off as not interested in the field (I've been playing DnD for years and it's one of my favorite hobbies, so i really enjoyed doing it)
Dive back into libraries you used
Have your projects used a web framework
Spotify
You said unfortunately this was your only thing, don't be self-negative during the interview
Try and break this down a bit more effectively
This was an app to help people find music similar to what they already like
HW for Basil:
Learn some of the basic terminology around websites (if interviewing for web dev stuff)
```
Addgene has a very strong Twitter game. As it turns out, Biotech Scientists have a very active presence on Twitter! We’d like to include some of our URLs in tweets but we come close to hitting the 280 character limit, so we want to be able to shorten our URLs to avoid this problem.
Followup Questions (Don't ask all of them)
What kinds of users does this service need to support?
What components would your application have, and what kind of infrastructure would you need to set up?
Roughly, how does the part that generates the short version work?
Roughly, how does the part that retrieves the URL for a short URL work?
If the system wanted to let users delete their shortened URLs, what would it need to track?
Can you describe the different data models you'd define?
How would this handle scale? Eg. millions of links?
```
URL shortener
Q: copy long url and create short url
API?
Be careful about throwing out buzzwords
Use API to convert the long URL to short url
API tokens
Save long URL into another variable
Not sure about how URLs work
Break down URL into parts, convert to a list
Ask questions
Think in terms of database and actions
```
What does a good answer look like for this question?
Take in long url, return short
DB that stores long and short URL
I would take the long URL, and make a Unique short url
uniquifying a short url: Hashing
addgene.org/cirspr/talens/viralviralrialviralviralrialviralviralrialviralviralrialviralviralrialviralviralrialviralviralrial --> tinurl.com/1b7z72
```
HW for buddy: research Hashing and basics of web apps (do a tutorial for a popular web framework, adam recommends django) https://docs.djangoproject.com/en/5.0/intro/tutorial01/
Common elements question
Make a for loop, loop through 1st, grab common elements
Asked the big question: what kind of lists?
Good job talking through your approach
Things:
called out:
index instead of the element in the list
popping elements out of lists
Be sure to always figure out what data you're dealing with, and what edge cases can crop up
De-duplicate?
Adam notes:
THings for this question
Ask clarifying questions
What kind of lists
What do we do with duplicates? ([1,1], [1,1,1,1])
initial solution:
def common_elements(lst1, lst2):
new_list = []
for num in lst1:
for num in lst2:
if lst2[num] == lst1[num]:
new_list.append(lst2[num])
return new_list
si = [1234m2. (/04id8zbmTxGgZ2JZy-gIWQ)123f]
for s in si:
...