Citrix System Inc Interview Question for Quality Assurance Engineers


Team: Xen-Client
Country: India
Interview Type: In-Person




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

Use a map, initialize it to 0.
Then iterate over the array incrementing the value of map.
Now re-iterate and if the value of any map is greater than 1 then duplicates exist. So print the number out.

- Sasi March 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The above would be feasible if there are asking for duplicates in Alphabets but the question is for number so if the array contains {1,3,4,10000,9000,10000,8}

so now the map has to contain 10000 elements which is just wasteful in our case where we are trying to find the duplicates for only 5 elements .

- Vinodh November 01, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Vinodh: You can store in hash map, both the no. (as key) and the count (as value). Print both key and value using getKey() and getValue().

- Atihsk November 07, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

array= [30, 20, 20, 20,30, 68, 23]
count=1
total=0
dict={}
for x in range (0, len(array)):
    if dict.has_key(array[x]):
        dict[array[x]] = dict[array[x]] + 1
    else:
        dict[array[x]] = 1

for item in dict:
    if dict[item] != 1:
        print item, dict[item]

- Anonymous December 31, 2014 | 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