力扣直通车
问题描述
提示
代码
package com.leetcode.medium;
/**
* @author 花君瑜
* @date 2022/8/1 19:47:37
**/
public class P1689_MinPartitions {
public int minPartitions(String n) {
int max = 0;
for (int i = 0; i < n.length(); i++) {
if (n.charAt(i) > max) {
max = n.charAt(i);
}
}
return max - '0';
}
public static void main(String[] args) {
P1689_MinPartitions mp = new P1689_MinPartitions();
String n = "32";
int max = mp.minPartitions(n);
System.out.println(max);
}
}