เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Operations on sets

Using mathematical notation, we can define the following operations given two sets \(X\) and \(Y\):

  \(X\cap Y\) - the intersection between \(X\) and \(Y\) (all elements which are in both \(X\) and \(Y\))

  \(X\cup Y\) - the union between \(X\) and \(Y\) (all elements which are either in \(X\) or \(Y\))

  \(X - Y\) - the difference between \(X\) and \(Y\) (all elements which are in \(X\) but not in \(Y\))

You are given 5 sets of integers A, B, C, D,E (You should see them in the console). What is the result of the following expression? $$ \left( A \cup \left( B \cap C \right)\right) - \left(D \cap E\right) $$

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Practicing Coding Interview Questions in Python

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำจริง

เปลี่ยนทฤษฎีให้เป็นการลงมือทำด้วยแบบฝึกหัดเชิงโต้ตอบหนึ่งในของเรา

เริ่มแบบฝึกหัด