Panda Guru LogoPanda
Guru

GreyOrange OA (SDE)

Round 1

Questions:

  1. Triangle and Points
    You are given the coordinates of a triangle with three vertices:

    • (x₁, y₁)
    • (x₂, y₂)
    • (x₃, y₃)

    Additionally, you are provided the coordinates of two points:

    • Point p: (xₐ, yₐ)
    • Point q: (xq, yq)

    Your task is to determine the following:

    Output:

    1. Print 1 if the triangle cannot be formed.
    2. Print 2 if both p and q lie inside the triangle.
    3. Print 3 if only point p lies within the triangle.
    4. Print 4 if only point q lies within the triangle.
    5. Print 5 if neither point lies inside the triangle.

    Input Format:

    • Coordinates of the triangle vertices:
      x₁, y₁, x₂, y₂, x₃, y₃
    • Coordinates of the points p and q:
      p(xₐ, yₐ), q(xq, yq)

    Example:

    Input: Triangle: (0, 0), (5, 0), (0, 5) Point p: (1, 1) Point q: (6, 6) Output: 3 # Only point p lies inside the triangle.
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 2

Questions: 2. Array Operations
You are given an array of n elements and two variables, x and y.

In each operation, you can:

  1. Subtract x from one element of the array.
  2. Subtract y from the remaining elements.

Your task is to find the minimum number of operations required to make every element of the array ≤ 0.

Input Format:

Output:

Print the minimum number of operations to make each element ≤ 0.

Example:

Input: 5 10 20 30 40 50 5 2 Output: 13
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 3

Questions: 3. Roman Numerals in Strings
You are given a string that contains a name followed by Roman numerals.

Your task is to return a vector of strings that stores:

  1. The string name.
  2. The numerical value of the Roman numeral (converted to integer).

The names should be in ascending order, and if the names are the same, the numbers should also be sorted in ascending order.

Input Format:

Output:

Return a vector of strings, sorted by name and numeral value.

Notes:

Example:

Input: John IX Mary XV John VIII Mary IX Output: ["John 8", "John 9", "Mary 9", "Mary 15"]
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.