• + 0 comments

    function squares(a: number, b: number): number { // Write your code here let squaresCount: number = 0

    let lower: number = Math.ceil(Math.sqrt(a))
    let upper: number = Math.floor(Math.sqrt(b))
    
    let squaresSet: Set<number> = new Set()
    
    for (let i = lower; i <= upper; i++) {
        squaresSet.add(i * i)
    }
    
    console.log(`lower: `${lower}, upper: $`{upper}, squareSet: ${Array.from(squaresSet)}`)
    
    return squaresSet.size
    

    }