package leetcode;

/**
 * https://leetcode.com/problems/maximum-69-number/
 */
public class Problem1323 {
    public int maximum69Number (int num) {
        return 0;
    }

    public static void main(String[] args) {
        Problem1323 prob = new Problem1323();
        System.out.println(prob.maximum69Number(9669)); // 9969
        System.out.println(prob.maximum69Number(9996)); // 9999
        System.out.println(prob.maximum69Number(9999)); // 9999
    }
}

@@ -154,307 +154,342 @@
     
-return 0
+String answer = Integer.toString(num)
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1323 prob = new Problem1323();%0A        System.out.println(prob.maximum69Number(9669)); // 9969%0A        System.out.println(prob.maximum69Number(9996)); // 9999%0A        System.out.println(prob.maximum69Number(9999)); // 9999
+String s = Integer.toString(num);%0A        for (int i = 0; i %3C s.length(); i++) %7B%0A            if (s.charAt(i) == '6') %7B%0A                answer = answer.substring(0, i) + '9' + answer.substring(i + 1);%0A                break;%0A            %7D%0A        %7D%0A        return Integer.parseInt(answer);
 %0A   

Solve problem 1323