Preguntas de entrevista de Data scientist

44 mil

Preguntas de entrevista para Data Scientist compartidas por los candidatos

Principales preguntas de entrevista

Ordenar: Relevancia|Popular|Fecha
Meta
A un Data Engineer le preguntaron...14 de julio de 2017

given a list of tuples of movie watched times, find how many unique minutes of the movie did the viewer watch e.g. [(0,15),(10,25)]. The viewer watched 25 minutes of the movie.

11 respuestas

t = [(0, 10), (15, 25), (12, 20), (30, 48)] total = 0 for i in t: total = total + i[1]-i[0] print("total time watched:" , total) Menos

Ignore my previous answer. I wasn't paying attention to the cases where two tuples overlap in terms of the time range. Menos

input=[(0,9),(0,10),(1,9)] l=[] for i in input: l=l.append(i[0]) l=l.append(i[1]) print(len(set(l))) Menos

Mostrar Más respuestas
Meta

""" # Question 2: # Fill in the blanks # # Given an array containing None values fill in the None values # with most recent non None value in the array # # For example: # - input array: [1,None,2,3,None,None,5,None] # # - output array: [1,1,2,3,3,3,5,5] #

11 respuestas

def fill_most_recent_non_none_value(input): recent_non_none_value = None for i in range(len(input)): if input[i]: recent_non_none_value = input[i] else: input[i] = recent_non_none_value return input Menos

what is the output expected a = [None, 2, 4, None , None, 5] output ==> [2, 2, 4, 4, 5, 5] or [None, 2, 4, 4, 4, 5] ?? Menos

It should be [2, 2, 4, 4, 5, 5]. The None element must be replaced by the next not null value if the None is in the beginning of the list. Menos

Mostrar Más respuestas
Boston Consulting Group

Behavioral questions probing about fit

11 respuestas

Hey Ramii, Congratulation on your achievement! I am in the onsite stage now. I wonder have you encountered pure business case on the onsite interview? For the tech case, do you mind give me a structure of it? Thank you so much! Menos

When you say 3rd round do you mean onsite? I have my onsite and dont exactly know what will come for interview - an analytical case study or a MBA case interview? Menos

I didn't apply through school, if that's what you're implying by onsite. I have a Masters degree in a quantitative field and around 4 years' experience in data science. The city I live in has a BCG genralist consulting office, but the nearest GAMMA hub is in another city. All my interviews were VC, where I connected with interviewers in the other city or overseas, from my local BCG office. Regarding case studies in interviews, the homework case was analytical. Others varied based on the work the interviewer did. People who work in GAMMA had cases with more numbers and charts, case interviews with generalist consultants were less analytical and more abstract in some sense. In both rounds - second and third - one interviewer was from GAMMA and other from generalist consulting. Hope this helps! And all the best with your interview! Menos

Mostrar Más respuestas
Fidelity Investments

Design patterns questions

10 respuestas

It was on 03-14.Within 2 days they scheduled for onsite interview.By the way what all design pattern questions they asked you in first round?I was asked only Observer Pattern and Singleton Pattern Menos

Ya the same thing.....I already listed right...I had a difficulty in answering Observer pattern so listed here so that others can prepare well :) On site they will ask to write small code I guess but not so complicated. I heard that fidelity interview is not that tough as tech companies. So prepare well, answer confidently. All the best for the interview. Menos

Did you guys gave the on-site interview? How was the experience?

Mostrar Más respuestas
Meta

Python questions: 1. Replace None value with previous value present in a list. 2. Given a ´dictionary, print the key for nth highest value present in the dict. If there are more than 1 record present for nth highest value then sort the key and print the first one. 3. Given two sentences, you have to print the words those are not present in either of the sentences.(If one word is present twice in 1st sentence but not present in 2nd sentence then you have to print that word too) 4. Forgot another question you have to pass all the cases, specially on edge cases. SQL questions: 1. Mostly % calculation, also refer the questions available here in Glassdoor. Next will be my Onsite Interview of 3.30hr. If anyone can help me on that or else I will update later on that interview as well.

10 respuestas

a=[None,2,"rest",None,9,4,None] b=[2,None,None,None] c=[] #If the first element is None, then I will replace it with the next following #element def nnn(a): if len(a) is 0: return "List is empty" for i in range(len(a)): if(a[0] is None): a[i] = a[i+1] if(a[i] is None): a[i] = a[i-1] return a print(nnn(a)) print(nnn(b)) print(nnn(c)) Menos

# 1. Replace None value with previous value present in a list. def return_filled_array(ls): if ls is None: return None if not ls: return [] p = None return [p:=e if e is not None else p for e in ls] assert return_filled_array(None) == None assert return_filled_array([]) == [] assert return_filled_array([None,8,None]) == [None,8,8] assert return_filled_array([1,None,2]) == [1,1,2] assert return_filled_array([5,None,None]) == [5,5,5] assert return_filled_array([1,None,2,3,None,None,5,None]) == [1,1,2,3,3,3,5,5] print('passed') Menos

# Given two sentences, you have to print the words those are not present in either of the sentences. def list_difference(A, B): return list(set(A.split(' ')) ^ set(B.split(' '))) A = "Hello world" B = "Hello Bob" print(list_difference(A, B)) Menos

Mostrar Más respuestas
Meta

Python : fill in the blank(edge case of input list : None , []) ,find count of letter in a string , uncommon words between 2 strings.

10 respuestas

st_A = set(A.split()) st_B = set(B.split()) print((st_A - st_B) | (st_B - st_A)) Menos

Yes we see the answer on right window. you can query a table and see the result on right panel too. Menos

string1 = "but" string2 = "het" output = [] str1_words = string1.split() str2_words = string2.split() if str1_words and str2_words: output=[word for word in str1_words if word not in str2_words] + [word for word in str2_words if word not in str1_words] elif not str1_words and str2_words: output = str2_words elif str1_words and not str2_words: output = str1_words else: pass print(output) Menos

Mostrar Más respuestas
Meta

You have a 2-D array of friends like [[A,B],[A,C],[B,D],[B,C],[R,M], [S],[P], [A]] Write a function that creates a dictionary of how many friends each person has. People can have 0 to many friends. However, there won't be repeat relationships like [A,B] and [B,A] and neither will there be more than 2 people in a relationship

10 respuestas

This is the O(1) complexity algorithm. items=[['A','B'],['A','C'],['B','D'],['B','C'],['R','M'], ['S'],['P'], ['A']] result=dict() for item in items: if item[0] not in result.keys(): result[item[0]]=len(item)-1 elif item[0] in result.keys(): result[item[0]]+=len(item)-1 print(result) Menos

▼ This is the O(1) complexity algorithm. items=[['A','B'],['A','C'],['B','D'],['B','C'],['R','M'], ['S'],['P'], ['A']] result=dict() for item in items: if item[0] not in result.keys(): result[item[0]]=len(item)-1 elif item[0] in result.keys(): result[item[0]]+=len(item)-1 print(result) This solution is not o(1) but o(nk) where k is number of keys as result.keys() is a list and you are iterating over a list which is o(n)... simply use if item[0] not in result which will make it o(n) ( since you still have to loop over items which makes it 0(n) ) Menos

flist=[['A','B'],['A','C'],['B','D'],['B','C'],['R','M'], ['S'],['P'], ['A']] fdict={} x,y=0,1 for a in flist: if len(a)==2: if a[x] not in fdict.keys(): fdict[a[x]]=1 elif a[x] in fdict.keys(): fdict[a[x]]=fdict[a[x]]+1 if a[y] not in fdict.keys(): fdict[a[y]]=1 elif a[y] in fdict.keys(): fdict[a[y]]=fdict[a[y]]+1 elif a[x] not in fdict.keys() and len(a)==1: fdict[a[x]]=0 Menos

Mostrar Más respuestas
Meta

Write a function that takes in two sorted lists and outputs a sorted list that is their union.

10 respuestas

Second part of merge sort. Don't answer with sort(a), etc. Anyone can do that... def merge(A, B): i=0 j=0 sorted_list = [] while i < len(A) and j < len(B): if A[i] <= B[j]: sorted_list.append(A[i]) i += 1 else: sorted_list.append(B[j]) j += 1 if i < len(A): sorted_list.extend(A[i:]) elif j < len(B): sorted_list.extend(B[j:]) return sorted_list Menos

write 2 helpers: 1) INSERT(A, b) = put element b within A in the sort order 2) DEL(A, a) = delete element a from A Then do this recursion: f(A,B) : if max(A) <= min(B) return [A B] else { B = INSERT(B, max(a)); A = DEL(A, max(a); f(A,B); } something like that. try coding and testing. I haven't. Menos

I assumed that we can not use any "sort" function and we want it with linear time. so here it is: def my_sort(list_a, list_b): if len(list_a) ==0: return list_b elif len(list_b) ==0: return list_a else: if list_a[-1] > list_b[-1]: return( my_sort(list_a[0:-1], list_b) + [list_a.pop(-1)]) else: return(my_sort(list_a,list_b[:-1]) + [list_b.pop(-1)]) Menos

Mostrar Más respuestas
Meta

SQL questions - A table schema with tables like employee, department, employee_to_projects, projects 1) Select employee from departments where max salary of the department is 40k 2) Select employee assigned to projects 3) Select employee which have the max salary in a given department 4) Select employee with second highest salary 5) Table has two data entries every day for # of apples and oranges sold. write a query to get the difference between the apples and oranges sold on a given day

10 respuestas

3) Select date, no_of_items_sold, lag(no_of_items_sold,1) over (partition by date order by date asc) from table t Menos

select e.eid from emp e where e.did in ( select e.did from emp e inner join department d on d.dept_id =e.did group by 1 having max(e.sal) =40000) ; Menos

5) I created a table like -- AppleOrangeSold(Date, Qty, Item) // Item being Apple and Orange (A and O) Query: SELECT o.DateSold, MAX(o.Orange - a.Apple) as 'Orange-Apple' FROM (SELECT DateSold, Qty AS Orange FROM AppleOrangeSold WHERE Item = "O") AS o INNER JOIN (SELECT DateSold, Qty AS Apple FROM AppleOrangeSold WHERE Item = "A") AS a ON o.DateSold = a.DateSold GROUP BY o.DateSold Menos

Mostrar Más respuestas
Meta

Calculate the average word length. For the given set of words return the average word length.

10 respuestas

def avg_len(word_list): return len(''.join(words)) / len(words) avg_len(words) Menos

def _average_world_length(array): if not array: return 0; sum = 0 for a in array: if not a: continue sum += len(a) return float(sum/len(array)) if('__main__'=='__main__'): print(_average_world_length(["awesome", "fine", "ok"])) print(_average_world_length(["awesome", "fine", "ok", "ok", "ok", "ok"])) print(_average_world_length(["awesome", None, "ok"])) print(_average_world_length(["awesome", "0", "ok"])) print(_average_world_length(None)) Menos

words_list = ['cat' , 'bat' , 'dra', 'dar', 'dra','art'] avg_wlen = sum([len(word) for word in words_list]) / len(words_list) print( avg_wlen ) Menos

Mostrar Más respuestas
Viendo 21 - 30 de 43.967 Preguntas de entrevista