当前位置:网站首页>2022.6.29-----leetcode.535
2022.6.29-----leetcode.535
2022-06-29 17:59:00 【路Lu727】
private Map<Integer, String> dataBase = new HashMap<Integer, String>();
private int id;//自增id
public String encode(String longUrl) {
id++;
dataBase.put(id, longUrl);
return "http://tinyurl.com/" + id;
}
public String decode(String shortUrl) {
int p = shortUrl.lastIndexOf('/') + 1;
int key = Integer.parseInt(shortUrl.substring(p));
return dataBase.get(key);
}边栏推荐
- jdbc_相关代码
- Adobe Premiere基础-不透明度(蒙版)(十一)
- Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
- 【TcaplusDB知识库】TcaplusDB运维单据介绍
- 【TcaplusDB知识库】TcaplusDB单据受理-事务执行介绍
- Shell tutorial circular statements for, while, until usage
- Sister Juan takes you to learn database -- 5-day dash day4
- Top 30 open source software
- Workflow module jar package startup error: liquibase – waiting for changelog lock
- [tcapulusdb knowledge base] tcapulusdb system user group introduction
猜你喜欢

Proxmox VE Install 7.2

Relationship among controller, service and Dao

Servlet学生管理系统(萌新练手版)

小迈科技 X Hologres:高可用的百亿级广告实时数仓建设

Adobe Premiere基础-批量素材导入序列-变速和倒放(回忆)-连续动作镜头切换-字幕要求(十三)

Servlet student management system (Mengxin hands-on version)

Adobe Premiere基础-炫酷文字快闪(十四)

Abc253 D fizzbuzz sum hard (tolerance exclusion theorem)

VB. Net read / write NFC ntag tag source code

Request header field xxxx is not allowed by Access-Control-Allow-Headers in preflight response问题
随机推荐
mysql -connector/j驱动下载
How do I add SmartArt to slides in PowerPoint?
Maximum length of palindrome substring (string hash + binary)
程序员资源推荐指南
Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
VMware安装ESXI
Distributed | several steps of rapid read / write separation
kubekey2.2.1 kubernetes1.23.7离线包制作+harbor部暑并上传镜像
3h精通OpenCV(八)-形状检测
How to use idea?
VB. Net read / write NFC ntag tag source code
Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
Record that the server has been invaded by viruses: the SSH password has been changed, the login fails, the malicious program runs full of CPU, the jar package fails to start automatically, and you ha
[网鼎杯 2020 青龙组]AreUSerialz
NVIDIA installs the latest graphics card driver
Find the maximum XOR value in the sequence given a number (01 Dictionary)
The soft youth under the blessing of devcloud makes education "smart" in the cloud
Image migration and data migration synchronization of old and new servers with different Alibaba cloud accounts
Lodash deep copy usage
shell教程之循环语句for,while,until用法