id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

ferrer@hendrix.edu > sameEnds
prev  |  next  |  chance

Return true if the group of N numbers at the start and end of the array are the same. For example, with [5, 6, 45, 99, 13, 5, 6], the ends are the same for end_len=0 and end_len=2, and false for end_len=1 and end_len=3. You may assume that end_len is in the range 0..len(nums) inclusive.


sameEnds([5, 6, 45, 99, 13, 5, 6], 1) → False
sameEnds([5, 6, 45, 99, 13, 5, 6], 2) → True
sameEnds([5, 6, 45, 99, 13, 5, 6], 3) → False

...Save, Compile, Run (ctrl-enter)

def sameEnds(nums, end_len):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy