VMWare Inc Interview Question


Country: United States
Interview Type: Phone Interview




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

list.sort(Comparator.naturalOrder())

- tyler_ua July 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can use Java inbuilt function compateTo(comparableString) and achieve this with n2 complexity. Below is a sample code snippet.

for(int i=0;i<=s.length-2;i++)
        {
            System.out.println(s[i]);
            for(int j=i+1;j<=s.length-1;j++)
            {
                
                if(s[i].compareTo(s[j])>0)
                {
                    String temp = s[j];
                    s[j]=s[i];
                    s[i]=temp;
                }
            }
        }

- Madhusudhan July 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java inbuilt function compareTo will work but with n2 complexity

for(int i=0;i<=s.length-2;i++)
{
System.out.println(s[i]);
for(int j=i+1;j<=s.length-1;j++)
{

if(s[i].compareTo(s[j])>0)
{
String temp = s[j];
s[j]=s[i];
s[i]=temp;
}
}
}

- Madhusudhan July 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Method 1: use general sorting algorithm Complexity: O(nlogn)
Method 2: use Trie data structures O(n)

- PrabhakarShah July 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can you someone help me how to get this using Trie DS. I have given all the above solutions but interviewer asked me to implement using Trie DS.

- Anonymous July 15, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can anyone one help me solve this using Trie DS. I have given all the above solutions but interviewer asked me to implement using Trie.

- sarunreddy82 July 15, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.Arrays;

public class StringSort {

public static void main(String[] args) {

String abc[]= {"ABCDEF","A","BEF","AABB","AA"};
Arrays.sort(abc);
for(int i=0;i<abc.length;i++)
{
System.out.println(abc[i]);
}

}

}

- Anonymous July 18, 2018 | 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