Sunidhi Bansal has Published 1101 Articles

Rotate a matrix by 90 degree without using any extra space in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 08:41:32

333 Views

We are given a 2-D array that will be used to form a matrix pattern. The task is to rotate a matrix by 90 degrees in an anti-clockwise direction such that the first row becomes the first column, second row becomes second column and third becomes third column and the ... Read More

Recursively print all sentences that can be formed from list of word lists in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 08:14:36

344 Views

Given a list of words. The goal is to create all possible sentences that can be formed by taking words from the list using a recursive approach. You can only take one word at a time from both the lists.Let us see various input output scenarios for thisInput −sentence[row][col] = {{"I", ... Read More

Reverse and Add Function in Java

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 08:02:33

487 Views

We are given with an integer and the agenda here is to reverse the digits of the number and add the reversed number to the original number and check if the resultant number is a palindrome or not and the process is repeated until it does. The breaking point of ... Read More

Reverse actual bits of the given number in Java

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:58:16

859 Views

Given an integer n that is not negative. The goal is to reverse the bits of n and report the number that results from doing so. While reversing the bits, the actual binary form of the integer is used; no leading 0s are taken into account.Let us see various input ... Read More

Recursive sum of digits of a number is prime or no in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:40:46

503 Views

Given an integer variable number as input. The goal is to calculate the sum of digits of the input number and check if that sum is prime or not. Do this till the obtained number with sum of digits becomes a single digit number. Check if that number is prime ... Read More

Recursive sum of digits of a number formed by repeated appends in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:36:06

292 Views

Given two integers ‘number’ and ‘repeat’ as input. The goal is to calculate the sum of digits of the input number repeated ‘repeat’ number of times until the sum becomes a single digit. Do this till the obtained number with sum of digits becomes a single digit number. If the ... Read More

Rotate a matrix by 90 degree in clockwise direction without using any extra space in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:23:33

3K+ Views

We are given a 2-D array that will be used to form a matrix pattern. The task is to rotate a matrix by 90 degrees in a clockwise direction such that the last row becomes the first column, second row becomes second column and first becomes third column and the ... Read More

Refactorable number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:19:18

72 Views

We are given an integer type value, let's say, number. The task is to check whether the given number is Refactorable or not. If yes print that the number is a refactorable number else print not possible.What is a Refactorable Number?A number is refactorable when it is divisible by its ... Read More

Rearrange characters in a string such that no two adjacent are same in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:13:17

748 Views

We are given a string, let's say, str of any given length. The task is to rearrange the given string in such a manner that there won't be the same adjacent characters arranged together in the resultant string.Let us see various input output scenarios for this −Input − string str = ... Read More

Rectangle with minimum possible difference between the length and the width in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 03-Nov-2021 07:09:52

227 Views

Given an area of rectangle as input. The goal is to find the sides of a rectangle such that the difference between the length and breadth is minimum.Area of Rectangle = length * breadth.ExamplesInput − Area = 100Output −Side of Rectangle with minimum difference:Length = 10, Breadth = 10Explanation − Sides with area ... Read More

Advertisements