Skip to content

Latest commit

 

History

History

maximum-69-number

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Maximum 69 number

Problem link

Solutions

Solution.cpp

// https://leetcode.com/problems/maximum-69-number

class Solution {
 public:
  int maximum69Number(int num) {
    auto s = to_string(num);
    for (char& c : s) {
      if (c == '6') {
        c = '9';
        break;
      }
    }
    return stoi(s);
  }
};

Tags