Date: 22/09/2025
TECHNICAL TRAINING
DAY - 4
1. Armstrong numbers between two intervals
2. Check if two strings match where one string contains wildcard characters
3. Convert an array into a zig-zag fashion
4. Program to replace every element with the next greatest element (from the right side) in a
given array of integers.
5. Program recursive method to calculate the product of all numbers in an array.
6. Program to find the second most frequent character in a given string
7. Given an array and an integer K, rotate the array to the left (anti-clockwise) by K positions.
8. Program to check whether a given number is a Disarium number.
9. Program to delete an element from a given index in an array.
10. Print Inverted Number Pyramid Pattern
11. Print Hollow Diamond Star Pattern
12. Given an array, sort alternate elements in ascending and descending order
13. You have a tank of capacity X liters. Water is poured in random quantities ≤Y liters at a
time. Stop once the tank exceeds 75% capacity and print how many pours it took.
14. Write a program to check whether a number is a Harshad
15. Given a sorted array and a number X, insert X into its correct position.
16. Given an integer N, find the sum of digits at even positions and at odd positions
separately.
17. There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every
second bulb.
On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on).
For the ith round, you toggle every i bulb. For the nth round, you only toggle the last bulb.
Return the number of bulbs that are on after n rounds.
18 . Given a string which only contains lowercase. You need delete the repeated letters only
leave
one, and try to make the lexicographical order of new string is smallest. i.e: bcabc
You need delete 1 'b' and 1 'c', so you delete the first 'b' and first 'c', the new string will be abc
which is smallest. If you try to use greedy algorithm to solve this problem, you must sure that
you could pass this case:
bacdcbc. answer is acdb not adcb
19. Convert a non-negative integer num to its English words representation.
Example 1:
Input: num = 123
Output: "One Hundred Twenty Three"
Example 2:
Input: num = 12345
Output: "Twelve Thousand Three Hundred Forty Five"
20. There are a total number of Monkeys sitting on the branches of a huge Tree. As travelers
offer Bananas and Peanuts, the Monkeys jump down the Tree. If every Monkey can eat k
Bananas and j Peanuts. If Total m number of Bananas and p number of Peanuts offered by
Travelers, calculate how many Monkeys remain on the Tree after some of them jumped down
to eat.
At a time, one Monkey gets down and finishes eating and goes to the other side
of the road. The Monkey who climbed down does not climb up again after eating until
the other Monkeys finish eating. Monkeys can either eat k Bananas or j Peanuts. If for
the last Monkey there are less than k Bananas left on the ground or less than j Peanuts
left on the ground, only that Monkey can eat Bananas (<k) along with the Peanuts (<j).
Write the code to take inputs as n, m, p, k, j and return the number of Monkeys
left on the Tree.
Where, n = Total number of Monkeys
k = Number of eatable Bananas by a single Monkey (Monkey that
jumped down last may get less than k Bananas)
j = Number of eatable Peanuts by a single Monkey (Monkey that jumped
down last may get less than Bananas)
m = Total number of Bananas p = Total number of Peanuts
Remember that the Monkeys always eat Bananas and Peanuts, so there is no
possibility of k and j having a value zero.
Example 1:
Input Values
20
2
3
12
12
Output Values
Number of Monkeys left on the Tree: 10
Note: Kindly follow the order of inputs as n, k, j, m, p as given in above
example. And output must include the same format as in above example(Number of
Monkeys left on the Tree:<Integer>)
For any wrong input display INVALID INPUT