Posts

Showing posts from 2024

Hacker Rank Price Check Solution

 import java.io.*; import java.util.*; import java.util.stream.*; class Result {     /*      * Complete the 'priceCheck' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. STRING_ARRAY products      *  2. FLOAT_ARRAY productPrices      *  3. STRING_ARRAY productSold      *  4. FLOAT_ARRAY soldPrice      */     public static int priceCheck(List<String> products, List<Float> productPrices, List<String> productSold, List<Float> soldPrice) {         // A map to store product names and their corresponding prices         Map<String, Float> priceMap = new HashMap<>();                  // Populate the map with pro...

What is Encryption and Decryption?

                                        What is Encryption and Decryption ? Encryption is conversion of data from plain text to ciphered text so that it becomes unreadable if fallen into wrong hands.  Decryption is conversion of the same encrypted data back to plain text.  There are 2 types of encryption:  Symmetric Encryption : When we make use of the same key for both encryption and decryption. This is mostly used when data needs to be transferred between closed systems. AES256 algorithm is a common example of this type of encryption.  Asymmetric Encryption : In asymmetric encryption the sender will use the public key of the receiver to encrypt the data, and the receiver should use their private key to decrypt the data, this private key file should never be shared. This type of encryption should be used while trying to secure a connection with a client and a server....