From 26ae79fc0d5a7e8a1d628290e071804ab674c66b Mon Sep 17 00:00:00 2001 From: Paramaguru Gnanaguru Date: Tue, 20 Oct 2020 14:15:42 -0700 Subject: [PATCH] phone screen update --- ...nPhoneScreening.cs => PhoneScreening_1.cs} | 2 +- ...kPhoneScreening.cs => PhoneScreening_2.cs} | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) rename Algorithm/LeetCode/Interviews/{AmazonPhoneScreening.cs => PhoneScreening_1.cs} (99%) rename Algorithm/LeetCode/Interviews/{FaceBookPhoneScreening.cs => PhoneScreening_2.cs} (85%) diff --git a/Algorithm/LeetCode/Interviews/AmazonPhoneScreening.cs b/Algorithm/LeetCode/Interviews/PhoneScreening_1.cs similarity index 99% rename from Algorithm/LeetCode/Interviews/AmazonPhoneScreening.cs rename to Algorithm/LeetCode/Interviews/PhoneScreening_1.cs index 3ce2892..1016362 100644 --- a/Algorithm/LeetCode/Interviews/AmazonPhoneScreening.cs +++ b/Algorithm/LeetCode/Interviews/PhoneScreening_1.cs @@ -11,7 +11,7 @@ namespace LeetCode.Interviews { [TestClass] // Date: 9/18/2018 - public class AmazonPhoneScreening + public class PhoneScreening1 { /* At amazon products are organized in a hierarchy called browse nodes. diff --git a/Algorithm/LeetCode/Interviews/FaceBookPhoneScreening.cs b/Algorithm/LeetCode/Interviews/PhoneScreening_2.cs similarity index 85% rename from Algorithm/LeetCode/Interviews/FaceBookPhoneScreening.cs rename to Algorithm/LeetCode/Interviews/PhoneScreening_2.cs index acd1553..47f9de2 100644 --- a/Algorithm/LeetCode/Interviews/FaceBookPhoneScreening.cs +++ b/Algorithm/LeetCode/Interviews/PhoneScreening_2.cs @@ -2,6 +2,38 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; +/* +Interview +--------- + +Q: Find and return the position of node in cloned tree for the given node in original tree ? +Note: Only structure is cloned, need not be values. +You are given two parameters: +T1 = Node of the original tree +T2 = Cloned tree root +TreeNode FindPosition(TreeNode clone, TreeNode nodeOfOriginal) { + // Your code... + return nodePositionInClone; +} +Example: +T1 + 10 + / \ + 20 30 + / | \ + 40 50 60 + / \ + 70 80 +T2 (Clone of T1) +Clone of Tree 1 - only the structure and need not be values + 1 + / \ + 2 3 + / | \ + 4 5 6 + / \ + 7 8 +*/ namespace LeetCode.Interviews { public class TreeNode @@ -17,7 +49,7 @@ public TreeNode(int value) } [TestClass] - public class FaceBookPhoneScreening + public class PhoneScreening2 { public TreeNode FindTreeNode(TreeNode clone, TreeNode nodePosition) {