**Tell us what’s happening:**

Wondering if people have got some faster ways to implement azSorted. I used a method of comparing each char in adjacent elements. Find the shortest length out of the 2 and compare up to that index the charCodes. There are then 4 cases to cover the outcomes and edge case. This seems inefficient like bubble sort.

I know there are faster ways can people shed some light on possible solutions that still cover all edge cases?

**Your code so far**

```
function allEqual (arr) {
if (arr.length === 0){
return true;
}
let resArr = [];
for (let i = 0; i < arr.length; i++){
let tally = 0;
for (let j = 0; j < arr[i].length; j++){
tally += arr[i].charCodeAt(j);
}
resArr.push(tally);
}
let total = resArr.reduce((acc,curr)=>acc+curr);
if (total%resArr[0] === 0){
return true;
}
return false;
}
function azSorted (arr) {
// Good luck!
if (arr.length === 0){
return true;
}
for (let i = 0; i < arr.length-1; i++){
let shortestLen = 0;
let elem1 = arr[i];
let elem2 = arr[i+1];
if (elem1.length <= elem2.length){
shortestLen = elem1.length;
}else{
shortestLen = elem2.length;
}
for (let j = 0; j < shortestLen; j++){
if(elem1.charCodeAt(j) === elem2.charCodeAt(j) && j === shortestLen-1){
return false;
}else if (elem1.charCodeAt(j) === elem2.charCodeAt(j)){
continue;
}else if (elem1.charCodeAt(j) < elem2.charCodeAt(j)){
break;
}else{
return false;
}
}
}
return true;
}
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36`

.

**Link to the challenge:**

https://learn.freecodecamp.org/coding-interview-prep/rosetta-code/compare-a-list-of-strings