## Sum of Total Strength of Wizards solution leetcode

Sum of Total Strength of Wizards solution leetcode As the ruler of a kingdom, you have an army of wizards at your command. You are given a 0-indexed integer array strength, where strength[i] denotes the strength of the ith wizard. For a contiguous group of wizards (i.e. the wizards’ strengths form a subarray of strength), the total strength is defined as the product of the following two values: The strength of … Read more

## Minimum Lines to Represent a Line Chart solution leetcode

Minimum Lines to Represent a Line Chart solution leetcode You are given a 2D integer array stockPrices where stockPrices[i] = [dayi, pricei] indicates the price of the stock on day dayi is pricei. A line chart is created from the array by plotting the points on an XY plane with the X-axis representing the day and the Y-axis representing the price and connecting adjacent … Read more

## Maximum Bags With Full Capacity of Rocks solution leetcode

Maximum Bags With Full Capacity of Rocks solution leetcode You have n bags numbered from 0 to n – 1. You are given two 0-indexed integer arrays capacity and rocks. The ith bag can hold a maximum of capacity[i] rocks and currently contains rocks[i] rocks. You are also given an integer additionalRocks, the number of additional rocks you can place in any of the bags. Return the maximum number of bags that could have full capacity after … Read more

## Percentage of Letter in String solution leetcode

Percentage of Letter in String solution leetcode Given a string s and a character letter, return the percentage of characters in s that equal letter rounded down to the nearest whole percent.   Example 1: Percentage of Letter in String solution leetcode   Input: s = “foobar”, letter = “o” Output: 33 Explanation: The percentage of characters in s that equal the letter ‘o’ is 2 … Read more

## Make them Zero solution codechef

Make them Zero solution codechef You are given an array AA of length NN. You can perform the following operation on the array any number of times: Choose any subsequence SS of the array AA and a positive integer XX such that XX is a power of 22 and subtract XX from all the elements of the subsequence SS. Find the minimum number of operations required to make all the elements of the array equal to 00. … Read more

## Score High solution codechef

Score High solution codechef Chef is taking a tough examination. The question paper consists of NN objective problems and each problem has 44 options A,B,C,A,B,C, and DD, out of which, exactly one option is correct. Since Chef did not study for the exam, he does not know the answer to any of the problems. Chef was looking nearby for help when his friend somehow … Read more

## Practice makes us perfect solution codechef

Practice makes us perfect solution codechef Most programmers will tell you that one of the ways to improve your performance in competitive programming is to practice a lot of problems. Our Chef took the above advice very seriously and decided to set a target for himself. Chef decides to solve at least 1010 problems every week for 44 weeks. Given the … Read more

## Degree of Polynomial solution codechef

Degree of Polynomial solution codechef In mathematics, the degree of polynomials in one variable is the highest power of the variable in the algebraic expression with non-zero coefficient. Chef has a polynomial in one variable xx with NN terms. The polynomial looks like A0⋅x0+A1⋅x1+…+AN−2⋅xN−2+AN−1⋅xN−1A0⋅x0+A1⋅x1+…+AN−2⋅xN−2+AN−1⋅xN−1 where Ai−1Ai−1 denotes the coefficient of the ithith term xi−1xi−1 for all (1≤i≤N)(1≤i≤N). Find the degree of the polynomial. Note: It is guaranteed that there exists at least one … Read more

## Subsequence-Numbers Divisible by 7 solution codechef

Subsequence-Numbers Divisible by 7 solution codechef Kulyash has given you an array AA of size NN. He defines the subsequence-number of a non-empty subsequence SS of array AA as the number formed by the concatenation of all the elements of the subsequence SS. Find the count of non-empty subsequences of AA having their subsequence-numbers divisible by 77. Since the answer can be huge, output it modulo 109+7109+7. Through this contest, selected students get access to a … Read more

## Xor Palindrome solution codechef

Xor Palindrome solution codechef You are given a binary string AA of length NN. You can perform the following type of operation on the string AA: Choose two different indices ii and jj (1≤i,j≤N)(1≤i,j≤N); Change AiAi and AjAj to Ai⊕AjAi⊕Aj. Here ⊕⊕ represents the bitwise XOR operation. Find the minimum number of operations required to convert the given string into a palindrome. Xor Palindrome solution codechef Input Format First line of the input contains TT, the number of … Read more