Intuit Software Engineering Internship question (online assessment)

Hi People,

I got the similar question to " 210 Course Schedule II" on Karat.io platform.

Instead of the integer 2D array of [course,prerequisite] form and the number of courses, the input was ONLY 2D String array of [prerequisite,course] form. Notice the inversion of the mapping form then the original question.

The output was supposed to be the name of the course which will be currently taken if you are at the halfway stage.

Example input:
[DS Algo]
[FoundationCS OS]
[CN CA]
[Algo FundationCS]
[CA DS]
[SD CN]

Output: DS

Explaination: Total 7 courses are there. if you look at the mapping and list out the order of courses. DS will be the 4th course. so at HALFWAY, you are taking DS.

If there are 6 courses, Then return the 3rd course of the sequence, not 4th bacause at Halfway, what course you are doing (or just finished) is course number 3.