Leetcode Algorithms -- Single Number II
Single Number II (Medium)
Description
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Analysis
我是直接枚举每一位的个数看看是否是3的倍数的。
虽然常数有点大。但是感觉比较通用啊。23333
My Solution
1 | //C++ |