/dpt/ - Daily Programming Thread

In these types of questions they expect you to produce a fast solution.

O(n^2) is so unbelievably worse than O(n), and it just shows you didn't really think about the problem in a clever way, but just brute forced it using some meme solution

>just brute forced it using some meme solution
yes

>wasting time with these problems
nah

>after linking with 46 different libraries and an hour of just debugging the compilation process, I finally have a 3 line program that puts a window on the screen (37 MB runtime btw)

the absolute state of modern computing

in my country, programming jobs don't require you to solve any programming problem.

you just talk about your past project or so, and maybe they send you a quick project for you to do in a week

Attached: 1536864856434s.jpg (187x250, 6K)

>don't specify what O speed is required
>lmao that's the wrong one, sorry nerd
This is why software is such a shitshow.
just learn vulkan

youtube.com/watch?v=8iYdJH1i4rc

A while ago I ground out a bunch of these leetcode type problems.
This sort of two pass, hash set, solution is common for these types of problems.

It all comes down to just learning the types of techniques you apply.
If you encounter something novel then it will depend on how smart you are, and how quickly you can relate the problem to something you are familiar with and adapt a known technique to it.

String join (const String a, const String b)
{
if(!b.length()) return a;
return join( a.push_back(b.peek()), b.pop());
}

Attached: .jpg (1920x1080, 174K)

sorry buddy, but you failed
>proceeds to spaz out like a baby
Its ok. Just practice solving these kinds of problems and learn what techniques the optimal solutions typically use

Attached: frend.jpg (680x344, 27K)

String join (const String a, const String b) {
return if(!b.length()) ? a : join(a.push_back(b.peek()), b.pop());
}