Interview Question


Country: United States




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

Exchange first and last elements, then exchange second and second-last elements and so on.

- Murali Mohan August 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public int[] reverseArray(int[] a) {
   int n = a.length;

   for(int i=0; i<n/2; i++) {
       int temp = a[i];
       a[i] = a[n-1-i];
       a[n-1-i] = temp;
   }
   return a;
}

- Anonymous August 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Anonymous User

public int[] reverseArray(int[] a)
{

       for (var i = a.length; i >=0; i--) {
         alert(a[i]);
       }

- Dwayne Walters August 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for(i=n-1,j=0;i>n/2;i--,j++)
{
t=arr[i];
arr[i]=arr[j];
arr[j]=t;
}

- dhamu August 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void main()
{
int a[]={1,45,33,55,34},b[5],i,,j,k,l;
for(i=4;j=0;i>=0;j,+4;i++;j--)
{
k=a[i];
a[i]=b[j];
b[j]=k;
}

- sanyam September 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Grade 10/11 programming question.

- bigphatkdawg September 19, 2013 | 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