3079. Find the Sum of Encrypted Integers Easy

@problem@discussion
#Array#Math



1/**
2 * [3079] Find the Sum of Encrypted Integers
3 *
4 * You are given an integer array nums containing positive integers. We define a function encrypt such that encrypt(x) replaces every digit in x with the largest digit in x. For example, encrypt(523) = 555 and encrypt(213) = 333.
5 * Return the sum of encrypted elements.
6 *  
7 * <strong class="example">Example 1:
8 * <div class="example-block" style="border-color: var(--border-tertiary); border-left-width: 2px; color: var(--text-secondary); font-size: .875rem; margin-bottom: 1rem; margin-top: 1rem; overflow: visible; padding-left: 1rem;">
9 * Input: <span class="example-io" style="font-family: Menlo,sans-serif; font-size: 0.85rem;">nums = [1,2,3]</span>
10 * Output: <span class="example-io" style="font-family: Menlo,sans-serif; font-size: 0.85rem;">6</span>
11 * Explanation: The encrypted elements are [1,2,3]. The sum of encrypted elements is 1 + 2 + 3 == 6.
12 * </div>
13 * <strong class="example">Example 2:
14 * <div class="example-block" style="border-color: var(--border-tertiary); border-left-width: 2px; color: var(--text-secondary); font-size: .875rem; margin-bottom: 1rem; margin-top: 1rem; overflow: visible; padding-left: 1rem;">
15 * Input: <span class="example-io" style="font-family: Menlo,sans-serif; font-size: 0.85rem;">nums = [10,21,31]</span>
16 * Output: <span class="example-io" style="font-family: Menlo,sans-serif; font-size: 0.85rem;">66</span>
17 * Explanation: The encrypted elements are [11,22,33]. The sum of encrypted elements is 11 + 22 + 33 == 66.
18 * </div>
19 *  
20 * Constraints:
21 * 
22 * 	1 <= nums.length <= 50
23 * 	1 <= nums[i] <= 1000
24 * 
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/find-the-sum-of-encrypted-integers/
29// discuss: https://leetcode.com/problems/find-the-sum-of-encrypted-integers/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34    pub fn sum_of_encrypted_int(nums: Vec<i32>) -> i32 {
35        0
36    }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn test_3079() {
47    }
48}
49


Back
© 2025 bowen.ge All Rights Reserved.