Ad

Okey im boring a bit so, yes, fight agains my self from the pass. Me at this moment remember about math ahahaahha

Code
Diff
  • def knight_move3d(position=(0, 0, 0)) -> bool:
        if position == (0, 0, 0):
            return True
    
        _sum: int  = 0
        mul: int = 1
        
        for i in position:
            if i > 2 or -2 > i:
                return False
    
            _sum += abs(i)
            mul = mul * i
    
        return _sum == 3 and mul == 0
    • def knight_move3d(position=(0, 0, 0)) -> bool:
    • if position == (0, 0, 0):
    • return True
    • res: list = [False, False, False]
    • _sum: int = 0
    • mul: int = 1
    • for i in position:
    • if i > 2 or -2 > i:
    • return False
    • res[abs(i)] = True
    • return all(res)
    • _sum += abs(i)
    • mul = mul * i
    • return _sum == 3 and mul == 0
Code
Diff
  • def knight_move3d(position=(0, 0, 0)) -> bool:
        if position == (0, 0, 0):
            return True
    
        res: list = [False, False, False]
        for i in position:
            if i > 2 or -2 > i:
                return False
            res[abs(i)] = True
        return all(res)
    • def knight_move3d(coordinates) -> bool:
    • return sorted(map(abs,coordinates))==[0,1,2] or coordinates==(0,0,0)
    • def knight_move3d(position=(0, 0, 0)) -> bool:
    • if position == (0, 0, 0):
    • return True
    • res: list = [False, False, False]
    • for i in position:
    • if i > 2 or -2 > i:
    • return False
    • res[abs(i)] = True
    • return all(res)