长风破浪会有时,直挂云帆济沧海

Dream Word

博客园 首页 新随笔 联系 订阅 管理

1:Determine if all characters of a string are unique

  bool isUnique(string input)

  {

    bitset<256> hashMap;

    for(int i = 0; i < input.length(); i++)

    {

      if(hashMap[(int)input[i])

      {

          return false;

      }

      hashMap[(int)input[i]] = 1;

    }

    return true;

  }

2:Given two strings,determine if they are permutations of each other.

  

posted on 2018-03-08 22:47  长风II  阅读(139)  评论(0编辑  收藏  举报