In this problem, we are given an array arr[] of n positive integers. Our task is to create a program to find the elements greater than the previous and next element in an Array. Code Description: We need to find the elements of the array that satisfy the condition, the element is greater that the element at index 1 less than it and also is greater than the element at index 1 greater than it.Let’s take an example to understand the problem, Input: arr[] = {3, 2, 5, 7, 3, 4, 5}Output: 7Explanation −Element with index one less than the current element, 5.Element with ... Read More
It is a matrix multiplication algorithm is based on divide and conquer method. It is used to multiply two matrices of the same size, Finding multiplication of two matrices−The strassen’s Algorithm reduces overhead for multiplication by simplifying the multiplication.Here is the multiplication made using the strassen’s Algorithm: M1 = a*(f - h) M2 = (a + b)*h M3 = (c + d)*e M4 = d*(g - e) M5 = (a + d)*(e + h) M6 = (b - d)*(g + h) M7 = (a - c)*(e + f) This can be easily remembered and the algorithm code can be decoded. For this we have a few rules, first remember these ... Read More
Editors are basically computer programs that are utilised to edit files on a computer. The provide environment to a programmer to create, edit, update, format a document in any order he/she wants to.In system programming or programming, editors are software or tools that are used to edit the program. These are basically text editors of special type that have integrated functionality to edit code.Some common program editors are notepad++, visual code, sublime. Also there are some edits that provide things used to do more than just editing the code. They are the integrated development environment (IDE) which can help you edit, debug and run ... Read More
In this problem, we are given an array arr[] consisting of n positive values. Our task is to find the element equal to the sum of all the remaining elements of the array.Code Description: We need to find the element whose value is equal to the sum of all elements of the array except that element.Let’s take an example to understand the problem, Input: arr[] = { 5, 4, 17, 1, 7 }Output: 17Explanation −The sum of the rest of the element is (5 + 4 + 1 + 7 ) = 17, which is equal to the remaining element 17.Solution Approach −A simple ... Read More
Dumpster diving or trashing is a technique used in cyber security and information technology which is commonly used by hackers to extract data. It is based on the fact that “something which is worthless for someone can be of great usage for someone else”. It works based on the idiom, “One man’s trash is another man’s treasure”. Trashing refers to searching online trash (unused information) and finding out fruitful information about a business or person to use it to perform hacking related activities.This dumpster diving is used to gather information to try to hack or extract information of business using a phishing technique by pretending to be ... Read More
A mathematical number defined in number theory in a given number base is a natural number equal to the perfect cube of another natural number such that the digit sum of the first natural number is equal to the digit sum of the second number(wikipedia).The number was found by Henry Dudeney. Its mathematical formula is −Here, we are given an integer n. Our task is to check whether the given number n is a dudeney number or not. Let’s take an example to understand the problem, Input: N = 17592Output: NoExplanation: The given number is not a dudney number.Solution Approach −The solution lies ... Read More
Every system works on operations mainly in two modes to safeguard hardware’s computation. The two modes are −User ModeKernel ModeUser Mode −The OS mode in which all the user applications and programs will run. Here, the user instructions are worked on and softwares like playing music is run.Kernel Mode −The OS mode in which the hardware loads and its computations are performed. Only privileged instructions are allowed to run in kernel mode. Some common privileged instructions are −Input-Output ManagementSwitching modes between user mode and kernel mode.Interrupt managementDual Mode in OS is the switching of modes between the two modes and switching of mode ... Read More
We are required to write a JavaScript function that takes in two strings of characters lets call them str1 and str2.The function should check whether we can form str2 from str1 by deleting exactly one character from str1. If we can do so the function should return true, false otherwise.For example −If the input strings are −const str1 = 'chemistty'; const str2 = 'chemisty';Then the output should be −const output = true;ExampleFollowing is the code −const str1 = 'chemistty'; const str2 = 'chemisty'; const stringSimilarity = (str1 = '', str2 = '') => { if(str1.length - str2.length !== 1){ ... Read More
We are required to write a JavaScript function that takes in an array of integers as the only argument.The function should sort the integers present in the array in increasing order based on the 1s present in their binary representation. If two or more numbers have the same number of 1s in their binary, they should be sorted in increasing order according to their magnitude.For example −If the input array is −const arr = [34, 37, 23, 89, 12, 31, 23, 89];Then the output array will be −const output = [34, 12, 37, 23, 89, 23, 89, 31];ExampleFollowing is the ... Read More
We are required to write a JavaScript function that takes in an array of literals as the first and the only argument.Our function should swap each consecutive even index with each other, and swap each consecutive odd indexes with each other.The function should do these swappings in place.For example −If the input array is −const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8];Then the array should become −const output = [2, 3, 0, 1, 6, 7, 4, 5, 8];because 0 and 2 gets swapped, 1 and 3 gets swapped, 4 and 6 gets swapped, 5 and 7 ... Read More