Wednesday, 1 Dec 2021
Category: School Programming

Given three strings D, M, and Y representing a date. The task is to check whether concatenation of date and month results in the same digits as of the year. Examples:Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a […]

Given a positive integer N, the task is to check whether all the digits of the given integer N are the same or not. If found to be true, then print Yes. Otherwise, print No.Examples:Input: N = 222Output: YesInput: N = 232Output: NoNaive Approach: The simplest approach to solve the given problem is to iterate […]

Given a matrix mat[][] of size N×N where two elements of the matrix are ‘1’ denoting the coordinate of the rectangle and ‘0’ denotes the empty space, the task is to find the other two coordinates of the rectangle.Note: There can be multiple answers possible for this problem, print any one of them.Examples: Input: mat[][] = […]

Given a sorted array arr[] of size N, the task is to print all the unique elements in the array.An array element is said to be unique if the frequency of that element in the array is 1.Examples:Input: arr[ ] = {1, 1, 2, 2, 3, 4, 5, 5}Output: 3 4Explanation: Since 1, 2, 5 […]

Program to calculate Kinetic Energy and Potential EnergyGiven three integers M, H, and V representing the mass, velocity, and height of an object respectively the task is to calculate its Kinetic Energy as well as its Potential Energy,Note: The value of acceleration due to gravity (g) is 9.8 and ignore units.   Examples:Input: M = 25, […]

#include using namespace std;  void crossProduct(int vect_A[],                  int vect_B[],                  int cross_P[]){        cross_P        = vect_A * vect_B          – vect_A * vect_B;          cross_P        = vect_A * vect_B          – vect_A * vect_B;          cross_P        = vect_A * vect_B          – vect_A * vect_B;}  void checkCollinearity(int x1, int y1,                       int z1, int x2,                       int y2, int z2){        int A = { x1, y1, z1 };    int B = { x2, y2, z2 };          int cross_P;          crossProduct(A, B, cross_P);              if (cross_P == […]

Program to find the Magnitude of a VectorGiven three integers representing the X, Y, and Z coordinates of a 3-D vector, the task is to find the magnitude of that vector.Example:Input: X = 1, Y = 2, Z = 2Output: 3Explanation: Magnitude of the vector is equal to √9 =3Input: X = 0, Y = […]