Open In App

GOCC18: Google’s Online Coding Challenge

The GOCC18 was held on September 26, 2020, for Google SWE New Grad 2021 (India). There were 2 coding questions to attempt, with a 60-minute time limit for completion. Below is the first question of the challenge:

Question1: The cost of a string



Your task is to create a string S considering lowercase English alphabets. You are given an array A of size 26 where A[i] denotes the cost of using the ith Alphabet (consider 1-based indexing). Find lexicographically the largest string S that can be created such that the cost of building the string is exactly W. For example, ‘abc’ is lexicographically smaller than ‘abcd’.

Input format:



Output format: For each test case, print the required string S in a new line.

Sample input

1
1 1 2 33 4 6 9 7 36 12 58 32 28 994 22 255 47 69 558 544 21 36 48 85 48 58
236

Sample output

zzzze
Article Tags :