当前位置:网站首页>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
边栏推荐
- PHP get real IP
- Agnosticism and practice makes perfect
- 【OJ】两个数组的交集(set、哈希映射 ...)
- Arduino - 字符判断函数
- Implementation of VGA protocol based on FPGA
- Optimization of streaming media technology
- Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
- Getting started with golang: for Range an alternative method of modifying the values of elements in slices
- 实用系列丨免费可商用视频素材库
- What if win11 can't turn off the sticky key? The sticky key is cancelled but it doesn't work. How to solve it
猜你喜欢

BBR encounters cubic

ADC of stm32

Ideal car × Oceanbase: when the new forces of car building meet the new forces of database

Where is the win11 microphone test? Win11 method of testing microphone

Where is the win11 automatic shutdown setting? Two methods of setting automatic shutdown in win11

Flexible combination of applications is a false proposition that has existed for 40 years

解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错

跨境电商如何通过打好数据底座,实现低成本稳步增长

第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】

Bean load control
随机推荐
第三方支付功能测试点【杭州多测师_王sir】【杭州多测师】
解决:exceptiole ‘xxxxx.QRTZ_LOCKS‘ doesn‘t exist以及mysql的my.cnf文件追加lower_case_table_names后启动报错
leetcode 650. 2 Keys Keyboard 只有两个键的键盘(中等)
数字图像处理实验目录
All things work together, and I will review oceanbase's practice in government and enterprise industry
JDBC练习案例
Go basic constant definition and use
List of major chip Enterprises
提交代码流程
@BindsInstance在Dagger2中怎么使用
潘多拉 IOT 开发板学习(HAL 库)—— 实验3 按键输入实验(学习笔记)
Win11麦克风测试在哪里?Win11测试麦克风的方法
Interface switching based on pyqt5 toolbar button -1
简述中台的常识
php 获取真实ip
Warning: implicitly declaring library function 'printf' with type 'int (const char *,...)‘
How does win11 turn on visual control? Win11 method of turning on visual control
What if win11 can't turn off the sticky key? The sticky key is cancelled but it doesn't work. How to solve it
Submit code process
JDBC練習案例