Minimum Number from Plus and Operations on Array Elements

Shubham Vora
Updated on 18-Jul-2023 17:16:15

135 Views

Problem Statement We have given an array of length ‘N’ containing some positive integers. Also, we have given the string of length ‘N-1’ containing only ‘*’ and ‘+’ characters, where ‘*’ is a multiplication operator, and ‘+’ is an addition operator. We require to perform the arithmetic operation with array elements in such a way that we can get a minimum positive integer value. Sample Examples Input array = [1, 2, 3], str = “*+” Output 5 Explanation It is the resultant value of ((1*2) + 3). Input array = [3, 3, 3, 3], str = ‘*++’ ... Read More

Make a String Non-Palindromic by Inserting a Given Character

Shubham Vora
Updated on 18-Jul-2023 17:13:31

169 Views

Problem Statement We have given a string str and character c in the input. We need to insert the given character c in the string at the index so that we can convert the string to non-palindromic. If we can’t convert the string to non-palindrome, print ‘-1’. Sample Examples Input str = ‘nayan’, c = ‘n’ Output ‘nnayan’ Explanation There can be multiple output strings as we can insert ‘n’ at any index in the given string. So, the output string can be ‘nnayan’, ‘nanyan’, ‘naynan’, ‘nayann’, etc. Input str = ‘sss’, c = ‘s’ Output ‘-1’ ... Read More

Difference Between HDLC and PPP

Pranavnath
Updated on 18-Jul-2023 17:12:42

4K+ Views

When it comes to information connect conventions, HDLC (High-Level Information Connect Control) and PPP (Point-to-Point Convention) are two broadly recognized guidelines. Whereas both conventions encourage the exchange of information between arranged gadgets, they contrast in a few crucial angles. This article points to shed light on the difference between HDLC and PPP, investigating their definitions, standardization, surrounding strategies, tending to components, mistake-taking care of capabilities, transaction highlights, verification back, association sorts, overhead contemplations, and applications. What is HDLC? High-level Data Link Control (HDLC) could be a synchronous bit-oriented information interface layer convention utilized for transmitting data over point-to-point and multipoint ... Read More

Lexicographically Largest String with Sum of Characters Equal to N

Shubham Vora
Updated on 18-Jul-2023 17:10:57

548 Views

Problem Statement We have given a positive integer num. We need to find the lexicographically largest string of lowercase alphabetical characters such that the sum of all characters of the string is equal to num. Here, ‘a’ = 1, ‘b’ = 2, ‘c’ = 3, ‘d’ = 4, …., ‘z’ = 26. We need to use the ‘z’ characters at the string's start to create the largest lexicographical string. At last, we need to use the last character according to the num % 26 value. Sample Examples Input num = 30 Output ‘zd’ Explanation The ‘zd’ is the ... Read More

Difference Between Diffie-Hellman and RSA

Pranavnath
Updated on 18-Jul-2023 17:10:40

2K+ Views

Within the domain of present-day cryptography, two noticeable calculations have played significant parts in securing delicate information Diffie-Hellman and RSA. Whereas both strategies are broadly utilized for key trade and encryption, they employ effective approaches to attain their cryptographic objectives. Diffie-Hellman, created by Whitfield Diffie and Martin Hellman in 1976, focuses on securing key trade conventions, empowering parties to set up a shared mystery over an uncertain channel. On the other hand, RSA, named after its makers Ron Rivest, Adi Shamir, and Leonard Adleman, utilizes public-key encryption to defend information secrecy, verification, and computerized marks. This article dives into the ... Read More

Save File with User-defined Name in Python

Rohan Singh
Updated on 18-Jul-2023 17:10:03

3K+ Views

In Python, saving files with user−defined file names is a common requirement in various applications and projects. By allowing users to specify the file name, we can provide them with a more personalized and customizable experience. This article will explain the process of saving files with file names provided by the user, using Python. Algorithm A general algorithm for saving file with file name from user is as follows: Prompt the user to enter the desired file name. ... Read More

Distinct Numbers from All Permutations of a Binary String

Shubham Vora
Updated on 18-Jul-2023 17:09:11

451 Views

Problem Statement We have given binary string str of length N. We need to find all permutations of the string, convert them to the decimal value, and return all unique decimal values. Sample Examples Input str = ‘1’ Output [1] Explanation All permutations of the ‘1’ is only ‘1’. So, the decimal value related to ‘1’ equals 1. Input str = ‘10’ Output [1, 2] Explanation The permutations of ‘10’ are only ‘01’ and ‘10’, equivalent to 1 and 2, respectively. Input ‘101’ Output [3, 5, 6] Explanation All possible permutations of ‘101’ are ... Read More

Difference Between Manchester and Differential Manchester

Pranavnath
Updated on 18-Jul-2023 17:08:21

7K+ Views

Digital encryption technology plays a crucial role in data transmission over communication channels. Manchester encoding and differential Manchester encoding are two good methods for efficiently transmitting digital data. The purpose of this article is to comprehensively compare these two coding schemes and highlight their unique characteristics, advantages, and differences. Manchester encoding, known for its simplicity and widespread use, uses transitions at the beginning or end of each bit period to represent bit values. In contrast, differential Manchester coding, also known as biphase mark code, uses transitions to transmit values. This important difference gives rise to some conflicting properties that affect ... Read More

Count Intervals That Intersect with a Given Meeting Time

Shubham Vora
Updated on 18-Jul-2023 17:07:14

123 Views

Problem Statement We have given a two-dimensional array containing the pairs of starting and ending times for time intervals in the 12-hour format. Also, we have given string str in the 12-hour time format. We need to find a total number of intervals which included the time represented by str. Sample Examples Input arr[][2] = {{“12:02:AM”, “10:55:PM”}, {“12:51:AM”, “11:40:AM”}, {“01:30:AM”, “12:00:PM”}, {“11:57:PM”, “11:59:PM”}}, str = “2:30:AM” Output 3 Explanation The time “2:30:AM” intersects the first three intervals. Input arr[][2] = {{“01:02:PM”, “10:55:PM”}, {“01:30:AM”, “11:00:AM”}}, str = “11:30:PM” Output 0 Explanation The ... Read More

Sequence Step Algorithm in Operating System

Pranavnath
Updated on 18-Jul-2023 17:07:08

304 Views

Scheduling algorithms are designed for serving the processes by providing the maximum utilization of the resources. The resources that are allocated to execute the given input, should not remain idle and repetitive projects has to be handled by the resources simultaneously without any break. Considering all these factors, a few simulation approaches have been developed to improve the repetitive activities by analyzing the nature of the process but none of the approaches delivered maximum resource utilization. Later, the sequence step algorithm has been initiated to minimize the processing and execution time of the process by determining the probability of process ... Read More

Advertisements