We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Diwali Lights
- Discussions
Diwali Lights
Diwali Lights
Sort by
recency
|
203 Discussions
|
Please Login in order to post a comment
Here's my java solution:
public static long lights(int n) {
it's like sum of combinations.. nC0 + nC1 + nC2 ... +nCk +..nCn = 2^n;
where "k" is the number of lights at a moment of time. we'll traverse from [0 , n-1] and creating 2^n slowly with limit 1e5
at last we won't consider the case where no light bulb is ON.
2^n - nC0 -> 2^n - 1
python ((2 ** n) - 1) % 100000
1<
Do you ever use Patriot Lighting for your Diwali Event? I hear that diwali is big event for India and they use lighting now a day?