Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website ๐Ÿ˜Š
Still working on it ๐Ÿ˜Š
Download Telegram
Forwarded from Aman Raj
Reyaan has given you the following problem to solve:

You are given an integer KK in base BB, represented by an array AA of length NN such that

0 \leq A_i \lt B0โ‰คA
i
โ€‹
<B for every 1 \leq i \leq N1โ‰คiโ‰คN
\sum_{i=1}^N A_i \cdot B^{N-i} = Kโˆ‘
i=1
N
โ€‹
A
i
โ€‹
โ‹…B
Nโˆ’i
=K
Note that N \leq BNโ‰คB in this problem.

Find the smallest non-negative integer XX such that X+KX+K contains every digit from 00 to B-1Bโˆ’1 in its base-BB representation.

XX can be very large, so print the answer modulo 10^9 + 710
9
+7.

Note: Leading zeros are not counted as part of the number, so for example 12 = 01212=012 has only two distinct digits: 11 and 22. However, 102102 does have three distinct digits.

Input Format
The first line of input will contain a single integer TT, denoting the number of test cases.
Each test case consists of two lines of input.
The first line of each test case contains two space-separated integers NN and BB โ€” the size of the array AA and the base.
The second line of each test case contains NN space-separated integers A_1, A_2, \ldots, A_NA
1
โ€‹
,A
2
โ€‹
,โ€ฆ,A
N
โ€‹
.
Output Format
For each test case, output on a new line the value of XX, modulo 10^9 + 710
9
+7.

Constraints
1 \leq T \leq 10^41โ‰คTโ‰ค10
4

1 \leq N \leq 10^61โ‰คNโ‰ค10
6

2 \leq B \leq 10^62โ‰คBโ‰ค10
6

N \leq BNโ‰คB
0 \leq A_i \lt B0โ‰คA
i
โ€‹
<B
A_1 \gt 0A
1
โ€‹
>0, i.e, the given number doesn't contain leading zeros.
The sum of BB across all test cases won't exceed 10^610
6
.
Forwarded from Aman Raj
There is a tree with NN vertices, rooted at vertex 11. Vertex ii has the value A_iA
i
โ€‹
written on it.

Alice walks along this tree, starting at the root.
When she is at vertex uu:

If uu has no children, she stops.
Otherwise, suppose uu has cc children. She picks one of them at random (each one has a \frac{1}{c}
c
1
โ€‹
probability of being picked), and then moves to it.
Alice also has a score, defined as follows:

Let the vertices she visited be u_1, u_2, \ldots, u_ku
1
โ€‹
,u
2
โ€‹
,โ€ฆ,u
k
โ€‹

Then, she will forget exactly one of these kk vertices; and her score will be the bitwise xor of the remaining ones.
That is, if she chooses to forget vertex u_iu
i
โ€‹
, then her score is A_{u_1} \oplus A_{u_2} \oplus \ldots \oplus A_{u_{i-1}} \oplus A_{u_{i+1}} \oplus \ldots \oplus A_{u_{k}}A
u
1
โ€‹

โ€‹
โŠ•A
u
2
โ€‹

โ€‹
โŠ•โ€ฆโŠ•A
u
iโˆ’1
โ€‹

โ€‹
โŠ•A
u
i+1
โ€‹

โ€‹
โŠ•โ€ฆโŠ•A
u
k
โ€‹

โ€‹
. Here, \oplusโŠ• denotes the bitwise xor operation.
Alice wants to maximize her score, and will always choose to forget a vertex optimally to achieve this.

What is Alice's expected final score?

Find the expected value modulo 10^9 + 710
9
+7.
That is, the expected value can be written as \frac{P}{Q}
Q
P
โ€‹
for two integers P, QP,Q such that \gcd(Q, 10^9 + 7) = 1gcd(Q,10
9
+7)=1; print the value of P\cdot Q^{-1} \pmod{10^9 + 7}Pโ‹…Q
โˆ’1
(mod10
9
+7).

Input Format
The first line of input will contain a single integer TT, denoting the number of test cases.
Each test case consists of multiple lines of input.
The first line of each test case contains a single integer NN โ€” the number of vertices of the tree.
The second line of each test case contains NN space-separated integers A_1, A_2, \ldots, A_NA
1
โ€‹
,A
2
โ€‹
,โ€ฆ,A
N
โ€‹
.
The next N-1Nโˆ’1 lines describe the edges. The i^{th}i
th
of these lines contains two space-separated integers u_iu
i
โ€‹
and v_iv
i
โ€‹
, denoting an edge between u_iu
i
โ€‹
and v_iv
i
โ€‹
.
Output Format
For each test case, output on a new line Alice's expected final score.

Constraints
1 \leq T \leq 10^41โ‰คTโ‰ค10
4

1 \leq N \leq 5\cdot 10^51โ‰คNโ‰ค5โ‹…10
5

1 \leq A_i \leq 10^91โ‰คA
i
โ€‹
โ‰ค10
9

The sum of NN over all test cases won't exceed 5\cdot 10^55โ‹…10
5
solve it
copy ques in notepad then do else you may get issue in understanding question
How many of you wanna learn JavaScript validation this Sunday will do one masterclass
Anonymous Poll
100%
Yes
0%
No
Whoever wants just message me @stockkida with your email ID ๐Ÿ™‚ will add details to your calendar ๐Ÿ—“๏ธ
The way you guy's are voting looks like you guy's know everything n no need to consume more data
Java Hyd Team pinned ยซThe way you guy's are voting looks like you guy's know everything n no need to consume more dataยป
Java Hyd Team
WHICH SUBJECT YOU WANT TO LEARN WITH US WITH A IMPLEMENTED PROJECT
Will cover core Java along with javascript validations this Sunday ๐Ÿ˜Š
public class PalindromeNumber {
public static void main(String[] args) {
int x = -121;
if(isPalindrome(x)){
System.out.println(x + " is a Palindrome number");
}
else{
System.out.println(x + " is not a Palindrome number");
}
}

public static boolean isPalindrome(int x) {
if(x < 0 || (x % 10 == 0 && x != 0)) {
return false;
}

int revertedNumber = 0;
while(x > revertedNumber) {
revertedNumber = revertedNumber * 10 + x % 10;
x /= 10;
}

// When the length is an odd number, we can get rid of the middle digit by revertedNumber/10
// For example when the input is 12321, at the end of the while loop we get x = 12, revertedNumber = 123,
// since the middle digit doesn't matter in palidrome(it will always equal to itself), we can simply get rid of it.
return x == revertedNumber || x == revertedNumber/10;
}
}
Given a valid (IPv4) IP address, return a defanged version of that IP address.

A defanged IP address replaces every period "." with "[.]".



Example 1:

Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"
Example 2:

Input: address = "255.100.50.0"
Output: "255[.]100[.]50[.]0"


Constraints:

The given address is a valid IPv4 address.
There is a programming language with only four operations and one variable X:

++X and X++ increments the value of the variable X by 1.
--X and X-- decrements the value of the variable X by 1.
Initially, the value of X is 0.

Given an array of strings operations containing a list of operations, return the final value of X after performing all the operations.



Example 1:

Input: operations = ["--X","X++","X++"]
Output: 1
Explanation: The operations are performed as follows:
Initially, X = 0.
--X: X is decremented by 1, X = 0 - 1 = -1.
X++: X is incremented by 1, X = -1 + 1 = 0.
X++: X is incremented by 1, X = 0 + 1 = 1.
Example 2:

Input: operations = ["++X","++X","X++"]
Output: 3
Explanation: The operations are performed as follows:
Initially, X = 0.
++X: X is incremented by 1, X = 0 + 1 = 1.
++X: X is incremented by 1, X = 1 + 1 = 2.
X++: X is incremented by 1, X = 2 + 1 = 3.
Example 3:

Input: operations = ["X++","++X","--X","X--"]
Output: 0
Explanation: The operations are performed as follows:
Initially, X = 0.
X++: X is incremented by 1, X = 0 + 1 = 1.
++X: X is incremented by 1, X = 1 + 1 = 2.
--X: X is decremented by 1, X = 2 - 1 = 1.
X--: X is decremented by 1, X = 1 - 1 = 0.


Constraints:

1 <= operations.length <= 100
operations[i] will be either "++X", "X++", "--X", or "X--".
1480. Running Sum of 1d Array
Easy
5.7K
281
Companies
Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]โ€ฆnums[i]).

Return the running sum of nums.



Example 1:

Input: nums = [1,2,3,4]
Output: [1,3,6,10]
Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4].
Example 2:

Input: nums = [1,1,1,1,1]
Output: [1,2,3,4,5]
Explanation: Running sum is obtained as follows: [1, 1+1, 1+1+1, 1+1+1+1, 1+1+1+1+1].
Example 3:

Input: nums = [3,1,2,10,1]
Output: [3,4,6,16,17]


Constraints:

1 <= nums.length <= 1000
-10^6 <= nums[i] <= 10^6
Hi,Mam
As discussed I need candidate for application software Development
Android ios full stack developer ( Exp. 1-3yrs) (Male/Female)
Salry - 15k- 40k/month
Skills โ€“ Android ,ios,Java,Flutter,Laravel Node JS,React JS
Opening-1-2
Project Exp.- BBPS App,Cab Booking, Ecommerce Multivendor,Grocery App,Food Deliver
*Hiring For Below Mentioned Profiles.*

*Java Developer* Experience - 3 to 5 years ? Notice Period - Max 30 Days.

*React Js Developer* Experience- 0 to 2 years.

*Location* -Pune.

Please share profiles
Kalyani Deshmukh
hr@bluepearlhealthtech.com