Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 16 of 81

Print uncommon elements from two sorted arrays

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 2K+ Views

Given two sorted arrays, we need to find and print all uncommon elements (elements that appear in one array but not in both). This problem uses a two-pointer technique to efficiently traverse both arrays simultaneously. Given : array1[] = {1, 4, 6, 9, 12} array2[] = {2, 4, 7, 8, 9, 10} Output : 1 2 6 7 8 10 12 Syntax void printUncommonElements(int arr1[], int n1, int arr2[], int n2); Algorithm Initialize two pointers i and j to traverse both arrays ...

Read More

Print missing elements that lie in range 0 – 99

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 291 Views

In C programming, finding missing elements within a specific range is a common problem. Given an array of integers, we need to identify which numbers from 0 to 99 are missing and display them either as individual numbers or as ranges. Syntax bool flag[MAX] = { false }; for (i = 0; i < n; i++) { if (array[i] >= 0 && array[i] < 100) { flag[array[i]] = true; } } Algorithm Create a boolean array flag[100] ...

Read More

Print the given 3 string after modifying and concatenating

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 315 Views

This program demonstrates how to modify multiple strings by replacing all characters with user−specified replacement characters, then concatenate the modified strings together. Syntax strlen(string) // Get string length strcat(dest, source) // Concatenate strings scanf("%s", string) // Read string input Algorithm START Step 1 → Declare three character arrays str1, str2, str3 and replacement characters ch1, ch2, ch3 Step 2 → Input the three strings and three replacement characters Step 3 → Replace all characters in str1 with ...

Read More

Print number of words, vowels and frequency of each character

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 406 Views

In C programming, string analysis is a common task where we need to count words, vowels, and find the frequency of specific characters. This program demonstrates how to analyze a string by counting these different elements in a single pass. Syntax // String traversal for character analysis for(i = 0; str[i] != '\0'; i++) { // Character comparison and counting logic } Algorithm START Step 1: Declare string array, character variable, and counters (freq=0, vowels=0, words=0) Step 2: Input string and target character Step 3: Loop through each character ...

Read More

Print n numbers such that their sum is a perfect square

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 233 Views

Given n numbers, we need to find n numbers whose sum is a perfect square. The solution uses the first n odd numbers, as the sum of first n odd numbers is always n². Input : 5 Output : 1 3 5 7 9 1+3+5+7+9=25 i.e (5)² Syntax for(i = 1; i

Read More

Count odd and even digits in a number in PL/SQL

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Mar-2026 2K+ Views

We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL. PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL. PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java. Input int number = 23146579 Output count of odd digits in a number are : 5 count of even digits in a number are : ...

Read More

Find elements of an array which are divisible by N using STL in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 333 Views

Given with an array and the task is to find the number which are divisible by N using standard template library in C++.To solve this problem we are using the function count_if() present in C++ standard template library.What is a count_if() function?Syntaxcount_if(LowerBound, UpperBound, function)Description − This function returns the number of elements in an array that satisfies the given condition. It takes three parameters.Lower Bound − It points to the first element of an array or any other sequence.Upper Bound − It points to the last element of an array or any other sequence.Function − It returns the Boolean value ...

Read More

Count number of ways to reach destination in a Maze in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 642 Views

Given a Maze represented as a row X col matrix in which the obstacle is represented as -1 and a clear cell has value other than -1. The goal is to start from the first cell arr[0][0] and reach the last cell arr[row][col] such that only two moves are allowed:Right move arr[i][j] to arr[i][j+1] and Down move arr[i][j] to arr[i+1][j].Let us understand with examples.Input -  arr[row][col] =  {{0, 0, 0}, {-1, -1, 0}, {0, 0, 0}}Output - Count of number of ways to reach destination in a Maze are: 1Explanation      0    1   2   0    0   ...

Read More

Count numbers in range such that digits in it and it's product with q are unequal in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 242 Views

Given two numbers start and end as range variables and an integer q as input. The goal is to find the numbers within a range such that the number and its product with q have no common digits.If the number is 5 and q is 3 then the product will be 15. Both 5 and 15 have a common digit 5.If the number is 2 and q is 5 then the product will be 10. Both 2 and 10 have no common digit.Let us understand with examples.For ExampleInput -  start = 5, end = 10, q = 2Output - Count ...

Read More

Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 395 Views

Given two numbers start and end as range variables. The goal is to find the count of numbers that lie in this range [start, end] and have a difference of sum of digits at even and sum of digits at odd positions as Prime.That is (sum of digits at even position)-(sum of digits at odd position) = a Prime numberLet us understand with examples.For ExampleInput - start = 230, end = 270Output - Count of Numbers in Range with difference between Sum of digits at even and odd positions as Prime are: 6Explanation -  The number(s) between 230 to 270 ...

Read More
Showing 151–160 of 809 articles
« Prev 1 14 15 16 17 18 81 Next »
Advertisements