All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : June 22, 2024
Last updated : June 22, 2024
Related Topics : String, Greedy
Acceptance Rate : 88.76 %
int minPartitions(char* n) {
int output = 0;
while (*n) {
output = *n - '0' < output ? output : (*n - '0');
n++;
}
return output;
}
class Solution {
public int minPartitions(String n) {
int maxx = 0;
for (char c : n.toCharArray()) {
maxx = Integer.max(maxx, c - '0');
}
return maxx;
}
}