当前位置:网站首页>leetcode 650. 2 keys keyboard with only two keys (medium)
leetcode 650. 2 keys keyboard with only two keys (medium)
2022-07-02 23:40:00 【InfoQ】
One 、 The main idea of the topic
- 1 <= n <= 1000
Two 、 Their thinking
3、 ... and 、 How to solve the problem
3.1 Java Realization
public class Solution {
public int minSteps(int n) {
int[] dp = new int[n + 1];
int h = n * n;
for (int i = 2; i <= n; i++) {
dp[i] = i;
for (int j = 2; j <= h; j++) {
if (i % j == 0) {
dp[i] = dp[j] + dp[i / j];
break;
}
}
}
return dp[n];
}
}
Four 、 Summary notes
- 2022/7/2 expect 7 month 11 Number
边栏推荐
- Win11如何开启目视控制?Win11开启目视控制的方法
- Hisilicon VI access video process
- The concepts of terminal voltage, phase voltage and line voltage in FOC vector control and BLDC control are still unclear
- (毒刺)利用Pystinger Socks4上线不出网主机
- 高数有多难?AI 卷到数学圈,高数考试正确率 81%!
- CDN 加速,需要域名先备案
- 顶级 DevOps 工具链大盘点
- 基于Pyqt5工具栏按钮可实现界面切换-1
- 【OJ】两个数组的交集(set、哈希映射 ...)
- 购买完域名之后能干什么事儿?
猜你喜欢
Talk about memory model and memory order
What can I do after buying a domain name?
【ML】李宏毅三:梯度下降&分类(高斯分布)
Bean加载控制
What is the official website address of e-mail? Explanation of the login entry of the official website address of enterprise e-mail
程序分析与优化 - 9 附录 XLA的缓冲区指派
Go basic data type
一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
MySQL Foundation
Where is the win11 microphone test? Win11 method of testing microphone
随机推荐
Bean load control
容器运行时分析
Which common ports should the server open
高数有多难?AI 卷到数学圈,高数考试正确率 81%!
Warning: implicitly declaring library function 'printf' with type 'int (const char *,...)‘
【OJ】两个数组的交集(set、哈希映射 ...)
Wechat applet basic learning (wxss)
How difficult is it to be high? AI rolls into the mathematics circle, and the accuracy rate of advanced mathematics examination is 81%!
The use of 8255 interface chip and ADC0809
MySQL基础
Integration of revolution and batch normalization
(stinger) use pystinger Socks4 to go online and not go out of the network host
数字图像处理实验目录
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
ArrayList分析2 :Itr、ListIterator以及SubList中的坑
FOC矢量控制及BLDC控制中的端电压、相电压、线电压等概念别还傻傻分不清楚
一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
【ML】李宏毅三:梯度下降&分类(高斯分布)
Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
CDN 加速,需要域名先备案