Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-01 03:25:19 10月03日 Update

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

Tags: Content array front end common algorithm maximum letter character string article format knowledge article minimum value most object that is attribute difference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology NVidia Microsoft MariaDB Huawei