https://leetcode.com/problems/longer-contiguous-segments-of-ones-than-zeros/



Runtime: 85 ms, faster than 52.94% of TypeScript online submissions for Longer Contiguous Segments of Ones than Zeros.

Memory Usage: 44.2 MB, less than 47.06% of TypeScript online submissions for Longer Contiguous Segments of Ones than Zeros.


```typescript
function checkZeroOnes(s: string): boolean {
    //8:05
    const regex0 = /0+/g;
    const regex1 = /1+/g;
    const found0 = s.match(regex0);
    const found1 = s.match(regex1);
    if (found0?.length && found1?.length) {
        found0.sort((a,b)=>b.length-a.length)
        found1.sort((a,b)=>b.length-a.length)
        //console.log(found0, found1)
        return found1[0].length > found0[0].length
    } 
    if (found1?.length) {
        return true
    } 
    return false
    //8:07
    //debug until 8:12
};
```
