Sort by

recency

|

261 Discussions

|

  • + 0 comments

    return r % 2 == 0 ? (10*(r/2 - 1) + 1) + (2*c - 2) : 10*((r+1)/2 - 1) + 2*(c-1)

    or

    return r % 2 == 0 ? 5*r - 11 + 2*c : 5*r - 7 + 2*c

  • + 0 comments

    for c++ must convertt the parsing of int to long long variable and also change stoi() to stoll() i got accepted after this

  • + 0 comments

    def strangeGrid(r, c): if (r-1) % 2 == 0: first_number = (r // 2) * 10 else: first_number = (((r-1) //2) * 10) + 1 return first_number + ((2 * c)-2)

  • + 0 comments
    def strangeGrid(r, c):
        # we surely know that if row is even then number is odd and vice versa (row odd = even number )
        if r%2!=0:
            return (math.ceil(r/2)-1)*10+(2*(c-1))
        else:
            return ((math.ceil(r/2)-1)*10 +1) +(2*(c-1))
    
  • + 0 comments

    As always the scala is broken since idiots parse the inputs as ints but then give it a number to parse which is too large to fit inside an int