I need help in solving following problem
In a class, N students are standing in a row(consider 1-based indexing).Every student is wearing some colored t-shirt.Students wearing the same colored t-shirts are friends with each other.A student is lonely if he is friends with no one. You have to tell who all are lonely students.
Input T — test case N — number of students each of N lines Color i — 0...N
Sample test case 3 7 AABCDCE 12 AABBCCDEFDFE 8 HEYSHYSH
Sample Output: 3 3 5 7 0 1 2








Who is Single?
Me.
Jokes aside, count frequency using a map or sth
Oh crap I thought that this is a clickbait title lol
Actually you don't have to use a map. You can omit the log factor.
Use a array of size (letters) and do this:
Initially all of the values are 0
If you have someone who lands on a 0-valued block, change the value to the position of this person
If you have someone who lands on a block with a positive integer, change the integer to -1 (as the people with this letter is not lonely)
If you have someone who lands on a -1, do nothing.
Then see which of the blocks have positive integer values.
I got clickbaited aswell lol