Question: Task 3 You are given N cards. Each card consists of a suit and a rank. There are four suits, s ( Spades ) ,

Task 3
You are given N cards. Each card consists of a suit and a rank. There are four suits, s (Spades), H (Hearts), D (Diamonds) and C (Clubs), and thirteen ranks, ordered (from the lowest to the highest)2,3,4,5,6,7,8,9,10, J (Jack), Q (Queen), K (King) and A (Ace).
Each card is represented by a string in the format "". For example, 10 of Spades is described as "10S", and Queen of Hearts as "QH"
There are six ranked card sets (described in detail below). Sets are ordered by their strength from the weakest to the strongest. Your task is to detect the card sets that can be formed from the given cards.
Detecting each card set is scored separately and is worth an equal number of points. If you detect more than one set, select the strongest one.
Write a function:
Results solution (vector &cards) ;
that, given an array of strings cards, returns a Results object representing the strongest card set that can be formed.
Assume that the following declarations are given:
struct Results {
string set_name;
vector selected_cards;
Files
a task
solution....
test-inpu...
set_name is a string which should be the name of detected set (see below);
selected_cards is a list of strings, which should be made of cards that form the detected set. Cards

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 Programming Questions!