Tip 1 : Practice questions on leetcode
Tip 2 : Understand the best solutions in depth and algorithm used
Tip 3 : Ask clarifying questions to the interviewer and break the problem to smaller sub parts
Tip 1 : Highlight your most impactful work on the resume
Tip 2 : Keep it easy to understand
This was a DS+Algo round. The interviewer shared the code editor and asked three questions. The questions were of easy to moderate level.



1) All codes are binary strings.
2) Each code should be able to determine its corresponding character uniquely.
3) The total numbers of bits used to represent the message are minimized.
If there are multiple sets of valid Huffman codes for a message. You can print any of them.
Consider the array ARR = [ 1, 4, 2 ] having 3 elements.
The array containing Huffman Codes for the above array will be [ '10', '0', '11' ]. Other Valid Huffman Codes are [ '01', '1', '00' ], [ '00', '1', '01' ] etc. Codes like [ '1', '0', '01' ], [ '1', '10' , '0' ] are some of the invalid Huffman Codes.



I solved this using the DFS algorithm.



1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
I explained the Brute force approach first and then moved to the optimal solution.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?