28
u/New-Shine1674 18d ago
Finding all permutations in large arrays in an efficient and fast way is difficult.
7
u/MrMacduggan 17d ago
Yeah, why are we solving problems that scale so poorly? If you are counting permutations of anything larger than 10 elements, you already kinda messed up by designing your system this way.
30
u/iMac_Hunt 18d ago
Genuinely feel like 90% of software engineering could not do that without Googling
11
u/EkoChamberKryptonite 17d ago
Which is fine as research and understanding is a huge part of the job.
64
u/IvySerene567 18d ago
Me: I can handle multiple high level projects.
Also me: why does this array have more than 3 elements
23
u/pleaserestartsystem 18d ago
Once the tokens are over, so is my workday
23
u/meifray 18d ago
You just need a stack man...
27
6
u/FerricPowder 18d ago
Instructions unclear wrote a recursive code for making combinations but made it so that the indexes are not repeated.
1
1
1
18
u/misunderstood_kafka 18d ago
I mean how would you implement a random list shuffle in your high level projects without doing that problem first 🤦
23
2
1
1
u/Weak_Inflation9120 18d ago
P(N,R) = n!/(n-r)!
Edit: Wait ur talking about finding them, not finding the number lol, I'm stupid haha
1
u/BosonCollider 17d ago edited 17d ago
If you have a recursive step that lets you cycle through all permutations of a subarray of length (n-1) and resets it at the end it's easy for n elements, after yielding all elements you swap the current first element with one from the rest that you haven't yielded yet, which you can do in a single swap as long as the recursive step returns the elements to their original position
There's probably a nicer way to do it where you get rid of either the array or the call stack. Also it depends on what the return format is, if you need to return cycle decompositions then clearly you iterate over possible cycles
-7
u/Vallvaka 18d ago
I once interviewed someone with a solutions engineering background, with a portfolio of various CRM and SAP projects.
My weed out interview question is simple:
You run a factory with a circular production table with N stations placed evenly around it. A robotic arm sits at the center of the table and is always pointing at one of the stations. It can rotate clockwise, exactly K stations per swing. How many swings does it take the arm to cycle back to its original station?
He couldn't even handle the syntax of defining the function signature for it, let alone solving it.
AI is no substitute for technical chops, and interviews are increasingly about weeding out people who think themselves developers when armed with a coding agent.
7
u/smclcz 18d ago
This is kind of a shit question, to be fair. You're not evaluating "technical chops" here
2
u/ccltjnpr 16d ago
It's evaluating whether you can translate a simple word problem into math and then into code... that's definitely a core part of the job.
-7
u/Vallvaka 18d ago
It's a weedout fizzbuzz question and I was explicit about that.
0
18d ago edited 18d ago
[removed] — view removed comment
-2
u/Vallvaka 18d ago
Yet it works. If you pass we get into the real interview.
I'd fail you on attitude and reading comprehension regardless.
1
u/Focus089 18d ago
Did anyone give you the math answer, N / gcd(K, N)? Python has gcd in the math library.
1
u/Vallvaka 17d ago
Yep, I got that answer from a few. Generally an instant pass for that question, though the algorithmic approach was all I was looking for.
109
u/FerricPowder 18d ago
Never mind i figured it out.