"okay user, we have just one more question, and then you can join our startup. can you reverse a binary tree?"

>"okay user, we have just one more question, and then you can join our startup. can you reverse a binary tree?"

can you?

the only thing im gonna reverse is your assholes queers

>The Virgin Muhazni vs. the Chad Hakim

Is your startup a restaurant kitchen?

I mean I wouldn't hire someone who couldn't do something as simple as that.

Define "reverse a binary tree".

Someone please make this

Sure i can. It will be "eert yranib". Am i hired?

no

Do you want a horizontal mirror image? Or do you want me to pick a tail (maybe the longest one) and create a kind of DAC that you couldn't really call a binary tree anymore but would look a lot like an inverted one?

String is a degenerate case of binary tree. Wouldn't expect you to know, clearly your startup is way below my level.

This fucking scares me. This is the one thing I couldn't do in data structures. Like how the fuck am I supposed to code this on the fly given 10-15min?
Spent hours trying to do this and rotate the stupid tree and failed. IRL I would half ass an attempt but wouldn't get the job desu

they want you to cheat by memorizing examples

I think they want to see your thought process more than quickly spouting out an answer. And maybe I'm wrong, but I think this is one of the easier examples. All you have to do is traverse the tree (DFS would probably be easiest for a binary tree) and swap the left and right node links at every step.

Wait, startup?
*ABORT*

why dont indians groom their disgusting monobrows

fucking first year recursives
why the hipster faggot who applied for google couldn't do it is beyond me, oh wait, hes shit at programming and he was applying for a programming job, fucking waste of time

if 1 then
return 0
else
return 1
end

Fuck. I have a job interview in 1.5 hours. I hope they won't ask me this stupid shit.

basically this but more like
ReverseTree(root) {
if (root == null) return;

temp = root.Left;
root.Left = root.Right;
root.Right = temp;

ReverseTree(root.Left);
ReverseTree(root.Right);
}

>t. soyboy

Only alpha chads with high testosterone can grow facial hair that wildly.

(binary tree)^-1

1
2 3
4 5 6 7
8 9 10 11 12 13 14 15

1
3 2
7 6 5 4
15 14 13 12 11 10 9 8

42

oops

Underrated

Any good job that gives you actual responsibilities and expects you to perform will give you puzzles like this during the selection process.
Being able to reverse a binary tree is something that should come natural if you have a formal education in computer science though, it's very straightforward if you think about it, to the point that recruiters will usually look at and judge your process and ingenuity of your solution more than whether you actually have one.

Yeah, sure, you just recursively swap the elements.

You should have learned how to manipulate data structures in your sophomore year. You did go to university, right? You are qualified for this job, right?

>ingenious solution to reversing a binary tree
This is an oxymoron on at least two levels

--- binary_tree
+++ binary_tree_reversed
@@ -1,* +1,* @@
class BinaryTreeNode {
- BinaryTreeNode left;
BinaryTreeNode right;
+ BinaryTreeNode left;
...
};

Hell yeah bitch

Aren't these the main characters from that facebook friendship drama?

>facebook friendship drama
wut?

I swear by the Allah's name, I can.
> oi brotha, you're hired, inshalla

Are you guys like the brown skinned Bogdanovs?