319. Bulb Switcher
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 54% Topics: Math, Brainteaser
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(1)
# Space: O(1)
import math
class Solution(object):
def bulbSwitch(self, n):
"""
type n: int
rtype: int
"""
# The number of full squares.
return int(math.sqrt(n))
Solution from kamyu104/LeetCode-Solutions · MIT