How many symbols must be on one card? (retired)
Description:
Introduction
You want do design a card game with n
cards where on each card are s
different symbols. Each card c_i
always has one symbol in common with any other card c_j
with i != j
.
It wouldn't be fun if the common symbol between any two cards is always the same.
Question
You wonder how many different symbols you have to put on one card, given that the game shall have n
cards (with n > 3
). Find the minimal number of symbols to use so that any 2 cards have exactly one symbol in common.
Example
In case of n = 7
cards, you would need 3 symbols on each card - consider the following matrix of cards and symbols:
symbol
1 2 3 4 5 6 7
1 X X - - X - -
2 X - X - - X -
3 X - - X - - X
card 4 - - X X X - -
5 - - - - X X X
6 - X X - - - X
7 - X - X - X -
Notice that any card only has one symbol in common with any other card.
Bad example:
The general case of the trivial solution shall not be valid (example with n = 4
and s = 2
):
symbol
1 2 3 4 5
c_1 X X - - -
c_2 X - X - -
c_3 X - - X -
c_4 X - - - X
This solution is prohibited, as the common symbol between any pair of cards is always the same.
Task
Write a function
CntDiffSymbols(n int)
that returns the count of different symbols needed for n
cards.
Similar Kata:
Stats:
Created | Aug 17, 2020 |
Warriors Trained | 414 |
Total Skips | 302 |
Total Code Submissions | 154 |
Total Times Completed | 19 |
Go Completions | 6 |
JavaScript Completions | 7 |
Python Completions | 14 |
TypeScript Completions | 2 |
Total Stars | 4 |
% of votes with a positive feedback rating | 60% of 10 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 6 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |