Evaluate Reverse Polish Notation in Javascript
Input: [“3”, “1”, “+”, “5”, “*”] Output: 9 Explanation: ((3 + 1) * 5) = 20 Algorithm: The key thing to realize in this to use stack as a data structure for the solution....
Input: [“3”, “1”, “+”, “5”, “*”] Output: 9 Explanation: ((3 + 1) * 5) = 20 Algorithm: The key thing to realize in this to use stack as a data structure for the solution....
Interview Question Implement an algorithm that determines if someone has won a game of tic-tac-toe Algorithm To determine if any of the two players have won the TicTacToe game or not, We need to...
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...
[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...
[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”] [/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]
Problem : Given a sorted and rotated array find the index of a pivot element in an array. Input : An array Output : An index Algorithm : Binary search tree Time complexity :...
Input : An array Output : An array Logic : Iterate over the input array called data Add the element to the output array called result if the element does not exist in the...
Problem : Given an array of positive integers find all the duplicate elements. Algorithm : Iterate over the array using forEach Find if there is a duplicate for the element using indexOf indexOf takes...
Problem : Create a pascal’s triangle using javascript. More details about Pascal’s triangle pattern can be found here. Input: #Rows = 6 Output: Logic : Pascal’s triangle can be simulated using 2-D array While...
Input: An array of n integers and given a number X. Expected output: All the unique pairs of elements (a, b), whose summation is equal to X. Example <pre>Given<span class=”pl-k”>var</span> unSortedArr <span class=”pl-k”>=</span> [<span...