Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
iiii38879dArray length is a constant in this case. There's no reason for such "optimization". Though the loops are stupid indeed.
Hazarth25659dI don't think this code actually does anything... What?
So start i at 3, assume array.length() is 5...
If 3 < 5
let j = 2
If i > len(arr)*2, so 3 > 5*2
Is the "i" in the nested loop a typo?
But even if It's supposed to be "j"
The for loop is just gonna fail because we already know that array.length() > 3, otherwise it wouldn't even execute due to the outside loop...
So if j starts on 2 and array.length() is bigger than 3 and *2 then j > array.length()*2 is never going to be true
I don't know if there's more typos in what you posted, or this code does literally nothing... What am I missing?
nanobot9829dBut that's how government jobs work 🤷🏻
We have a saying:
"Tike raho pagla,
Kaam karega agla"
Which translates to:
"Somehow survive (till retirement),
The next guy after you will do the real work"
I thought it was an Indonesian app until I saw the tag.