Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common algorithm questions for web front-end interview?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This "web front-end interview common algorithm questions what are the knowledge points of this article, most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this" web front-end interview common algorithm questions what are the article "it.

1 object to an array

The format of varobj= {0length', 1obj', 2obj', 3var_slice= 'mother', length:4} / / must be similar to that of an array (the key value is the index and has the length attribute) var_slice= [] .slice; varobjArr=_slice.call (obj)

two。 Count the most letters in a string

FunctioncountMost (str) {constobjCount= {}

Str=str.split ('). Sort (). Join ('); for (leti=0;imaxValue) {

MaxStr= []

MaxStr.push (p)

MaxValue=objCount [p]

} elseif (objCount [p] = = maxValue) {

MaxStr.push (p)

}

} returnmaxStr.length==1?maxStr [0]: maxStr

} console.log (countMost ('afjghdfffffraaaasdddddenas'))

3. Find out the maximum difference of the following positive arrays

Constarr= [10, 5, 11, 7, 8, 9]; functiongetMaxProfit (arr) {letmax=arr [0]

Min=arr [0]; for (leti=1;i

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report