## Move all negative elements to one side of array

Move all negative elements to one side of array – Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the …

## Find top three repeated in array

The problem “Find top three repeated in array” states that you are given an array of n numbers with some repeated numbers in it. Your task is to find out the top 3 repeated numbers in an array. Example [1,3,4,6,7,2,1,6,3,10,5,7] 1 3 6 Explanation Here 1,3 and 6 are repeated …

## Check if two arrays are equal or not

The problem “Check if two arrays are equal or not” states that you are given two arrays. The problem statement says that you have to determine if given arrays are equal or not. Example arr1[] = { 1, 4, 2, 5, 2 }; arr2[] = { 2, 1, 5, 4, …

## Print the Fibonacci numbers in reverse order

Problem Statement Given a number n, print the fibonacci numbers in reverse order. Example n = 5 3 2 1 1 0 Explanation: The Fibonacci numbers are 0, 1, 1, 2, 3 as per their ordering. But since we needed to print in reverse order. n = 7 8 5 …

## Print Fibonacci sequence using 2 variables

Problem Statement The problem “Print Fibonacci sequence using 2 variables” states that you need to print the Fibonacci sequence but there is a limitation of using only 2 variables. Example n = 5 0 1 1 2 3 5 Explanation The output sequence has the first five elements of the …

## Palindrome Number

Problem Statement the problem “Palindrome Number” states that you are given an integer number. Check if it is a palindrome or not. Solve this problem without converting the given number into a string. Example 12321 true Explanation 12321 is a palindrome number because when we reverse 12321 it gives 12321 …

## Reverse a String

Problem Statement “Reverse a String” problem states that you are given a string s of size n. Write a program to reverse it. So, what does reversing a string means? It generally means reversing the input string that we are given. That is it is defined as an operation doing …

## Special Number

What can be so special about a number? Let us find out. We have with us an array of N numbers. A number can be special if it is divisible by one or more numbers except for the number itself. Firstly let us clear this with a few examples before …

## Reverse a Number Using Stack

In reverse a number using stack problem we have given an integer variable representing a number. Print the reverse the given number using stack. Example Input : 12345 Output : 54321 Input : 207 Output : 702 Explanation for Reverse a Number Using Stack Let number n = 12345 Start traversing and store the …

## Valid Palindrome

Given a string s of length n. Write a program to find if the string is valid palindrome or not. If not you may delete at most one character from the string to make it a palindrome. Any string which is the same as it’s reverse is known as a …

Translate »