Menu
Coddy logo textTech

Recap - Event Guests

Part of the Logic & Flow section of Coddy's R journey. Lesson 16 of 64.

challenge icon

Challenge

Medium

Complete guest_report(invited, arrivals). arrivals lists every check-in, and a guest may check in more than once. Return four lines:

  • Arrived: followed by the number of different guests who checked in
  • No-shows: followed by the invited guests who never checked in
  • Uninvited: followed by the guests who checked in without an invitation
  • Repeat check-ins: followed by the guests who checked in more than once

Sort each list of names, write each name once, and join them with , . An empty list is written none.

The supplied code reads the invited guests and the arrivals as comma-separated lines and prints each returned line.

Try it yourself

guest_report <- function(invited, arrivals) {
  # Write your code here
  character(0)
}

# Supplied input/output code: keep it as it is
input <- suppressWarnings(readLines(file("stdin")))
cat(guest_report(strsplit(input[1], ",")[[1]], strsplit(input[2], ",")[[1]]), sep = "\n")

All lessons in Logic & Flow

Practice on your own: Online R compiler