Cost to make a string Panagram in C++

In this tutorial, we will be discussing a program to find the cost of making a string panagram.

For this we will be provided with an array of integers. Our task is to convert the given string into a panagram and calculate the cost of doing that with the help of the array provided with the costs of adding characters.

Example

 Live Demo

#include 
using namespace std;
//calculating the total cost of
//making panagram
int calc_cost(int arr[], string str) {
   int cost = 0;
   bool occurred[26] = { false };
   for (int i = 0; i 

Output

63
Updated on: 2020-02-05T07:27:08+05:30

195 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements