#dsa

Read more stories on Hashnode

Articles with this tag

Your task is to divide the numbers (1,2,3,....n) into two sets of equal sum. The only input line contains an integer n. Input The only input line...

A number spiral is an infinite grid whose upper-left square has the number 1. Here are the first five layers of the spiral: Your task is to find...

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

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

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

Problem Statement: Consider an algorithm that takes as input a positive integer. If it is even, the algorithm divides it by two, and if it is odd, the...