We all know about FizzBuzz and the facts that: 1. there are more then 1 way to solve it and 2. it filters out the incompetent But FizzBuzz isn't perfect.
Please suggest new challenges other than FizzBuzz which would weed out morons like pic related but allow potential experts through. Multiple suggestions in series are accepted.
>inb4 - this is to make everyone on Sup Forums more productive, help us all sharpen our skills, and give me something to do.
Woah dude then i would have to divide and use an operator
Oliver Allen
Not with a reimplementation of modulo, idiot. You've failed for not understanding the problem.
Evan Fisher
Print the first 25 palindromic primes.
Very easy, but in an interview scenario 95% would fail.
Jack Ortiz
>divide it's like you want to be a noob i multiply the fuck out of it
Brandon Flores
are you telling me that convenience is a less professional word than sanity?
James Torres
Well it's your fault for not making thay clear.
Asher Butler
What about something that checks for leap years? It certainly would be on the same level of FizzBuzz and has as well a few ways how to approach the problems.
Jaxon Hill
Neet. Mind pseudo-coding it to show that is possible and not imaginary?
Brody Kelly
>without modulo Seems pretty clear. Implementing modulo is still using modulo.
Henry Edwards
Roman to Decimal function. The other way around is really straight forward, but here you have to consider the subtraction rule
Justin Rodriguez
There simplest way is to use multiple counters and resetting them at 3, 5, and 15. It's possible with fewer, though.
Logan Sanders
Nah, its not. Dont use % means no %'s in code. If you dont want people to % or / then say no % or /
Jason Collins
I didn't say "without percent signs," you thick skulled fool.
Isaiah Perez
Sieve of Eratosthenes Recursive Fibonacci Reverse a binary tree Implement a (doubly)Linked list
Jackson Peterson
Recursive anything, and then "how would you convert this to an iterative approach?"
Nathan Gutierrez
Retarded idea
Joshua Wilson
Retarded post
Anthony Ross
Recursive string palindromicity test.
Owen Hernandez
8 queens 15 puzzle Solver.
William Allen
When it comes to a more mathematical problem: How about writing a function that calculates the determinant of a (n,n) matrix. Great example to use recursion here.
Robert Lewis
Thats the mod operator
Adrian Lewis
>fizzbuzz >more than one way to solve it Wrong.
Sebastian Garcia
Care to enlighten us to your line of reasoning?
Joshua Harris
It's useless to try to challenge Sup Forums at anything harder than fizzbuzz. Every time I try, I get almost zero replies and get accused of trying to ask for homework help. A recent code challenge on Sup Forums was to see if two strings were anagrams, a one-liner in most high level languages. And yet, many people in the thread still got it wrong.
The only reason fizzbuzz is popular on Sup Forums is because it's incredibly simple and it lets morons who solve it feel superior to the even more moronic who can't even do that.
Bentley Torres
We had a couple of great threads about evolving images the other day.
Lucas Roberts
>he doesn't know what a circular lookup table is
Jayden Long
A 15 element circular linked list containing precomputed values for 1-15 that is then iterated through. However trivial this problem to solve, the problem is that I've been noticing that even if I'm able to solve these questions in interviews I still get rejected without explanation. Looks like I'm going to be a NEET forever, what a shame.
Sebastian Wood
Am I missing something, is there some secret convoluted neckbeard method that you're supposed to use for this or is the "99% of programmers fail" just a meme
Jackson Gray
>"but i can write fizzybuzzy in a meme way... i dont even use modulus sir... please sirr.... i learnet this in mumbai school of computers science sir...."
Leo Roberts
> However trivial this problem to solve, the problem is that I've been noticing that even if I'm able to solve these questions in interviews I still get rejected without explanation. Looks like I'm going to be a NEET forever, what a shame
How are your social skills?
Matthew Richardson
>i < 100 Whoops, pretend that's
Elijah Nguyen
>he has branching main(){ for (char i=0;++i
Nathaniel Murphy
Umm, I'm one of those people who think stupid (read: white, cis, or straight) people should be eaten alive. Does this qualify me as being social?
Liam Sanders
Holy Shit. Did they reject the PR? I would reject that so hard.
Levi Butler
>Please suggest new challenges other than FizzBuzz which would weed out morons like pic related but allow potential experts through. For this it is better to ask character questions, for example "what is the difference between a computer and a human being". If they can't answer accurately then you know there is a problem with them
Christopher Gonzalez
No, beside maybe using a Stringbuilder, this is the optimal solution for FizzBuzz.
A lot of people just did 4 cases (Fizz, Buzz, FizzBuzz, number) checking both modulo in various combinations though, which is the rather naive approach to it
Wyatt Anderson
We need more challenges like that. That was a fun problem to solve
Hunter Diaz
Do you think this comes across during the interview process?
Brody Evans
This is a pretty good one because it lends itself so nicely to recursion, and would be annoying to do without it.
I don't think this is a question of how professional the words are.
They have different meanings in a lot of cases. I don't really know what the context of this code is, but it could very well be the case that sanity is the more applicable descriptor.
Jonathan Cooper
I try to hide it and pretend to be normal as much as I can
Ryan Ross
Fizzbuzz but with 0 and INF instead of 3 and 5
Ian Roberts
Compute and sum the primes under 2 million.
Nicholas Fisher
Trying to imply that having things laid out in a sane way is merely convenient is a rather absolutely, isn't it?
Alexander Evans
>absolutely *abhorrent
Jordan Baker
The issue is that most people don't know about leap year rules other than divisible by 4.
Tyler Edwards
The good questions are normally posted on /sci/ where you have lurking math,physics and engineering, and competent cs students instead of Sup Forums try there.
Josiah Fisher
triple ref pointers? I'll just kill myself right now, thanks.
Angel Adams
Just check if it's divisible by 3
Thomas Flores
Full disclosure: I would only be able to solve this through gaussian elimination if i didn't have access to google.
Caleb Martinez
Brainlet here, can someone explain this for me?
Jason Powell
Have you tried asking them why you're rejected?
Julian Campbell
>which would weed out morons like pic related I mean, yeah the commit is stupid but she is anything but a moron.
Tyler Thompson
I would like to remove Appleish language.
No more "APP" "APP" "APP" "APP" !
Ryan Jackson
that's still easily reachable. Just for filling a 2d array via function you already need to use ***
Hudson Clark
Coding challenges in interviews are useless if you search more than a code shitting monkey.
Sebastian Phillips
The problem is that it needs to trickle down. You just can't introduce another programming problem to Sup Forums and have them interested in it. The average Sup Forums-tard is a illiterate coder at most. Meaning he's dabbling in his chosen language which is mostly python or javascript or pajeet tier. Introducing another problem makes all their known routines of fizzbuzz obsolete. They need to lurk more first in order to get at this problem. So you need to provide solutions yourself to feed them. You need to do this in probably 100 threads a month so that you get enough attention from the average faggots here and having them spoonfed enought since they sure as hell wouldn't have been able to wipe their ass without assistance. Never forget most posters here are the bottom of the barrel, sweetie
Benjamin Cruz
% is modulus. Basically divide 2 numbers and the remainder is returned.
So 9 % 3 would be 0, 10 % 3 would be 1. Since we want to see if the number is divisible by 3 or 5 we just check to see if the remainder is 0.
Tyler Evans
solving problems has nothing to do with being able to "code". you could write it out in psuedocode if you want. if u think syntax is hard ur fuckin gay and dum.
Caleb Green
I'm talking about illiterate people nigger. Every combination of tasks exponentially rises the complexity of problems if you don't know what you're doing. If you fail read and comprehend you should just fuck off
Justin Lopez
t. retard
Ethan Sanchez
I've got a decent test.
You have a singly linked list. You are unaware if it is linear or circular. All you have is a pointer to an element in the list. Each node in the list looks like this:
typedef struct node{ int value; node* next; } node;
Devise a way to determine whether the list is linear or circular.
Parker Gomez
The algorithm is rather simple though with the Laplace expansion. It's basically just the sum of all values (1, x) * the absolute value of it's Minor (determinant of the sub-matrix without the first row and the column x). Cascade that down to a (3,3) matrix and do Sarrus. Or you do it down to a 2x2 and do a11*a22-a12*a21
Asher Nelson
Knight's tour.
Elijah Morris
Will that even compile when you specify "node" twice?
Jackson Reyes
So why not work for safe space faggots at Mozilla?
Robert Nelson
>Recursive Fibonacci >not just >nth Fibonacci number >and asking for a number close to buffer overflow
Hudson Allen
That you're retarded was obvious but thanks for clearing that up
Josiah Williams
The naive approach would be to keep a pointer to where you started, and traverse until you get to the end (ostensibly null) or where you started (by simple comparison).
Colton Davis
This is a classic problem, people will have the solution memorized
Kayden Martin
More interesting is if the list can have a linear first section, then terminate in a cycle, because you may never return to your head node. In that case, you have to store everywhere you've been as you check.
Jackson Brooks
An interesting one I was asked is to populate an m*n table with numbers in a spiral. E.g. 1 2 3 4 5 12 13 14 15 6 11 10 9 8 7
Hunter Sanders
Wow, so fucking hard
function mod(x,d) while x>=d do x = x-d end return x end
Samuel Edwards
Here's your homework private static bool CheckAnagram(string word1, string word2) { var word1Array = word1.ToCharArray(); var word2Array = word2.ToCharArray(); Array.Sort(word1Array); Array.Sort(word2Array);
var loopLength = word1Array.Length < word2Array.Length ? word1Array.Length : word2Array.Length;
var word1Pos = 0; var word2Pos = 0;
while (word1Array[word1Pos] == ' ') { word1Pos++; } while (word2Array[word2Pos] == ' ') { word2Pos++; }
for (var x = 0; x < loopLength; ++x) { if (word1Pos >= word1Array.Length || word2Pos >= word2Array.Length || word1Array[word1Pos] != word2Array[word2Pos]) return false; word1Pos++; word2Pos++; } return true; }
Caleb Ortiz
I actually like this. Similar to FizzBuzz, it's testing your grasp of basic control flow more than anything math related, and yet most people would still fail it.
Joseph Rivera
implementing modulo yourself doesn't satisfy the prompt: you're still using modulo. Try something more creative.
David Russell
Really your only options are re-implementing modulo or using a look up table. Really obtuse re-implementations of modulo inside your main loop are still re-implementations of modulo.
It's a pretty stupid problem.
Bentley Jenkins
Just ask them to solve a fucking pixel maze with where squares are 2d boolean-arrays with DFS or BFS.
There you go.
Lucas Price
This
Also bubblesort on the whiteboard
Isaac Russell
Iterative Fibbonaci anyone?
Kayden King
>Absolute unreadable mess. I wouldn't hire you for sure. Enjoy being a 1337 h4xx0r and poverty.
int main(){ node linearNode; linearNode.next = NULL; node circularNode; circularNode.next = new node; circularNode.next->next = &circularNode; std::cout
Gabriel Hughes
One is "struct node" which is typedef'd to "node"
Easton Hall
For my interview I had to implement an averaging digital filter for a signal. They got me to read in a CSV file full of data and write out the filtered example. They checked it by using excel to graph the data :^)
Might be too much for a basic code monkey job, but it shows that you know how to read / write files, needing a loop in a loop for the filtering and that basic bounds checking.
Alexander Collins
Seen this question before, an there's a really nice solution which works for a linear section before a loop as well. The name is great too, Tortoise and Hare, and the implementation can be explained simply.
Iterate through the list with two pointers, but one moves 2 steps each time (the hare). If the tortoise and hare pointers ever meet, then there is a cycle.
Yes, but unless you took a linear algebra exam yesterday you're probably not going to remember the exact operations of that algorithm, making it unsuitable for a coding test that doesn't allow google.
Aaron Rodriguez
Well I just wrote it down, and I took that exam 2 years ago
David Ward
>Assembly FizzBuzz >x86 instruction set >1 hour
Isaac Myers
That might actually be a decent challenge if you allow google and know the candidate hasn't done assembly before.
Fizzbuzz is trivial enough that it's not impossible to complete, but the challenge is still hard enough that you can set the bar at various places depending on what kind of candidate you're looking for. You'll get to see how they cope with a difficult problem and how they research things they don't know, and how they can adapt to completely unfamiliar contexts.
Andrew Evans
Who would actually use this as a hiring metric? We give candidates a complex take home assignment that requires basic recursion skills and graph traversal.
Luis Nelson
Add two arrays of int of different lengths together.
Be more specific. Do you mean sum the values of the two arrays, stopping once you've reached the end of one array?
Alexander Nguyen
I once remember Falcon saying he was able to weed out a lot of idiots just by asking them to count down from like... 700 to 200 in decrements of 13.
Jaxson Sanders
>Please suggest new challenges other >than FizzBuzz which would weed out morons like pic related but allow potential experts through. Just ask them to write a recursive function that can only be solved through recursion. This is a trick question, of course; but without basic math/programming knowledge you'll have them there wasting time like morons.
Lincoln Foster
For example;
Input
int[] a = {3, 6, 2}; int[] b = {4, 2, 5, 3, 1};
Output
{7, 8, 7, 3, 1}
Chase Diaz
What you say is "without modulo" but what you mean is "without math operands" seeing you shoot down anything that uses math to work it out.