Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the function of Card grouping in leecode

Shulou Source: shulou.com Published: 2022-06-01 17:59:25 10月02日 Update

This article is about how leecode implements the card grouping function. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

nine hundred and fourteen。 Card grouping

Https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/

Given a deck of cards, each card has an integer written on it.

At this point, you need to select a number X so that we can divide the whole deck into one or more groups according to the following rules:

Each group has X cards.

All the cards in the group have the same integer written on them.

Return true only if you have the optional X > = 2.

Example 1: input: (1) true explanation: the feasible grouping is [1meme 1], [2recorder 2], [3Perry 3], [4p4] example 2: input: [1meme 1meme 1meme 2pm 2pyrm 3] output: false explanation: there are no groups that meet the requirements. Example 3: input: [1] output: false explanation: there are no packets that meet the requirements. Example 4: input: [1Reagen1] output: true explanation: feasible grouping is [1Reagen1] example 5: input: [1Perry 1magent2magin2] output: true explanation: feasible grouping is [1magin1], [2mag2], [2mag2] hint: 1

Tags: Grouping elements examples interpretation input output number feasible minimum more number function content integer article good practical same successful from Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno MySQL Microsoft Xiaomi