OA was conducted on Hackerearth for SDE.
Problem 1 :
A string S of legth N has to be reconstructed from 2(start, end)+k substrings(random length). Start substring is a prefix of S and end substring is a suffix of S. These substrings can be overlapping each other from right, left or both sides with minimum of 4 characters.
Eg : abcde123, de123xyz, 3xyzpqr
Output : abcde123xyzpqr
Problem 3 :
Homes are aligned in a row. In any given row, maximum half of the homes are occupied. In a season, people got infected and all must vacate homes to move to unoccupied homes. Movements are sequential and not parallel (i.e one home completes the movement, then only the second home starts). To reduce the overall time taken, it's better to move to a nearby empty room than a farther one. i'th home to j'th home movement results in abs(j-i) distance. Minimize the overall distance covered by the time all infected home completes the movement to unoccupied homes.
Input : n = no of homes
String s denoting occupied and unoccupied homes(1 = occupied, 0 = unoccupied)
Example:
n = 4
"1001"
Ans : 2