###### tags: `BiWeekly Contest` # BiWeekly Contest 143 ## [3345. Smallest Divisible Digit Product I](https://leetcode.com/problems/smallest-divisible-digit-product-i/) (<font color=#00B8A3>Easy</font>) 限制: <ul> <li><code>1 <= n <= 100</code></li> <li><code>1 <= t <= 10</code></li> </ul> ### Solution #### 時間複雜度: $O(n)$ #### 空間複雜度: $O(1)$ 程式碼: ```cpp class Solution { public: int digitProdcutCalc(int num) { int result = 1; while (num) { result *= num % 10; num /= 10; } return result; } int smallestNumber(int n, int t) { for (; n <= 100; n++) { if (digitProdcutCalc(n) % t == 0) return n; } return -1; } }; ``` --- ## [3346. Maximum Frequency of an Element After Performing Operations I](https://leetcode.com/problems/maximum-frequency-of-an-element-after-performing-operations-i/) (<font color=#FFC011>Medium</font>) 限制: <ul> <li><code>1 <= nums.length <= 10<sup>5</sup></code></li> <li><code>1 <= nums[i] <= 10<sup>5</sup></code></li> <li><code>0 <= k <= 10<sup>5</sup></code></li> <li><code>0 <= numOperations <= nums.length</code></li> </ul> ### Solution #### 時間複雜度: $O()$ #### 空間複雜度: $O()$ 程式碼: ```cpp ``` --- ## [3347. Maximum Frequency of an Element After Performing Operations II](https://leetcode.com/problems/maximum-frequency-of-an-element-after-performing-operations-ii/) (<font color=#FF375F>Hard</font>) 限制: <ul> <li><code>1 <= nums.length <= 10<sup>5</sup></code></li> <li><code>1 <= nums[i] <= 10<sup>9</sup></code></li> <li><code>0 <= k <= 10<sup>9</sup></code></li> <li><code>0 <= numOperations <= nums.length</code></li> </ul> ### Solution #### 時間複雜度: $O()$ #### 空間複雜度: $O()$ 程式碼: ```cpp ``` --- ## [3348. Smallest Divisible Digit Product II](https://leetcode.com/problems/smallest-divisible-digit-product-ii/) (<font color=#FF375F>Hard</font>) 限制: <ul> <li><code>2 <= num.length <= 2 * 10<sup>5</sup></code></li> <li><code>num</code> consists only of digits <code>'0'-'9'</code>.</li> <li><code>num</code> does not contain leading zeros.</li> <li><code>1 <= t <= 10<sup>14</sup></code></li> </ul> ### Solution #### 時間複雜度: $O()$ #### 空間複雜度: $O()$ 程式碼: ```cpp ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up