Pascals triangle javascript code
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...
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...
Problem: Given a number X, flip it to -X. Time complexity : O ( X ) Logic : The negation can be implemented by adding -1, X times. Solution :
Problem description : Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs, find them all and return them in...
Input : A number // 10 Output : An array // [2, 5] Logic : Key here is that we need to check the divisor starting with 2 to the square root of the...
Problem description : Write a method to determine the given number is odd or not. If it’s not a number then throw an error. Add this method as native javascript method. Input : A...
Problem description : Write a javascript function that accepts a string argument in the format {digit}d{digit}; where The first digit represents the number of dices. The second digit represents the number of sides. The...
Problem description : Write a function that prints the numbers from 1 to 100. But for multiples of three prints Fizz instead of the number and for the multiples of five prints Buzz. For...