Preparing for an interview? Check out Cracking the Coding Interview
Published on

ServiceNow | Software Engineer | Hyderabad

Author
  • Shared Anonymously

YOE: 2+
JL: 5 (SP)
Current Employer: Infosys Pvt Ltd.
College: NIT-B 2022 pass-out.

I have Interviewed for Software Engineer role at Hyderabad.
HR was very polite and discussed the process that will going to have 2 Techinical rounds based on DSA and last will be HR/Managerial.

Given the 1st only.

tow questions asked both are not very specific to DSA, as last I got she was checking mydesign and implementation skills in real world senario case.

  1. we need to find if two or more vehicles will collide, if we have given the speed on some given time of a vehicle. a sensor will emit and fire a function where we going to receive the data such as speed and time which is exactly 10 km from check post. I was very simple, I us unordered_set to store and check the travelTime calculated as:
    currTime + distance x speed x 60
    when I start explaing the TC she told me "It's not about optimization, I was checkin If you can remember D = T/S".

mean while me: Is baar yaha hone se raha!

  1. Allocate seat in a train compartment, where a group of family trying to book seats in a way their seats are facing to each other on preference. for example if all seats are vacent in below scnario.

1,2,3 - 4
5,6,7 - 8

and 6 seat need to allocate together, the eligible seats will be 1,2,3 and 5,6,7 since they are facing each other, 4,8 are not eligible in this case, So, we can't utilize them, but if only 2 peple need to book seat then only this 4,8 pair will be eligible, the second thing the above seat arrangment represent a section and we can't allocare partial seat between tow different sections (at a time 6 seat booking can be done). Also we can have more till 72 seats. like in a train compartment.
Given the solution in one function as we always do while doing CP, mostly I used maths to map the number of peoples like %8 for section check, %4 for side lower and side upper seats, +4 increments, doing all this by iterating over the seats linearly.

During feebdback, She told me that insted of maths we can simply solve this problem by implementing sectionc and compartments as Class to represent real world entity.

Verdict: not selected.
Learning: even though you are solving DSA problems try representing thing as Class and to represent real world entity and you not need to revise all the PMC formulas for any techinical rounds, I don't think this will make any sense for a SE role.

Sorry for the typos will fix and later on.

ReportMark as Helpful