From 667e049b34eec9b9c4d0ab610c095c81a73118ca Mon Sep 17 00:00:00 2001 From: Sahil Bairagi Date: Fri, 2 Oct 2020 16:39:52 +0530 Subject: [PATCH] Solved Bulb switcher. Fixes #135 --- LeetCode/0319_BulbSwitcher.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 LeetCode/0319_BulbSwitcher.py diff --git a/LeetCode/0319_BulbSwitcher.py b/LeetCode/0319_BulbSwitcher.py new file mode 100644 index 0000000..fb53b7f --- /dev/null +++ b/LeetCode/0319_BulbSwitcher.py @@ -0,0 +1,7 @@ +# The bulbs that will be turned on in the end will be the ones that are perfect squares. +# So we just have to find the perfect square less than n; Square root of which will be the answer. +# Contributed by: Sahil Bairagi + +class Solution: + def bulbSwitch(self, n: int) -> int: + return int(n**(0.5))