Count Number of Cities We Can Visit from Each City in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:50:08

730 Views

Suppose we have a list of N coordinate points P in the form (xi, yi). The x and y values are permutation of first N natural numbers. For each k in range 1 to N. We are at city k. We can apply the operations arbitrarily many times. The operation: We move to another city that has a smaller x-coordinate and a smaller y-coordinate or larger x or larger y coordinate than the city we are currently in. We have to find the number of cities we can reach from city k.So, if the input is like P = [[1, ... Read More

Importance of Information Systems

Ginni
Updated on 03-Mar-2022 07:47:51

4K+ Views

An information system is the application of data production, flows, and use inside organizations. Information system creates huge use of data technology defines. But it is essential to appreciate that its capacity encompasses systems in their entirety, such as manual events, the interface among manual and automated elements of systems, design elements of IT means, and economic, legal, organizational, behavioural, and social elements of systems.Information systems overlap with both the computer science and business administration disciplines. The information system of an organization can be represented as a system that serves to support data within the organization when and where it ... Read More

Count Operations Needed to Reach N by Paying Coins in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:47:24

195 Views

Suppose we have five numbers, N, A, B, C, D. We start with a number 0 and end at N. We can change a number by certain number of coins with the following operations −Multiply the number by 2, paying A coinsMultiply the number by 3, paying B coinsMultiply the number by 5, paying C coinsIncrease or decrease the number by 1, paying D coins.We can perform these operations any number of times in any order. We have to find the minimum number of coins we need to reach NSo, if the input is like N = 11; A = ... Read More

Find Maximum Distance Between Two Rival Students After X Swaps in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:47:12

315 Views

Suppose we have four numbers n, x, a and b. There are n students in the row. There are two rivalling students among them. One of them is at position a and another one is at position b. Positions are numbered from 1 to n from left to right. We want to maximize the distance between these two students. We can perform the following operation x times: Select two adjacent students and then swap them. We have to find the maximum possible distance after x swaps.So, if the input is like n = 5; x = 1; a = 3; ... Read More

What is Information Security

Ginni
Updated on 03-Mar-2022 07:46:16

6K+ Views

Information security is a set of practices designed to carry private data secure from unauthorized access and alteration for the duration of storing or transmitting from one location to another.Information security is designed and carried out to protect the print, digital, and other private, sensitive, and private data from unauthorized persons. It can be used to secure data from being misused, acknowledgment, destruction, alteration, and disruption.Computer networks are connected in daily transactions and communication inside the government, private, or corporates that needs security. The most common and easy method of protecting network support is assigning it with a unique name ... Read More

Find Array After Removal of Left Occurrences of Duplicate Elements in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:40:37

161 Views

Suppose we have an array A with n elements. We want to remove duplicate elements. We want to leave only the rightmost entry for each element of the array. The relative order of the remaining unique elements should not be changed.So, if the input is like A = [1, 5, 5, 1, 6, 1], then the output will be [5, 6, 1]StepsTo solve this, we will follow these steps −Define two arrays b and vis of size: 1200 each x := 0 n := size of A for initialize i := n - 1, when i >= 0, update (decrease ... Read More

Find Maximum Possible Amount of Allowance in C++ Game

Arnab Chakraborty
Updated on 03-Mar-2022 07:40:24

247 Views

Suppose we have three numbers A, B and C. Consider a game: There are three "integer panels", each with a digit form 1 to 9 (both inclusive) printed on it, and one "operator panel" with a '+' sign printed on it. The player should make a formula of the form X+Y, by arranging the four panels from left to right. Then, the amount of the allowance will be equal to the resulting value of the formula.We have to find the maximum possible amount of the allowance.So, if the input is like A = 1; B = 5; C = 2, ... Read More

Calculate Years to Get X Rupees with 1% Interest in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:37:50

187 Views

Suppose we have a number X. We have 100 rupees in a bank. The bank returns annual interest rate of 1 % compounded annually. (Integers only). We have to check how many years we need to get X rupees?So, if the input is like X = 520, then the output will be 213.StepsTo solve this, we will follow these steps −sum := 0 balance := 100 while balance < n, do:    interest := balance / 100    sum := sum + 1    balance := balance + interest return sumExampleLet us see the following implementation to get better understanding ... Read More

Find Number of Distinct Values After Negating a Subarray in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:33:05

234 Views

Suppose we have an array A with n elements. We select any subset of given numbers and negate these numbers. We have to find maximum number of different values in the array we can get.So, if the input is like A = [1, 1, 2, 2], then the output will be 4, because we can negate first and last numbers to make the array [-1, 1, 2, -2] with four different values.StepsTo solve this, we will follow these steps −Define one set se n := size of A for initialize i := 0, when i < n, update (increase i ... Read More

Count Expected Number of Operations for Node Removal in C++

Arnab Chakraborty
Updated on 03-Mar-2022 07:28:50

204 Views

Suppose we have the adjacency matrix of a directed graph G. Until the graph becomes empty, we are repeating the following operation: Select one vertex from G, then erase that vertex and all vertices that are reachable from that vertex by following some edges. Erasing a vertex will also erase the edges incident to it. We have to find the expected number of times the operation is doneSo, if the input is likethen the output will be 1.6667, because initially select vertex A, remove all vertices, if we select vertex B, remove B and C, and in second operation select ... Read More

Advertisements