Q1) an array is given, find avg . If avg is present in arr, which is a whole number return true, else false!(vv easy qs but still idk why 4 hidden test cases were wrong can someone tell why)?
Q2) i dont remember clearly but there are n elements given in an array you have to calculate min no. of T (chances ) to make this arr non-decreasing.
ci = ci+2power(x-1) x is ur chance.
for eg - [1,7,6,5] for the 1st chance we take 6,5 and arr becomes 1,7,7,6 then for 2nd chance we take only 6 element arr becomes [1,7,7,8] this is a inc array return 2.as we needed two chances for making it a non dec array.
Q3)There are n nodes given, an array for credits arr, m - no. of birectional roads each having x,y,z where x and y road has a length of z. source,destination.
each road can be taken if the curr credit >= length and credits for start = startnode .
find the min dist req to reach from source to destination
i hope this example helps:
input :
n = 5
credits = 2 10 5 100 3
m = 8
0 1 5
0 3 5
0 2 1
1 3 10
1 4 15
2 3 7
2 4 90
3 4 80
source = 0
destination = 4.
output : 19