Sort by

recency

|

200 Discussions

|

  • + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    if name == 'main': t = int(input().strip())

    for i in range(t):
        first_multiple_input = input().rstrip().split()
        n = int(first_multiple_input[0])
        k = int(first_multiple_input[1])
        L = []
        L1 = []
        for i in range(n):
            L.append(i)
        l = 0
        r = n-1
        while l<r:
            L1.append(L[r])
            L1.append(L[l])
            l += 1
            r -= 1
        if l == r:
            L1.append(L[l])
        print(L1.index(k))
    
  • + 0 comments

    The Reverse Game challenge on HackerRank is such a fun puzzle to work through! I love how it really pushes you to think about the problem from a different angle and optimize your approach. Sometimes these logic-based challenges remind me of how different types of games can make you think strategically, even when you're just playing for fun. I’ve found apps like https://aviator-pinup.info/best-aviator-game-app do a great job of blending simple gameplay with a need for quick thinking, which is a cool way to keep the brain sharp when you need a break from coding but still want to stay engaged!

  • + 0 comments

    One line solution :)

    return k < n/2 ? (2*k + 1) : 2*(n - k - 1)

  • + 1 comment

    i don't understand problem ! who can be help me please !!!

  • + 2 comments
    def reverseGame(n, k):
        if n %2 != 0 and k == (n-1)/2:
            z = n - 1
        elif k >= n/2:
            z = ((n - 1) - k) * 2
        else:
            z = 1+2*k
        return z