Sources of Electromotive Force (EMF)

Manish Kumar Saini
Updated on 29-May-2021 14:46:26

2K+ Views

Concept of Electromotive Force (EMF)The electromotive force (EMF) of a source, is a measure of the energy the source gives to each coulomb of charge. The EMF is measured in volts (V).At first sight, the name EMF implies that it is a force that causes the current to flow but this not correct, because it is not a force but energy supplied to the charge by some source of energy such as a battery. The EMF maintains potential difference while the potential difference causes current to flow.Difference between EMF and Potential DifferenceAs we know, the EMF of the battery is ... Read More

Explain Superposition Theorem

Manish Kumar Saini
Updated on 29-May-2021 14:45:40

19K+ Views

The superposition theorem is used in solving a network in which two or more sources are present and connected not in series or in parallel.Statement of Superposition TheoremIf two or more voltage or current sources are acting simultaneously in a linear network, the resultant current in any branch is the algebraic sum of the currents that would be produced in it, when each source acts alone and all other independent sources are replaced by their internal resistances.Explanation of Superposition TheoremIn the circuit given below, we have to find the branch currents viz. i1, i2, i3 by using superposition theorem.Step 1 ... Read More

Working Principle of Voltaic Cell (Galvanic Cell)

Manish Kumar Saini
Updated on 29-May-2021 14:35:50

5K+ Views

A Voltaic cell is an electrochemical cell that converts the chemical energy of spontaneous (natural) redox reactions into electrical energy. The Voltaic cell is also called as Galvanic cell.The voltaic cell is named after its inventor Alessandro Volta in 1799.In redox (oxidation-reduction) reactions, the electrons are moved between two different species and if these reactions occur spontaneously then energy is released as a result of these reactions. Therefore, the released energy is used to do work. To deal with this energy, it is necessary to split the reaction into two half reactions – Oxidation and Reduction. By using two different ... Read More

Find Longest Distance of 1s in Binary Form of a Number using Python

Arnab Chakraborty
Updated on 29-May-2021 14:33:17

327 Views

Suppose we have a number N, we have to find the longest distance between two consecutive 1's in its binary representation. If there are no two-consecutive 1's, then return 0.So, if the input is like 71, then the output will be 4, because 71 in binary is 1000111. Now there are four ones, and first 1 and the second 1 are at distance 4. All others are one distance away. So longest distance is 4 here.To solve this, we will follow these steps −K := make a list of bits of binary representation of NMax := 0, C := 0, ... Read More

Find Longest Nice Substring Using Python

Arnab Chakraborty
Updated on 29-May-2021 14:32:57

604 Views

Suppose we have a string s. We have to find longest nice substring of s. For a string s, it will be said to nice when, for every letter of the alphabet in s, it appears in uppercase and lowercase both. If there are multiple such substring, then return the substring of the earliest occurrence.So, if the input is like s = "ZbybBbz", then the output will be "bBb" as this contains lowercase and uppercase B's.To solve this, we will follow these steps −cur_max:= -1res:= blank stringfor i in range 0 to size of s, doc := s[i]upper := a ... Read More

Merge Strings Alternately Using Python

Arnab Chakraborty
Updated on 29-May-2021 14:32:28

6K+ Views

Suppose we have two strings s and t. We have to merge them by adding letters in alternating fashion, starting from s. If s and t are not of same length, add the extra letters onto the end of the merged string.So, if the input is like s = "major" t = "general", then the output will be "mgaejnoerral", as t is larger than s, so we have added extra part "ral" at the end.To solve this, we will follow these steps −i := j := 0result := blank stringwhile i < size of s and j < size of ... Read More

Count Items Matching a Rule Using Python

Arnab Chakraborty
Updated on 29-May-2021 14:32:09

489 Views

Suppose we have an array nums, where each nums[i] contains three elements [type_i, color_i, name_i]. These are describing the type, color, and name of the ith item. We also have a rule represented by two other strings, ruleKey and ruleValue. Now we can say the ith item is matched the rule if one of the following is true −ruleKey = "type" and ruleValue = type_i.ruleKey = "color" and ruleValue = color_i.ruleKey = "name" and ruleValue = name_i.We have to find number of matching we can find.So, if the input is likeBikeblueElecBCarsilverSumoBikeblueTVSAnd ruleKey = "color", ruleValue = "blue", then the output ... Read More

Find Nearest Point with Same X or Y Coordinate Using Python

Arnab Chakraborty
Updated on 29-May-2021 14:31:48

2K+ Views

Suppose we have a set of points given in an array called pts. We also have another point (x, y) which is our current location. We are defining a valid point as, a point which shares the same x-coordinate or the same y-coordinate as our current point. We have to return the index of the valid point with the smallest Manhattan distance from our current location (x, y). If there are more than one points, then return the valid point with the smallest index. (Note: the Manhattan distance between two points (a, b) and (p, q) is |a - p| ... Read More

Check if Binary String has At Most One Segment of Ones in Python

Arnab Chakraborty
Updated on 29-May-2021 14:31:34

502 Views

Suppose we have a binary string s (without leading zeros), We have to check whether s contains at most one contiguous segment of ones or not.So, if the input is like s = "11100", then the output will be True as there is one segment of ones "111".To solve this, we will follow these steps −count := -1if size of s is same as 1, thenreturn Truefor each i in s, doif i is same as "1" and count > -1, thenreturn Falseotherwise when i is same as "0", thencount := count + 1return TrueLet us see the following implementation ... Read More

Check if One String Swap Can Make Strings Equal in Python

Arnab Chakraborty
Updated on 29-May-2021 14:31:18

490 Views

Suppose we have two strings s and t of same length. Consider an operation where we choose two indices in a string (not necessarily different) and swap the characters at the selected indices. We have to check whether it is possible to make both strings same by performing at most one string swap on exactly one of the strings or not.So, if the input is like s = "hello" t = "hlelo", then the output will be True because we need to swap 'e' and 'l' at either s or t to make them equal.To solve this, we will follow ... Read More

Advertisements