Why are programming interview questions so hard, especially the math, when coding isn't that complicated?

Why are programming interview questions so hard, especially the math, when coding isn't that complicated?

Attached: 1625327785353.jpg (500x447, 57.3K)

If it's not that complicated then you shouldn't have a problem with the interview

>especially the math
give an example

I can't find any but alot of logic questions regarding "how would you could this"

*code

Learn to read retard, he said the interview questions are hard, while regular programming isn't

>gets filtered by boolean logic
Kek

Initially, there is a heap of stones on the table.
You and your friend will alternate taking turns, and you go first.
On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
The one who removes the last stone is the winner.

Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false.

>Cares about boolean logic

if n = 1,2,3 return true
else if n >3
return "shit nigga this too damn hard, lemme get that job anyway tho for real"

my intuition tells me to use induction on this, or some sort of recurrence algorithm maybe?

Companies are assholes and interviewers are trying hard to make impression of very tallented team of monkeys.

Seriously, for all the stupid shit in internship and hard pro-level questions in JS exam, the code I inhreited was absolute trash.

They probably don't want people who claim programming is easy but can't pass easy tests?

Although it is also possible your test was too difficult. It's not the case that everyone who recruits has a grasp on what's needed.

> when coding isn't that complicated?
You wish. Between knowing all the stupid and its workarounds and the genuine difficulty of doing various things, it's not easy. Most people only manage to do a shit job even with some years of experience.

This is harder than a whole lot of jobs even if you filter for only the ambitious literate people who put in effort it's not going easy.

I think in europe they dont do this, they just give you a realistic feature and you have to implement it in 2-3 hours

I've written programs and often times the math is the least difficult part

They had to filter the people who couldn't fizzbuzz, then they realized they had to filter some more.
I just did some basic math and it looks like if it's divisible by 4 you're a loser.
if n < 3:
return True
#4: 1, 3 lose
#5: 1, 1, 3 win
#6: 2, 1, 3 win
#7: 3, 1, 3 win
#8: 3, 1...lose?
#8: 2, 2...lose
#8: 1, 3...lose
#9

if n%4 == 0 then he loses
proof by induction on k. n = 4k:
1. k = 1 -> n=4 he loses
2. assume he loses on k then on k+1 we have n=4k+4
2.1 you pick 1 he picks 3 then your turn is n=4k which you lose by hypothesis
2.2 you pick 2 he picks 2 then your turn is n=4k you losed
2.3 you pick 3 he picks 1 then your turn is n=4k you losed again lmao

if n%4 != 0 then he win
proof: P={1,2,3} pick set
if n%4 != 0 then (n-n%4) % 4 == 0. n%4 € {1,2,3} == P so by picking n%4 we have n'=n-n%4 -> n'%4==0 which means enemy will lose by previous theorem

>coding isn't that complicated

>He thinks coding is complicated
NGMI

Because they pay you 300k if you get through the interview.

To filter out people who know interview be like that and still didn't prepare.

return n > 4 && n % 4 != 0
ez