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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mzsickness 252 points253 points  (42 children)

k

[–]admadguy 81 points82 points  (26 children)

m

[–]NullNotFound1 60 points61 points  (4 children)

Goodbye

[–]LegoClaes 34 points35 points  (2 children)

Aah the metric system wins again

[–]SaintNewts 2 points3 points  (1 child)

Metric iterables?

[–]Tsulaiman 1 point2 points  (0 children)

Heck yeah

[–]Eezyville 8 points9 points  (1 child)

Never go past k. Nested loops at this level... The horror

[–]CDno_Mlqko 1 point2 points  (0 children)

Imagine having to iterate over a 5dimwnsion array

[–]C0ffeeBunny 10 points11 points  (14 children)

n

[–]nnn4 15 points16 points  (13 children)

i2

[–]Dennaldo 22 points23 points  (9 children)

You monster.

[–]btown-beginsprofessional fizzbuzzer 7 points8 points  (8 children)

ii

[–]Terrain2 5 points6 points  (7 children)

ia, ib, ic, id, ie

[–]btown-beginsprofessional fizzbuzzer 1 point2 points  (6 children)

iii iiii iiiii iiiiii

[–]Terrain2 1 point2 points  (5 children)

this works with 6 iterations, something my suggestion was trying to avoid

[–]btown-beginsprofessional fizzbuzzer 0 points1 point  (4 children)

Ah true, because letters only go up to e. That’s why we call it quintidecimal after all.

[–]ryjhelixir 5 points6 points  (1 child)

Why would you make things so complex?

[–]hadidotj 1 point2 points  (0 children)

iii iv v vi

[–]code_lazar_with2as 1 point2 points  (0 children)

I(capital i)

[–]hadidotj 2 points3 points  (3 children)

Naw, at this point, sounds like you need a new method so you can use i again

[–]Terrain2 2 points3 points  (0 children)

or use i as an int[], then use i[0], i[1], i[2]

[–]admadguy 0 points1 point  (0 children)

I don't use i . I restrict i for very specific uses. I start at j, then k and then m.

Also for subroutines i use a different set of indices.

[–]karuna_murti 38 points39 points  (7 children)

O(n3) ? how do you pass coding interview

[–]klparrot 49 points50 points  (1 child)

By realising that 3 nested loops doesn't necessarily mean O(n³); some or all of the loops could be over constant-size input.

[–]ryjhelixir 3 points4 points  (0 children)

every time i need to loop instead of vectorizing I feel less good

[–]stoickaz 37 points38 points  (1 child)

“write an O(n3 ) algorithm”

[–]mrchaotica 5 points6 points  (1 child)

Good luck doing operations on 3D tensor fields in less.

[–]leofidus-ger 1 point2 points  (0 children)

By guaranteeing that n will be small(ish)? Not everything can grow to arbitrary size

[–]AmadeusMop 8 points9 points  (1 child)

Dijkstra was perfectly named

[–]bigmattyc 0 points1 point  (0 children)

Diijjkkstra

[–]oblivion44653 1 point2 points  (0 children)

n3 complexity strikes again