HJ9题解 | #提取不重复的整数#

提取不重复的整数

https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    string str;
    vector<int> ve(10, 0);
    cin>>str;
    reverse(str.begin(), str.end());
    for (int i=0; i<str.size(); i++)
    {
        if(ve[(int)(str[i])] == 0)
        {
            cout<<str[i];
            ve[(int)(str[i])] = 1;
        }
    }
}
全部评论

相关推荐

鼠鼠能上岸吗:进行中是秋招大项目进行中,你还可以选别的岗位;已结束是这个岗位流程结束了;筛选中就是在简历筛选环节没hr捞
投递美团等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务