Question: b) (35 points) Smallest slice cut to make list consecutive. First, review the slicing operator as defined in Programming Assignment 3. In this part, given

 b) (35 points) Smallest slice cut to make list consecutive. First,

b) (35 points) Smallest slice cut to make list consecutive. First, review the slicing operator as defined in Programming Assignment 3. In this part, given a list L, we are interested in finding a slice of L of minimal length whose removal from L makes the elements of L consecutive. In particular, implement the function mingliceCut (L), which takes L as input argument and does the following: If I consists of consecutive elements, your function should return the empty list 0 (no need to remove anything from L) Else, your function should return a slice L[i:j+1) whose removal from L makes the elements of L consecutive, for some indices i and j such that 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!