A permutation of integers 1,2,…,n1,2,…,n is called beautiful if there are no adjacent elements whose difference is 11. Given n, construct a beautiful permutation if... Read more

You are given an array of n integers. You want to modify the array so that it is increasing, i.e., every element is at least as large as the previous element. On each move, you may... Read more

You are given a DNA sequence: a string consisting of characters A, C, G, and T. Your task is to find the longest repetition in the sequence. This is a maximum-length substring containing onl... Read more

You are given all numbers between 1,2,…,n1,2,…,n except one. Your task is to find the missing number. Input The first input line contains an integer n. The second line contains n−1... Read more

Consider an algorithm that takes as input a positive integer n. If n is even, the algorithm divides it by two, and if nn is odd, the algorithm multiplies it by three and adds one. The algori... Read more

Design, Develop and Implement a program in C for the following operations on Stringsa. Read a Main String (STR), a Pattern String (PAT) and a Replace String (REP).b. Perform Pattern Matching... Read more

Check if it possible to jump to last position of Array Given an array with positive integers as elements indicating the maximum length of a jump which can be made from any position in the ar... Read more

Highest power of 2 less than or equal to a given number Problem Statement : You are given with a number you need to find the highest power of 2 either less than or equal to the given number.... Read more

Java SHA-256 hackerrank Solution Cryptographic hash functions are mathematical operations run on digital data; by comparing the computed hash (i.e., the output produced by executin... Read more

Java allows for Covariant Return Types, which means you can vary your return type as long you are returning a subclass of your specified return type. Method Overriding allows a sub... Read more