The Captain's Room Problem Solution

Author: Al-mamun Sarkar Date: 2020-03-24 18:09:15

The Captain's Room HackerRank Python Sets problem solution. 

Code:


def coptain_room(rooms, k):
	myset = set(rooms)
	ans = (sum(myset)*k) - sum(rooms)
	return (ans // (k-1))


if __name__ == '__main__':
	k = int( input() )
	rooms = list(map(int, input().split()))
	print(coptain_room(rooms, k))