Data Structures & AlgorithmsModerateTCS NQT · GATE CS
Problem: What is the determinant of the matrix [[2, 1], [1, 3]]?
- A. 6
- B. 4
- C. 5
- D. 7
Correct answer: C. 5
For [[a, b], [c, d]] the determinant is ad − bc = 2·3 − 1·1 = 5. Adding the products (ad + bc) gives 7, and the trace a + d also gives 5 here only by coincidence.
More Coding Interview Problems questions
- Problem: How many permutations of the letters A, B, C, D leave no letter in its original position (for example, A is not in the first…
- Problem: The sum of all integers from 1 to 200 that are divisible by neither 4 nor 7 is what value?
- Problem: How many integers from 1 to 100 inclusive are divisible by 7 but not by 14?
- Problem: What is the least common multiple of 6, 8 and 12?
- Problem: How many trailing zeros does 30! have in base 10?
- Problem: How many unordered pairs {x, y} with x ≠ y from the set {1, 2, 3, 4, 5} have x + y even?