JS算法题
2021-06-04 18:02
标签:return targe sre function tar key code pre aaa JS算法题 标签:return targe sre function tar key code pre aaa 原文地址:https://www.cnblogs.com/lceihen/p/14645698.html求字符串出现次数最多字符
let str = "aaabbccccddddd"
function longSre(str) {
let zifu;
let max = 0;
let arr = str.split(‘‘)
let map = new Map()
for (let i = 0; i max) {
zifu = item
max = map.get(item)
}
}
console.log(zifu)
console.log(max)
}
longSre(str)
两数之和
var twoSum = function(nums, target) {
let map=new Map()
for(let i=0;i