题目:
解答:
1 class Solution { 2 public: 3 bool isUnique(string astr) 4 { 5 int mark = 0; 6 for (int i = 0; i < astr.size(); i++) 7 { 8 int move_bit = astr[i] - ‘a‘; 9 if ((mark & (1 << move_bit)) != 0) 10 { 11 return false; 12 } 13 else 14 { 15 mark |= (1 << move_bit); 16 } 17 } 18 return true; 19 } 20 };
原文:https://www.cnblogs.com/ocpc/p/12831695.html