In this problem, we are given an integer n and a matrix of size n X n which contains the weight of the cell. Our task is to create a program that will find the maximum weight path ending at any element of the last row in a matrix. While finding the path the traversal will start from top-left (0, 0) and the valid moves will be down and diagonal, no left move is allowed.Let’s take an example to understand the problem, Input −n = 3 Mat[3][3] ={ {4, 3, 1} {5, 8, 9} {6, 7, 2}}Output ... Read More
EPC or Electronic Product Code is a universal identifier that are encoded on RFID (Radio Frequency Identification) tags to check identities of objects like inventory, assets and people, and track them. The second generation of this technology, as laid down by EPCglobal Tag Data Standard, is called EPC Gen 2.The architecture of EPC Gen 2, RFID network has two main components −Tags or labels − They are affixed on objects so that they can be identified or tracked.Readers or interrogators − They are the intelligent part of the system that tracks the tags.The architecture is shown as below −RFID tags ... Read More
In this problem, we are given two positive integers n and k. Our task is to find maximum xor between 1 to n using maximum X numbersLet’s take an example to understand the problem, Input − n = 5, k = 2Output − 7Explanation −elements till 5 is 1, 2, 3, 4, 5 Selecting all XOR pairs: 1^2 = 3, 1^3 = 2, 1^4 = 5, 1^5 = 4 2^3 = 4, 2^4 = 6, 2^5 = 7 3^4 = 7, 3^5 = 6 4^5 = 1 The maximum here is 7.To solve this problem, the maximum XOR can be ... Read More
Electronic Product Code (EPC) is a universal identifier that aims to render a unique identity to every possible physical object of the world. EPCs are mostly encoded on RFID (Radio Frequency Identification) tags that are used to check identities of objects like inventory, assets and people, and track them.EPC is the 96–bit number associated with an RFID tag for identifying a particular tag amongst other tags. It distinguishes two identical products, and also provide the product’s manufacture date, origin or batch number.The EPC structure is laid down by EPCglobal Tag Data Standard, an open standard freely defined by EPCglobal Inc.EPC ... Read More
In this problem, we are given a matrix of size n X n. Our task is to create a program that will calculate the maximum XOR value of a complete row or a complete column.Let’s take an example to understand the problem, Input −N = 3 mat[N][N] = {{4, 9, 1} {2, 8, 3} {10, 12, 11}}Output −13Explanation −Row1: 4^9^1 = 12 Row2: 2^8^3 = 9 Row3: 10^12^11 = 13 Col1: 4^2^10 = 12 Col2: 9^8^12 = 13 Col3: 1^3^11 = 9Here, we have calculated the XOR of all rows and columns and then the maximum of them is printed.To ... Read More
In this problem, we are given a 2D array of size n*n. Our task is to create a program that will print the mean and median of the matrix in C++.Mean is the average of the date set. In a matrix mean is the average of all elements of the matrix.Mean = (sum of all elements of the matrix)/(number of elements of the matrix)Median is the middlemost element of the sorted data set. For this, we will have to sort the elements of the matrix.Median is calculated as, If n is odd, median = matrix[n/2][n/2]If n is even, median = ... Read More
In this problem, we are given an array of n integers and some m querries. Our task is to create a program that calculates the integral value(round down) of the mean of the ranges given by the querries.Let’s take an example to understand the problem, Input −array = {5, 7, 8, 9, 10} m = 2; [0, 3], [2, 4]Output −7 9To solve this problem, we have two methods one is direct and the other is using prefix sum.In the direct approach, for each query, we will loop from the start index to the end index of the range. And ... Read More
In this problem, we are given two vessels with capacities x and y and a supply of infinite water. Our task is to create a program that will be able to calculate exactly 1 liter in one vessel. Given the condition that x and y are co-primes. Co-primes also is known as relatively prime, mutually prime are numbers two numbers that have 1 as their only common divisor. So, this implies that their gcd(greatest common divisor) is 1.Here, let’s suppose we have two vessels V1 with capacity x and V2 with capacity y. To measure 1 liter using these two ... Read More
In this problem, we are given an array of n integers and we are adding K elements to the array and then find the median of the resultant array. Given the condition, N+k is odd.Let’s take an example to understand the problem, Input −array = {23, 65, 76, 67} ; k =1Output −67To solve this problem, we will sort the given elements in ascending order and then add k elements at the end of the array i.e. we will take k greater elements.The condition is given that n+k is odd. So, the median can be calculated using the formula, (n+k)/2.ExampleProgram ... Read More
In this problem, we are given a data stream that is continuously reading integers. Our task is to create a program that will read elements and calculate the medians for these elements.The Median of an array is the middle element from a sorted sequence(it can be ascending or descending).Calculating medianFor odd count, the median is the middle elementFor even count, the median is average of two middle elementLet’s take an example to understand the problem, Input − 3, 65, 12, 20, 1At each input, Input - 3 : sequence -(3) : median - 3 Input - 65 : sequence -(3, ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP