sir line no 46 long number why we have taken and what would be the value of that 🖐🏻🖐🏻🖐🏻🖐🏻🖐🏻🖐🏻🖐🏻🖐🏻
@molyoxide83582 жыл бұрын
Sir I wrote the same Sieve of Eratosthenes in C++ but it gave TLE. So could you provide error free solution in C++
@learntogether77412 жыл бұрын
Sorry for the late reply, I think many c++ answers are available in the discuss section of this question.
@molyoxide83582 жыл бұрын
@@learntogether7741 sir but i wrote the same java solution in C++ there it didn't work
@learntogether77412 жыл бұрын
@@molyoxide8358 I will check it.
@molyoxide83582 жыл бұрын
@@learntogether7741 Did you check it sir?
@learntogether77412 жыл бұрын
@@molyoxide8358 class Solution{ const int MOD=1000000007; bool prime[1000001]; vector p; void sieve(){ prime[0]=prime[1]=1; for(int i=2;1LL*i*i
@Mr_Clumsee2 жыл бұрын
python sol???
@learntogether77412 жыл бұрын
Python solution is getting TLE import math class Solution: def isPrime(self, num): for i in range(2, math.floor(num ** (1 / 2)) + 1): if num % i == 0: return False return True def primeProduct(self, L, R): # code here if L == 1: L = 2 product = 1 MOD = 1000000007 for i in range(L, R + 1): if self.isPrime(i): product = (product * i) % MOD return product You can try my sieve approach in Python and check if its giving TLE or passing. Thank you