Amazon Interview | Set 70 (On-Campus For Internship)

Online Round Coding Question:

  1. Given a float number 7.64, convert it into the string WITHOUT using any inbuilt function/library.
    for eg:
    input
    float no.: 7.64
    output
    string: 7.64
  2. Given the inorder and preorder traversals of a Binary Tree, output the postorder traversal of it.
    for eg:
    input:
    Inorder: 7, 8, 4, 1, 6, 2, 5
    Preorder: 1, 4, 7, 8, 2, 6, 4
    output:
    Postorder: 8, 7, 4, 6, 5, 2, 1

Round 1 written:

  1. Given a string find the length of longest substring which has none of its character repeated?
    for eg:
    i/p string:
    abcabcbb
    length of longest substring with no repeating charcters: 3 (abc)
  2. Given a link list with right pointers and each element of the list has a down link contains another link list with down pointers as:
     5 -> 7 -> 9 -> 18
     |    |    |    |
    10    6    14   20
     |    |    |    |
    11    8    19   22
     |    |         |
    12    13        24
     |    
    15

    each right and down list are sorted.
    Write a function flatten() which flattens this link list to a single link list with all the elements in sorted order as:
    5->6->7->8->9->10->11->12->13->14->15->18->19->20->22->24


PI Round 1:

The interview started with discussions and questioning about the internship project and other projects mentioned in my Resume.
After the discussions about projects interviewer asked a question on string the question was:

  1. A string of length n and an integer m was given, give an algo. to rotate the string counter clockwise by m. I was asked to give all the check conditions for input m.
    Then the interviewer asked me to write a code for the same with a strict guideline that there should not be any mistake in the code ;).
  2. After this he asked me about heap, min and max heap, insertion and deletion in a heap. He asked me to prove that the time complexity of inserting n elements in a heap.
    At-least he asked about the uses of heap data structure and other data structure which are implemented using heap.

PI Round 2:

  1. What is the difference b/w abstract and interface class?
  2. Write a program to create single thread and print “Hello World”, stating all the arguments of createThread function?
  3. What is a deadlock and what are the condition necessary for the deadlock to occur?
  4. What is a cache memory and how it is implemented?
  5. Explain LRU, FIFO and other page replacement algorithms?
  6. write a code to implement LRU cache and then implement full cache memory?

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.


Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.