Sieve of Eratosthenes | Count Primes | Leetcode 204
Vložit
- čas přidán 25. 07. 2024
- Time: O(n*log(log n)); www.geeksforgeeks.org/how-is-...
Spane: O(n)
Topic: Array
Code:
github.com/Nideesh1/Algo/blob...
Leetcode:
leetcode.com/problems/count-p...
Note I claim no rights to this question. All rights belong to Leetcode. If I'm reviewing a solution that was from another Leetcode user or Leetcode itself I will give credit below.
Credit to :
Intro:(0:00)
Input/Output/Approach:(0:11)
Sieve:(0:33)
Sieve Reasoning:(0:57)
Code:(3:18)
Dry Run:(4:08)
Hey there! Just wanted to let you know that some of the below links in this video description are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!
Start getting great at system design: bytebytego.com?fpr=nideesh (affiliate link)
Handpicked Algorithms and Data Structures for Interview To Save Time: interviewpen.com/?via=nideesh (affiliate link)
Fast track to becoming a knowledgeable SWE www.educative.io/unlimited?af... (affiliate link)
it took me just 5 mins to understand Sieve of Eratosthenes, thanks to you
Glad it helped Adhish
I generally do not comment on videos but i had to on this one.
you are a good teacher because i just came to this video after watching 3 video on the same topic and i got the algo in 2 min of your video.
Thanks for making it simple and concise 😀
Really helpful. Thanks a lot
Great Explanation
Understood Thanks!
Amazing explanation, I suscribed
thank you so much
Hey there! Just wanted to let you know that some of the links in this comment are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!
Start getting great at system design: bytebytego.com?fpr=nideesh (affiliate link)
Handpicked Algorithms and Data Structures for Interview To Save Time: interviewpen.com/?via=nideesh (affiliate link)
Fast track to becoming a knowledgeable SWE www.educative.io/unlimited?aff=K1z6 (affiliate link)
On the 2nd line: why do we need to create an array of len(n+1) ? why not len(n)? Are there any specific reasons?
czcams.com/video/0ABnO_WoexE/video.html
를 이용하여
1부터 1,000까지 사이에 있는
소수의 개수(counting prime numbers)를 구하는 영상 입니다.
Still works if the boolean array is intialized to have just n elements instead of n + 1 for me using python.
How come they (leetcode) cannot explain like you do! Thanks!
It is nice, on the surface, but using `number` for storing bit flags is extremely sub-optimal in JavaScript, because `number` can store 53 bits, not 1.
Please explain how to calculate TC for this approach.