Minimum operations required to make all elements in an array of first N odd numbers equalGiven an array consisting of…

# Mathematical

### Print all distinct even and odd prefix Bitwise XORs of first N natural numbers

Print all distinct even and odd prefix Bitwise XORs of first N natural numbersGiven a positive integer N, the task…

### Minimum difference possible between two given numbers by rearranging their digits in the same order

#include using namespace std; int minDifference(int X, int Y){ int minDiff = INT_MAX; string x = to_string(X); string y = to_string(Y); int n = x.size(); int…

### Longest Non-Increasing Subsequence in a Binary String

Longest Non-Increasing Subsequence in a Binary StringGiven a binary string S of size N, the task is to find the…

### Maximum height of an elevation possible such that adjacent matrix cells have a difference of at most height 1

#include using namespace std; #define M 3#define N 3 void findHeightMatrixUtil(int mat[][N], int height[M][N]){ queue q; int vis[M][N] = { 0 }; for (int i =…

### Number of substrings having an equal number of lowercase and uppercase letters

Number of substrings having an equal number of lowercase and uppercase lettersGiven string S consisting of lowercase and uppercase letters,…

### Partition a Linked List into K continuous groups with difference in their sizes at most 1

#include using namespace std; struct ListNode { int val; struct ListNode* next;}; void push(ListNode** head_ref, int node_val){ ListNode* new_node = new ListNode(); new_node->val = node_val; new_node->next = (*head_ref); (*head_ref)…

### Modify a string by circularly shifting each character to the right by respective frequencies

Modify a string by circularly shifting each character to the right by respective frequenciesGiven a string S consisting of lowercase…

### Minimum time required to complete all tasks without altering their order

import java.util.*; class GFG { static void findMinimumTime( String tasks, int K) { Map map = new HashMap(); int curr_time = 0; for (char c : tasks.toCharArray()) { if…

### Median of all nodes from a given range in a Binary Search Tree ( BST )

#include using namespace std; struct Node { struct Node *left, *right; int key;}; Node* newNode(int key){ Node* temp = new Node; temp->key = key; temp->left = temp->right…