99.5% of job applicants and 80% of Jow Forums cant even count odd numbers from 1 to 100. Can you do better?

99.5% of job applicants and 80% of Jow Forums cant even count odd numbers from 1 to 100. Can you do better?

Attached: 1531984149274.png (4592x2292, 1.65M)

Other urls found in this thread:

github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp
twitter.com/SFWRedditVideos

>create a chess game
this isnt really easy desu. chess has so many rules...

You have movement rules and the exceptions you can hard-code in later.

They're not that many.
Try writing an AI that isn't randomly guessing legal moves.

>What is alpha beta pruning search plus board eval function

Attached: 43659292_486227418549795_4385563708349218816_n.png.jpg (655x731, 44K)

the eval function is the tricky part.
if you don't know much about chess, you'll probably implement something that's not much better than randomly guessing.
Or you'll run out of time because at each step there are too many moves to consider.

>the eval function is the tricky part.
Yes, this is true. Just copy one that already has been tested by many, many volunteer CPU hours.
>github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp

Attached: cigar.jpg (657x527, 36K)

>hard-code

Attached: 1538156453913.png (600x842, 142K)

for i in range(100):
if i % 2 != 0:
print(i)

Knowing how to read will help you with future interviews.

Python noob here. Here's my attempt without modulos operator.

for i in range(100):
x = i / 2
y = str(x)
if y[-1] == "5":
print(i)

>count odd numbers from 1 to 100.
>count odd numbers
>count

I'm inept at programming and I can count how many odd numbers there are without a modulus operator. This isn't a serious question.

c=0
for i in range(100):
x = i / 2
y = str(x)
if y[-1] == "5":
c += 1
print(c)

Just count them in another variable rather than print the the value of i

why so difficult
for(let i = 0; i < 100; i+=2) {
console.log("Even: ", i);
console.log("Odd: ", i+1);
}

Mine works regardless of the starting number.

from 1 to 100, not from 0 to 99

there are exactly 1/2 odd numbers and 1/2 even numbers so there are 50 odd numbers between 1 - 100

int odd=0;
for(int i=0; i

I completely refuse to. Liberals like to claim that beong abnormal or ODD is ok, but we all know better. I'm not going to get caught up in their communist bullshit by lending credence to it.

I also refuse to have anything to do with so-called even counting either, because we all know that all things are not even, like they want to cuck you into believing.

Good multi layered bait/10

100's even, your nitpick is shit.

() => 50;

can i have the text version of this, or can anyone suggest me a tool to make it myself?

start typing

do you have the technical part?
thanks naon

Yes it looks like stupid and interesting at the same time.

n-int(n)=0

wow so hard

i failed a skype job screening once because i wrote if (num & 1) and the hiring manager didn't like my answer

good, you deserve it
any sane compiler already optimizes this for you

>What is the difference between a pointer and an address?

Umm... I don't know... A pointer is an abstraction, while an address is a value?

But... an address could also be an abstraction?...

a pointer is a data type
an address is a location in memory
a pointer can point to an address

thanks for repostan this, i'm learning a new language and this is always a fun bunch of little exercises.

It's an address that contains another address.

I swear to god you people are fucking retards.

Attached: Screenshot_20181030_201830.png (1366x768, 392K)

>a pointer can point to an address
no, a pointer points to a value/object

Yes:

1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99

Attached: 9.jpg (858x1000, 69K)

What if I want all the numbers from 1 to 1000

it points to its address in memory

It'll just take longer, OP said nothing about programming a solution which is why you all failed the interview, you rushed ahead thinking you knew what they want before engaging your brain and doing what was asked.

Let's be real how many of you niggas Actually work in tech.

Attached: 65197EF4-ACBE-4355-8791-67E49DFF49C2.jpg (419x400, 28K)

I know, right?

Attached: file.png (48x42, 1K)

>Jow Forums performing better than job applicants

Attached: 1514887709445.gif (500x267, 996K)

IntStream.range(1, 100).filter(number -> number % 2 != 0).forEach(System.out::println);

What's wrong with privacy badger user?

Is this a fucking joke?
I read number 2 and laughed my fucking ass of at your assessment as to the amount of people that would fail to answer it.

m8 that is quite literally a single for loop and a line within it to print it. you can do it in one line if you were so inclined

For (i==1, i+=2, i

Placebo.

>Needing a fucking loop
Math.pow(99 / 2 + 1, 2);

>because none of us have jobs/careers
Stop projecting.

t. at work getting paid $80/hr

[code[
for (var i = 1; i < 101; i++)
{
if (i % 2 != 0){ console.log(i);
}
}
[/code]


This is what happens when people learn languages from frameworks or libraries, instead of the vanilla version.

I think the part he's talking about is the extra parts wherein you don't use the modulus operator or if/else statements. Albeit I think those are more little tricks than actual deep program understanding, desu. It's kind of like when doing a javascript coding interview and they ask for a reversed string, but then get booty-blasted about using the .reverse() method.

>sum all integers from 0 to 1000

lmaoing at all the losers who use a fucking loop for this

int sum = 1000 * 1001 / 2;

Attached: 1536052717274.jpg (180x180, 8K)

>not 1001 * 500
4th grader detected. Study those division tables.

Help me out here. I can't think of a sensible way to do 7 that uses more than one loop. Unless they mean all the multiplication tables up to 12x12 {1x1, 1x2,..., 1×12, 2x1, 2x2,..., 12x12} instead of just the 12 times table {12x1, 12×2, ...}. But it just says "the 12 times table"

Im still stuck on the first one. If i open a text editor and type my name out im fucked right? I would type out 'your name on the screen' and hit print. Did i do it right Jow Forums?

echo {1..100..2} | cowsay

I don't even have a printer so I'm really fucking lost on a lot of these.

q1 :: IO ()
q1 = putStrLn "Hackerman"

q2 :: IO ()
q2 = mapM_ print [700,687..200]

q3 :: [Int] -> IO ()
q3 = print . (!! 1)

q4 :: IO ()
q4 = print $ sum [0..1000]

q4' :: (Enum a, Num a, Show a) => a -> a -> IO ()
q4' x y = print $ sum [x..y]

q5 :: IO ()
q5 = getLine >>= \x -> if x == "Jack" then putStrLn "Hi Jack!"
else putStrLn ("Hello " ++ x)

q6 :: IO ()
q6 = mapM_ (putStrLn . f) [1..100]
where f x = show x ++ " is " ++ e x
e x = if even x then "even" else "odd"

q6' :: IO ()
q6' = sequence_ $ zipWith f [1..100] $ cycle ["is odd","is even"]
where f x y = putStrLn $ show x ++ " " ++ y

q7 :: IO ()
q7 = mapM_ putStrLn $ f [1..12] [1..12]
where f x y = show x ++ " x " ++ show y ++ " = " ++ show (x * y)

I can
def odd():
return [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31...99

Or even better
int a [50]; for (i=1; i

this is made up shit to exploit weak coder's feels.

> cycle ["is odd","is even"]
THAT'S ACTUALLY PRETTY CLEVER
I would've done it differently but I like the way you solved it

Thank you user.

The extra part is easy as fuck too, you just count by 2.

len(range(1, 100, 2))

>sum
>doesn't use any addition

Learn to math, brainlet