Had a virtual onsite split into 2 days.
Day 1/ Day2:
You have an encoding that maps each letter to a number
A -> 0 B -> 1 ... K -> 10 ... U -> 20 ... Z -> 25
given an encoded string e.g. '911', find the total number of possible encoding strings that can be generated.
Example: '10' => ['BA', 'K'] => 2; '911' => ['JBB', 'JL'] => 2; '1' => ['B'] => 1Sink zeroes down in binary tree, requirements:
1. Only swap values between nodes
2. After completion, either the zero node is the leaf node or the subtree of the zero node contains only zero nodesI was able to complete the second one using post order traversal. For first question, I did DP but interviewer was not fully convinced with the solution.
I was able to design it but not able to do time management and this way lot of things that i know was not able to communicate with the interviewer.
Given an array of integers and a window size, write a function that returns average value for each rolling window.
Context: Consider an array of integers and integer k . For each element X in the array one can construct a slice of the array that includes X and k-1 elements before X ( k elements in total) - this is called 'rolling window', and k is called 'window size'
Example:
input = [1,2,3,4,5]
window_size = 3
output = [2.0, 3.0, 4.0]https://leetcode.com/problems/meeting-rooms-ii/description/This round, I was able to complete both the questions on time.