In this problem, we are given an input string of lowercase characters. Our task is to maximum occurring character in an input string.In case of multiple values with the same frequency of occurrence, we need to print lexicographically smaller values.Let’s take an example to understand the problem, Inputstring = “programming”OutputgSolution ApproachTo find the solution to the problem, we need to sort the read string and then traverse the string so that we could find the character which has maximum occurrence in the string. We would use hashing method (hash table method) to conquer this problem. Traversing and hashing the each ... Read More
In this problem, we are given a binary array bin[] consisting of only 0’s and 1’s. Our task is to find the number of zeroes.The array is sorted i.e. all 0’s are arranged together after 1’s.Let’s take an example to understand the problem, Inputarr[] = {1, 1, 1, 0, 0, 0, 0}Output4Solution ApproachA simple solution to the problem is using the fact that the array is sorted, that is the number of 0’s in the array can be found using the first occurrence of 0 in the array. As after the first occurrence all values will be zero.For finding the ... Read More
In this problem, we are given three integer values A, B, C. Our task is to find the number of solutions to the given equation.EquationX = B*Sm(X)^A + Cwhere Sm(X) is the sum of digits of X.We need to count all the values of X such that it satisfies the above equation where X can be any number between 1 to 109.Let’s take an example to understand the problem, InputA = 3, B = 6, C = 4Output3Solution ApproachA solution to solve the problem is by counting the number of values of X. For this, the sum of digits plays ... Read More
Sources of EnergyThe electrical energy is obtained from energy available in the various forms in the nature. The main sources of energy used to generate electrical energy are −The SunThe Sun is the main source of energy. The heat energy radiated by the Sun is to be focused over a small area with the help of reflectors. Then, this heat energy can be used to produce steam and the steam energy can be used to drive the turbine, which in turn drives an alternator to generate electrical energy.This method of generating electrical energy has limited applications because −It requires a ... Read More
In this problem, we are given a number N denoting the number of bricks provided to create the stair. Our task is to find the number of stair steps.Using the given bricks, we need to create a stair step. Each step takes one more brick that the last step. And the first step is two bricks high. We need to find the number of such steps that can be made from bricks.Let’s take an example to understand the problem, InputN = 40Output3ExplanationStep = 1 ; bricks required = 2; total bricks used = 2 ; bricks remaining = 38Step = ... Read More
The universally adopted electric power system is three-phase AC operating at a constant frequency such as 50 Hz in India and 60 Hz in USA, etc. The power system delivers power to the consumers through its transmission and distribution systems.It is important that the electric power supply should be satisfactory. Let us take a look at the primary requirements to have satisfactory electric supply.Good Voltage RegulationThe power system must have a good voltage regulation because the voltage variations disturb the operation of both power equipment and lights. For example, an electric motor is designed to have its best operating characteristics ... Read More
A thermal or steam power plant is a generating station which converts heat energy of coal combustion into electrical energy. A modern thermal power plant consists of a number of necessary and auxiliary equipment. In this article, we will take a look at the most important equipment of a thermal power plant.BoilerA boiler is a device in which water is converted into steam by utilising the heat energy of coal combustion. There are two types of steam boilers viz −Water Tube Boiler - In a water tube boiler, water flows through the tubes and the hot gases of combustion of ... Read More
Electric power can be transmitted either by AC transmission system (i.e. the voltage and current are alternating) or DC transmission system (i.e. the voltage and current are direct or unidirectional). Each transmission system has its own advantages and disadvantages. Therefore, we need to discuss the technical advantages and disadvantages of the AC and DC transmission systems so that we can select the right system for the electric power transmission.AC Transmission SystemThe AC transmission system is the one in which the alternating current is employed for the transmission of electric power. Nowadays, electric power is almost generated, transmitted and distributed in ... Read More
In this problem, we are given a 2D binary matrix. Our task is to find the number of islands Using DFS.Island is a ground of 1 or more connected 1’s in the matrix.Let’s take an example to understand the problem, Inputbin[][] = {{ 1 0 0 0} {0 1 0 1} {0 0 0 0} {0 0 1 0}}Output3 ExplanationIslands are : bin00 - bin11 bin13 bin32Solution ApproachTo find the island from a binary matrix using a disjoint set data structure. To find island count, we will traverse the matrix and do union of ... Read More
A gas turbine power plant is the type of power generating station in which gas turbine is used as the prime mover for the generation of electrical energy.The schematic diagram of a gas turbine power plant is shown in the figure.The main components of a typical gas turbine power plant are as follows −CompressorRegeneratorCombustion ChamberGas TurbineAlternatorStarting MotorCompressorThe compressor is an apparatus used to increase the pressure of air taken from the atmosphere. In gas turbine power plants, rotatory type compressors are generally used.The air at atmospheric pressure is drawn by the compressor through an air filter which removes the dust ... Read More