Coding Interview Questions

Review this list of 374 coding interview questions and answers verified by hiring managers and candidates.
  • Software Engineer
    Coding
    +1 more
  • Walmart Labs logoAsked at Walmart Labs 

    "Did the code in Python"

    Divyani .. - "Did the code in Python"See full answer

    Software Engineer
    Coding
    +1 more
  • "The solution produces the same result as the 'prescribed solution' yet it does not get accepted In the test results section transcript['year'] = transcript['year'].astype(str) df = pd.pivottable(data = transcript, index = 'studentid', columns = 'year', values = 'yearlygpa', aggfunc = 'mean').resetindex() df = df[(df['2021'] < df['2022']) & (df['2022'] < df['2023'])] df['average_gpa'] = df[['2021', '2022', '2023']].mean(axis=1).round(2) return df "

    Prachi G. - "The solution produces the same result as the 'prescribed solution' yet it does not get accepted In the test results section transcript['year'] = transcript['year'].astype(str) df = pd.pivottable(data = transcript, index = 'studentid', columns = 'year', values = 'yearlygpa', aggfunc = 'mean').resetindex() df = df[(df['2021'] < df['2022']) & (df['2022'] < df['2023'])] df['average_gpa'] = df[['2021', '2022', '2023']].mean(axis=1).round(2) return df "See full answer

    Coding
    Data Analysis
  • "The best and average of both the algorithms is same which is O(nlog(n)), but the worst time complexity of QuickSort is O(n^2){a case where all the elements are sorted in opposite to the fashion/order you want} while the worst TC for merge sort remains the same O(nlog(n)). and The SC for QS=O(logn) and MS=O(n)."

    The_ A. - "The best and average of both the algorithms is same which is O(nlog(n)), but the worst time complexity of QuickSort is O(n^2){a case where all the elements are sorted in opposite to the fashion/order you want} while the worst TC for merge sort remains the same O(nlog(n)). and The SC for QS=O(logn) and MS=O(n)."See full answer

    Coding
  • "Table user is empy....... Problem with this problem "

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

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

  • "As we can pass info to only one child at a time, I told that from any given node, we have to pass the info to that child(of this node) which has the largest subtree rooted at it. To calculate the subtree sizes, I used DFS. And then to calculate the minimum time to pass info to all the nodes, I used BFS picking the largest subtree child first at every node. I couldn't write the complete code in the given time and also made a mistake in telling the overall time complexity of my approach. I think t"

    Lakshman B. - "As we can pass info to only one child at a time, I told that from any given node, we have to pass the info to that child(of this node) which has the largest subtree rooted at it. To calculate the subtree sizes, I used DFS. And then to calculate the minimum time to pass info to all the nodes, I used BFS picking the largest subtree child first at every node. I couldn't write the complete code in the given time and also made a mistake in telling the overall time complexity of my approach. I think t"See full answer

    Software Engineer
    Coding
    +1 more
  • Amazon logoAsked at Amazon 

    "Use Dijkstra's Algorithm with priority queue"

    Karthik R. - "Use Dijkstra's Algorithm with priority queue"See full answer

    Software Engineer
    Coding
    +2 more
  • JP Morgan Chase logoAsked at JP Morgan Chase 
    Software Engineer
    Coding
    +1 more
  • Dropbox logoAsked at Dropbox 
    Video answer for 'Find duplicate files in a file system.'

    " read_dir(path: str) -> list[str] returns the full path of all files and sub- directories of a given directory. is_file(path: str) -> bool: returns true if the path points to a regular file. is_dir(path: str) -> bool: returns true if the path points to a directory. read_file(path: str) -> str: reads and returns the content of the file. The algorithm: notice that storing all the file contents' is too space intensive, so we can't read all the files' contents to store and compare with each"

    Idan R. - " read_dir(path: str) -> list[str] returns the full path of all files and sub- directories of a given directory. is_file(path: str) -> bool: returns true if the path points to a regular file. is_dir(path: str) -> bool: returns true if the path points to a directory. read_file(path: str) -> str: reads and returns the content of the file. The algorithm: notice that storing all the file contents' is too space intensive, so we can't read all the files' contents to store and compare with each"See full answer

    Software Engineer
    Coding
    +2 more
  • Amazon logoAsked at Amazon 

    "na"

    Nishigandha B. - "na"See full answer

    Software Engineer
    Coding
    +1 more
  • Flatiron Health logoAsked at Flatiron Health 
    Software Engineer
    Coding
    +2 more
  • New York Times logoAsked at New York Times 

    "input = [ {"topic": 1, "chapter": 1, "section": 1}, {"topic": 2, "chapter": 2, "section": 1}, {"topic": 3, "chapter": 2, "section": 2}, {"topic": 4, "chapter": 1, "section": 1}, {"topic": 5, "chapter": 1, "section": 1}, {"topic": 6, "chapter": 2, "section": 2}, {"topic": 7, "chapter": 2, "section": 2}, {"topic": 8, "chapter": 2, "section": 3}, ] expected_output = [ {'chapter': 1, 'sections': [ {'section': 1, 'topics': [ {'top"

    Anonymous Unicorn - "input = [ {"topic": 1, "chapter": 1, "section": 1}, {"topic": 2, "chapter": 2, "section": 1}, {"topic": 3, "chapter": 2, "section": 2}, {"topic": 4, "chapter": 1, "section": 1}, {"topic": 5, "chapter": 1, "section": 1}, {"topic": 6, "chapter": 2, "section": 2}, {"topic": 7, "chapter": 2, "section": 2}, {"topic": 8, "chapter": 2, "section": 3}, ] expected_output = [ {'chapter': 1, 'sections': [ {'section': 1, 'topics': [ {'top"See full answer

    Software Engineer
    Coding
    +1 more
  • Databricks logoAsked at Databricks 

    "You will need to start from Browser and go all the way up to Analytic systems and methods. Everything needs to be covered"

    Divya K. - "You will need to start from Browser and go all the way up to Analytic systems and methods. Everything needs to be covered"See full answer

    Technical Program Manager
    Coding
    +2 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

    Coding
    Data Structures & Algorithms
  • Meta (Facebook) logoAsked at Meta (Facebook) 

    "if decreasing arr, start from end and keep checking if next element increases by 1 or not. wherever not, put that value there."

    Rishabh R. - "if decreasing arr, start from end and keep checking if next element increases by 1 or not. wherever not, put that value there."See full answer

    Coding
    Data Structures & Algorithms
    +1 more
  • Intuit logoAsked at Intuit 

    "did well but messed up dequeue"

    Shivani N. - "did well but messed up dequeue"See full answer

    Software Engineer
    Coding
    +1 more
  • Machine Learning Engineer
    Coding
    +1 more
  • "simply check its size if the size if the size is greater than n then yes it has duplicate"

    Kunal kumar S. - "simply check its size if the size if the size is greater than n then yes it has duplicate"See full answer

    Machine Learning Engineer
    Coding
    +2 more
  • "boolean isMatch(String s, String p) { int i=0; int j=0; int sID=-1; int prevM=-1; while(i<s.length()){ if(j<p.length() && (s.charAt(i)==p.charAt(j) || p.charAt(j)=='?')){ i++; j++; }else if(j<p.length() && p.charAt(j)=='*'){ sID=j; prevM=i; j++; }else if(sID!=-1){ j=sID+1; prevM++; i=prevM; }else{ return false; } } while(j<p.length() && p.charAt(j)=='*') j++; if(i!=s.length() || j!=p.leng"

    Ravi C. - "boolean isMatch(String s, String p) { int i=0; int j=0; int sID=-1; int prevM=-1; while(i<s.length()){ if(j<p.length() && (s.charAt(i)==p.charAt(j) || p.charAt(j)=='?')){ i++; j++; }else if(j<p.length() && p.charAt(j)=='*'){ sID=j; prevM=i; j++; }else if(sID!=-1){ j=sID+1; prevM++; i=prevM; }else{ return false; } } while(j<p.length() && p.charAt(j)=='*') j++; if(i!=s.length() || j!=p.leng"See full answer

    Software Engineer
    Coding
    +1 more
Showing 281-300 of 374