当前位置:网站首页>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);
}边栏推荐
- Adobe Premiere基础-声音调整(音量矫正,降噪,电话音,音高换挡器,参数均衡器)(十八)
- Adobe Premiere基础-不透明度(蒙版)(十一)
- Sister Juan takes you to learn database -- 5-day dash day4
- Abc253 D fizzbuzz sum hard (tolerance exclusion theorem)
- 【目标跟踪】|stark配置 win otb
- 【网络是怎么连接的】第三章 探索集线器,交换机和路由器
- DevCloud加持下的青软,让教育“智”上云端
- shell教程之循环语句for,while,until用法
- Dictionary tree (optional)
- MaxCompute Studio
猜你喜欢

Adobe Premiere基础-不透明度(混合模式)(十二)

Adobe Premiere基础-不透明度(蒙版)(十一)

Premature end of script headers 或 End of script output before headers

Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising

Adobe Premiere基础-时间重映射(十)

Niuke Xiaobai monthly race 52 E group logarithmic sum (inclusion exclusion theorem + dichotomy)

Precondition end of script headers or end of script output before headers

Servlet student management system (Mengxin hands-on version)

codeforces每日5题(均1700)-第二天

VB. Net read / write NFC ntag tag source code
随机推荐
mysql -connector/j驱动下载
回文子串的最大长度(字符串哈希+二分)
js两个一维数组合并并去除相同项(整理)
Relationship among controller, service and Dao
【TcaplusDB知识库】TcaplusDB单据受理-创建业务介绍
【TcaplusDB知识库】TcaplusDB单据受理-事务执行介绍
【TcaplusDB知识库】TcaplusDB系统用户组介绍
让 Google 搜索到自己的博客
Maxcompute string replacement function -replace
Find the maximum XOR value in the sequence given a number (01 Dictionary)
On adding and subtracting dates
Servlet学生管理系统(萌新练手版)
NVIDIA installs the latest graphics card driver
Servlet student management system (Mengxin hands-on version)
Sister Juan takes you to learn database -- 5-day sprint Day1
Adobe Premiere基础-不透明度(混合模式)(十二)
[网鼎杯 2020 青龙组]AreUSerialz
markdown常用字体
Have you grasped the most frequently asked question in the interview about massive data processing?
Longest XOR path (dfs+01trie)