[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/spu2mg/ Sum of Primes Under 2 Million general ITT we share

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 10
Thread images: 3

File: Ulam.png (3MB, 3464x3464px) Image search: [Google]
Ulam.png
3MB, 3464x3464px
/spu2mg/ Sum of Primes Under 2 Million general

ITT we share stories of when we were asked to complete this challenge. Feel free to also share other tech interview questions you have been asked so we may discuss them.
>>
>>59729874
std::cout << "2 3 5 7 9 11 13" /* TODO finish list */
>>
import sumprimes
sumprimes.sum(2000000)
>>
File: images (1).jpg (6KB, 316x202px) Image search: [Google]
images (1).jpg
6KB, 316x202px
>practice spu2m endlessly
>attend programming interview
>they actually ask me to do it
>write it flawlessly on the whiteboard in python
>don't get the job
>'you indented with tabs instead of spaces'
>>
>>59729874

I don't even know what a primary is. Too lazy to even google it. Fuck you OP.
>>
>>59730821
very funny.
>>
stop
>>
fuck. I'd typed out this greentext as I walked through the problem analyzing time/space requs of a naiive sieve of eratosthenes-based approach then various optimizations that could be made but I accidentally tapped the back button on this keyboard while cutting it down to character limit and lost all of it. I guess that's what I get for not using an external editor.

Long story short:
>guesstimated an upper bound for the sum which was larger than 2 ^ 32 but well below 2 ^ 64 so depending on language/architecture we should be fine adding (possibly needing to specify that I want 64 bit integer depending on the language)
>sieve would run in O(n log log n) time (great!) and take up ~2MB of space (not so great)
>can pack things down to 1/8th of that if packing 8 bools into a byte is efficient for us (probably)
>can keep a running total of primes we find as we run the sieve
>there are other sieves that have lower memory requirements but this one is easy to implement so it may not be worth the extra effort depending on our needs

(I don't get this meme but I always love solving even simple problems)
>>
File: large.jpg (44KB, 600x400px) Image search: [Google]
large.jpg
44KB, 600x400px
>>59731057
Man, I would love to do that as an interviewer.
Imagine spotting the autism in someone as they enter the room. You know they won't pass the actual interview test and you wouldn't want them in your company anyway so you start giving them basic programming tests and questions to make them feel confident and happy.
Then one week later you call them saying they didn't get the job because of some trivial detail like using tabs instead of spaces.
>>
>>59731345
A lot of interviewees struggle with basic programming questions.
Thread posts: 10
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.