← All problemsSign in

Chef and Sort

CodeChefRating 2924Open on judge ↗

Chef has permutation P consisting of first N numbers, (i.e. from 1 to N). He wants to sort it, but he doesn't know any type of sort, except Bogosort . Chef is afraid that Bogosort might take a lot of time, so he optimized that algorithm and called it Chefsort. But he doesn't know expected time complexity of this algorithm. Formally, he wants to find expected value of findSwaps function. Please hel

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start