# Write a program to perform Consecutive prefix overlap concatenation Using endswith() + join() + list comprehension + zip() + loop

## Topic: Write a program to perform Consecutive prefix overlap concatenation Using endswith() + join() + list comprehension + zip() + loop

Solution

```
def help_fnc(i, j):
for ele in range(len(j), -1, -1):
if i.endswith(j[:ele]):
return j[ele:]

test_list = ["India", "gone", "new", "best"]

print("The original list is : " + str(test_list))

res = ''.join(help_fnc(i, j) for i, j in zip([''] +
test_list, test_list))

print("The resultant joined string : " + str(res))
def isValidSudoku(board):
rows = [{} for i in range(9)]
columns = [{} for i in range(9)]
boxes = [{} for i in range(9)]

for i in range(9):
for j in range(9):
num = board[i][j]
if num != '.':
num = int(num)
box_index = (i//3)*3 + (j//3)
rows[i][num] = rows[i].get(num, 0) + 1
columns[j][num] = columns[j].get(num, 0) + 1
boxes[box_index][num] = boxes[box_index].get(num, 0) + 1
if rows[i][num] > 1 or columns[j][num] > 1 or boxes[box_index][num] > 1:
print(" i= {0} j = {1} box_index ={2}".format(i,j,box_index))
print("rows[i]: ", rows[i])
print("columnns[j]: ", columns[j])
print("boxes[box_index]: ", boxes[box_index])
return False

return True

```