RSRamandeep Singhinramandeepsingh.hashnode.dev·Feb 14, 2024 · 1 min readDistinct numbersYou are given a list of N integers, and your task is to calculate the number of distinct values in the list. Input The first input line has an integer n: the number of values. The second line has the integers x1,x2,…,xn. Output Print one integer: the...00
RSRamandeep Singhinramandeepsingh.hashnode.dev·Feb 7, 2024 · 1 min readTrailing ZeroesYour task is to calculate the number of trailing zeroes in the factorial n! for example, 20! = 2432902008176640000 Input The only input line has an integer n. Output Print the number of trailing zeros in n! Constraints 1 <= n <= 10^9 Example Input:...00
RSRamandeep Singhinramandeepsingh.hashnode.dev·Feb 7, 2024 · 2 min readBit StringsYour task is to calculate the number of bit strings of length n. For example, if n=3, the correct answer is 888, because the possible bit strings are 000, 001, 010, 011, 100, 101, 110, and 111. Input The only input line has an integer n. Output Print...00
RSRamandeep Singhinramandeepsingh.hashnode.dev·Jan 29, 2024 · 2 min readPermutationsA permutation of integers 1,2,…,n is called beautiful if there are no adjacent elements whose difference is 111. Given nnn, construct a beautiful permutation if such a permutation exists. Input The only input line contains an integer on n. Output Pri...00
RSRamandeep Singhinramandeepsingh.hashnode.dev·Jan 29, 2024 · 1 min readRepetitionsYou 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 contains ...00