Lonely Integer

  • + 0 comments

    Time: O(N), Space: O(1)

    int lonelyinteger(vector a) { int ret {0};

    for (int num : a)
        ret ^= num;
    
    return ret;
    

    }