Pergunta de entrevista da empresa Workday

Given a node n on a binary tree, find the longest distance to a leaf node

Respostas da entrevista

Sigiloso

6 de nov. de 2020

public int heightOfTree() { return heightUtil(getRoot()); } private int heightUtil(Node root) { if (root == null) { return -1; } int left = heightUtil(root.getLeft()); int right = heightUtil(root.getRight()); return Math.max(left, right) + 1; }

1

Sigiloso

17 de jan. de 2021

There's a lot of elements to typically cover in these questions, clarifications, scoping, making sure you're answering the actual question the interviewer is looking for you to answer, etc. Could be worth doing a mock interview with one of the Prepfully Workday Software Applications Engineer experts... they've worked in the role so they clearly know how to get through the interview. prepfully.com/practice-interviews