Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
2,189 views
in Online Assessments by Expert (111,530 points) | 2,189 views

1 Answer

0 like 0 dislike
1.Given N boxes containing different number of Books in each box(numBook[i]),take a minimum number of books from the boxes conditions are such that:

you must take either all or none of the books inside a given box.
you cannot skip taking books from boxes adjacent to each other.Box1 and 2 can not be skipped but you can skip box 1 and 3.
you must have a minimum number of books in your hand
for example ,if there are 6 boxes and the number of books in box are {7,2,13,12,9,1} then the minimum number of books u can take is 15(by skipping box 1,3,5).

0>N>100

numBook[i]<10000

2.In the game of cricket, players can score runs by hitting the ball delivered at them(by another player called bowler) and running between designated spots(wickets).

suppose if a player is only allowed to score 1,2,4 and 6 runs in a ball.How many ways the player can score N runs without hitting consecutive 4s?



for ex, to score 4 runs, the player can hit the runs in subsequent balls in the following ways.

1,1,1,1

1,1,2

1,2,1

2,1,1

2,2

4

Output=6
by Expert (111,530 points)