Untitled
unknown
c_cpp
4 years ago
1.1 kB
2
Indexable
/* * @lc app=leetcode.cn id=752 lang=cpp * * [752] 打开转盘锁 */ // @lc code=start #include <string> #include <iostream> #include <vector> using namespace std; class Solution { private: public: string change(string val, int pos,int op){ val[pos] = char(val[pos] + ((int)(val[pos] - '0') + op + 10)%10); return val; } int openLock(vector<string>& deadends, string target) { if(target == '0000'){ return 0; } queue<string> q; set<string> vis; set<string> dead; int step = 0; for(int i = 0; i < deadends.size(); i++){ dead.insert(deadends[i]); } q.push() while(!q.empty()){ string cur = q.front(); q.pop(); } return 0; } }; int main(){ Solution sol; string str[]={"0201","0101","0102","1212","2002"}; vector<string> strArray(str, str+4); string target = "0202"; cout<<sol.change(target, 0, -1)<<endl; return 0; } // @lc code=end
Editor is loading...