## Permutations CSES Solution

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 such a permutation exists. Input The only input line co... Read more

## Increasing Array CSES Solution

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 increase the value of any element by one. What is the... Read more

## Repetitions CSES solution

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 only one type of character. Input The only input line cont... Read more

## Missing Number CSES solution

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−1n−1 numbers. Each number is distinct and between 11 and... Read more

## Weird Algorithm CSES solution

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 algorithm repeats this until n is one. For example, the seque... 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 Operation: Find and Replace all occurrences of PAT in... 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 array. Check if it is possible to have a jumps combinatio... 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. So, for this problem first we will se the iterative me... Read more

## Java SHA-256 hackerrank Solution

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 executing a hashing algorithm) to a known and expected hash val... Read more

## Covariant Return Types HackerRank solution

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 subclass to override the behavior of an existing... Read more