permutation icon indicating copy to clipboard operation
permutation copied to clipboard

panic: reflect: slice index out of range

Open moraes opened this issue 11 years ago • 2 comments

See:

http://play.golang.org/p/3oPYrSsY-R

moraes avatar Sep 08 '14 09:09 moraes

Looks like after iterating the loop starting on line 187 of permutation.go that the 'i' variable is decremented until it becomes -1. It is then used again on line 193 that results in an exception. Will likely create a PR or fork this if the project is dead. screenshot

Coderrob avatar Jan 04 '16 00:01 Coderrob

This took me ages to diagnose what was going wrong. This problem happens whenever the slice to permute contains two of the same value. Easy to spot if your inputs are integers, less simple if they are a more complex structure. No idea how to fix the code in question though

cbehopkins avatar Mar 15 '16 12:03 cbehopkins