Android lab
Kaagaz_20220505_10242770264
Kaagaz_20220505_10242770264
CamScanner 05-09-2022 13.38.54DocScanner 10 May 2022 08-06
DIPLAB ki
Largest 3-Same-Digit Number in String solution leetcode You are given a string num representing a large integer. An integer is good if it meets the following conditions: It is a substring of num with length 3. It consists of only one unique digit. Return the maximum good integer as a string or an empty string “” if no such integer exists. Note: A substring is a contiguous sequence of characters within a string. … Read more
Count Nodes Equal to Average of Subtree solution leetcode Given the root of a binary tree, return the number of nodes where the value of the node is equal to the average of the values in its subtree. Note: The average of n elements is the sum of the n elements divided by n and rounded down to the nearest integer. A subtree of root is a tree consisting of root and all of its descendants. Count Nodes … Read more
Count Number of Texts solution leetcode Alice is texting Bob using her phone. The mapping of digits to letters is shown in the figure below. In order to add a letter, Alice has to press the key of the corresponding digit i times, where i is the position of the letter in the key. For example, to add the letter ‘s’, Alice has to press ‘7’ four times. … Read more
Check if There Is a Valid Parentheses String Path solution leetcode A parentheses string is a non-empty string consisting only of ‘(‘ and ‘)’. It is valid if any of the following conditions is true: It is (). It can be written as AB (A concatenated with B), where A and B are valid parentheses strings. It can be written as (A), where A is a valid parentheses string. You are given an m x n matrix of parentheses grid. … Read more
Kaagaz_20220505_10242770264
Increase 2 consecutive characters solution codechef Chef has 22 strings AA and BB of equal length NN. Both strings contain lowercase english alphabets only. Chef can perform several moves on string AA. In one move, Chef has to: Select an index i (1≤i≤N−1)i (1≤i≤N−1). Replace A[i]A[i] with (A[i]+1)(A[i]+1). Replace A[i+1]A[i+1] with (A[i+1]+1)(A[i+1]+1). For example, if A=abczeA=abcze, a valid move would be to select index 33. This way the string becomes abdaeabdae after performing the move. Note … Read more
Decomposition Reaction solution codechef A thermal decomposition reaction is breakdown of a compound into one or more compounds when heated. For example, P→a⋅Q+b⋅RP→a⋅Q+b⋅R is a decomposition reaction. Here, 11 unit of PP is converted into aa unit of QQ and bb unit of RR after completion of the reaction. You are given NN compounds numbered from 11 to NN. The initial amount of the ithith compound is QiQi. You are also given MM equations. Every equation is of the … Read more