# Class Photos

<figure><img src="https://3743232000-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHW2IQuh2PFpWJDvBz2FF%2Fuploads%2Fgit-blob-9e3b49473ced90b6c23fbd4e8ebd1040d00463a0%2FScreenshot%202023-01-20%20at%2018.57.59.png?alt=media" alt=""><figcaption></figcaption></figure>

```javascript
function classPhotos(redShirtHeights, blueShirtHeights) {
  redShirtHeights.sort((a, b) => b - a);
  blueShirtHeights.sort((a, b) => b - a);

  let front = redShirtHeights;
  let back = blueShirtHeights;
  if (front[0] > back[0]) {
    front = blueShirtHeights;
    back = redShirtHeights;
  }

  for (let i = 0; i < front.length; i++) {
    if (front[i] < back[i]) continue;
    return false;
  }
  
  return true;
}

// Do not edit the line below.
exports.classPhotos = classPhotos;
```
