Articles on Trending Technologies

Technical articles with clear explanations and examples

C++ code to find max ornaments to make decoration good

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 347 Views

Suppose we have three numbers y, b and r. There are y yellow ornaments, b blue ornaments and r red ornaments for decoration. A decoration will be beautiful, if the number of blue ornaments used is greater by exactly 1 than the number of yellow ornaments, and the number of red ornaments used is greater by exactly 1 than the number of blue ornaments. We want to choose as many ornaments as possible and also want to make our decoration good. We have to find the maximum number of ornaments used for a beautiful decoration.So, if the input is like ...

Read More

C++ code to find rank of student from score table

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 1K+ Views

Suppose we have a 2d array of size n x 4. Consider there are n students and their ids are starting from 0 to n-1. Each of them has four scores on English, Geography, Maths and History. In the table, the students will be sorted by decreasing the sum of their scores. If two or more students have the same sum, these students will be sorted by increasing their ids. We have to find the id of student whose id is 0.So, if the input is like10098100100100100100100909990100100986099then the output will be 2StepsTo solve this, we will follow these steps −n ...

Read More

C++ code to find minimum moves with weapons to kill enemy

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 836 Views

Suppose we have an array A with n elements, and another number H. H is health of an enemy. We have n weapons and damaging power of ith weapon is A[i]. Different weapons can be used to kill the enemy. We cannot use same weapon twice in a row. We have to count minimum how many times we can use weapons to kill the enemy.So, if the input is like A = [2, 1, 7]; H = 11, then the output will be 3, because if we use weapon with damage power 7, then use 2 then again use 7 ...

Read More

C++ code to get updated string with same 'a' and 'b' count

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 256 Views

Suppose we have as string S with even length n. S contains only two types of characters 'a' and 'b'. We want to modify the string so that every its prefix of its length has an equal amount of letters 'a' and 'b'. To achieve that, we can perform the following operation arbitrary number of times: Select some position in his string and replace the letter on this position with the other letter. Return the updated string.So, if the input is like S = "aabbbb", then the output will be "baabab"StepsTo solve this, we will follow these steps −n := ...

Read More

C++ code to find card spread way to make all sum equal for each player

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 242 Views

Suppose we have an array A with n elements. Here n is even. A[i] is a number written on ith card. There are n/2 people who want to play a game. At the beginning, each player will take two cards. We have to find the way to distribute cards in such a way that sum of values written on the cards will be same for each player.So, if the input is like A = [1, 5, 7, 4, 4, 3], then the output will be [(0, 2), (5, 1), (3, 4)], because A[0] + A[2] = 8, A[5] + A[1] ...

Read More

C++ code to count number of operations to make two arrays same

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2022 328 Views

Suppose we have two arrays A and B with n number of elements. Consider an operation: Select two indices i and j, then decrease ith element by 1 and increase jth element by 1. Each element of the array must be non-negative after performing an operation. We want to make A and B same. We have to find the sequence of operations to make A and B same. If not possible, return -1.So, if the input is like A = [1, 2, 3, 4]; B = [3, 1, 2, 4], then the output will be [(1, 0), (2, 0)], because ...

Read More

What are the Properties of Data Encryption Standard?

Ginni
Ginni
Updated on 14-Mar-2022 1K+ Views

DES is a block cipher. The encryption procedure is create of two permutations (Pboxes) that it can be defined initial and final permutations, and 16 Feistel rounds. Each round need a different 48-bit round key created from the cipher key according to a pre-represented algorithm. The DES function uses a 48-bit key to the rightmost 32 bits (RI−1) to create a 32-bit output.There are two properties of DES which are as follows −Avalanche EffectAvalanche effect defines a small change in the plaintext (or key) should make an important change in the ciphertext. It can change in one bit of plaintext ...

Read More

What are the Variations of DES?

Ginni
Ginni
Updated on 14-Mar-2022 3K+ Views

There are two main variations of Data Encryption Standard are as follows −Double DES − Double DES is an encryption approach which need two instance of DES on same plain text. In both instances it uses multiple keys to encrypt the plain text. Both keys are needed at the time of decryption.The 64 bit plain text goes into first DES instance which than transformed into a 64 bit middle text utilizing the first key and thus it goes to second DES instance which provides 64 bit cipher text by utilizing second key.Double DES is easy as it does that normal ...

Read More

What are the elements of DES?

Ginni
Ginni
Updated on 14-Mar-2022 829 Views

There are various elements of DES which are as follows −Use of S-Boxes − The tables used for substitution i.e., the S-boxes, in DES are kept hidden by IBM. IBM supports that it took them over 17 person years to appear up with the internal design of the S-boxes.Key Length − Cryptographic system has two important elements including the cryptographic algorithm and the key. The inner operating of the DES algorithm are completely popular to the general public. Hence, the strength of the DES lies only in the other element including its key, which should be secret.Differential Cryptanalysis − Differential ...

Read More

What is Expansion Permutation in Information Security?

Ginni
Ginni
Updated on 14-Mar-2022 1K+ Views

This operation expands the right half of the information, R from 32 bits to 48 bits and this operation changes the order of the bits as well as repeating specific bits. It is called an expansion permutation.This operation has two objective including it creates the right half the similar size as the key for the XOR operation and it supports a longer result that can be compressed during the substitution operation. It can be enabling one bit influence two substitutions, the dependency of the output bits on the input bits spread quicker. This is known as avalanche effect.DES is designed ...

Read More
Showing 45151–45160 of 61,297 articles
Advertisements