You are given an array arr of size n and an integer k. You need to find if there's a triplet in the array which sums up to the given integer k.
The function triple_sum© accepts the parameters array of integer arr having size n and an integer k.Complete the function triple_sum and return 1 if the triple sum exists else return 0.
For Example: if the array arr is [1,3,6,7,8,12,1] of size 7 and value of k is 18 then 3+7+8=18. the output will be 1.
A power jumper has the capability to increase his strength every time he takes a jump. When he takes consecutive jumps, he starts with a single unit distance jump and every next jump in the forward direction has t strength (i.e. distance) of his previous two jumps.
Every next jump in the backward direction has a strength (i.e. distance) of 1 unit.
If he turns his directions, he loses all his concentration and strength. He is standing at a lane having a wall at its start and end. If at an instant, he is at the start of the lane and starts jumping consecutively, how ma will it take for him to reach X units distance from the start?
Note: He can jump only backwards and forwards.
Dorothy has been caught up in a cyclone and has reached the Munchkin kingdom in the magical land of Oz. On her way, she comes across a yellow brick road, across wh wizard The brick road, however, requires a test of the mind to cross it. It has been set up by the wizard so that unworthy people may not enter his castle.
The yellow brick road can only be crossed in the following way:
- There are N bricks and each brick is labeled with a random number from 0 to 9.
- Durathy is on the 1* brick and needs to reach the Nth brick.
- if she is on the brick with value V, then she can move to the i+1th brick, i-1th brick or any brick with the same value V.
- Hetp Dorothy cross the golden brick road in the smallest number of moves.