Walmart Coding Question – Solved

12 Live
Counting Repeated Game Scores During a school sports day event, students record their scores, However, some students accidentally recorded the same score multiple times. Your task is to help the event organizer identify all scores that are repeated and determine the indices where each duplicate occurs. You are given an integer N, representing the number of students, followed by a list of their scores. For each score that is repeated, output the score, followed by the letter 'T, and then the indices where the score appears. If no duplicates are found, return -1. Input Format The first line contains an integer N - the number of students. The next N lines each contain an integer, representing a score recorded by a student. | Output Format For each score that appears more than once, print the score, followed by the letter'l', and then the indices where the score appears, separated by spaces. If no scores are repeated, output -1.

Asked in: Walmart

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |