1689. Partitioning Into Minimum Number Of Deci-Binary Numbers Medium
1/**
2 * [1689] Partitioning Into Minimum Number Of Deci-Binary Numbers
3 *
4 * A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not.
5 * Given a string n that represents a positive decimal integer, return the minimum number of positive deci-binary numbers needed so that they sum up to n.
6 *
7 * Example 1:
8 *
9 * Input: n = "32"
10 * Output: 3
11 * Explanation: 10 + 11 + 11 = 32
12 *
13 * Example 2:
14 *
15 * Input: n = "82734"
16 * Output: 8
17 *
18 * Example 3:
19 *
20 * Input: n = "27346209830709182346"
21 * Output: 9
22 *
23 *
24 * Constraints:
25 *
26 * 1 <= n.length <= 10^5
27 * n consists of only digits.
28 * n does not contain any leading zeros and represents a positive integer.
29 *
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/
34// discuss: https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39 pub fn min_partitions(n: String) -> i32 {
40 0
41 }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_1689() {
52 }
53}
54
Back
© 2025 bowen.ge All Rights Reserved.