Tasks Details
easy
Find value that occurs in odd number of elements.
Task Score
100%
Correctness
100%
Performance
100%
A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired.
For example, in array A such that:
A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9
- the elements at indexes 0 and 2 have value 9,
- the elements at indexes 1 and 3 have value 3,
- the elements at indexes 4 and 6 have value 9,
- the element at index 5 has value 7 and is unpaired.
Write a function:
def solution(A)
that, given an array A consisting of N integers fulfilling the above conditions, returns the value of the unpaired element.
For example, given array A such that:
A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9the function should return 7, as explained in the example above.
Write an efficient algorithm for the following assumptions:
- N is an odd integer within the range [1..1,000,000];
- each element of array A is an integer within the range [1..1,000,000,000];
- all but one of the values in A occur an even number of times.
Copyright 2009–2024 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.
Solution
Programming language used Python
Time spent on task 33 minutes
Notes
not defined yet
Task timeline
Code: 16:25:50 UTC,
java,
autosave
Code: 16:33:46 UTC,
py,
autosave
Code: 16:33:56 UTC,
py,
autosave
Code: 16:34:26 UTC,
py,
autosave
Code: 16:34:53 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def countAppearance()
def solution(A):
# write your code in Python 3.6
pass
Code: 16:36:10 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def countAppearance()
def solution(A):
# write your code in Python 3.6
pass
Code: 16:36:21 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def countAppearance()
def solution(A):
# write your code in Python 3.6
pass
Code: 16:36:31 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def countAppearance():
def solution(A):
# write your code in Python 3.6
pass
Code: 16:36:41 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
pass
Code: 16:37:04 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
Counter(A)
print("Counter = ", A)
Code: 16:37:05 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
Counter(A)
print("Counter = ", A)
Analysis
expand all
Example tests
1.
0.036 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = [9, 3, 9, 3, 9, 7, 9]
Code: 16:37:34 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counCounter(A)
print("Counter = ", A)
Code: 16:37:47 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
Code: 16:37:49 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
Analysis
expand all
Example tests
1.
0.040 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1})
Code: 16:39:01 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
Code: 16:39:13 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
Analysis
expand all
Example tests
1.
0.036 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'>
Code: 16:39:54 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
Code: 16:40:17 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray))
Code: 16:40:29 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray)):
print(i)
Code: 16:40:30 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray)):
print(i)
Analysis
expand all
Example tests
1.
0.036 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> 0 1 2
Code: 16:42:25 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray)):
print(i, )
Code: 16:42:36 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray)):
print(i, counterArray)
Code: 16:42:43 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
for i in range(len(counterArray)):
print(i, counterArray[i])
Analysis
expand all
Example tests
1.
0.040 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> 0 0 1 0 2 0
Code: 16:45:08 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
te
for i in range(len(counterArray)):
print(i, counterArray[i])
Code: 16:45:31 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).items()
print(test)
for i in range(len(counterArray)):
print(i, counterArray[i])
Code: 16:45:33 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).items()
print(test)
# for i in range(len(counterArray)):
# print(i, counterArray[i])
Analysis
expand all
Example tests
1.
0.036 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_items([(9, 4), (3, 2), (7, 1)])
Code: 16:46:06 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).va()
print(test)
# for i in range(len(counterArray)):
# print(i, counterArray[i])
Code: 16:46:10 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
# for i in range(len(counterArray)):
# print(i, counterArray[i])
Analysis
expand all
Example tests
1.
0.040 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Invalid result type, int expected, <class 'NoneType'> found.stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:48:44 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for
Code: 16:48:54 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in
Code: 16:49:17 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray:
if(evenOdd(v)):
return v
Code: 16:49:28 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray:
if(evenOdd(v)):
return v
Code: 16:49:28 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray:
if(evenOdd(v)):
return v
Analysis
expand all
Example tests
1.
0.036 s
RUNTIME ERROR,
tested program terminated with exit code 1
stderr:
Traceback (most recent call last): File "exec.py", line 129, in <module> main() File "exec.py", line 91, in main result = solution( A ) File "/tmp/solution.py", line 18, in solution for k, v in counterArray: TypeError: 'int' object is not iterablestdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:49:59 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray,:
if(evenOdd(v)):
return v
Code: 16:50:08 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray.items():
if(evenOdd(v)):
return v
Analysis
expand all
Example tests
1.
0.056 s
WRONG ANSWER,
got 4 expected 7
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:50:27 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray.items():
if(evenOdd(v) == False):
return v
Code: 16:50:27 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray.items():
if(evenOdd(v) == False):
return v
Analysis
expand all
Example tests
1.
0.036 s
WRONG ANSWER,
got 1 expected 7
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:50:53 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
for k, v in counterArray.items():
if(evenOdd(v) == False):
return v
Code: 16:51:05 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
return v
Code: 16:51:35 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
max = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < max:
answer = max
return v
Code: 16:52:06 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < counter:
answer = counter
return v
Code: 16:53:37 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < counter:
answer = counter
return v
Code: 16:54:31 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < counter:
answer = counter
return
Code: 16:54:41 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < counter:
answer = counter
return answer
Code: 16:55:50 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = counter
return answer
Code: 16:56:00 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = v
return answer
Code: 16:56:15 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = v
return answer
Analysis
expand all
Example tests
1.
0.036 s
WRONG ANSWER,
got 0 expected 7
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:56:41 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = v
return answer
Code: 16:56:51 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = v
return answer
Analysis
expand all
Example tests
1.
0.036 s
WRONG ANSWER,
got 1 expected 7
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:56:58 UTC,
py,
verify,
result: Failed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < v:
answer = v
return answer
Analysis
expand all
Example tests
1.
0.036 s
WRONG ANSWER,
got 1 expected 7
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:57:34 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = v
return answer
Code: 16:57:41 UTC,
py,
verify,
result: Passed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Analysis
expand all
Example tests
1.
0.036 s
OK
stdout:
Counter = Counter({9: 4, 3: 2, 7: 1}) <class 'collections.Counter'> dict_values([4, 2, 1])
Code: 16:58:02 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
#print("Counter = ", counterArray)
print(type(counterArray))
test = Counter(A).values()
#print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Code: 16:58:12 UTC,
py,
autosave
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
#print("Counter = ", counterArray)
test = Counter(A).values()
#print(test)
answer = 0
counter = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Code: 16:58:23 UTC,
py,
verify,
result: Passed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
#print("Counter = ", counterArray)
#test = Counter(A).values()
#print(test)
answer = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Analysis
Code: 16:58:34 UTC,
py,
verify,
result: Passed
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
#print("Counter = ", counterArray)
#test = Counter(A).values()
#print(test)
answer = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Analysis
Code: 16:58:36 UTC,
py,
final,
score: 
100
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
from collections import Counter
#Given a number, return true if its even or false if its odd
def evenOdd(N):
if((N % 2) == 0):
return True
else:
return False
def solution(A):
# write your code in Python 3.6
counterArray = Counter(A)
#print("Counter = ", counterArray)
#test = Counter(A).values()
#print(test)
answer = 0
for k, v in counterArray.items():
if(evenOdd(v) == False):
if answer < k:
answer = k
return answer
Analysis summary
The solution obtained perfect score.
Analysis
Detected time complexity:
O(N) or O(N*log(N))