
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

549 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", "You"}, {"Do", "do not like"}, {"walking", "eating"}}Output −I Do walking I Do eating I like walking I like eating You Do walking You Do eating You like walking You like eatingExplanation − Taking one word from each list in sentence[0-2] gives above sentences.Input −sentence[row][col] = {{"work", "live"}, {"easy", "happily"}}Output −work ... Read More

546 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 challenge is that we don’t have to use any extra space.Let us see various input output scenarios for this −Input −int arr[row_col_size][row_col_size] = { { 5, 1, 4}, { 9, 16, 12 }, { 2, 8, 9}}Output −Rotation of a matrix by 90 degree without using any extra space ... Read More

4K+ Views
To find the row corresponding to a nearest value in an R data frame, we can use which.min function after getting the absolute difference between the value and the column along with single square brackets for subsetting the row.To understand how it works, check out the examples given below.Example 1Following snippet creates a sample data frame −ID

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 challenge is that we don’t have to use any extra space.Let us see various input output scenarios for this −Input −int arr[row_col_size][row_col_size] = { { 5, 1, 4}, { 9, 16, 12 }, { 2, 8, 9}}Output −Rotation of a matrix by 90 degree in clockwise direction without using any ... Read More

169 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 total count of factors available. For example, number 9 is refactorable as it has a total number of factors i.e. 3(1, 3, 9) and 9 is divisible by 3 hence its a refactorable number.Let us see various input output scenarios for this −Input − int number = 9Output − It is a ... Read More

1K+ 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 = "itinn"Output − Rearrangement of characters in a string such that no two adjacent are same is: initn.Explanation − We are given a string type variable let’s say, str. Now we will rearrange the characters of an input string in such a manner that no two same characters occur at the same position ... Read More

403 Views
The easiest way to find the frequency is to create a table for the provided vector or data frame column and it can be done with table function. But, if the frequency needs to be found with subsetting then subset function and transform function will also be required as shown in the below examples.Example 1Following snippet creates a sample data frame −head(ChickWeight, 20)OutputThe following dataframe is created − weight Time Chick Diet 1 42 0 1 1 2 51 2 1 1 3 59 4 1 1 4 ... Read More

291 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 = 100.2 - 50, 4 - 25, 5 - 20, 10 - 10. Sides with minimum difference are 10-10 with difference = 0. As we know tha square is a rectangle with equal length on all sides.Input − Area = 254Output − Side of Rectangle with minimum difference :Length = 127, Breadth ... Read More

2K+ Views
To create a block diagonal matrix using a matrix in R, we can use bdiag function of Matrix package.For Example, if we have a matrix called M and we want to create block diagonal using M 4 times by using the below command −bdiag(replicate(4,M,simplify=FALSE))Check out the Examples given below to understand how it can be done.Example 1Following snippet creates a sample matrix −M1

3K+ Views
The sub totals for every row and column are actually called marginal sums. Therefore, we can use addmargins function to our table to get the sub totals for every row and column.For example, if we have table called TABLE then we can add the sub totals by using the command given below −TABLE