Interview Question 1
For a non-negative real number \(x\), the floor of \(x\), denoted by \( \lfloor x \rfloor\) is the largest integer that is less than or equal to \(x\). For example, \(\lfloor 3 \rfloor = 3 \) and \( \lfloor 6.999 \rfloor = 6 \).
Update: This post was updated to use MathJax on July 10, 2022.
- Let \(n\) be a positive natural number that is a perfect square. You are asked to pick a set of \( \lfloor \frac{n}{2} \rfloor \) natural numbers from \( 1,2, \ldots,n - 1 \), such that none of the chosen numbers is a perfect square, and no two distinct chosen elements add up to \(n \). For what values of \(n\) is this possible?
- Let \(n\) be a positive natural number that is a perfect cube. You are asked to pick a set of \( \lfloor \frac{n}{2} \rfloor \) natural numbers from \( 1,2, \ldots,n -1 \), such that none of the chosen numbers is a perfect cube, and no two distinct chosen elements add up to \(n\). For what values of \(n\) is this possible?
Update: This post was updated to use MathJax on July 10, 2022.
Tags: oxford, cs, maths, interview
3 responses