Interview Questions

Review this list of 4,065 interview questions and answers verified by hiring managers and candidates.
  • +1

    "this task is misleading . i used lag(1) and lead(1) cuz it did not say "compare temperature from 2 days before and 1 day before" , it reads to me as if its asking "compare cur temperature to prev and future and see if it rose and fall""

    Erjan G. - "this task is misleading . i used lag(1) and lead(1) cuz it did not say "compare temperature from 2 days before and 1 day before" , it reads to me as if its asking "compare cur temperature to prev and future and see if it rose and fall""See full answer

    Coding
    SQL
  • +1

    "WITH suspicious_transactions AS ( SELECT c.first_name, c.last_name, t.receipt_number, COUNT(t.receiptnumber) OVER (PARTITION BY c.customerid) AS noofoffences FROM customers c JOIN transactions t ON c.customerid = t.customerid WHERE t.receipt_number LIKE '%999%' OR t.receipt_number LIKE '%1234%' OR t.receipt_number LIKE '%XYZ%' ) SELECT first_name, last_name, receipt_number, noofoffences FROM suspicious_transactions WHERE noofoffences >= 2;"

    Jayveer S. - "WITH suspicious_transactions AS ( SELECT c.first_name, c.last_name, t.receipt_number, COUNT(t.receiptnumber) OVER (PARTITION BY c.customerid) AS noofoffences FROM customers c JOIN transactions t ON c.customerid = t.customerid WHERE t.receipt_number LIKE '%999%' OR t.receipt_number LIKE '%1234%' OR t.receipt_number LIKE '%XYZ%' ) SELECT first_name, last_name, receipt_number, noofoffences FROM suspicious_transactions WHERE noofoffences >= 2;"See full answer

    Data Engineer
    Coding
    +3 more
  • +8

    "with my_table as (select * , rownumber() over(order by customerid) as row_index from customers) select customer_id, customer_name from my_table where row_index % 3 = 0"

    Marcos G. - "with my_table as (select * , rownumber() over(order by customerid) as row_index from customers) select customer_id, customer_name from my_table where row_index % 3 = 0"See full answer

    Coding
    SQL
  • +1

    "SELECT e1.empid AS manageremployee_id, e1.empname AS managername, COUNT(e2.empid) AS numberofdirectreports FROM employees AS e1 INNER JOIN employees AS e2 ON e2.managerid = e1.empid GROUP BY e1.emp_id HAVING COUNT(e2.emp_id) >= 2 ORDER BY numberofdirectreports DESC, managername ASC `"

    Alvin P. - "SELECT e1.empid AS manageremployee_id, e1.empname AS managername, COUNT(e2.empid) AS numberofdirectreports FROM employees AS e1 INNER JOIN employees AS e2 ON e2.managerid = e1.empid GROUP BY e1.emp_id HAVING COUNT(e2.emp_id) >= 2 ORDER BY numberofdirectreports DESC, managername ASC `"See full answer

    Coding
    SQL
  • "with cte as (select *, row_number() over(order by score desc) as rn from players) select player_name, score, rn as ranking from cte where rn= 4 or rn =6 or rn =11 `"

    Gowtami K. - "with cte as (select *, row_number() over(order by score desc) as rn from players) select player_name, score, rn as ranking from cte where rn= 4 or rn =6 or rn =11 `"See full answer

    Coding
    SQL
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • +7

    "WITH high_score AS( SELECT player_id, MAX(gamescore) AS maxscore FROM scores GROUP BY player_id ), rankings AS( SELECT p.player_name, p.team_id, max_score, DENSERANK() OVER(PARTITION BY p.teamid ORDER BY h.maxscore DESC) AS scorerank FROM high_score AS h JOIN players AS p USING(player_id) ) SELECT team_id, player_name, max_score FROM rankings WHERE score_rank <= 2 GROUP BY teamid, playername O"

    Alvin P. - "WITH high_score AS( SELECT player_id, MAX(gamescore) AS maxscore FROM scores GROUP BY player_id ), rankings AS( SELECT p.player_name, p.team_id, max_score, DENSERANK() OVER(PARTITION BY p.teamid ORDER BY h.maxscore DESC) AS scorerank FROM high_score AS h JOIN players AS p USING(player_id) ) SELECT team_id, player_name, max_score FROM rankings WHERE score_rank <= 2 GROUP BY teamid, playername O"See full answer

    Coding
    SQL
  • +7

    "WITH previous AS(SELECT viewer_id, watch_hours, LAG(watchhours) OVER(PARTITION BY viewerid ORDER BY year, month) AS previous_hours, year, month FROM watch_time GROUP BY viewer_id, year, month ), streaks AS(SELECT viewer_id, SUM(CASE WHEN previoushours IS NOT NULL AND previoushours = 3 `"

    Alvin P. - "WITH previous AS(SELECT viewer_id, watch_hours, LAG(watchhours) OVER(PARTITION BY viewerid ORDER BY year, month) AS previous_hours, year, month FROM watch_time GROUP BY viewer_id, year, month ), streaks AS(SELECT viewer_id, SUM(CASE WHEN previoushours IS NOT NULL AND previoushours = 3 `"See full answer

    Coding
    SQL
  • +6

    "with t1 as (select employee_name, department_id, salary, avg(salary) over (partition by departmentid) as avgsalary, abs(salary - avg(salary) over (partition by department_id)) as diff from employees ) select employee_name, department_id, salary, avg_salary, denserank() over (partition by departmentid order by diff desc) as deviation_rank from t1 order by departmentid asc, deviationrank asc, employee_name `"

    Alexey T. - "with t1 as (select employee_name, department_id, salary, avg(salary) over (partition by departmentid) as avgsalary, abs(salary - avg(salary) over (partition by department_id)) as diff from employees ) select employee_name, department_id, salary, avg_salary, denserank() over (partition by departmentid order by diff desc) as deviation_rank from t1 order by departmentid asc, deviationrank asc, employee_name `"See full answer

    Coding
    SQL
  • Adobe logoAsked at Adobe 

    "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["

    Vince S. - "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +3 more
  • " function diffBetweenTwoStrings(source, target) { /** @param source: string @param target: string @return: string[] */ let dp = new Array(source.length+1).fill().map(() => Array(target.length+1).fill(0)) for (let i = source.length; i>= 0; i--) { for (let j = target.length; j>= 0; j--) { if (i === source.length) { dpi = target.length - j } else if (j === target.length) { dpi = sou"

    Matthew K. - " function diffBetweenTwoStrings(source, target) { /** @param source: string @param target: string @return: string[] */ let dp = new Array(source.length+1).fill().map(() => Array(target.length+1).fill(0)) for (let i = source.length; i>= 0; i--) { for (let j = target.length; j>= 0; j--) { if (i === source.length) { dpi = target.length - j } else if (j === target.length) { dpi = sou"See full answer

    Data Structures & Algorithms
    Coding
  • Adobe logoAsked at Adobe 
    +22

    "#inplace reversal without inbuilt functions def reverseString(s): chars = list(s) l, r = 0, len(s)-1 while l < r: chars[l],chars[r] = chars[r],chars[l] l += 1 r -= 1 reversed = "".join(chars) return reversed "

    Anonymous Possum - "#inplace reversal without inbuilt functions def reverseString(s): chars = list(s) l, r = 0, len(s)-1 while l < r: chars[l],chars[r] = chars[r],chars[l] l += 1 r -= 1 reversed = "".join(chars) return reversed "See full answer

    Software Engineer
    Data Structures & Algorithms
    +4 more
  • +14

    "function swap(arr, i, j) { const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } function sortKMessedArray(arr, k) { for (let i=0; i < arr.length; i++) { for (let j=1; j <= k; j++) { if (arr[i+j] < arr[i]) { swap(arr, i, i+j); } } } return arr; } `"

    Tiago R. - "function swap(arr, i, j) { const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } function sortKMessedArray(arr, k) { for (let i=0; i < arr.length; i++) { for (let j=1; j <= k; j++) { if (arr[i+j] < arr[i]) { swap(arr, i, i+j); } } } return arr; } `"See full answer

    Data Structures & Algorithms
    Coding
  • +4

    "function getDifferentNumberImmutable(arr) { const exists = new Array(arr.length).fill(false); for (let item of arr) { exists[item] = true; } for (let i=0; i < exists.length; i++) { if (!exists[i]) { return i; } } return arr.length; } function getDifferentNumber(arr) { let i=0; while (i < arr.length) { while (arr[i] < arr.length && arr[i] !== i) { // switch (arr[i] and arr[arr[i]]) const j = arr[i]; const temp = arr[j]; arr[j]"

    Tiago R. - "function getDifferentNumberImmutable(arr) { const exists = new Array(arr.length).fill(false); for (let item of arr) { exists[item] = true; } for (let i=0; i < exists.length; i++) { if (!exists[i]) { return i; } } return arr.length; } function getDifferentNumber(arr) { let i=0; while (i < arr.length) { while (arr[i] < arr.length && arr[i] !== i) { // switch (arr[i] and arr[arr[i]]) const j = arr[i]; const temp = arr[j]; arr[j]"See full answer

    Data Structures & Algorithms
    Coding
  • +6

    "Good Question, but I would've marked this as medium not hard difficulty, since it's just a straightforward traversal."

    Ahmed A. - "Good Question, but I would've marked this as medium not hard difficulty, since it's just a straightforward traversal."See full answer

    Data Structures & Algorithms
    Coding
  • +11

    "function spiralCopy(inputMatrix) { if (inputMatrix.length === 1) return inputMatrix[0]; let lowerY = 0; let upperY = inputMatrix.length-1; let lowerX = 0; let upperX = inputMatrix[0].length-1; const output = []; while (true) { if (lowerX > upperX) break; for (let x = lowerX; x upperY) break; for (let y = lowerY; y <= upperY; y++) { output.push(inputMatrix[y][u"

    Tiago R. - "function spiralCopy(inputMatrix) { if (inputMatrix.length === 1) return inputMatrix[0]; let lowerY = 0; let upperY = inputMatrix.length-1; let lowerX = 0; let upperX = inputMatrix[0].length-1; const output = []; while (true) { if (lowerX > upperX) break; for (let x = lowerX; x upperY) break; for (let y = lowerY; y <= upperY; y++) { output.push(inputMatrix[y][u"See full answer

    Data Structures & Algorithms
    Coding
  • Adobe logoAsked at Adobe 

    "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"

    Divya R. - "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"See full answer

    Software Engineer
    Data Structures & Algorithms
    +4 more
  • Adobe logoAsked at Adobe 
    +24

    " from typing import List one pass O(n) def find_duplicates(arr1: List[int], arr2: List[int]) -> List[int]: duplicates = [] i1 = i2 = 0 while i1 < len(arr1) and i2 < len(arr2): if arr1[i1] == arr2[i2]: duplicates.append(arr1[i1]) i2 += 1 i1 += 1 return duplicates debug your code below print(find_duplicates([1, 2, 3, 5, 6, 7], [3, 6, 7, 8, 20])) `"

    Rick E. - " from typing import List one pass O(n) def find_duplicates(arr1: List[int], arr2: List[int]) -> List[int]: duplicates = [] i1 = i2 = 0 while i1 < len(arr1) and i2 < len(arr2): if arr1[i1] == arr2[i2]: duplicates.append(arr1[i1]) i2 += 1 i1 += 1 return duplicates debug your code below print(find_duplicates([1, 2, 3, 5, 6, 7], [3, 6, 7, 8, 20])) `"See full answer

    Data Engineer
    Data Structures & Algorithms
    +2 more
  • +18

    "def check_byte(octet): _""" Checks if the given string \octet\ represents a valid byte (0-255). """_ Check for empty string if not octet: return False Check if the string has non-digit characters if not octet.isdigit(): return False Check for leading zeroes in multi-digit numbers if len(octet) > 1 and octet[0] == '0': return False Check if the integer value is between 0 and 255 return 0 <= int(octet) <= 255 def va"

    Robert W. - "def check_byte(octet): _""" Checks if the given string \octet\ represents a valid byte (0-255). """_ Check for empty string if not octet: return False Check if the string has non-digit characters if not octet.isdigit(): return False Check for leading zeroes in multi-digit numbers if len(octet) > 1 and octet[0] == '0': return False Check if the integer value is between 0 and 255 return 0 <= int(octet) <= 255 def va"See full answer

    Data Structures & Algorithms
    Coding
  • +7

    "I couldn't follow the solution offered here, but my solution seemed to pass 6/6 tests. Any feedback is welcome, thank you! def encrypt(word): en_word = "" for i in range(len(word)): if i == 0: en_word += chr(ord(word[0])+1) else: num = ord(word[i]) + ord(en_word[i-1]) while num > 122: num -= 26 en_word += chr(num) return en_word def decrypt(word): de_word = "" for i in range(len(word)): if i == 0: de_word += chr(ord(word[i]"

    Anonymous Armadillo - "I couldn't follow the solution offered here, but my solution seemed to pass 6/6 tests. Any feedback is welcome, thank you! def encrypt(word): en_word = "" for i in range(len(word)): if i == 0: en_word += chr(ord(word[0])+1) else: num = ord(word[i]) + ord(en_word[i-1]) while num > 122: num -= 26 en_word += chr(num) return en_word def decrypt(word): de_word = "" for i in range(len(word)): if i == 0: de_word += chr(ord(word[i]"See full answer

    Data Structures & Algorithms
    Coding
  • +7

    "My solution is simple; it does an in-order DFS traversal to create an array of in-order elements then it searches through the array to find the node we want the successor of. finally we return the node that is 1 after the input node, in the case our input node is the last element of our DFS we know there is no successor, therefore it returns None/null. CODE INSTRUCTIONS: 1) The method fi"

    Rohan M. - "My solution is simple; it does an in-order DFS traversal to create an array of in-order elements then it searches through the array to find the node we want the successor of. finally we return the node that is 1 after the input node, in the case our input node is the last element of our DFS we know there is no successor, therefore it returns None/null. CODE INSTRUCTIONS: 1) The method fi"See full answer

    Data Structures & Algorithms
    Coding
Showing 1701-1720 of 4065