hey striver, a request. As you upload videos, kindly also make the required updates in the A to Z sheet as well so that we wont have to find them out on YT.
Queries store the list. If Queries=3, then three range given.., So find primes for every range..., To access l and r of first query, l = Queries [i][0] r = Queries [i][1] Means if i=0 then it acces 0th l & r. If i=1 then it access 1st L & R And so on...,
Here queries can be seen as an array of array where the array the queries stores just have 2 indexes first for l(left) and r(right) So the queries stores the l and r for each query
hey striver, a request. As you upload videos, kindly also make the required updates in the A to Z sheet as well so that we wont have to find them out on YT.
yes yes i also want to say this same thing
can you please provide the link of the question?
Ya please anyone provide the link
@@sachinchoudhary4142 did you get it
spoj prime1
great!
love your work ❤❤❤❤
Take rest bro
and Understood 🙂🙂
Great explanation.
Great Bro; Understood well;
Hey Striver, can you please provide the respective code in c++/java.
class Solution {
public:
int count(int n) {
vector prime(n, 1);
int count = 0;
for(int i = 2; i * i < n; i++) {
if(prime[i] == 1) {
for(int j = i * i; j < n; j += i) {
prime[j] = 0;
}
}
}
for(int i = 2; i < n; i++) {
if(prime[i] == 1) {
count++;
}
}
return count;
}
bool isPrime(int n) {
if (n
wont time complexity have another O(10^6) because seive function will take O(10^6) + O(10^6*loglog10^6) and then prefix sum takes O(10^6) as well
Understood :))
notes?
VIEDO ON OA???
can anyone explain me what is l = queries[i][0] and r = queries[i][1]
Queries store the list.
If Queries=3,
then three range given..,
So find primes for every range...,
To access l and r of first query,
l = Queries [i][0]
r = Queries [i][1]
Means if i=0 then it acces 0th l & r.
If i=1 then it access 1st L & R
And so on...,
Here queries can be seen as an array of array where the array the queries stores just have 2 indexes first for l(left) and r(right)
So the queries stores the l and r for each query
Dimag ka bosda ho gaya bhai
skill issue