Skip to content

MacleansCollegeCodingClub2024/Beginners-Problems-7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Beginners-Problems-7

Beginners Problems on Sets

Have you seen this number before?

Given a list of numbers (e.g. [1,3,8,35, 4,2,3]) Print ‘YES’ if the next number has already been ‘seen’ before, and ‘NO’ if the next number hasn’t been encountered yet.

E.g. (using the example list): NO

NO

NO

NO

NO

NO

YES

Special Words

Given a string of words as input, print the number of distinct words. From these distinct words, print the number of times ‘a’ appears.

E.g. The quick brown fox jumps over the lazy dog

8

1

Special Numbers

We have 2 lists containing some numbers. Print the numbers that appear in both lists and in ascending order.

e.g. listA = [18, 2, 90, 3, 5]

listB = [2, 86, 42, 5, 7]

Output: 2 5

Multilingual

(please refer to document for clearer layout)

You’re surrounded by a group of people who speak different languages. Sift through all of them and display the necessary information. You are given:

  1. The number of people you’re surrounded by
  2. The number of languages are spoken by each person
  3. What languages are spoken by the corresponding person

You must display:

  1. The number of languages everyone in the group speaks
  2. What language(s) is spoken by everyone in the group
  3. The number of total languages spoken in the group
  4. What languages are spoken in the group

Input is in bold. Example:

How many people are there? 3

(To person 1) How many languages can you speak? 3

What languages can you speak in? English

Mandarin

Arabic

(To person 2) How many languages can you speak? 4

What languages can you speak in?

Portuguese

English

Tagalog

Arabic

(To person 3) How many languages can you speak? 1

What languages can you speak in?

English

Number of languages everyone speaks: 1

Spoken language(s) everyone speaks: English

Total languages spoken in the group: 5

Languages spoken: English, Mandarin, Arabic, Portuguese, Tagalog

About

Beginners Problems on Sets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published