Question: Kindly solve this question in C++ programming language. A palindrome is a word, which reads the same backward as forward. Some examples of palindromes are:
Kindly solve this question in C++ programming language. 
A palindrome is a word, which reads the same backward as forward. Some examples of palindromes are: "kayak", "radar", "mom". Write a function: class Solution \{ public String solution(int N, int K ); } that, given two integers N and K, returns a palindrome of length N which consists of K distinct lower-case letters (az). Examples: 1. Given N=5,K=2, your function may return "abbba". There are many other possibilities; for example, it could also return "zdzdz". On the other hand, "aaaa" is an incorrect answer as it contains only one distinct letter. 2. Given N=8,K=3, your function may return "ppsccspp". 3. Given N=3,K=2, your function may return "opo". Assume that: - N is an integer within the range [1..200]; - K is an integer within the range [1..26]; - Creation of the required palindrome is always possible. In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
