Given an integer n and let a = 1, b = 2, c= 3, ….., z = 26. The task is to find the minimum number of letters needed to make a total of n.
Input: n = 48
48 can be written as z + v, where z = 26 and v = 22
Input: n = 23
Approach: There are 2 possible cases:
- If n is divisible by 26 then the answer will be n / 26.
- If n is not divisible by 26 then the answer will be (n / 26) + 1.
Below is the implementation of the above approach:
Time Complexity: O(1)
- Minimum number of Appends needed to make a string palindrome
- Minimum number of bracket reversals needed to make an expression balanced | Set - 2
- Minimum number of bracket reversals needed to make an expression balanced
- Minimum letters to be removed to make all occurrences of a given letter continuous
- Find minimum operations needed to make an Array beautiful
- Find minimum number of Log value needed to calculate Log upto N
- Minimum number of steps needed to remove the substring K from given string
- Find out the minimum number of coins required to pay total amount
- Find minimum number to be divided to make a number a perfect square
- Minimum number of swaps required to make a number divisible by 60
- Minimum divisor of a number to make the number perfect cube
- Find the minimum number to be added to N to make it a prime number
- Minimum number to be added to all digits of X to make X > Y
- Find minimum number of coins that make a given value
- Minimum number of changes required to make the given array an AP
- Make palindromic string non-palindromic by rearranging its letters
- Minimum number of deletions to make a string palindrome | Set 2
- Minimum number of elements to be removed to make XOR maximum
- Find the minimum number to be added to N to make it a power of K
- Minimum number of Parentheses to be added to make it valid
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : AnkitRai01