Problem 44241. NCHOOSEK - Time Optimization
Solution Stats
Problem Comments
-
4 Comments
Sorry, but it's not clear to me what the objective is. At test #3, nchoosek should accept a v that is a cell array of 30 column vectors? (What's the purpose: to present combinations per vector, or to present all cell arrays that choose a certain number of vectors?) And at test #4, nchoosek(v,1) should equal v', even when v contains duplicate entries and isn't sorted?
nchoosekFast(V,K) should have the same behavior as nchoosek(V,K) for a vector V.
you can valid:
celldisp(nchoosek({[1 2],[5 6 7],3}, 2)),
nchoosek([3 1 2 2], 1).
Always return "While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore."
Maybe you should forbid the use of nchoosek? Or is the MATLAB nchoosek faster currently? It passes the last test case without changes. Moreover, nchoosek runs within 1.30 s currently for the test case at an i5-3230M CPU, 2.60GHz. That's already pretty fast.
Solution Comments
-
3 Comments
This current leading solution runs within 1.40s, which is worse than the performance of regular nchoosek at my pc.
I'm confused about how the scoring based on speed works for this problem.
Confused if this is a trick question as nchoosek works fine and is not slow...
Problem Recent Solvers71
Suggested Problems
-
Find the peak 3n+1 sequence value
1814 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
845 Solvers
-
415 Solvers
-
Area of an equilateral triangle
4978 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
659 Solvers
More from this Author8
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!