Amazon Interview Questions

Please implement a function which returns the nth number in Fibonacci sequences with an input n.

How to check whether there is a loop in a linked list?

How to get the median from a stream of numbers at any time? The median is middle value of numbers. If the count of numbers is even, the median is defined as the average value of the two numbers in middle.

How to verify whether a binary tree is a binary search tree?

How do you get the depth of a binary tree? Nodes from the root to a leaf form a path. Depth of a binary tree is the maximum length of all paths.

No. 36 - Permutation
Please print all permutations of a given string. For example, print “abc”, “acb”, “bac”, “bca”, “cab”, and “cba” when given the input string “abc”.

No. 37 - Missing Number in an Array
An array n - 1 unique numbers in the range from 0 to n - 1. There is only one number in the range from 0 to n - 1 missing. Please write a function to find the missing number

No. 40 - Add on Lists
Nodes in a list represent a number. Please implement a function/method to add numbers in two lists, and store the sum into a new list. 

Given a matrix with 1s and 0s, please find the number of groups of 1s. A group is defined by horizontally or vertically adjacent 1s.

No. 48 - Least Number after Deleting Digits
Please get the least number after deleting k digits from the input number. For example, if the input number is 24635, the least number is 23 after deleting 3 digits.

No. 49 - Longest Substring without Duplication
Given a string, please get the length of the longest substring which does not have duplicated characters. Supposing all characters in the string are in the range from ‘a’ to ‘z’.

14 comments:

  1. this is my code for searching words on 2dimension array i got stuck on first part of the code before starting left to right and up down ...also the end of the code aim of the program is to tell user input words to find on 2 dimension array and if it found program will tell "found"if not it will tell "not found".


    # include
    # define N 10
    # define M 6
    int main()
    {
    int a,j=0;
    int count,k,i=0;
    int found=0;
    char X[10][10]={{'X','F','O','X','F','R','E','G','I','T'},{'Z','L','A','D','I','E','S','F','U','R'},{'E','U','I','V','S','W','K','R','C','N'},{'O','Q','H','O','H','I','T','G','S','M'},{'B','B','T','Z','N','L','E','Y','V','L'},{'C','X','A','D','E','W','L','O','Q','S'},{'D','E','F','G','O','C','G','K','U','T'},{'N','F','T','L','H','W','A','O','P','S'},{'E','A','F','L','E','V','E','T','R','Z'},{'B','I','L','I','Z','A','R','D','J','F'}};
    char Y;
    char W[M];

    for(a=0;a='A'&& Y<='Z')
    {
    W[i]=Y;
    i++;
    }
    count=i;

    while(!found&&i<N)
    {
    if(W[0]==X[i][j]&&!found)
    {
    //left to right of the table
    k=1;
    while(k<count&& W[k]==X[i][j+k]&&j+k<N)k++;
    if(k==count) found=1;
    }

    if(W[0]==X[i][j]&&!found)
    {
    //upper to downward

    k=1;

    while(k<count&& W[k]==X[i+k][j]&&i+k<N)k++;
    if(k==count) found=1;
    }
    j++;
    if(j==N)
    {
    j=0;
    i++;
    }
    }
    }
    if(found) printf("found!!!!");
    else printf("not found!!!");

    return 0;

    }

    ReplyDelete
    Replies
    1. Tks very much for your post.

      Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.

      You also find all interview questions at link at the end of this post.

      Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:

      Best rgs

      Delete
  2. Interview Questions in Amazon for Interns, specially for Fresher Intern

    ReplyDelete
  3. /**
    * Created by niranjan on 6/5/15.
    */
    public class DeletingDigits
    {
    public static void main(String[] args)
    {
    int a=24635;
    int count=0;
    int[] b = new int[5];
    while (a!=0)
    {
    b[count]=a%10;
    a=a/10;
    count++;
    }
    int[] c=new int[20];
    int count1=0;
    for (int i = 0 ; i < count ; i++)
    {
    for (int j = 0 ; j < count ; j++)
    {
    if(i==j)
    {
    continue;
    }
    else
    {
    c[count1]=(b[i]*10)+b[j];
    count1++;
    }
    }
    }
    for (int i = 0; i < count1-1; i++)
    {
    int value;
    for (int j = 1; j < (count1-i); j++)
    {
    if(c[j-1] > c[j])
    {
    value = c[j-1];
    c[j-1] = c[j];
    c[j] = value;
    }
    }
    }
    System.out.println(c[0]);
    }
    }

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Tks very much for your post.

    Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.

    You also find all interview questions at link at the end of this post.

    Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:

    Best rgs

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. interesting article thank you for sharing
    http://www.jobslatest14.in/

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    Recruitment Consultancy in Chennai
    Recruitment Franchise in chennai

    ReplyDelete