Saturday, 4 Dec 2021
Category: Technical Scripter 2020

The tree is a hierarchical Data Structure. A binary tree is a tree that has at most two children. The node which is on the left of the Binary Tree is called “Left-Child” and the node which is the right is called “Right-Child”. Also, the smaller tree or the subtree in the left of the […]

#include using namespace std;    void assignValues(int Edges[], int n) {          vector tree[n + 1];             for (int i = 0; i < n - 1; i++) {            int u = Edges[i];         int v = Edges[i];         tree[u].push_back(v);         tree[v].push_back(u);     }                  vector visited(n + 1, false);             vector answer(n […]

import java.io.*; class GFG {                    static boolean isMatch(String text,                            String pattern)     {                  if (text == null || pattern == null) {             return false;         }                  int N = text.length();                  int M = pattern.length();                           boolean[][] dp = new boolean[N + 1][M + 1];                  dp = true;                   […]

In programming, the modulo operation gives the remainder or signed remainder of a division, after one integer is divided by another integer. It is one of the most used operators in programming. This article discusses when and why the modulo operation yields a negative result. Examples: In C, 3 % 2 returns 1. However, -3 […]

#include using namespace std;    #define ROW 4 #define COL 4    struct Point {     int x, y; };    struct Node {     Point pt;     int dist; };    bool isValid(int row, int col) {     return (row >= 0) && (col >= 0)            && (row < ROW) && (col < COL); }    int dRow[] […]

Maximize time by replacing ‘_’ in a given 24 Hour format time Given a string S representing a time in 24 hours format, with ‘_’ placed at positions of some digits, the task is to find the maximum time possible by replacing the characters ‘_’ with any digit. Examples: Input: S = “0_:4_”Output: 09:39Explanation: Replacing the […]

import java.io.*; import java.util.*;    class Edge {             int src;             int nbr;             int wt;             Edge(int src, int nbr, int wt)     {         this.src = src;         this.nbr = nbr;         this.wt = wt;     } }    class Pair implements Comparable {             int wsf;             String psf; […]

Minimum removals required such that given string consists only of a pair of alternating characters Given a string S, the task is to find the minimum removal of characters required such that the string S consists only of two alternating characters. Examples: Input: S = “adebbeeaebd”Output: 7Explanation: Removing all occurrences of ‘b’ and ‘e’ modifies […]

“In some ways, programming is like a painting. You start with a blank canvas and certain basic raw materials. You use a combination of science, art, and craft to determine what to do with them.” — Andrew Hunt Yes, programming in itself is a very beautiful art. Sometimes we may face some problems while trying […]

Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String Given a binary string S of size N, the task is to maximize sum of count of consecutive 0s present at the start and end of any of the rotations of the given string S. Examples: Input: […]