Walmart Coding Question – Solved

9 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

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |