Category: Amazon

0

Tic Tac Toe Winner

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...

0

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...

0

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...

0

Generate all combinations of a string in javascript

[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]

0

Dedupe an array in javascript

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...

1

Find duplicates in an array using javascript

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...

Show Buttons
Hide Buttons