If you make your variable names short enough, you can just make them an all-lowercase string [a-z0-9]+ and not worry about CamelCase or underscores or minuses

If you name your variables things like x, y, c, i, eu, ev, gorp, then you don't have to worry about CamelCase

@vaporeon_
The downside of doing that is that your code starts looking like this:

class Solution {
public:
int p(int i, int l, int s) {
return (s + i) % l;
}

int swap(vector<int>& a, int i, int j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
return j;
}

void rotate(vector<int>& n, int k) {
int L = n.size();

k = k % L;

int c = 1;
while ((c * k) % L != 0) c++;

for (int i = 0; i < L / c; i++)
for (int j = 1, b = i, D = L - k; j < c; j++)
b = swap(n, b, p(b, L, D));
}
};

@wallhackio I don't see the problem (why would you name an array of integers n, though? That's traditionally reserved for the size/length of an array or a matrix!)

(Also, is while ((c * k) % L != 0) c++; really the only way to find a c such that (c * k) % L == 0? The repeated multiplication sounds very inefficient, but my brain doesn't want to do maths right now...)

@vaporeon_ i intentionally renamed variables to make it stupider

also, this was a difficult solution that is a little tricky explain. also, i dont fully understand how it works lol

@wallhackio Not very leet of them to require JavaScript just to see the task...

Follow

@vaporeon_ they have a terminal where you can write code in an online IDE and immediately check the result against test cases so it actually makes sense in this context

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.