当前位置:网站首页>Summary of force deduction questions
Summary of force deduction questions
2022-06-11 07:51:00 【AQ14_】
Code details
Array
1、 Encountered array related problems , It is necessary to judge the boundary conditions
Array sorting
// Array forward sort
nums.sort(function(a,b){
return a - b
})
Generate 26 The first value is 0 Array of
const characters = Array(26).fill(0)
Array to string
const key = characters.join()
Declare a binary array
const memo = []
for (let i = 0;i <n;i++){
memo.push([])
}
Traversal string
// Define two pointers
let left = 0
let right = s.length - 1
// Traversal string
while(left < right){
if(s[left] !== s[right]){
return false
}
left++
right--
}
Use regular expressions to remove non letters from strings
\W Find non word characters
s = s.toLowerCase().replace(/[\W_]/g,"")
Split characters with extended strings :
let s = "anagra"
console.log([...s]);
Output is :['a', 'n', 'a', 'g', 'r', 'a']
Then you can sort the characters :
[...s].sort()
Output :['a', 'a', 'a', 'g', 'n', 'r']
adopt [...s].sort().join('') Form a string
边栏推荐
- . Net C Foundation (6): namespace - scope with name
- wordcloud的使用
- 零基础自学SQL课程 | OUTER JOIN外连接
- 学习《缠解论语》
- C language lesson 2
- Activity中,View#postDelay会导致内存泄漏,但是不会影响Activity的生命周期执行。
- Alchemy experience (model training of deep learning) the necessity of timely adjusting training parameters for some situations (the adjustment of learning rate LR is the primary) summarizes some metho
- Wc2020 course selection
- Tidb cloud launched Google cloud marketplace, empowering global developers with a new stack of real-time HTAP databases
- 空间几何
猜你喜欢

记一次忽略@SuppressLint(“NewApi“)提示引发的血案

空间几何

放大镜子效果图

C# 微信上传Form-data

Servlet

C- print 99 multiplication table

Simple configuration of vscade
![[codeforces1019e] raining season](/img/8e/4a96954ee7dae5f81eaae05b5a075b.png)
[codeforces1019e] raining season

Understanding of Poisson distribution and Poisson process and Erlang distribution and their relations (important theories in queuing theory and operational research)

二本畢業,銀行外包測試工作 4 個月有餘。聊聊一些真實感受 ...
随机推荐
远程办公经验分享 | 社区征文
运筹学导论
[IOT] intelligent hardware: how to obtain the WiFi signal strength of hardware products
860. 柠檬水找零
【CodeForces908H】New Year and Boolean Bridges (FWT)
C language three chess games
Sort - merge sort
Getting started with bladed tutorial (video)
How to prepare for the new PMP syllabus exam?
Black Qunhui dsm7.0.1 physical machine installation tutorial
Zero foundation self-study SQL course | union joint query
Collation of basic knowledge of intermediate development of Andrews (for interview)
【软件测试】这样的简历已经刷掉了90%的面试者
零基础自学SQL课程 | UNION 联合查询
C language - Growth Diary -01- count primes and sum
Wc2020 course selection
forEach 中 return 和 for 中 break
Opencv for face recognition
【AtCoder1998】Stamp Rally(整体二分+并查集)
Bidirectional linked list simple template (pointer version)