Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Odd or Even length string
null string
normal string
naming convention
xml summary comments
Proper Indentation
Dry Run of the program
Case sensitive or insensitive comparison
All Return paths need to be validated.

- ankushbindlish May 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

<pre lang="java" line="1" title="CodeMonkey82409" class="run-this">#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<cassert>
#include<climits>
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef pair<int,int> ii;
typedef pair<int,ii> pii;
typedef long long LL;
#define sz(c) (int)c.size()
#define pb push_back
#define all(v) v.begin(),v.end()
#define inc(i,n) for(int i=0;i<n;i++)
#define dec(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define INF 100000000
#define F first
#define S second
#define PRV(V) inc(i,sz(V)) cout<<V[i]<<" ";cout<<endl
main(){
string s;
cin>>s;
int maxLen =0;
for(int i=0;i<s.size();i++){
int len = 1;
for(int j=i-1,k=i+1;j>=0 && k<s.size();j--,k++)
if(s[j]==s[k])
len+=2;
else
break;
maxLen = max(maxLen,len);
len = 0;
for(int j=i,k=i+1;j>=0 && k<s.size();j--,k++){
if(s[j]!=s[k])
break;
else
len+=2;
}
maxLen = max(maxLen,len);
}
cout<<maxLen<<endl;
return EXIT_SUCCESS;
}
</pre><pre title="CodeMonkey82409" input="yes">
</pre>

- Anonymous August 31, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More