• Home
  • About
    • Che1's Blog photo

      Che1's Blog

      Che1's Dev Blog

    • Learn More
    • Facebook
    • Instagram
    • Github
    • Steam
    • Youtube
  • Posts
    • All Posts
    • Django
    • Python
    • Front-end
    • Algorithm
    • etc
    • All Tags
  • Projects

[Codility] Lv2 - OddOccurrencesInArray

05 Apr 2018

Reading time ~1 minute

최종 답안

def solution(A):
    sorted_A = sorted(A)
    
    for i in range(0, len(sorted_A), 2):
        if i + 1 == len(sorted_A):
            return sorted_A[-1]
        if sorted_A[i] != sorted_A[i+1]:
            return sorted_A[i]

Reference

Codility



AlgorithmCodilityArrays Share Tweet +1