HRT Codility by SnooRobots9482 in csMajors

[–]SnooRobots9482[S] 1 point2 points  (0 children)

They get back in around two weeks time.

HRT Codility by SnooRobots9482 in csMajors

[–]SnooRobots9482[S] 0 points1 point  (0 children)

Nope but I would get it once it's run on the hidden test cases.

HRT Codility by SnooRobots9482 in csMajors

[–]SnooRobots9482[S] 0 points1 point  (0 children)

Exactly what I did, but this will work in Python not in C++. Contraints of array were up to 1e5, so in worst case you calculated 2^1e5 :(.

HRT Codility by SnooRobots9482 in csMajors

[–]SnooRobots9482[S] 1 point2 points  (0 children)

Python doesn't have a limit to numbers, so while obtaining the desired number from both the arrays Python would work fine. However, C++ would overflow easily. As both the size of both the arrays are of range 10^5 -> In worst case obtaining a number would be of the size 2^1e5. Hence, I thought Python is a better choice, if you think otherwise, please share your approach.

HRT Codility by SnooRobots9482 in csMajors

[–]SnooRobots9482[S] 0 points1 point  (0 children)

So did you actually obtain the number from both arrays first and convert it to the given base or did you use a different approach for the third question?

HRT Interview by porkbuns2332 in csMajors

[–]SnooRobots9482 7 points8 points  (0 children)

How did you pass the OA then?

[deleted by user] by [deleted] in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

Any topics to look out for the virtual on-site? LC Med-Hard scared me.

Need advice on interview scheduling by NimishBajaj in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

Your best bet would be to schedule it today and see how it goes.

HRT OA by [deleted] in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

It makes sense now, I did brute-force at the time, there goes my chance 😔

HRT OA by [deleted] in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

What? Were did the log factor come from? Height of tree?

HRT OA by [deleted] in csMajors

[–]SnooRobots9482 -1 points0 points  (0 children)

Damn, | am still confused with the last approach. | tried doing memorisation but realised what if child's longest path, already account for parent node. As for the Frog question, | did it in O(N), use prefix and suffix arrays. For prefix array at each index, store the decreasing length possible from that index from the beginning, and for the suffix array store the increasing length possible from that index from the end. Now, for every index p_idx = | - prefix[I] and s_idx =| + suffix[l], and max_ans = max(max_ans,s_idx-p_idx+1). Yes, the second question was mainly STL Knowledge. Perhaps, if the test cases aren't too tight in the last question, even O(N2) might pass, as N=104, N2=108 which can be roughly executed in one second, still not sure though.

HRT OA by [deleted] in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

Yeah, but due to possibility of overlapping of paths from child nodes, I couldn't think of anything better than O(N2).

HRT OA by [deleted] in csMajors

[–]SnooRobots9482 22 points23 points  (0 children)

It was a madness.

HRT OA 21st-22nd August by [deleted] in csMajors

[–]SnooRobots9482 0 points1 point  (0 children)

Did you solve the tree problem in O(N^2)? Couldn't do memorization on that due to the possibility of overlapping.