Loop over an array with the given timeout for each element
Problem You are given an array of objects each with its name and timeout value. Iterate over each element inside an array in the interval of the given timeout. Solution We have to set...
Problem You are given an array of objects each with its name and timeout value. Iterate over each element inside an array in the interval of the given timeout. Solution We have to set...
[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” use_border_color=”off” border_color=”#ffffff” border_style=”solid”] Given a binary tree, level k, print all the nodes at level k. For example, 4, 7, 8 are at level 2. 1...
Problem: Given stair case with n stairs, count the number of ways in which you can climb the stairs. Each time you can either take 1 step or 2 steps. Solution: — Number of...
Problem : The Towers of Hanoi is a classic puzzle with 3 pegs and multiple disks of different sizes. The goal of the puzzle is to move all the disks from the first peg...
Problem description : Convert a given binary tree to a linked list of all the nodes at each depth (if you have a binary tree with depth D, you’ll have D linked lists). Logic...
Problem : Given a string and an array of words, find out if the input string can be broken into a space-separated sequence of one or more words. For example, inputDict = [“I” ,...
Problem : Given a nested array, flatten the given array. Input : [1, 2, 3, [4, 5], [6, [7, 8]]] Output : [1, 2, 3, 4, 5, 6, 7, 8] Logic : Iterate throgh...
Problem description: The following nested array contains some invalid entries (which are not numbers). We also want to filter those entries in our average calculation. var nestedArray = [ 1, 2, 3, [4, 5,...