I have a list of 5 ints from 1 to 6 (simulating 5 dice rolling), randomly generated for example:
L = [1,2,3,4,5]
and I want to check that if this list when sorted, contains either
[1,2,3,4] or [2,3,4,5] or [3,4,5,6].
How would I go about checking if list L contains any of the 3 combinations?
I don't want to have to go through and check if
L[i] == l1 [i], L[i]== l2 [i], L[i]== l3 [i]
for int in the list. I feel like its just a simple question of asking if the list contains either of the other lists or something. I'm just having trouble connecting the dots and its not clicking for me. Any help would be appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…