Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

How many ordered pairs (a, b) with 1 <= a, b <= 10 satisfy a^2 + b^2 <= 50?

  1. A. 34
  2. B. 19
  3. C. 28
  4. D. 33

Correct answer: D. 33

Two-pointer over sorted values, or direct enumeration, gives the count of ordered pairs. Counting only a <= b (second option) gives the unordered count, which is different.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic