当前位置:网站首页>Daily question 2 12
Daily question 2 12
2022-07-05 02:50:00 【mujiaoniao】
I'm not alone
Catalog
Lee_3: Longest character :
The idea of sliding windows , Ensure that the characters in the window meet the requirements of the topic , Reject the non-conforming questions directly
public int lengthOfLongestSubstring(String s) {
// The longest substring without repetition
int len = s.length();
if (len == 0 ) return 0;
Map<Character,Integer> map = new HashMap<>();
int max = 0;
int left = 0;
for (int i = 0; i < len; i++) {
if (map.containsKey(s.charAt(i))){
left = Math.max(left,map.get(s.charAt(i))+1);
}
map.put(s.charAt(i),i);
// Store the value of the subscript .
max = Math.max(max,i-left+1);// Through constant progress on left Subscript control Eliminate the existing characters ;
}
return max;
}边栏推荐
- openresty ngx_ Lua execution phase
- Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
- Elk log analysis system
- Port, domain name, protocol.
- Design and practice of kubernetes cluster and application monitoring scheme
- openresty ngx_ Lua variable operation
- Tiny series rendering tutorial
- Acwing game 58 [End]
- Azkaban actual combat
- Master Fur
猜你喜欢

2.常见的请求方法

Summary and practice of knowledge map construction technology

Bumblebee: build, deliver, and run ebpf programs smoothly like silk

Simple use of devtools

【LeetCode】110. Balanced binary tree (2 brushes of wrong questions)

Azkaban概述

openresty ngx_lua執行階段

Avoid material "minefields"! Play with super high conversion rate

Avoid material "minefields"! Play with super high conversion rate

Linux Installation redis
随机推荐
2021 Li Hongyi machine learning (3): what if neural network training fails
Kotlin - 协程 Coroutine
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
LeetCode146. LRU cache
Acwing第 58 场周赛【完结】
SFTP cannot connect to the server # yyds dry goods inventory #
Moco V2 literature research [self supervised learning]
低度酒赛道进入洗牌期,新品牌如何破局三大难题?
College Students' innovation project management system
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
Pat grade a 1119 pre- and post order traversals (30 points)
tuple and point
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Azkaban实战
Elk log analysis system
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
【LeetCode】501. Mode in binary search tree (2 wrong questions)
This + closure + scope interview question
Exploration of short text analysis in the field of medical and health (II)
Simple use of devtools