Data Scientist Coding Interview Questions

Review this list of 111 coding data scientist interview questions and answers verified by hiring managers and candidates.
  • "select a.playername as player1, b.playername as player2, abs(a.level-b.level) as level_disparity from players a cross join players b on a.playername < b.playername where abs(a.level-b.level) <=5 order by level_disparity `"

    Gowtami K. - "select a.playername as player1, b.playername as player2, abs(a.level-b.level) as level_disparity from players a cross join players b on a.playername < b.playername where abs(a.level-b.level) <=5 order by level_disparity `"See full answer

    Data Scientist
    Coding
    +1 more
  • "Table user is empy....... Problem with this problem "

    Gabriella F. - "Table user is empy....... Problem with this problem "See full answer

    Data Scientist
    Coding
    +1 more
  • Adobe logoAsked at Adobe 
    +7

    "def traprainwater(height: List[int]) -> int: n = len(height) totalwaterlevel = 0 for i in range(n): j = i+1 while j = n: break rows = j - i -1 intrwaterlevel = min(height[j], height[i]) * rows for k in range(i+1, j): intrwaterlevel -= height[k] totalwaterlevel += intrwaterlevel i = j return totalwaterlevel"

    Manoj R. - "def traprainwater(height: List[int]) -> int: n = len(height) totalwaterlevel = 0 for i in range(n): j = i+1 while j = n: break rows = j - i -1 intrwaterlevel = min(height[j], height[i]) * rows for k in range(i+1, j): intrwaterlevel -= height[k] totalwaterlevel += intrwaterlevel i = j return totalwaterlevel"See full answer

    Data Scientist
    Coding
    +4 more
  • "The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name." Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."

    Chao peter Y. - "The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name." Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."See full answer

    Data Scientist
    Coding
    +2 more
  • Apple logoAsked at Apple 

    Coin Change

    IDE
    Medium
    +6

    "The example given is wrong. The 2nd test case should have answer 3, as we can get to 6 by using 3 coins of denomination 2."

    Anmol R. - "The example given is wrong. The 2nd test case should have answer 3, as we can get to 6 by using 3 coins of denomination 2."See full answer

    Data Scientist
    Coding
    +3 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Apple logoAsked at Apple 
    +2

    "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"

    Vaibhav D. - "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"See full answer

    Data Scientist
    Coding
    +4 more
  • Adobe logoAsked at Adobe 

    "Leetcode 347: Heap + Hashtable Follow up question: create heap with the length of K instead of N (more time complexity but less space )"

    Chen J. - "Leetcode 347: Heap + Hashtable Follow up question: create heap with the length of K instead of N (more time complexity but less space )"See full answer

    Data Scientist
    Coding
    +3 more
  • " import pandas as pd from datetime import datetime def findfastestlike(log: pd.DataFrame) -> pd.DataFrame: log=log.sortvalues(['userid','timestamp']) #get the prev event, time by user log['prevevent'] = log.groupby('userid')['event'].shift(1) log['prevtimestamp'] = log.groupby('userid')['timestamp'].shift(1) True only on rows where the previous event was a login and the current event is a like log['loginlike'] = (log['prevevent'] == 'log"

    Sean L. - " import pandas as pd from datetime import datetime def findfastestlike(log: pd.DataFrame) -> pd.DataFrame: log=log.sortvalues(['userid','timestamp']) #get the prev event, time by user log['prevevent'] = log.groupby('userid')['event'].shift(1) log['prevtimestamp'] = log.groupby('userid')['timestamp'].shift(1) True only on rows where the previous event was a login and the current event is a like log['loginlike'] = (log['prevevent'] == 'log"See full answer

    Data Scientist
    Coding
    +2 more
  • " debug your code below departments = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'name': ['Reporting', 'Engineering', 'Marketing', 'Biz Dev', 'Silly Walks'] }) employees = pd.DataFrame({ 'id': [1, 2, 3, 4, 5, 6], 'first_name': ['John', 'Ava', 'Cailin', 'Mike', 'Ian', 'John'], 'last_name': ['Smith', 'Muffinson', 'Ninson', 'Peterson', 'Peterson', 'Mills'], 'salary': [20000, 10000, 30000, 20000, 80000, 50000], 'department_id': [1, 5, 2, 2, 2, 3] }) projects = p"

    Sean L. - " debug your code below departments = pd.DataFrame({ 'id': [1, 2, 3, 4, 5], 'name': ['Reporting', 'Engineering', 'Marketing', 'Biz Dev', 'Silly Walks'] }) employees = pd.DataFrame({ 'id': [1, 2, 3, 4, 5, 6], 'first_name': ['John', 'Ava', 'Cailin', 'Mike', 'Ian', 'John'], 'last_name': ['Smith', 'Muffinson', 'Ninson', 'Peterson', 'Peterson', 'Mills'], 'salary': [20000, 10000, 30000, 20000, 80000, 50000], 'department_id': [1, 5, 2, 2, 2, 3] }) projects = p"See full answer

    Data Scientist
    Coding
    +2 more
  • Oracle logoAsked at Oracle 

    "def countuniqueoutfits(totalpants: int, uniquepants: int, totalshirts: int, uniqueshirts: int, totalhats: int, uniquehats: int) -> int: """ Number of unique outfits can simply be defined by (uniquepantschoose1uniqueshirtschoose1uniquehatschoose_1) (uniquepantschoose1*uniqueshirtschoose1) # Not wearing a hat nchoosek is n """ res = (uniquepants*uniqueshirtsuniquehats) + (uniquepantsunique_shirts) return res print(countuniqueoutfits(2, 1, 1, 1, 3, 2))"

    Sai R. - "def countuniqueoutfits(totalpants: int, uniquepants: int, totalshirts: int, uniqueshirts: int, totalhats: int, uniquehats: int) -> int: """ Number of unique outfits can simply be defined by (uniquepantschoose1uniqueshirtschoose1uniquehatschoose_1) (uniquepantschoose1*uniqueshirtschoose1) # Not wearing a hat nchoosek is n """ res = (uniquepants*uniqueshirtsuniquehats) + (uniquepantsunique_shirts) return res print(countuniqueoutfits(2, 1, 1, 1, 3, 2))"See full answer

    Data Scientist
    Coding
  • Adobe logoAsked at Adobe 

    "#include #include #include using namespace std; void printComs(int prev, int start, int end, int target) { if (start >= end) return; while (start target) { end--; } else { st"

    Iris F. - "#include #include #include using namespace std; void printComs(int prev, int start, int end, int target) { if (start >= end) return; while (start target) { end--; } else { st"See full answer

    Data Scientist
    Coding
    +4 more
Showing 101-111 of 111