Interview Questions

Write a function that takes in two rectangles and returns true if the overlap and false if they do not.Find one missing card from deck of 51 card

Software QA/Tests Interview Questions from Microsoft


(Continued from previous question...)

Write a function that takes in two rectangles and returns true if the overlap and false if they do not.Find one missing card from deck of 51 card

Question:
Find one missing card from deck of 51 card


maybe an answer:


use XOR.
XOR numbers of cards = missing card number
XOR colors of cards = missing card color
XOR of suites of cards = missing card suite.

XOR(A, A) = 0

and if you do XOR on even times repeated no.s we will get zero.
and if you do XOR on all even times and one no. odd times then we will get odd time repeated no.
Here, in our case... missing no. repeated odd no. of times n other no. repeated even no. of times.
So, our XOR will work here.

(Continued on next question...)

Other Interview Questions