Tanmoy is an ACM ICPC contestant. During practice he came across a problem named ‘OWLLEN’. He has ha…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
what is the test case 4?My code isn’t getting past test case 4.But i have checked my code for every posssible value it’s properly working.What’s the problem here please someone tell me.
@integer The statement has been updated. Please check the problem statement again… especially the input specification. Previously the contraint was formatted incorrectly.
#include <stdio.h>
int main(void)
{
int c[10] = {0,0,0,0,0,0,0,0,0,0}, x = 0, max = 0, ans = 0;
long int num;
scanf("%li", &num);
while(num > 0)
{
c[num % 10]++;
num /= 10;
x++;
}
for (int i = 0; i < 10; i++)
{
if (max < c[i])
{
max = c[i];
ans = i;
}
}
printf("%d", ans);
return 0;
}
why this code not passing test:4 and why there is no debugging icon?
Why this code is not producing the correct output for 2nd test case?
num = input('')
numlist = {
}
for i in num:
if numlist.get(i) == None:
numlist.update({f"{i}": "1"})
else:
count = numlist.get(i)
count = int(count)
numlist.update({f"{i}": f"{count + 1}"})
maxValue = max(numlist.values())
resultList = []
for x in numlist:
if numlist.get(x) == maxValue:
resultList.append(x)
print(min(resultList))