I’m aiming google/fb london/zurich. The problem is to create an iterator for binary search tree. To solve this problem I’ve implemented morris traversal but it’s a bit tricky algo so took a lot of time to debug and make all testcases pass. Am i so far behind the hiring bar?
Wut
Yes
Keep practicing. This is a fairly easy problem.
There are so many Asian kids who can solve this problem just if you give the problem number.
I’m an asian kid too 😂😂
Not Asian enough. Insert unimpressed Asian dad meme here.
Creating an iterator vs simply iterating have different considerations. If you’re trying to do the former and are using traditional Morris traversal (without cloning the tree), you’re doing it wrong. Your tree is temporarily destroyed and unusable until you release the iterator. Did you create an iterator but now want to serialize your untouched tree? Nope, good luck with that. This is the difference between theory and practical application. Do it the normal way and use a stack like a real person.
Yeah. Makes sense. Thanks
Binary search tree iterator was amazon easiest interview question. I doubt even google ask this. Are you experienced?
3 year. Just lost touch with the things. Didn’t do any competitive coding after college
This may be your kickstart. I would suggest to start with leetcode topics learning first. Search, array, binary tree search etc.
It should pass the test cases in the first try
It’s quite literally just the next Inorder traversal problem wrapped in an API. Easy as cake.
this isn’t out of practice, this is not at fang level. or degree level frankly. this is extremely basic stuff. it’s not a trick that depends on some trivial knowledge you wouldn’t normally have. it’s basic stuff.
So many runtime errors, so sloppy...