# Author: Kavit

## Level order, breadth first search or zig-zag traversal of a binary tree

Traverse the binary tree in breadth first search also known as level order traversal manner. // Should print  8, 3, 10, 1, 6, 14, 4, 7, 13 Pseudo Algorithm PSEUDO ALGORITHM (Breadth first search...

## Length of Longest Substring Without Repeating Characters

Example Given “bbb”, the answer is 1. Given “pwwke”, the answer is 3. Given “obamacare”, the answer is 4. Algorithm Time complexity: O(n) Have a pointer which tracks the starting index of the current...

Design an Email Service API service     Requirements   Who is the end consumer of the API ? Internal developers Third party developers Security Authentication Authorization Auditing Database Max storage per company based on...

## Merge K-sorted Arrays

Problem : Given k sorted arrays of size n, merge all the k arrays into one sorted array. Example : var n_k_arr = [ [ 8, 10, 12 ], [ 6, 9, 13 ],...

## Time Conversion: 12 hour to 24 hour format

Convert 12 hour clock to 24 hour clock. Solution

## Given an array of numbers, return array of products of all other numbers

Problem Given an array of n integers, return an array of same size such that prod[i] is equal to the product of all the elements of arr[] except arr[i].   Restrictions  – Not allowed to...

## Delete all the nodes from a binary tree

Recursive : To delete all the nodes, you will have to visit all the nodes. There are three ways to traverse the binary tree : Post order Pre order In order. To delete all...

## what does console.log.bind(console) do?

Function#bind allows you to create a new function, whose this value will be set to the value you pass.   Hence, it allows you to abstract the console.log statements. So, you can type : var...

## How to test random dice roll function?

Given a function, `const RandomDiceRoll = () => return num; ` which returns a random number between 1 to 6. As a tester for this function, how would you verify that the function returns the...

## Find length of the largest subarray with contiguous elements

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_text_color=”#000000″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”] Given an array of distinct integers, find length of the longest subarray which contains numbers that can be arranged in a continuous sequence. If...