Tap here to switch tabs
Problem
Submissions

Problem: Card Flipping Game

Card Flipping Game gives paired front and back values for each card. Flip any cards to find the smallest number that can be on a back while appearing on no front, or return zero.

Statement

You are given two 00 indexed integer arrays fronts and backs, each of length n, representing the numbers written on the front and back of n cards.

You can flip any number of cards. Flipping a card swaps the number on its front with the number on its back.

A number is considered good if it is on the back of at least one card and does not appear on the front of any card.

Return the minimum possible good number. If no good number can be obtained, return 00.

Constraints:

  • n == fronts.length == backs.length

  • 1≤1 \leq n ≤1000\leq 1000

  • 1≤1 \leq fronts[i], backs[i] ≤2000\leq 2000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Card Flipping Game

Card Flipping Game gives paired front and back values for each card. Flip any cards to find the smallest number that can be on a back while appearing on no front, or return zero.

Statement

You are given two 00 indexed integer arrays fronts and backs, each of length n, representing the numbers written on the front and back of n cards.

You can flip any number of cards. Flipping a card swaps the number on its front with the number on its back.

A number is considered good if it is on the back of at least one card and does not appear on the front of any card.

Return the minimum possible good number. If no good number can be obtained, return 00.

Constraints:

  • n == fronts.length == backs.length

  • 1≤1 \leq n ≤1000\leq 1000

  • 1≤1 \leq fronts[i], backs[i] ≤2000\leq 2000