4 ms·
If I do a live coding challenge, it is absurdly simple and is meant to root out people who have literally no business being in the room. Write a function that
by whoomp12342 3y ago
If I do a live coding challenge, it is absurdly simple and is meant to root out people who have literally no business being in the room.
Write a function that takes in a string and returns 1 if the amount of letters in the string is odd. It returns 0 if the amount of letters in the string is even.
If you can do this, we are good. I dont need NP hard or whiteboarding or algorithms. I can tell how good you are just by talking to you about your background.
- traverseda 3y agoI can never remember how modulus works, I use it so infrequently.
- deleted 3y ago[deleted]
- whoomp12342 3y agohighly recommend learning how division works within assembly. If you can understand sending this data into registers, you will never forget how mod works. Honestly, I dont even care if you use modulus or not. Solve the problem within a function demonstrating you know CS101 concepts we are good. like, really. No judgement, this is just an idiot filter.
- arghnoname 3y agoSure, but you probably remember division. "I can't remember of n % 2 returns 0 or 1 on even, so in place of that I wrote (if ((n/2)* 2 == n) for even, assuming integral division"
- AbsoluteCabbage 3y agoJust use n & 1 then. An odd number ends in binary 1; and’ing it with 1 yields 1 if its odd.
- emodendroket 3y agoYou don't even have to get that cute. Do integer division, multiply the result by the divisor, and subtract the product from the original dividend. Surely you can't say you don't use multiplication, division, and subtraction.
- emodendroket 3y agoI think implementing a function that does what a modulo operator would is itself a fairly straightforward question.
- d0mine 3y agoWhich kind? For example, can you name a difference between Python and C semantics for % op (if any).
- JohnMakin 3y agothe best fit jobs I've ever had have also taken this approach. Absurdly easy programming problem, then 95% talking about my background.
- AbsoluteCabbage 3y agoBonus if you use n & 1 instead of n % 2 != 0
- loa_in_ 3y agoSome candidate, done, sweating: "I wasn't sure if the limericks, speeches and open letters count as letters here but the criteria used are easily replaceable" /jk