Linode Interview Question for Python Developers


Country: United States




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

public List<Integer> uniqueSetOfDuplicateValues(int[] array) {
HashSet<Integer> valueSet = new HashSet<Integer>();
List<Integer> uniqueSet = new ArrayList();
for(int I=0;i< array.length; i++) {
    if(uniqueSet.add(array[I]))
	continue;
   else 
	uniqueSet.add(array[I]);
}

return uniqueSet;
}

- Chetan January 29, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

x = input("please enter integers")
a = x.split(' ')
print(a)
d  = {}
for a1 in a:
    if(d.get(a1)==None):
        d[a1] = 1
    else:
        print(d)
        print('duplicate',a1)
        break

- Anonymous February 21, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

x = input("please enter integers")
a = x.split(' ')
print(a)
d = {}
for a1 in a:
if(d.get(a1)==None):
d[a1] = 1
else:
print(d)
print('duplicate',a1)
break

- Engineer1111 February 21, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In python:
vals, counts = np.unique(a, return_counts=True)
vals[counts>1]

- Sho March 08, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

result = []
for i in range(0, len(arr)):
        for j in range(i+1, len(arr)):
                if arr[i] == arr[j]:
                    result.append(arr[i])
print(result)

- Ramu reddy September 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

result = []
for i in range(0, len(arr)):
for j in range(i+1, len(arr)):
if arr[i] == arr[j]:
result.append(arr[i])
print(result)

- Ramu reddy September 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

set(list)

- Varaprasad Pemmasani September 25, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

>>> def duplicates(l):
... d={}
... for i in l:
... d[i]=d.get(i,0)+1
... for k,v in d.items():
... if v>1:
... print(k,'found ',v)
...

- Anonymous May 17, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

>>> def duplicates(l):
... d={}
... for i in l:
... d[i]=d.get(i,0)+1
... for k,v in d.items():
... if v>1:
... print(k,'found ',v)
...

- Tharakanadha Reddy May 17, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

print("Input")
duparr = input().split(' ')
#duparr = [1,1,2,3,4,10,9,8,7,6]
print(duparr)
h = {}
for d in duparr:
    if(d in h):
        print('duplicate')
        break
    else:
        h[d] = 1
        print(h)

- Engineer1111 December 18, 2020 | 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