Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- struct {
- bool operator() (int a, int b) const {
- if (b == 0) {
- if (a == 0) {
- return false;
- }
- else {
- return true;
- }
- } else {
- return false;
- }
- }
- } ZeroIsKing;
- class Solution {
- public:
- void moveZeroes(vector<int>& nums) {
- std::stable_sort(nums.begin(), nums.end(), ZeroIsKing);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement