当前位置:网站首页>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
边栏推荐
- 数据集-故障诊断:西储大学轴承的各项数据以及数据说明
- 非路由组件之头部组件和底部组件书写
- [redis notes] compressed list (ziplist)
- Flexible combination of applications is a false proposition that has existed for 40 years
- Go basic constant definition and use
- [error record] the flutter reports an error (could not resolve io.flutter:flutter_embedding_debug:1.0.0.)
- 理想汽车×OceanBase:当造车新势力遇上数据库新势力
- Simple square wave generating circuit [51 single chip microcomputer and 8253a]
- Arduino - character judgment function
- JDBC练习案例
猜你喜欢
Integration of revolution and batch normalization
“一个优秀程序员可抵五个普通程序员!”
RuntimeError: no valid convolution algorithms available in CuDNN
Win11启用粘滞键关闭不了怎么办?粘滞键取消了但不管用怎么解决
基于Pyqt5工具栏按钮可实现界面切换-1
Getting started with golang: for Range an alternative method of modifying the values of elements in slices
Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
Win11麦克风测试在哪里?Win11测试麦克风的方法
Remote connection of raspberry pie by VNC viewer
JDBC practice cases
随机推荐
How can cross-border e-commerce achieve low-cost and steady growth by laying a good data base
Data set - fault diagnosis: various data and data description of bearings of Western Reserve University
采用VNC Viewer方式遠程連接樹莓派
富滇银行完成数字化升级|OceanBase数据库助力布局分布式架构中台
简述中台的常识
Win11麦克风测试在哪里?Win11测试麦克风的方法
Golang common settings - modify background
Implementation of VGA protocol based on FPGA
Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)
FOC矢量控制及BLDC控制中的端电压、相电压、线电压等概念别还傻傻分不清楚
The difference between new and make in golang
Integration of revolution and batch normalization
golang入门:for...range修改切片中元素的值的另类方法
YOLOX加强特征提取网络Panet分析
【Redis笔记】压缩列表(ziplist)
Load balancing cluster (LBC)
Markdown basic grammar
Makefile configuration of Hisilicon calling interface
内网渗透 | 手把手教你如何进行内网渗透
基于Pyqt5工具栏按钮可实现界面切换-2