Problem statement

https://binarysearch.com/problems/Light-Bulb-Toggling/

Solution

Equal to Leetcode 0319 Bulb Switcher.

Complexity

It is O(1) for time and space.

Code

class Solution:
    def solve(self, n):
        return int(sqrt(n))