Hello developers,
I got stack with codeforce 152A problem , I found a solution in python but I don’t know python , anybody can convert it from python to javascript ?
problem link
data = input().split()
N, M = int(data[0]), int(data[1])
marks = [None] * N
for i in range(N):
marks[i] = input()
answer = 0
subj = []
if N == 1:
print(N)
else:
for i in range(N):
tmp_answer = 0
for col in range(M):
flag = 1
for j in range(N):
if int(marks[j][col]) > int(marks[i][col]):
flag = 0
if flag == 1:
tmp_answer = 1
if tmp_answer == 1:
answer += 1
print(answer)
It doesn’t work could mean many things. How doesn’t it work?
It looks like your braces don’t agree with the Python indentation. If put the control statements on the same indentation and then put braces for every control statement, that should help.
Yeah, I’d guess your brace mismatch is causing you to access variables incorrectly. Python forces users to use whitespace meaningfully. Your translation has to respect the logic expressed by the whitespace.