ConceptWith respect of a given array A having N elements and two integers l and r where, 1≤ ax ≤ 105 and 1≤ l≤ r≤ N. We can select any element of the array (let’s say ax) and delete it, and also delete all elements equal to ax+1, ax+2 … ax+R and ax-1, ax-2 … ax-L from the array. This step will cost ax points. Our task is to maximize the total cost after deleting all the elements from the array.Input2 1 2 3 2 2 1 l = 1, r = 1Output8Here, we choose 2 to delete, then (2-1)=1 ... Read More
ConceptWith respect of given two numbers P and Q ( P and Q can be up to 10^6 ) which forms a number N = (P!/Q!). Our task is to reduce N to 1 by performing maximum number of operations possible. Remember, in each operation, one can replace N with N/X if N is divisible by X. Determine the maximum number of operations that can be possible.InputA = 7, B = 4Output4ExplanationN is 210 and the divisors are 2, 3, 5, 7InputA = 3, B = 1Output2ExplanationN is 6 and the divisor are 2, 3.MethodIt has been observed that factorization ... Read More
ConceptWith respect of a given integer X, our task is to determine the maximum value N so that the sum of first N natural numbers should not exceed X.InputX = 7Output22 is the maximum possible value of N because for N = 3, the sum of the series will exceed X i.e. 1^2 + 2^2 + 3^2 = 1 + 4 + 9 = 14InputX = 27Output33 is the maximum possible value of N because for N = 4, the sum of the series will exceed X i.e. 1^2 + 2^2 + 3^2 + 4^2 = 1 + 4 + ... Read More
ConceptWith respect of a given grid of numbers, determine maximum length Snake sequence and display it. It has been observed that if multiple snake sequences exist with the maximum length, display any one of them.Actually, a snake sequence is made up of adjacent numbers in the grid so that for each number, the number on the right or the number below it is either +1 or -1 its value. Here, for instance, if we are at location (a, b) in the grid, we can either move right i.e. (a, b+1) if that number is ± 1 or move down i.e. ... Read More
ConceptWith respect of the given number of cities N numbered from 0 to N-1 and the cities in which stations are located, our task is to determine the maximum distance between any city and its nearest station. It should be noted that the cities with stations can be given in any order.InputnumOfCities = 6, stations = [2, 4]Output2InputnumOfCities = 6, stations = [4]Output4The following figure indicates the first example containing 6 cities and the cities with stations highlighted with green color. So, in this case, the farthestcities from its nearest stations are 0 at a distance of 2. Hence maximum ... Read More
The major differences between EBIT and net income are as follows −EBIT (Earnings before Interest and Taxes)It evaluates profits earned through an entity.An operating income earned by an entity before adjustments (interests and taxes) is EBIT.The main purpose is to determine profit earning of an entity.EBIT can be defined as difference between revenue and operating expense (or) sum of net income, interest and taxes (or) difference between Earnings Before Interest Tax Depreciation and Amortisation (EBITA) and depreciation, amortisation expensesIt is used by governments, equity holders and debt holders.Interest and expenses incurred are not considered.Cost of operating business is ignored.Operating expenses ... Read More
The major differences between joint venture and partnership are as follows −Joint VentureIt is a trade formed by two or more individuals.The duration of time is fixed.The parties are called Co-Ventures.The profit/loss are distributed on interim basis.There are no specific governing laws.A specific name is not required.The accounts may/may not be separately maintained.It follows liquidation accounting.It includes profit-seeking ventures.A minor is not accepted as a Co-Venturer.PartnershipIt is an agreement made by two or more individuals having respective proportionate shares to start a business.The duration of time is not fixed.The parties are called partners.The profit is distributed annually.It is regulated by ... Read More
The major differences between bidding and auction are as follows −BiddingBuyer buys the commodity by offering a bid/price.It includes competitive offer for a product/service.It shows value/demand for a product/service.The main aim is to win the contract/bid that put for an auction.It creates competition to increase demand for a commodity.For organisations, bids are allotted for lower bid with proper quotations and paper works.AuctionIt is held to get better value for goods/service sold.It is the process of buying/selling.Bidders are allowed to place the bid and highest bidder will be allotted the goods/services.The main aim is to get best/highest price for a good/service.The ... Read More
The major differences between investment and speculations are as follows −InvestmentPurchasing an asset/security for good returns is termed as an investment.It is long term and has moderate risk.Investors will go for the cautions and conservative approach.The decision is made on financial performance of a company.The returns are modest and continuous.It is used for self.Examples &minnus; stock markets, bonds, mutual funds etc.SpeculationsA risky financial transaction for high profits is termed as speculation.It is short term (less than a year).An investor will go for an aggressive approach.The decision is made on technical charts, market psychology and individual decisions.It excepts return at high ... Read More
The major differences between interest rate and annual percentage rate are as follows −Interest rateIt is used to calculate monthly payments/EMIs of loans.It relates to cost of borrowing.The formula to calculate the interest rate is as follows − A = P(1+rt), where, A implies simple interest, P for principle amount, r for interest rate, t is time period.It impacts outstanding debt amount.The high interest rates are preferred.Annual percentage rateIt provides full information on principle amount which reflects cost of loan.It relates to total cost of loan.The formula to calculate annual percentage rate is as follows − Annual percentage rate = ... Read More