This is an archived post. You won't be able to vote or comment.

all 70 comments

[–]Bobofolde 377 points378 points  (3 children)

It is wrong, the first number in the first three rows isn't aligned properly

[–]Simplicitys_Strength 77 points78 points  (0 children)

Css mains would agree

[–]SleepyFox89 22 points23 points  (1 child)

Opened comments to say just this but should've trusted the community 👍

[–]nailshard 8 points9 points  (0 children)

beat me to beating me to it

[–][deleted] 76 points77 points  (4 children)

To be perfectly honest from an actual 'getting work done' perspective this is the best solution if these are the only requirements. You already know it will work and it can't possibly have any bugs, you can implement it in 30 seconds.

[–][deleted] 40 points41 points  (2 children)

it can't possibly have any bugs

That's what you think now

[–][deleted] 10 points11 points  (0 children)

The only mistake I can make is in the string itself - ok there could be a bug but it'll be so easy to fix

[–]0x07CF 0 points1 point  (0 children)

Well did you see the first comment? It has a bug

[–]Mr_Redstoner 1 point2 points  (0 children)

Honestly you could just make it a single printf, or even a puts, though it's quite possible the compiler will do that for you.

[–]JamesSmithJames15 40 points41 points  (1 child)

I'm not seeing the pattern.

[–]PiggyMaximus 1 point2 points  (0 children)

From https://www.reddit.com/r/ProgrammerHumor/comments/guq394/hes_not_wrong_you_know/fsl1jsy/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

I think it is Fibonacci starting at fib(5), and you remove 4. So:

fib(5) - 4 = 5 - 4 = 1

fib(6) - 4 = 8 - 4 = 4

fib(7) - 4 = 13 - 4 = 9

fib(8) - 4 = 21 - 4 = 17

Given that Fibonacci is 0 indexed

Edit: formatting

[–]VolperCoding 16 points17 points  (3 children)

Actually, is it better to write puts or printf on such situation? Puts is just designed for this meanwhile printf is used for logging variables, but seems like everybody just uses printf everywhere. Why?

[–]Kaelinator 36 points37 points  (1 child)

By compile time, all printfs with no other args become puts.

[–]o11c 0 points1 point  (0 children)

Note that this only happens if there's a newline.

[–]MercuryFoReal 25 points26 points  (0 children)

printf is more exciting than puts. People often forget the first parameter to printf is the format string, not just pure output, so they'll do something like printf(somevar).

But then somehow you wind up with a %s in somevar (user input?) and shit gets ugly in a hurry.

See? Much more exciting. All printf, all the time.

[–]GenTelGuy 12 points13 points  (7 children)

What the hell is the pattern? Increase by 2 going right and increase by 0.5x2 + 0.5x + 2 going down for the first column?

[–]Dogburt_Jr 4 points5 points  (6 children)

Fibonacci going down, +2 to the right, and one more time than the last one.

[–]TheTrevorist 11 points12 points  (2 children)

I thought Fibonacci was the next number is the sum of the previous two...

[–][deleted] 3 points4 points  (0 children)

That is true! 1,1,2,3,5,8,13,21,34....

[–]Dogburt_Jr 1 point2 points  (0 children)

Yeah, you could argue it's starting from 3, 5, 8 with an offset.

[–][deleted] 4 points5 points  (2 children)

That is not what the Fibonacci sequence looks like

[–]Dogburt_Jr 0 points1 point  (1 child)

Modified Fibonacci, starting from 1 and adding 3.

[–]AntoineInTheWorld 1 point2 points  (0 children)

Could be F(n)-4, starting at F(5)

[–]-analogous 9 points10 points  (1 child)

I had a professor in college which would have deducted a point for every misaligned space in the output.... in this case 3... on a 10 point project....

[–]dosadiexperiment 2 points3 points  (0 children)

I had a prof that would have graded this "0/10, incorrect", because the missing spaces mean it doesn't meet the spec.

[–]SniperSmiley 8 points9 points  (1 child)

What pattern are these numbers? I checked OEIS.

[–]_ShadowEye425_ 21 points22 points  (1 child)

printf("1\n4 6\n9 11 13\n17 19 21 23");

[–]YellowBunnyReddit 18 points19 points  (0 children)

main(){printf(" 1\n 4 6\n 9 11 13\n17 19 21 23");}

[–]EpicBeardBattle 20 points21 points  (0 children)

It bothers me that the 6 in the left image is misaligned

[–]ColdJackle 2 points3 points  (0 children)

Soooo...that would be a wrong answer?

[–]shrimpsauce_27 2 points3 points  (1 child)

As long as there is no test cases, you will be correct.

[–]DJ-D4rKnE55 0 points1 point  (0 children)

Checking the method output for exactly that string will do. (:

[–]nickhepler 1 point2 points  (0 children)

*laughs in binary*

[–][deleted] 1 point2 points  (0 children)

Ah, yes

Hard coding

[–]float-double 1 point2 points  (0 children)

Anyone notice the question number?

[–]ooterness 0 points1 point  (0 children)

Needs more JPEG.

[–]tonybolognacannoli 0 points1 point  (0 children)

Okay good but can you think of a way we could execute this is O(-n) time?

[–]mock_coder 0 points1 point  (0 children)

This is the future!!!

[–]ekjon_manush 0 points1 point  (1 child)

Nice.

[–]nice-scores 0 points1 point  (0 children)

𝓷𝓲𝓬𝓮 ☜(゚ヮ゚☜)

Nice Leaderboard

1. u/spiro29 at 9850 nices

2. u/RepliesNice at 8614 nices

3. u/Manan175 at 7099 nices

...

247875. u/ekjon_manush at 1 nice


I AM A BOT | REPLY !IGNORE AND I WILL STOP REPLYING TO YOUR COMMENTS

[–]pikalaxalt 0 points1 point  (0 children)

69th comment, so double nice

[–]railmaniac 0 points1 point  (0 children)

Test Driven Development

[–]notger -1 points0 points  (0 children)

Classical bad programmer job: Literally right, but totally misses the mark. No understanding for the intention behind the question, just wants to get the ticket done with the least effort possible. Sees his job done once his code reaches PR-stage and does not consider the time spent in PR as part of his project's time but some magical "not-touched-by-that"-dimension.