def test_challenge_int(): # Use 0 or 1 # Use upper and lower limits assert solution(2) == 2 assert solution(4) == 4 assert solution(0) == 0 assert solution(1) == 1 assert solution(5) == 5
def test_challenge(): # Create empty array (dependent on test) # Create single entry array # Create an array with the answer at the start # Create an array with the answer at the end # Create an array with the answer in the middle # Single entry slot assert (solution([2, 3, 1, 5]) == 4)
def test_challenge(): assert solution(5, [1, 3, 1, 4, 2, 3, 5, 4]) == 6 assert solution(5, [1, 3, 5, 4, 2, 3, 1, 4]) == 4 assert solution(5, [5, 4, 3, 2, 1, 3, 1, 4]) == 4 assert solution(2, [1, 3, 2]) == 2 assert solution(2, [1]) == -1 assert solution(2, [1, 1]) == -1 assert solution(5, [1, 3, 1, 4, 2, 3, 1, 4]) == -1
def test_challenge_all(): assert solution(1) == 0 assert solution(9) == 2 assert solution(15) == 0 assert solution(20) == 1 assert solution(529) == 4 assert solution(1041) == 5 assert solution(2147483647) == 0
def test_challenge_all(): # Single entry slot assert solution([99]) == 99 # Answer in last slot assert solution([2, 2, 3, 3, 4]) == 4 # Answer in first slot assert solution([2, 3, 3, 4, 4]) == 2 # Answer in middle slot assert solution([2, 2, 3, 4, 4]) == 3 # Different positions assert solution([9, 3, 9, 3, 9, 7, 9]) == 7 assert solution([9, 3, 9, 3, 9, 1, 9]) == 1 assert solution([9, 1, 9, 1, 9, 2, 9]) == 2 assert solution([9, 1, 9, 1, 9, 2, 9]) == 2
def test_challenge(): # Create empty array (dependent on test) # Create single entry array assert solution(6, 11, 2) == 3 assert solution(0, 0, 11) == 1 assert solution(1, 1, 11) == 0 assert solution(10, 10, 5) == 1 assert solution(10, 10, 7) == 0 assert solution(10, 10, 20) == 0
def test_challenge(): # Use 0 or 1 # Use upper and lower limits assert solution(10, 85, 30) == 3
def test_challenge(): assert solution([4, 2, 2, 5, 1, 5, 8]) == 1
def test_challenge(): assert solution([4]) == 0 assert solution([1]) == 1 assert solution([4, 1, 3, 2]) == 1 assert solution([4, 1, 3]) == 0
def test_challenge_array(): assert (solution([3, 1]) == 2) assert (solution([3, 1, 2, 4, 3]) == 1) assert (solution([-10, -20, -30, -40, 100]) == 20)
def test_challenge_array(): assert solution([10, 2, 5, 1, 8, 20]) == 1 assert solution([10, 50, 5, 1]) == 0
def test_challenge(): # Create empty array (dependent on test) # Create single entry array assert solution([0, 1, 0, 1, 1]) == 5
def test_challenge(): assert solution("CAGCCTA", [2, 5, 0], [4, 5, 6]) == [2, 4, 1]
def test_challenge_array(): assert solution([3, 8, 9, 7, 6], 3) == [9, 7, 6, 3, 8] assert solution([0, 0, 0], 1) == [0, 0, 0] assert solution([1, 2, 3, 4], 4) == [1, 2, 3, 4] assert solution([1, 2, 3, 4], 0) == [1, 2, 3, 4] assert solution([5, -1000], 1) == [-1000, 5] assert solution([], 1) == [] assert solution([1, 2, 3, 4, 5, 6, 7], 2) == [6, 7, 1, 2, 3, 4, 5] assert solution([4, 6, 0, 0, -2, 10, -4], 0) == [4, 6, 0, 0, -2, 10, -4] assert solution([4, 6, 0, 0, -2, 10, -4], 1) == [-4, 4, 6, 0, 0, -2, 10] assert solution([4, 6, 0, 0, -2, 10, -4], 2) == [10, -4, 4, 6, 0, 0, -2] assert solution([4, 6, 0, 0, -2, 10, -4], 3) == [-2, 10, -4, 4, 6, 0, 0] assert solution([4, 6, 0, 0, -2, 10, -4], 4) == [0, -2, 10, -4, 4, 6, 0] assert solution([4, 6, 0, 0, -2, 10, -4], 5) == [0, 0, -2, 10, -4, 4, 6] assert solution([4, 6, 0, 0, -2, 10, -4], 6) == [6, 0, 0, -2, 10, -4, 4] assert solution([4, 6, 0, 0, -2, 10, -4], 7) == [4, 6, 0, 0, -2, 10, -4]
def test_challenge(): # Create empty array (dependent on test) # Create single entry array assert solution(5, [3, 4, 4, 6, 1, 4, 4]) == [3, 2, 2, 4, 2]