Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool confusingNumber(int N) {
- int new_n = 0;
- vector <int> valid_new_rotate {0, 1,-1,-1,-1,-1, 9,-1, 8, 6};
- int old = N;
- while (N)
- {
- int dig = N % 10;
- if (valid_new_rotate[dig] == -1)
- {
- return false;
- }
- new_n = new_n *10 + valid_new_rotate[dig] ;
- cout << new_n << endl;
- N /= 10;
- }
- return new_n != old;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement