diff --git "a/data/train/php-003.jsonl" "b/data/train/php-003.jsonl" --- "a/data/train/php-003.jsonl" +++ "b/data/train/php-003.jsonl" @@ -475,7 +475,7 @@ {"question_id": 3232, "task_id": "find-if-digit-game-can-be-won", "difficulty": "Easy", "problem_description": "You are given an array of positive integers nums.\n\nAlice and Bob are playing a game. In the game, Alice can choose either all single-digit numbers or all double-digit numbers from nums, and the rest of the numbers are given to Bob. Alice wins if the sum of her numbers is strictly greater than the sum of Bob's numbers.\n\nReturn true if Alice can win this game, otherwise, return false.\n\nExample 1:\n\nInput: nums = [1,2,3,4,10]\nOutput: false\nExplanation:\nAlice cannot win by choosing either single-digit or double-digit numbers.\n\nExample 2:\n\nInput: nums = [1,2,3,4,5,14]\nOutput: true\nExplanation:\nAlice can win by choosing single-digit numbers which have a sum equal to 15.\n\nExample 3:\n\nInput: nums = [5,5,5,25]\nOutput: true\nExplanation:\nAlice can win by choosing double-digit numbers which have a sum equal to 25.\n\nConstraints:\n\n- 1 <= nums.length <= 100\n- 1 <= nums[i] <= 99\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [9, 9, 9, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 14]) == True\n assert candidate(nums = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [50, 25, 10, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == True\n assert candidate(nums = [5, 5, 5, 25]) == True\n assert candidate(nums = [1, 11, 22, 33, 44, 55, 66, 77, 88, 99]) == True\n assert candidate(nums = [45, 46, 47, 48, 49, 50, 51, 52, 53, 54]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [1, 2, 3, 4, 10]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [10, 20, 30, 40, 5]) == True\n assert candidate(nums = [50, 50, 50, 50, 50, 50]) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10]) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]) == True\n assert candidate(nums = [10, 10, 10, 1, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 10, 10, 10]) == True\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 99]) == True\n assert candidate(nums = [10, 20, 30, 40]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48]) == True\n assert candidate(nums = [9, 99, 8, 88, 7, 77, 6, 66, 5, 55, 4, 44, 3, 33, 2, 22, 1, 11]) == True\n assert candidate(nums = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 1, 11, 21, 31, 41]) == True\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [55, 44, 33, 22, 11, 99, 88, 77, 66, 55, 44, 33]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [9, 12, 15, 20, 25, 30, 35, 40, 45, 50]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [10, 20, 30, 40, 5, 15, 25, 35, 45, 55]) == True\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 99]) == True\n assert candidate(nums = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 22, 32, 42, 52, 62, 72, 82, 92, 3, 33, 43, 53, 63, 73, 83, 93, 4, 44, 54, 64, 74, 84, 94, 5, 55, 65, 75, 85, 95, 6, 66, 76, 86, 96, 7, 77, 87, 97, 8, 88, 98, 9, 99, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 58, 59, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 91, 93, 94, 95, 97, 98, 99]) == True\n assert candidate(nums = [10, 21, 32, 43, 54, 65, 76, 87, 98, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 32, 43, 54, 65, 76, 87, 98, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 32, 43, 54, 65, 76, 87, 98, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 21, 32, 43, 54, 65, 76, 87, 98, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [8, 18, 28, 38, 48, 58, 68, 78, 88, 98, 9, 19, 29, 39, 49]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59]) == True\n assert candidate(nums = [88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70]) == True\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9, 55]) == True\n assert candidate(nums = [1, 20, 3, 40, 5, 60, 7, 80, 9, 10]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 99]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 11, 22, 33, 44, 55, 66, 77, 88, 99, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 5, 15, 25, 35, 45]) == True\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 1, 11, 22, 33, 44]) == True\n assert candidate(nums = [99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == True\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) == True\n assert candidate(nums = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [45, 55, 65, 75, 85, 95, 5, 15, 25, 35, 45]) == True\n assert candidate(nums = [45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50]) == True\n assert candidate(nums = [15, 25, 35, 45, 55, 65, 75, 85, 95, 5, 10, 15, 20, 25, 30]) == True\n assert candidate(nums = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [12, 23, 34, 45, 56, 67, 78, 89, 90, 11]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98]) == True\n assert candidate(nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 10, 20, 30, 40, 50]) == True\n assert candidate(nums = [99, 98, 97, 96, 95, 94, 93, 92, 91, 90]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == True\n assert candidate(nums = [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41]) == True\n assert candidate(nums = [1, 11, 2, 22, 3, 33, 4, 44, 5, 55, 6, 66, 7, 77, 8, 88, 9, 99]) == True\n assert candidate(nums = [50, 40, 30, 20, 10, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) == True\n assert candidate(nums = [99, 88, 77, 66, 55, 44, 33, 22, 11, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [45, 54, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 6, 7, 8, 9]) == True\n assert candidate(nums = [41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 99, 98, 97, 96, 95, 94, 93, 92, 91]) == True\n assert candidate(nums = [9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 12, 22, 32, 42, 52, 62, 72, 82, 92]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 99, 88, 77, 66, 55, 44, 33, 22, 11]) == True\n assert candidate(nums = [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 1, 2, 3, 4, 5, 6, 7, 8, 9, 60, 70, 80, 90, 5]) == True\n assert candidate(nums = [8, 17, 26, 35, 44, 53, 62, 71, 80, 89, 10, 19, 28, 37, 46]) == True\n assert candidate(nums = [1, 12, 23, 34, 45, 56, 67, 78, 89, 90]) == True\n assert candidate(nums = [99, 88, 77, 66, 55, 44, 33, 22, 11, 1]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 10, 20, 30, 40, 50]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 1, 2]) == True\n assert candidate(nums = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) == True\n assert candidate(nums = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65]) == True\n assert candidate(nums = [1, 10, 2, 20, 3, 30, 4, 40, 5, 50, 6, 60, 7, 70, 8, 80, 9, 90]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert candidate(nums = [45, 55, 65, 75, 85, 95, 10, 20, 30, 40, 50, 60, 70, 80, 90]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 15, 15, 15, 15, 15]) == True\n assert candidate(nums = [1, 12, 3, 45, 6, 78, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 91, 92, 93, 94, 96, 97, 98, 99]) == True\n assert candidate(nums = [11, 22, 33, 44, 55, 66, 77, 88, 99, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [99, 1, 98, 2, 97, 3, 96, 4, 95, 5, 94, 6, 93, 7, 92, 8, 91, 9, 90]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]) == True\n assert candidate(nums = [1, 12, 3, 14, 5, 16, 7, 18, 9, 10]) == True\n assert candidate(nums = [1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == True\n assert candidate(nums = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]) == True\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 90, 81, 72, 63, 54, 45]) == True\n assert candidate(nums = [10, 20, 30, 40, 50, 60, 70, 80, 90, 99, 1, 2, 3, 4, 5]) == True\n assert candidate(nums = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 1, 2, 3, 4, 6, 7, 8, 9]) == True\n", "comparison": "exact"}, "public_tests": ["[1,2,3,4,10]", "[1,2,3,4,5,14]", "[5,5,5,25]"], "hints": ["Alice wins if the sum of all single-digit numbers and the sum of all double-digit numbers are different."], "metadata": {"canonical_parameter_names": ["nums"], "leetcode_dataset_entry_point": "Solution().canAliceWin", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:17:50+00:00", "tests_total": 121, "tests_dropped": 6, "flags": [], "topic_tags": ["array", "math"]}, "language": "php", "interface": {"raw_signature": "function canAliceWin($nums) {", "container": "Solution", "callable": "canAliceWin", "parameters": [{"name": "nums", "type": "Integer[]"}], "return_type": "Boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} {"question_id": 3233, "task_id": "find-the-count-of-numbers-which-are-not-special", "difficulty": "Medium", "problem_description": "You are given 2 positive integers l and r. For any number x, all positive divisors of x except x are called the proper divisors of x.\n\nA number is called special if it has exactly 2 proper divisors. For example:\n\n- The number 4 is special because it has proper divisors 1 and 2.\n- The number 6 is not special because it has proper divisors 1, 2, and 3.\n\nReturn the count of numbers in the range [l, r] that are not special.\n\nExample 1:\n\nInput: l = 5, r = 7\nOutput: 3\nExplanation:\nThere are no special numbers in the range [5, 7].\n\nExample 2:\n\nInput: l = 4, r = 16\nOutput: 11\nExplanation:\nThe special numbers in the range [4, 16] are 4 and 9.\n\nConstraints:\n\n- 1 <= l <= r <= 10^9\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(l = 100,r = 200) == 99\n assert candidate(l = 5,r = 7) == 3\n assert candidate(l = 20,r = 50) == 29\n assert candidate(l = 1,r = 10) == 8\n assert candidate(l = 100,r = 150) == 50\n assert candidate(l = 4,r = 16) == 11\n assert candidate(l = 10,r = 20) == 11\n assert candidate(l = 1000,r = 10000) == 8987\n assert candidate(l = 25,r = 25) == 0\n assert candidate(l = 100000,r = 200000) == 99980\n assert candidate(l = 250000,r = 250100) == 101\n assert candidate(l = 1000000,r = 1000010) == 11\n assert candidate(l = 999999999,r = 1000000000) == 2\n assert candidate(l = 1,r = 100000000) == 99998771\n assert candidate(l = 100000,r = 150000) == 49990\n assert candidate(l = 1000000000,r = 1000000000) == 1\n assert candidate(l = 500000,r = 501000) == 1001\n assert candidate(l = 3,r = 3) == 1\n assert candidate(l = 1,r = 1000000) == 999832\n assert candidate(l = 5000,r = 6000) == 999\n assert candidate(l = 10000,r = 11000) == 999\n assert candidate(l = 2,r = 2) == 1\n assert candidate(l = 5000,r = 7000) == 1997\n assert candidate(l = 1000000,r = 1500000) == 499969\n assert candidate(l = 8,r = 8) == 1\n assert candidate(l = 1000000,r = 10000000) == 8999723\n assert candidate(l = 300000000,r = 400000000) == 99999729\n assert candidate(l = 500000,r = 1000000) == 499959\n assert candidate(l = 4,r = 1000000) == 999829\n assert candidate(l = 10000000,r = 10001000) == 1001\n assert candidate(l = 25,r = 50) == 24\n assert candidate(l = 1,r = 3) == 3\n assert candidate(l = 999999,r = 1000000) == 2\n assert candidate(l = 999900,r = 1000000) == 101\n assert candidate(l = 50,r = 100) == 51\n assert candidate(l = 8,r = 100) == 90\n assert candidate(l = 16,r = 25) == 9\n assert candidate(l = 1000000,r = 1001000) == 1001\n assert candidate(l = 16,r = 256) == 237\n assert candidate(l = 999,r = 1001) == 3\n assert candidate(l = 123456,r = 789012) == 665473\n assert candidate(l = 10000,r = 10100) == 101\n assert candidate(l = 999999950,r = 1000000000) == 51\n assert candidate(l = 50000,r = 60000) == 9996\n assert candidate(l = 123456,r = 123486) == 31\n assert candidate(l = 49,r = 50) == 1\n assert candidate(l = 97,r = 101) == 5\n assert candidate(l = 10000,r = 100000) == 89961\n assert candidate(l = 3000000,r = 3000100) == 101\n assert candidate(l = 500,r = 500) == 1\n assert candidate(l = 100000000,r = 100010000) == 10001\n assert candidate(l = 1234567,r = 8765432) == 7530626\n assert candidate(l = 150,r = 250) == 100\n assert candidate(l = 2,r = 3) == 2\n assert candidate(l = 8000000,r = 8000100) == 101\n assert candidate(l = 25,r = 36) == 11\n assert candidate(l = 987654,r = 987674) == 21\n assert candidate(l = 500,r = 1500) == 997\n assert candidate(l = 5000,r = 50000) == 44972\n assert candidate(l = 2000000,r = 2000050) == 51\n assert candidate(l = 500000,r = 500010) == 11\n assert candidate(l = 1,r = 100) == 96\n assert candidate(l = 500000,r = 600000) == 99990\n assert candidate(l = 1,r = 1000) == 989\n assert candidate(l = 1000,r = 2000) == 998\n assert candidate(l = 14,r = 28) == 14\n assert candidate(l = 100000000,r = 1000000000) == 899997829\n assert candidate(l = 1000000,r = 1000100) == 101\n assert candidate(l = 500000000,r = 600000000) == 99999786\n assert candidate(l = 101,r = 200) == 98\n assert candidate(l = 100,r = 1000) == 894\n assert candidate(l = 81,r = 81) == 1\n assert candidate(l = 49,r = 64) == 15\n assert candidate(l = 8,r = 25) == 16\n assert candidate(l = 5000,r = 7500) == 2497\n assert candidate(l = 25,r = 49) == 23\n assert candidate(l = 1000,r = 1500) == 500\n", "comparison": "exact"}, "public_tests": ["5\n7", "4\n16"], "hints": ["A special number must be a square of a prime number.", "We need to find all primes in the range [sqrt(l), sqrt(r)].", "Use sieve to find primes till sqrt(10^9)."], "metadata": {"canonical_parameter_names": ["l", "r"], "leetcode_dataset_entry_point": "Solution().nonSpecialCount", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:17:52+00:00", "tests_total": 77, "tests_dropped": 0, "flags": [], "topic_tags": ["array", "math", "number-theory"]}, "language": "php", "interface": {"raw_signature": "function nonSpecialCount($l, $r) {", "container": "Solution", "callable": "nonSpecialCount", "parameters": [{"name": "l", "type": "Integer"}, {"name": "r", "type": "Integer"}], "return_type": "Integer", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} {"question_id": 3234, "task_id": "count-the-number-of-substrings-with-dominant-ones", "difficulty": "Medium", "problem_description": "You are given a binary string s.\n\nReturn the number of substrings with dominant ones.\n\nA string has dominant ones if the number of ones in the string is greater than or equal to the square of the number of zeros in the string.\n\nExample 1:\n\nInput: s = \"00011\"\nOutput: 5\nExplanation:\nThe substrings with dominant ones are shown in the table below.\n\ni | j | s[i..j] | Number of Zeros | Number of Ones\n3 | 3 | 1 | 0 | 1\n4 | 4 | 1 | 0 | 1\n2 | 3 | 01 | 1 | 1\n3 | 4 | 11 | 0 | 2\n2 | 4 | 011 | 1 | 2\n\nExample 2:\n\nInput: s = \"101101\"\nOutput: 16\nExplanation:\nThe substrings with non-dominant ones are shown in the table below.\nSince there are 21 substrings total and 5 of them have non-dominant ones, it follows that there are 16 substrings with dominant ones.\n\ni | j | s[i..j] | Number of Zeros | Number of Ones\n1 | 1 | 0 | 1 | 0\n4 | 4 | 0 | 1 | 0\n1 | 4 | 0110 | 2 | 2\n0 | 4 | 10110 | 2 | 3\n1 | 5 | 01101 | 2 | 3\n\nConstraints:\n\n- 1 <= s.length <= 4 * 10^4\n- s consists only of characters '0' and '1'.\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(s = \"1111\") == 10\n assert candidate(s = \"100100100\") == 8\n assert candidate(s = \"1111010101\") == 33\n assert candidate(s = \"000111000\") == 12\n assert candidate(s = \"11110000\") == 15\n assert candidate(s = \"0000\") == 0\n assert candidate(s = \"111000\") == 9\n assert candidate(s = \"01010101111\") == 34\n assert candidate(s = \"0011110011\") == 31\n assert candidate(s = \"0000101010\") == 11\n assert candidate(s = \"00001111\") == 15\n assert candidate(s = \"000111\") == 9\n assert candidate(s = \"1001001001\") == 10\n assert candidate(s = \"11111\") == 15\n assert candidate(s = \"01010101\") == 14\n assert candidate(s = \"11010101\") == 18\n assert candidate(s = \"10101010\") == 14\n assert candidate(s = \"1010100000\") == 10\n assert candidate(s = \"010101\") == 10\n assert candidate(s = \"1100111100\") == 31\n assert candidate(s = \"101010\") == 10\n assert candidate(s = \"00011\") == 5\n assert candidate(s = \"11001100\") == 13\n assert candidate(s = \"101101\") == 16\n assert candidate(s = \"111000111\") == 18\n assert candidate(s = \"1010101010101010\") == 30\n assert candidate(s = \"00000\") == 0\n assert candidate(s = \"10010010\") == 8\n assert candidate(s = \"000111000111000111000\") == 36\n assert candidate(s = \"111111111111111111111111\") == 300\n assert candidate(s = \"000011000110001100011000\") == 28\n assert candidate(s = \"1111110000000011\") == 35\n assert candidate(s = \"111000111000111000\") == 33\n assert candidate(s = \"1111000000000011111\") == 37\n assert candidate(s = \"000000111111000000111111\") == 70\n assert candidate(s = \"0110110110110110110\") == 88\n assert candidate(s = \"1101010101010101\") == 34\n assert candidate(s = \"111111111100000000000000000000\") == 74\n assert candidate(s = \"10101010101010101010101010101010101010101010101010\") == 98\n assert candidate(s = \"11000000001111111111\") == 79\n assert candidate(s = \"00111111001111110011111100111111001111110011111100111111001111110011\") == 657\n assert candidate(s = \"11110000000000000000000000000000000\") == 15\n assert candidate(s = \"111110000011111000001111100000\") == 82\n assert candidate(s = \"1100110011001100\") == 29\n assert candidate(s = \"00000000000000000000000000001111111\") == 39\n assert candidate(s = \"010101010101010101010101\") == 46\n assert candidate(s = \"1100110011001100110011001100110011001100110011001100110011001100110\") == 133\n assert candidate(s = \"0001110001110001\") == 26\n assert candidate(s = \"1001001001001001001001001001001001001001001001001001001001001001\") == 64\n assert candidate(s = \"000111000111000111\") == 33\n assert candidate(s = \"101010101010101010101010\") == 46\n assert candidate(s = \"1100000000000011\") == 10\n assert candidate(s = \"1000000000001000\") == 5\n assert candidate(s = \"111111111111111111111111111100000000000000000000\") == 496\n assert candidate(s = \"1000000000000011\") == 7\n assert candidate(s = \"010101010101010101\") == 34\n assert candidate(s = \"1000000000000000000000000000\") == 2\n assert candidate(s = \"111000111000111000111000111000\") == 57\n assert candidate(s = \"1111111000000000000\") == 39\n assert candidate(s = \"0000000000000000\") == 0\n assert candidate(s = \"11111000001111100000111110000011111\") == 104\n assert candidate(s = \"101010101010101010101010101010\") == 58\n assert candidate(s = \"0100111101110010\") == 60\n assert candidate(s = \"100100100100100100100\") == 20\n assert candidate(s = \"111100001111000011110000\") == 57\n assert candidate(s = \"0000000001111111110000000000\") == 80\n assert candidate(s = \"0011001100110011\") == 29\n assert candidate(s = \"11000011000011000011000011\") == 31\n assert candidate(s = \"0000111100001111000011110000\") == 63\n assert candidate(s = \"1000000010000000100000001\") == 10\n assert candidate(s = \"0000000000000000000000000000000000000000000000000000000000000000\") == 0\n assert candidate(s = \"11111000000000001111111111\") == 96\n assert candidate(s = \"000000010000000100000001\") == 8\n assert candidate(s = \"100010001000100010001000\") == 17\n assert candidate(s = \"11111111111111111111000000000000\") == 264\n assert candidate(s = \"1001001001001001001001001001001\") == 31\n assert candidate(s = \"0000000000000000000000000000000000000000\") == 0\n assert candidate(s = \"11110000111100001111\") == 51\n assert candidate(s = \"1111111110000000000000000000\") == 61\n assert candidate(s = \"010101010101010101010101010101010101010101010101\") == 94\n assert candidate(s = \"11111000001111100000111110000011111000001111100000111110000011111\") == 194\n assert candidate(s = \"111111111100000000001111111111\") == 148\n assert candidate(s = \"01010101010101010101010101010101010101010101010101\") == 98\n assert candidate(s = \"000000000000000000000000000000001111111111111111111111111111111\") == 601\n assert candidate(s = \"111000011111000\") == 39\n assert candidate(s = \"11111111111111111111\") == 210\n assert candidate(s = \"1001001001001001001001001001001001001001001001001001\") == 52\n assert candidate(s = \"0000000000000000000000000000001111111111111111111111111111111\") == 601\n assert candidate(s = \"1111111111111111\") == 136\n assert candidate(s = \"1111111111111111111111111111111111111111111111111111111111111111\") == 2080\n assert candidate(s = \"0000000111111111111\") == 103\n assert candidate(s = \"0101010111111111\") == 96\n assert candidate(s = \"00000000000000000000000000000000111111111111111111111111111111111\") == 676\n assert candidate(s = \"111111000000111111000000111111\") == 100\n assert candidate(s = \"0000000001111111\") == 39\n assert candidate(s = \"0001010101101011\") == 37\n assert candidate(s = \"00000000001111111111\") == 74\n assert candidate(s = \"0011001100110011001100110011001100110011001100110011001100110011001\") == 129\n assert candidate(s = \"1111100000111110000011111\") == 74\n assert candidate(s = \"111000111000111000111\") == 42\n assert candidate(s = \"1001001001001001\") == 16\n assert candidate(s = \"11001100110011001100\") == 37\n assert candidate(s = \"01010101010101010101010101010101\") == 62\n assert candidate(s = \"1110010001100011110\") == 40\n assert candidate(s = \"1111000000000000000000000000000000000000\") == 15\n assert candidate(s = \"00000000000000000000000000000000000000000000000000\") == 0\n assert candidate(s = \"1001001001001001001001\") == 22\n assert candidate(s = \"111000111000111000111000111\") == 54\n assert candidate(s = \"0000111111110000\") == 63\n assert candidate(s = \"0011110011110011\") == 65\n assert candidate(s = \"1111111100000000\") == 49\n assert candidate(s = \"1111000011110000111100001111000011110000\") == 99\n assert candidate(s = \"11100111001110011100111001110011100111001110011100\") == 171\n assert candidate(s = \"111110000111100001111\") == 58\n assert candidate(s = \"110000110000110000110000110000\") == 33\n assert candidate(s = \"0101010101010101\") == 30\n assert candidate(s = \"000000000000000000000000\") == 0\n assert candidate(s = \"111000111000111000111000111000111000111000111000\") == 93\n assert candidate(s = \"00000000000000000000000000000000000111111111111111\") == 154\n assert candidate(s = \"0000011111111100000\") == 80\n assert candidate(s = \"0000111111111111\") == 103\n assert candidate(s = \"000111000111000111000111000111\") == 57\n assert candidate(s = \"1000100010001000100\") == 14\n assert candidate(s = \"1001001001001001001\") == 19\n assert candidate(s = \"0110011001100110011001\") == 41\n assert candidate(s = \"11111111111111111000000000000000000000000000000000000000000000011\") == 200\n assert candidate(s = \"0010110101101011\") == 46\n assert candidate(s = \"000000000011111111110000000000\") == 96\n assert candidate(s = \"00000111110000011111000001111100000111110000011111000001111100000\") == 180\n assert candidate(s = \"11111111111111111111111111111111111111111111111111\") == 1275\n assert candidate(s = \"11011011011011011011011011011011011\") == 184\n assert candidate(s = \"1110001110001110\") == 33\n assert candidate(s = \"10010010010010010010010010010010\") == 32\n assert candidate(s = \"1110011100011100011\") == 44\n assert candidate(s = \"00000000000000000000\") == 0\n assert candidate(s = \"1111000011110000\") == 36\n assert candidate(s = \"10101010101010101010101010101010\") == 62\n assert candidate(s = \"01001001001001001001001\") == 23\n assert candidate(s = \"1111111111000000\") == 74\n assert candidate(s = \"0000000011111111\") == 49\n assert candidate(s = \"1111000000001111\") == 30\n assert candidate(s = \"01001001001001001001001001001001\") == 32\n assert candidate(s = \"1000001111110000\") == 42\n assert candidate(s = \"000000000011111111111111111111\") == 264\n assert candidate(s = \"1100001100001100\") == 19\n assert candidate(s = \"1111111111\") == 55\n assert candidate(s = \"1010101010101010101010101010101010101010\") == 78\n assert candidate(s = \"0110011001100110\") == 31\n assert candidate(s = \"1111000000000000111111111111\") == 118\n assert candidate(s = \"1111000011110000111100001111\") == 72\n assert candidate(s = \"00000000000000000001\") == 2\n assert candidate(s = \"0000000000111111\") == 30\n assert candidate(s = \"0011001100110011001100110011\") == 53\n assert candidate(s = \"01010101010101010101\") == 38\n assert candidate(s = \"111110111110111110111110111110\") == 453\n assert candidate(s = \"111110000000\") == 22\n assert candidate(s = \"1111111101010101\") == 84\n assert candidate(s = \"1101001010010100\") == 24\n assert candidate(s = \"1111010101010101\") == 45\n assert candidate(s = \"000001111100000111110000011111\") == 82\n assert candidate(s = \"0000000000000000000000000001\") == 2\n assert candidate(s = \"10101010101010101010\") == 38\n assert candidate(s = \"0110110110110110110110110110110\") == 156\n assert candidate(s = \"11111111111111110000000000\") == 174\n assert candidate(s = \"0000111100001111\") == 36\n", "comparison": "exact"}, "public_tests": ["\"00011\"", "\"101101\""], "hints": ["Let us fix the starting index l of the substring and count the number of indices r such that l <= r and the substring s[l..r] has dominant ones.", "A substring with dominant ones has at most sqrt(n) zeros.", "We cannot iterate over every r and check if the s[l..r] has dominant ones. Instead, we iterate over the next sqrt(n) zeros to the left of l and count the number of substrings with dominant ones where the current zero is the rightmost zero of the substring."], "metadata": {"canonical_parameter_names": ["s"], "leetcode_dataset_entry_point": "Solution().numberOfSubstrings", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:17:54+00:00", "tests_total": 165, "tests_dropped": 0, "flags": ["figure_reference"], "topic_tags": ["string", "enumeration"]}, "language": "php", "interface": {"raw_signature": "function numberOfSubstrings($s) {", "container": "Solution", "callable": "numberOfSubstrings", "parameters": [{"name": "s", "type": "String"}], "return_type": "Integer", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} -{"question_id": 3235, "task_id": "check-if-the-rectangle-corner-is-reachable", "difficulty": "Hard", "problem_description": "You are given two positive integers xCorner and yCorner, and a 2D array circles, where circles[i] = [x_i, y_i, r_i] denotes a circle with center at (x_i, y_i) and radius r_i.\n\nThere is a rectangle in the coordinate plane with its bottom left corner at the origin and top right corner at the coordinate (xCorner, yCorner). You need to check whether there is a path from the bottom left corner to the top right corner such that the entire path lies inside the rectangle, does not touch or lie inside any circle, and touches the rectangle only at the two corners.\n\nReturn true if such a path exists, and false otherwise.\n\nExample 1:\n\nInput: xCorner = 3, yCorner = 4, circles = [[2,1,1]]\nOutput: true\nExplanation:\nThe black curve shows a possible path between (0, 0) and (3, 4).\n\nExample 2:\n\nInput: xCorner = 3, yCorner = 3, circles = [[1,1,2]]\nOutput: false\nExplanation:\nNo path exists from (0, 0) to (3, 3).\n\nExample 3:\n\nInput: xCorner = 3, yCorner = 3, circles = [[2,1,1],[1,2,1]]\nOutput: false\nExplanation:\nNo path exists from (0, 0) to (3, 3).\n\nExample 4:\n\nInput: xCorner = 4, yCorner = 4, circles = [[5,5,1]]\nOutput: true\nExplanation:\n\nConstraints:\n\n- 3 <= xCorner, yCorner <= 10^9\n- 1 <= circles.length <= 1000\n- circles[i].length == 3\n- 1 <= x_i, y_i, r_i <= 10^9\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 499999999]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[1, 1, 1], [4, 4, 1], [2, 2, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 100000000]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [2, 2, 1]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[2, 2, 1], [3, 3, 1]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 1]]) == True\n assert candidate(xCorner = 3,yCorner = 3,circles = [[2, 1, 1], [1, 2, 1]]) == False\n assert candidate(xCorner = 3,yCorner = 4,circles = [[2, 1, 1]]) == True\n assert candidate(xCorner = 4,yCorner = 4,circles = [[5, 5, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 1], [3, 3, 2]]) == True\n assert candidate(xCorner = 3,yCorner = 3,circles = [[1, 1, 2]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[3, 3, 3], [12, 12, 3], [7, 7, 2], [9, 9, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[10, 10, 5], [15, 15, 3], [5, 5, 2], [18, 2, 1], [2, 18, 1]]) == True\n assert candidate(xCorner = 25,yCorner = 25,circles = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5]]) == False\n assert candidate(xCorner = 8,yCorner = 8,circles = [[2, 2, 3], [6, 6, 3]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [2, 2, 3], [8, 8, 3]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 5, 1], [9, 5, 1], [5, 1, 1], [5, 9, 1], [2, 2, 2], [8, 2, 2], [2, 8, 2], [8, 8, 2]]) == False\n assert candidate(xCorner = 8,yCorner = 8,circles = [[4, 4, 2], [2, 2, 1], [6, 6, 1], [1, 7, 2], [7, 1, 2]]) == True\n assert candidate(xCorner = 1000000,yCorner = 1000000,circles = [[500000, 500000, 300000], [300000, 300000, 100000], [700000, 700000, 100000], [100000, 100000, 50000], [900000, 900000, 50000], [100000, 900000, 50000], [900000, 100000, 50000], [500000, 100000, 200000], [500000, 900000, 200000]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 1], [14, 14, 1], [7, 7, 5]]) == False\n assert candidate(xCorner = 7,yCorner = 7,circles = [[3, 3, 1], [4, 3, 1], [3, 4, 1], [4, 4, 1], [2, 2, 1], [2, 3, 1], [3, 2, 1], [2, 4, 1], [4, 2, 1]]) == True\n assert candidate(xCorner = 30,yCorner = 30,circles = [[1, 1, 1], [29, 29, 1], [15, 15, 10], [15, 15, 5]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 4], [2, 2, 1], [8, 8, 1], [1, 1, 1], [9, 9, 1], [4, 1, 1], [1, 4, 1], [8, 4, 1], [4, 8, 1]]) == False\n assert candidate(xCorner = 3,yCorner = 10,circles = [[2, 5, 1], [1, 3, 1], [2, 8, 1], [1, 7, 1], [2, 2, 1], [1, 1, 1], [2, 9, 1], [1, 9, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 5, 2], [5, 1, 2], [5, 9, 2], [9, 5, 2]]) == True\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 1], [15, 15, 1], [1, 15, 1], [15, 1, 1], [8, 8, 3], [7, 7, 2], [9, 9, 2]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[1, 1, 1], [1, 20, 1], [20, 1, 1], [20, 20, 1], [10, 10, 5]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[999999999, 999999999, 1], [500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[1, 1, 2], [2, 2, 2], [3, 3, 2], [4, 4, 2], [5, 5, 2], [6, 6, 2], [7, 7, 2], [8, 8, 2], [9, 9, 2], [1, 9, 2], [9, 1, 2], [4.5, 4.5, 3]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[5, 5, 5], [45, 45, 5], [25, 25, 10], [15, 15, 3], [35, 35, 3]]) == False\n assert candidate(xCorner = 150,yCorner = 150,circles = [[10, 10, 10], [20, 20, 10], [30, 30, 10], [40, 40, 10], [50, 50, 10], [60, 60, 10], [70, 70, 10], [80, 80, 10], [90, 90, 10], [100, 100, 10], [110, 110, 10], [120, 120, 10], [130, 130, 10], [140, 140, 10], [150, 150, 10]]) == False\n assert candidate(xCorner = 20,yCorner = 15,circles = [[10, 10, 5], [15, 15, 3], [5, 5, 4]]) == True\n assert candidate(xCorner = 15,yCorner = 20,circles = [[1, 1, 1], [14, 19, 1], [8, 10, 2], [7, 8, 2], [9, 8, 2], [8, 7, 2], [8, 9, 2]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 25, 20], [50, 75, 20], [25, 50, 20], [75, 50, 20]]) == True\n assert candidate(xCorner = 500,yCorner = 500,circles = [[100, 100, 50], [400, 400, 50], [250, 250, 150], [250, 250, 100]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[500000000, 500000000, 100000000], [900000000, 900000000, 100000000], [100000000, 100000000, 100000000]]) == False\n assert candidate(xCorner = 500,yCorner = 500,circles = [[250, 250, 150], [100, 100, 50], [400, 400, 50], [50, 50, 20], [450, 450, 20], [100, 450, 20], [450, 100, 20], [250, 50, 100], [250, 450, 100]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [5, 5, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[3, 3, 1], [6, 6, 1], [2, 8, 2], [8, 2, 2]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[500, 500, 300], [300, 300, 100], [700, 700, 100], [100, 100, 50], [900, 900, 50], [100, 900, 50], [900, 100, 50], [500, 100, 200], [500, 900, 200]]) == False\n assert candidate(xCorner = 6,yCorner = 8,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [1, 8, 1], [6, 1, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[25, 25, 20], [75, 75, 20], [50, 50, 20], [25, 75, 20], [75, 25, 20]]) == True\n assert candidate(xCorner = 9,yCorner = 9,circles = [[2, 2, 2], [2, 6, 2], [6, 2, 2], [6, 6, 2], [5, 5, 1]]) == False\n assert candidate(xCorner = 7,yCorner = 7,circles = [[2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 1000000,yCorner = 1000000,circles = [[100000, 100000, 50000], [900000, 900000, 50000], [500000, 500000, 150000], [500000, 500000, 100000]]) == True\n assert candidate(xCorner = 7,yCorner = 7,circles = [[1, 6, 1], [2, 5, 1], [3, 4, 1], [4, 3, 1], [5, 2, 1], [6, 1, 1], [7, 7, 1], [7, 6, 1], [7, 5, 1], [7, 4, 1], [7, 3, 1], [7, 2, 1], [7, 1, 1]]) == False\n assert candidate(xCorner = 30,yCorner = 40,circles = [[15, 20, 5], [10, 25, 6], [20, 10, 4], [5, 30, 3], [25, 5, 2]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 30], [70, 70, 20], [30, 30, 25], [10, 10, 10], [90, 90, 10]]) == False\n assert candidate(xCorner = 12,yCorner = 12,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [1, 12, 1], [12, 1, 1]]) == False\n assert candidate(xCorner = 12,yCorner = 12,circles = [[1, 1, 2], [2, 2, 2], [3, 3, 2], [4, 4, 2], [5, 5, 2], [6, 6, 2], [7, 7, 2], [8, 8, 2], [9, 9, 2], [10, 10, 2], [11, 11, 2]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 10, 3], [10, 5, 3], [10, 15, 3], [15, 10, 3], [10, 10, 5]]) == True\n assert candidate(xCorner = 8,yCorner = 8,circles = [[1, 8, 1], [8, 1, 1], [4, 4, 2], [2, 2, 1], [6, 6, 1], [5, 5, 1], [3, 3, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 3,circles = [[5, 2, 1], [4, 2, 1], [6, 2, 1], [3, 2, 1], [7, 2, 1], [2, 2, 1], [8, 2, 1], [5, 1, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[1, 1, 1], [20, 20, 1], [10, 10, 5], [15, 5, 3]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 10, 5], [10, 5, 5], [20, 20, 5], [15, 15, 5], [25, 5, 5], [5, 25, 5]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [45, 45, 1], [46, 46, 1], [47, 47, 1], [48, 48, 1], [49, 49, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1], [5, 5, 2], [3, 3, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[8, 8, 3], [7, 7, 2], [6, 6, 1], [9, 9, 2], [10, 10, 3], [11, 11, 4]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [20, 20, 5], [30, 30, 5], [40, 40, 5], [50, 50, 5]]) == False\n assert candidate(xCorner = 80,yCorner = 60,circles = [[10, 10, 10], [20, 20, 10], [30, 30, 10], [40, 40, 10], [50, 50, 10], [60, 60, 10], [70, 70, 10]]) == False\n assert candidate(xCorner = 10000,yCorner = 10000,circles = [[1000, 1000, 500], [9000, 9000, 500], [5000, 5000, 1500], [5000, 5000, 1000]]) == True\n assert candidate(xCorner = 7,yCorner = 7,circles = [[1, 1, 1], [1, 7, 1], [7, 1, 1], [7, 7, 1], [3, 4, 1], [4, 3, 1], [4, 5, 1], [5, 4, 1]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 30,yCorner = 40,circles = [[10, 10, 5], [20, 20, 10], [5, 5, 2], [25, 25, 4]]) == True\n assert candidate(xCorner = 50,yCorner = 50,circles = [[25, 25, 10], [30, 30, 15], [20, 20, 5], [10, 40, 5]]) == True\n assert candidate(xCorner = 100000,yCorner = 100000,circles = [[10000, 10000, 5000], [90000, 90000, 5000], [50000, 50000, 15000], [50000, 50000, 10000]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 20], [30, 30, 5], [70, 70, 5], [10, 10, 2], [90, 90, 2], [10, 90, 2], [90, 10, 2], [50, 10, 10], [50, 90, 10]]) == True\n assert candidate(xCorner = 500000000,yCorner = 500000000,circles = [[250000000, 250000000, 100000000], [300000000, 300000000, 150000000]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[10, 10, 5], [90, 90, 5], [50, 50, 20], [50, 50, 10]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[100, 100, 100], [900, 900, 100], [500, 500, 500], [300, 700, 200], [700, 300, 200]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000], [1000000000, 1000000000, 1]]) == False\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[1, 1, 1], [1000, 1000, 1], [500, 500, 100], [900, 900, 50]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 499999999], [1000000000, 1000000000, 1]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[3, 3, 2], [6, 6, 2], [4, 4, 1], [5, 5, 1]]) == True\n assert candidate(xCorner = 50,yCorner = 50,circles = [[25, 25, 10], [10, 10, 5], [40, 40, 5], [5, 5, 2], [45, 45, 2], [10, 40, 2], [40, 10, 2]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 10], [40, 40, 10], [60, 60, 10], [50, 30, 10], [50, 70, 10]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1], [5, 5, 2], [2, 5, 1], [5, 2, 1]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [20, 20, 5], [30, 30, 5], [40, 40, 5]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[100, 100, 100], [900, 900, 100], [500, 500, 300], [500, 500, 200]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 5, 4], [20, 20, 4], [15, 15, 4], [10, 10, 3], [25, 25, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 4], [15, 15, 4], [10, 10, 6]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 10], [20, 20, 5], [80, 80, 5], [10, 10, 2], [90, 90, 2], [10, 90, 2], [90, 10, 2], [50, 10, 5], [50, 90, 5], [10, 50, 5], [90, 50, 5]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 2], [9, 9, 2], [5, 5, 3]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [40, 40, 5], [10, 40, 5], [40, 10, 5], [25, 25, 10]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[2, 2, 2], [3, 3, 1], [4, 4, 2], [5, 5, 1], [6, 6, 2], [7, 7, 1], [8, 8, 2]]) == False\n assert candidate(xCorner = 100,yCorner = 50,circles = [[25, 25, 15], [75, 25, 15], [50, 45, 10]]) == True\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 2], [2, 2, 2], [3, 3, 2], [4, 4, 2], [5, 5, 2], [6, 6, 2], [7, 7, 2], [8, 8, 2], [9, 9, 2], [10, 10, 2], [11, 11, 2], [12, 12, 2], [13, 13, 2], [14, 14, 2]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [13, 13, 1], [14, 14, 1], [15, 15, 1], [16, 16, 1], [17, 17, 1], [18, 18, 1], [19, 19, 1], [20, 20, 1], [21, 21, 1], [22, 22, 1], [23, 23, 1], [24, 24, 1], [25, 25, 1], [1, 1, 12], [25, 25, 12]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[25, 25, 20], [75, 75, 20], [50, 50, 10], [10, 90, 10], [90, 10, 10]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[499999999, 499999999, 100000000], [500000000, 500000000, 200000000]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[999999999, 999999999, 10], [1, 1, 100], [500000000, 500000000, 1000000]]) == False\n assert candidate(xCorner = 18,yCorner = 18,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [13, 13, 1], [14, 14, 1], [15, 15, 1], [16, 16, 1], [17, 17, 1], [18, 18, 1], [9, 9, 5]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 20], [30, 70, 15], [70, 30, 15], [10, 10, 5], [90, 90, 5], [20, 20, 3], [80, 80, 3]]) == True\n assert candidate(xCorner = 12,yCorner = 12,circles = [[6, 6, 3], [3, 3, 2], [9, 9, 2], [1, 1, 1], [11, 11, 1]]) == False\n assert candidate(xCorner = 18,yCorner = 18,circles = [[9, 9, 5], [1, 1, 1], [17, 17, 1], [1, 17, 1], [17, 1, 1], [5, 5, 1], [13, 13, 1], [7, 13, 1], [13, 7, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 3], [10, 10, 3], [15, 15, 3], [2, 2, 1], [18, 18, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[3, 3, 2], [7, 7, 2], [5, 5, 1]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 40], [70, 30, 20], [30, 70, 25], [10, 10, 5], [90, 90, 5]]) == True\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 1], [15, 15, 1], [10, 10, 5], [5, 15, 1], [15, 5, 1]]) == True\n", "comparison": "exact"}, "public_tests": ["3\n4\n[[2,1,1]]", "3\n3\n[[1,1,2]]", "3\n3\n[[2,1,1],[1,2,1]]", "4\n4\n[[5,5,1]]"], "hints": ["Create a graph with n + 4 vertices.", "Vertices 0 to n - 1 represent the circles, vertex n represents upper edge, vertex n + 1 represents right edge, vertex n + 2 represents lower edge, and vertex n + 3 represents left edge.", "Add an edge between these vertices if they intersect or touch.", "Answer will be false when any of two sides left-right, left-bottom, right-top or top-bottom are reachable using the edges."], "metadata": {"canonical_parameter_names": ["xCorner", "yCorner", "circles"], "leetcode_dataset_entry_point": "Solution().canReachCorner", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:17:56+00:00", "tests_total": 105, "tests_dropped": 0, "flags": ["has_images"], "topic_tags": ["array", "math", "depth-first-search", "breadth-first-search", "union-find", "geometry"]}, "language": "php", "interface": {"raw_signature": "function canReachCorner($xCorner, $yCorner, $circles) {", "container": "Solution", "callable": "canReachCorner", "parameters": [{"name": "xCorner", "type": "Integer"}, {"name": "yCorner", "type": "Integer"}, {"name": "circles", "type": "Integer[][]"}], "return_type": "Boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} +{"question_id": 3235, "task_id": "check-if-the-rectangle-corner-is-reachable", "difficulty": "Hard", "problem_description": "You are given two positive integers xCorner and yCorner, and a 2D array circles, where circles[i] = [x_i, y_i, r_i] denotes a circle with center at (x_i, y_i) and radius r_i.\n\nThere is a rectangle in the coordinate plane with its bottom left corner at the origin and top right corner at the coordinate (xCorner, yCorner). You need to check whether there is a path from the bottom left corner to the top right corner such that the entire path lies inside the rectangle, does not touch or lie inside any circle, and touches the rectangle only at the two corners.\n\nReturn true if such a path exists, and false otherwise.\n\nExample 1:\n\nInput: xCorner = 3, yCorner = 4, circles = [[2,1,1]]\nOutput: true\nExplanation:\nThe black curve shows a possible path between (0, 0) and (3, 4).\n\nExample 2:\n\nInput: xCorner = 3, yCorner = 3, circles = [[1,1,2]]\nOutput: false\nExplanation:\nNo path exists from (0, 0) to (3, 3).\n\nExample 3:\n\nInput: xCorner = 3, yCorner = 3, circles = [[2,1,1],[1,2,1]]\nOutput: false\nExplanation:\nNo path exists from (0, 0) to (3, 3).\n\nExample 4:\n\nInput: xCorner = 4, yCorner = 4, circles = [[5,5,1]]\nOutput: true\nExplanation:\n\nConstraints:\n\n- 3 <= xCorner, yCorner <= 10^9\n- 1 <= circles.length <= 1000\n- circles[i].length == 3\n- 1 <= x_i, y_i, r_i <= 10^9\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 499999999]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[1, 1, 1], [4, 4, 1], [2, 2, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 100000000]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [2, 2, 1]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[2, 2, 1], [3, 3, 1]]) == True\n assert candidate(xCorner = 5,yCorner = 5,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 1]]) == True\n assert candidate(xCorner = 3,yCorner = 3,circles = [[2, 1, 1], [1, 2, 1]]) == False\n assert candidate(xCorner = 3,yCorner = 4,circles = [[2, 1, 1]]) == True\n assert candidate(xCorner = 4,yCorner = 4,circles = [[5, 5, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 1], [3, 3, 2]]) == True\n assert candidate(xCorner = 3,yCorner = 3,circles = [[1, 1, 2]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[3, 3, 3], [12, 12, 3], [7, 7, 2], [9, 9, 1]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[10, 10, 5], [15, 15, 3], [5, 5, 2], [18, 2, 1], [2, 18, 1]]) == True\n assert candidate(xCorner = 25,yCorner = 25,circles = [[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5]]) == False\n assert candidate(xCorner = 8,yCorner = 8,circles = [[2, 2, 3], [6, 6, 3]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [2, 2, 3], [8, 8, 3]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 5, 1], [9, 5, 1], [5, 1, 1], [5, 9, 1], [2, 2, 2], [8, 2, 2], [2, 8, 2], [8, 8, 2]]) == False\n assert candidate(xCorner = 8,yCorner = 8,circles = [[4, 4, 2], [2, 2, 1], [6, 6, 1], [1, 7, 2], [7, 1, 2]]) == True\n assert candidate(xCorner = 1000000,yCorner = 1000000,circles = [[500000, 500000, 300000], [300000, 300000, 100000], [700000, 700000, 100000], [100000, 100000, 50000], [900000, 900000, 50000], [100000, 900000, 50000], [900000, 100000, 50000], [500000, 100000, 200000], [500000, 900000, 200000]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 1], [14, 14, 1], [7, 7, 5]]) == False\n assert candidate(xCorner = 7,yCorner = 7,circles = [[3, 3, 1], [4, 3, 1], [3, 4, 1], [4, 4, 1], [2, 2, 1], [2, 3, 1], [3, 2, 1], [2, 4, 1], [4, 2, 1]]) == True\n assert candidate(xCorner = 30,yCorner = 30,circles = [[1, 1, 1], [29, 29, 1], [15, 15, 10], [15, 15, 5]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 4], [2, 2, 1], [8, 8, 1], [1, 1, 1], [9, 9, 1], [4, 1, 1], [1, 4, 1], [8, 4, 1], [4, 8, 1]]) == False\n assert candidate(xCorner = 3,yCorner = 10,circles = [[2, 5, 1], [1, 3, 1], [2, 8, 1], [1, 7, 1], [2, 2, 1], [1, 1, 1], [2, 9, 1], [1, 9, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 5, 2], [5, 1, 2], [5, 9, 2], [9, 5, 2]]) == True\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 1], [15, 15, 1], [1, 15, 1], [15, 1, 1], [8, 8, 3], [7, 7, 2], [9, 9, 2]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[1, 1, 1], [1, 20, 1], [20, 1, 1], [20, 20, 1], [10, 10, 5]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[999999999, 999999999, 1], [500000000, 500000000, 500000000]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[5, 5, 5], [45, 45, 5], [25, 25, 10], [15, 15, 3], [35, 35, 3]]) == False\n assert candidate(xCorner = 150,yCorner = 150,circles = [[10, 10, 10], [20, 20, 10], [30, 30, 10], [40, 40, 10], [50, 50, 10], [60, 60, 10], [70, 70, 10], [80, 80, 10], [90, 90, 10], [100, 100, 10], [110, 110, 10], [120, 120, 10], [130, 130, 10], [140, 140, 10], [150, 150, 10]]) == False\n assert candidate(xCorner = 20,yCorner = 15,circles = [[10, 10, 5], [15, 15, 3], [5, 5, 4]]) == True\n assert candidate(xCorner = 15,yCorner = 20,circles = [[1, 1, 1], [14, 19, 1], [8, 10, 2], [7, 8, 2], [9, 8, 2], [8, 7, 2], [8, 9, 2]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 25, 20], [50, 75, 20], [25, 50, 20], [75, 50, 20]]) == True\n assert candidate(xCorner = 500,yCorner = 500,circles = [[100, 100, 50], [400, 400, 50], [250, 250, 150], [250, 250, 100]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[500000000, 500000000, 100000000], [900000000, 900000000, 100000000], [100000000, 100000000, 100000000]]) == False\n assert candidate(xCorner = 500,yCorner = 500,circles = [[250, 250, 150], [100, 100, 50], [400, 400, 50], [50, 50, 20], [450, 450, 20], [100, 450, 20], [450, 100, 20], [250, 50, 100], [250, 450, 100]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[5, 5, 2], [5, 5, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[3, 3, 1], [6, 6, 1], [2, 8, 2], [8, 2, 2]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[500, 500, 300], [300, 300, 100], [700, 700, 100], [100, 100, 50], [900, 900, 50], [100, 900, 50], [900, 100, 50], [500, 100, 200], [500, 900, 200]]) == False\n assert candidate(xCorner = 6,yCorner = 8,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [1, 8, 1], [6, 1, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[25, 25, 20], [75, 75, 20], [50, 50, 20], [25, 75, 20], [75, 25, 20]]) == True\n assert candidate(xCorner = 9,yCorner = 9,circles = [[2, 2, 2], [2, 6, 2], [6, 2, 2], [6, 6, 2], [5, 5, 1]]) == False\n assert candidate(xCorner = 7,yCorner = 7,circles = [[2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 1000000,yCorner = 1000000,circles = [[100000, 100000, 50000], [900000, 900000, 50000], [500000, 500000, 150000], [500000, 500000, 100000]]) == True\n assert candidate(xCorner = 7,yCorner = 7,circles = [[1, 6, 1], [2, 5, 1], [3, 4, 1], [4, 3, 1], [5, 2, 1], [6, 1, 1], [7, 7, 1], [7, 6, 1], [7, 5, 1], [7, 4, 1], [7, 3, 1], [7, 2, 1], [7, 1, 1]]) == False\n assert candidate(xCorner = 30,yCorner = 40,circles = [[15, 20, 5], [10, 25, 6], [20, 10, 4], [5, 30, 3], [25, 5, 2]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 30], [70, 70, 20], [30, 30, 25], [10, 10, 10], [90, 90, 10]]) == False\n assert candidate(xCorner = 12,yCorner = 12,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [1, 12, 1], [12, 1, 1]]) == False\n assert candidate(xCorner = 12,yCorner = 12,circles = [[1, 1, 2], [2, 2, 2], [3, 3, 2], [4, 4, 2], [5, 5, 2], [6, 6, 2], [7, 7, 2], [8, 8, 2], [9, 9, 2], [10, 10, 2], [11, 11, 2]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 10, 3], [10, 5, 3], [10, 15, 3], [15, 10, 3], [10, 10, 5]]) == True\n assert candidate(xCorner = 8,yCorner = 8,circles = [[1, 8, 1], [8, 1, 1], [4, 4, 2], [2, 2, 1], [6, 6, 1], [5, 5, 1], [3, 3, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 3,circles = [[5, 2, 1], [4, 2, 1], [6, 2, 1], [3, 2, 1], [7, 2, 1], [2, 2, 1], [8, 2, 1], [5, 1, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[1, 1, 1], [20, 20, 1], [10, 10, 5], [15, 5, 3]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 10, 5], [10, 5, 5], [20, 20, 5], [15, 15, 5], [25, 5, 5], [5, 25, 5]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [45, 45, 1], [46, 46, 1], [47, 47, 1], [48, 48, 1], [49, 49, 1]]) == False\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1], [5, 5, 2], [3, 3, 1], [7, 7, 1]]) == False\n assert candidate(xCorner = 15,yCorner = 15,circles = [[8, 8, 3], [7, 7, 2], [6, 6, 1], [9, 9, 2], [10, 10, 3], [11, 11, 4]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [20, 20, 5], [30, 30, 5], [40, 40, 5], [50, 50, 5]]) == False\n assert candidate(xCorner = 80,yCorner = 60,circles = [[10, 10, 10], [20, 20, 10], [30, 30, 10], [40, 40, 10], [50, 50, 10], [60, 60, 10], [70, 70, 10]]) == False\n assert candidate(xCorner = 10000,yCorner = 10000,circles = [[1000, 1000, 500], [9000, 9000, 500], [5000, 5000, 1500], [5000, 5000, 1000]]) == True\n assert candidate(xCorner = 7,yCorner = 7,circles = [[1, 1, 1], [1, 7, 1], [7, 1, 1], [7, 7, 1], [3, 4, 1], [4, 3, 1], [4, 5, 1], [5, 4, 1]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1]]) == False\n assert candidate(xCorner = 30,yCorner = 40,circles = [[10, 10, 5], [20, 20, 10], [5, 5, 2], [25, 25, 4]]) == True\n assert candidate(xCorner = 50,yCorner = 50,circles = [[25, 25, 10], [30, 30, 15], [20, 20, 5], [10, 40, 5]]) == True\n assert candidate(xCorner = 100000,yCorner = 100000,circles = [[10000, 10000, 5000], [90000, 90000, 5000], [50000, 50000, 15000], [50000, 50000, 10000]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 20], [30, 30, 5], [70, 70, 5], [10, 10, 2], [90, 90, 2], [10, 90, 2], [90, 10, 2], [50, 10, 10], [50, 90, 10]]) == True\n assert candidate(xCorner = 500000000,yCorner = 500000000,circles = [[250000000, 250000000, 100000000], [300000000, 300000000, 150000000]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[10, 10, 5], [90, 90, 5], [50, 50, 20], [50, 50, 10]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[100, 100, 100], [900, 900, 100], [500, 500, 500], [300, 700, 200], [700, 300, 200]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 500000000], [1000000000, 1000000000, 1]]) == False\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[1, 1, 1], [1000, 1000, 1], [500, 500, 100], [900, 900, 50]]) == False\n assert candidate(xCorner = 1000000000,yCorner = 1000000000,circles = [[500000000, 500000000, 499999999], [1000000000, 1000000000, 1]]) == False\n assert candidate(xCorner = 9,yCorner = 9,circles = [[3, 3, 2], [6, 6, 2], [4, 4, 1], [5, 5, 1]]) == True\n assert candidate(xCorner = 50,yCorner = 50,circles = [[25, 25, 10], [10, 10, 5], [40, 40, 5], [5, 5, 2], [45, 45, 2], [10, 40, 2], [40, 10, 2]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 10], [40, 40, 10], [60, 60, 10], [50, 30, 10], [50, 70, 10]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 1], [9, 9, 1], [5, 5, 2], [2, 5, 1], [5, 2, 1]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [20, 20, 5], [30, 30, 5], [40, 40, 5]]) == True\n assert candidate(xCorner = 1000,yCorner = 1000,circles = [[100, 100, 100], [900, 900, 100], [500, 500, 300], [500, 500, 200]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 5, 4], [20, 20, 4], [15, 15, 4], [10, 10, 3], [25, 25, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 4], [15, 15, 4], [10, 10, 6]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 10], [20, 20, 5], [80, 80, 5], [10, 10, 2], [90, 90, 2], [10, 90, 2], [90, 10, 2], [50, 10, 5], [50, 90, 5], [10, 50, 5], [90, 50, 5]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[1, 1, 2], [9, 9, 2], [5, 5, 3]]) == False\n assert candidate(xCorner = 50,yCorner = 50,circles = [[10, 10, 5], [40, 40, 5], [10, 40, 5], [40, 10, 5], [25, 25, 10]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[2, 2, 2], [3, 3, 1], [4, 4, 2], [5, 5, 1], [6, 6, 2], [7, 7, 1], [8, 8, 2]]) == False\n assert candidate(xCorner = 100,yCorner = 50,circles = [[25, 25, 15], [75, 25, 15], [50, 45, 10]]) == True\n assert candidate(xCorner = 15,yCorner = 15,circles = [[1, 1, 2], [2, 2, 2], [3, 3, 2], [4, 4, 2], [5, 5, 2], [6, 6, 2], [7, 7, 2], [8, 8, 2], [9, 9, 2], [10, 10, 2], [11, 11, 2], [12, 12, 2], [13, 13, 2], [14, 14, 2]]) == False\n assert candidate(xCorner = 25,yCorner = 25,circles = [[5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [13, 13, 1], [14, 14, 1], [15, 15, 1], [16, 16, 1], [17, 17, 1], [18, 18, 1], [19, 19, 1], [20, 20, 1], [21, 21, 1], [22, 22, 1], [23, 23, 1], [24, 24, 1], [25, 25, 1], [1, 1, 12], [25, 25, 12]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[25, 25, 20], [75, 75, 20], [50, 50, 10], [10, 90, 10], [90, 10, 10]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[499999999, 499999999, 100000000], [500000000, 500000000, 200000000]]) == True\n assert candidate(xCorner = 999999999,yCorner = 999999999,circles = [[999999999, 999999999, 10], [1, 1, 100], [500000000, 500000000, 1000000]]) == False\n assert candidate(xCorner = 18,yCorner = 18,circles = [[1, 1, 1], [2, 2, 1], [3, 3, 1], [4, 4, 1], [5, 5, 1], [6, 6, 1], [7, 7, 1], [8, 8, 1], [9, 9, 1], [10, 10, 1], [11, 11, 1], [12, 12, 1], [13, 13, 1], [14, 14, 1], [15, 15, 1], [16, 16, 1], [17, 17, 1], [18, 18, 1], [9, 9, 5]]) == False\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 20], [30, 70, 15], [70, 30, 15], [10, 10, 5], [90, 90, 5], [20, 20, 3], [80, 80, 3]]) == True\n assert candidate(xCorner = 12,yCorner = 12,circles = [[6, 6, 3], [3, 3, 2], [9, 9, 2], [1, 1, 1], [11, 11, 1]]) == False\n assert candidate(xCorner = 18,yCorner = 18,circles = [[9, 9, 5], [1, 1, 1], [17, 17, 1], [1, 17, 1], [17, 1, 1], [5, 5, 1], [13, 13, 1], [7, 13, 1], [13, 7, 1]]) == False\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 3], [10, 10, 3], [15, 15, 3], [2, 2, 1], [18, 18, 1]]) == True\n assert candidate(xCorner = 10,yCorner = 10,circles = [[3, 3, 2], [7, 7, 2], [5, 5, 1]]) == True\n assert candidate(xCorner = 100,yCorner = 100,circles = [[50, 50, 40], [70, 30, 20], [30, 70, 25], [10, 10, 5], [90, 90, 5]]) == True\n assert candidate(xCorner = 20,yCorner = 20,circles = [[5, 5, 1], [15, 15, 1], [10, 10, 5], [5, 15, 1], [15, 5, 1]]) == True\n", "comparison": "exact"}, "public_tests": ["3\n4\n[[2,1,1]]", "3\n3\n[[1,1,2]]", "3\n3\n[[2,1,1],[1,2,1]]", "4\n4\n[[5,5,1]]"], "hints": ["Create a graph with n + 4 vertices.", "Vertices 0 to n - 1 represent the circles, vertex n represents upper edge, vertex n + 1 represents right edge, vertex n + 2 represents lower edge, and vertex n + 3 represents left edge.", "Add an edge between these vertices if they intersect or touch.", "Answer will be false when any of two sides left-right, left-bottom, right-top or top-bottom are reachable using the edges."], "metadata": {"canonical_parameter_names": ["xCorner", "yCorner", "circles"], "leetcode_dataset_entry_point": "Solution().canReachCorner", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:17:56+00:00", "tests_total": 105, "tests_dropped": 1, "flags": ["has_images"], "topic_tags": ["array", "math", "depth-first-search", "breadth-first-search", "union-find", "geometry"]}, "language": "php", "interface": {"raw_signature": "function canReachCorner($xCorner, $yCorner, $circles) {", "container": "Solution", "callable": "canReachCorner", "parameters": [{"name": "xCorner", "type": "Integer"}, {"name": "yCorner", "type": "Integer"}, {"name": "circles", "type": "Integer[][]"}], "return_type": "Boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} {"question_id": 3238, "task_id": "find-the-number-of-winning-players", "difficulty": "Easy", "problem_description": "You are given an integer n representing the number of players in a game and a 2D array pick where pick[i] = [x_i, y_i] represents that the player x_i picked a ball of color y_i.\n\nPlayer i wins the game if they pick strictly more than i balls of the same color. In other words,\n\n- Player 0 wins if they pick any ball.\n- Player 1 wins if they pick at least two balls of the same color.\n- ...\n- Player i wins if they pick at least i + 1 balls of the same color.\n\nReturn the number of players who win the game.\n\nNote that multiple players can win the game.\n\nExample 1:\n\nInput: n = 4, pick = [[0,0],[1,0],[1,0],[2,1],[2,1],[2,0]]\nOutput: 2\nExplanation:\nPlayer 0 and player 1 win the game, while players 2 and 3 do not win.\n\nExample 2:\n\nInput: n = 5, pick = [[1,1],[1,2],[1,3],[1,4]]\nOutput: 0\nExplanation:\nNo player wins the game.\n\nExample 3:\n\nInput: n = 5, pick = [[1,1],[2,4],[2,4],[2,4]]\nOutput: 1\nExplanation:\nPlayer 2 wins the game by picking 3 balls with color 4.\n\nConstraints:\n\n- 2 <= n <= 10\n- 1 <= pick.length <= 100\n- pick[i].length == 2\n- 0 <= x_i <= n - 1\n- 0 <= y_i <= 10\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(n = 10,pick = [[0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3]]) == 4\n assert candidate(n = 10,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]) == 1\n assert candidate(n = 3,pick = [[0, 0], [1, 0], [1, 0], [1, 0]]) == 2\n assert candidate(n = 5,pick = [[1, 1], [2, 4], [2, 4], [2, 4]]) == 1\n assert candidate(n = 2,pick = [[0, 0], [1, 1], [1, 1]]) == 2\n assert candidate(n = 5,pick = [[1, 1], [1, 2], [1, 3], [1, 4]]) == 0\n assert candidate(n = 2,pick = [[0, 0], [1, 0], [1, 0], [1, 0]]) == 2\n assert candidate(n = 4,pick = [[0, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 0]]) == 2\n assert candidate(n = 3,pick = [[0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2]]) == 3\n assert candidate(n = 4,pick = [[0, 1], [0, 2], [0, 3], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [0, 1], [0, 2], [0, 3], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]) == 2\n assert candidate(n = 10,pick = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4]]) == 5\n assert candidate(n = 4,pick = [[0, 1], [1, 1], [1, 2], [2, 2], [2, 2], [2, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2]]) == 3\n assert candidate(n = 5,pick = [[0, 1], [1, 1], [1, 2], [2, 2], [2, 2], [2, 3], [2, 3], [3, 3], [3, 3], [3, 4], [3, 4], [4, 4], [4, 5], [4, 5], [4, 6]]) == 1\n assert candidate(n = 6,pick = [[0, 0], [1, 1], [1, 1], [1, 2], [2, 2], [2, 2], [2, 2], [2, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5]]) == 6\n assert candidate(n = 10,pick = [[0, 0], [1, 0], [1, 0], [2, 0], [2, 0], [2, 0], [2, 1], [3, 0], [3, 1], [3, 2], [3, 2], [3, 2], [4, 0], [4, 1], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 4], [5, 4], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 5], [6, 5], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 6], [7, 6], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 7], [8, 7], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 8], [9, 8]]) == 3\n assert candidate(n = 7,pick = [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [3, 4], [4, 5], [4, 5], [4, 5], [4, 5], [5, 6], [5, 6], [5, 6], [5, 6], [6, 7], [6, 7], [6, 7], [6, 7], [6, 7], [6, 7], [6, 7]]) == 5\n assert candidate(n = 3,pick = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [2, 0], [2, 1], [2, 2], [2, 0], [2, 1], [2, 2], [2, 0], [2, 1], [2, 2]]) == 3\n assert candidate(n = 4,pick = [[0, 1], [0, 2], [0, 3], [1, 1], [1, 1], [1, 2], [2, 1], [2, 2], [2, 2], [3, 1], [3, 2], [3, 3], [3, 3], [3, 3]]) == 2\n assert candidate(n = 6,pick = [[0, 0], [1, 0], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [3, 3], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]]) == 2\n assert candidate(n = 7,pick = [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [2, 2], [3, 2], [3, 3], [3, 3], [3, 3], [4, 3], [4, 4], [4, 4], [4, 4], [5, 4], [5, 4], [5, 5], [5, 5], [5, 5], [5, 5], [6, 5], [6, 5], [6, 5], [6, 6], [6, 6]]) == 1\n assert candidate(n = 3,pick = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) == 2\n assert candidate(n = 5,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) == 2\n assert candidate(n = 5,pick = [[0, 0], [0, 0], [0, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4]]) == 5\n assert candidate(n = 8,pick = [[0, 0], [0, 0], [0, 0], [1, 0], [1, 0], [1, 0], [1, 1], [1, 1], [2, 0], [2, 0], [2, 0], [2, 1], [2, 1], [2, 2], [2, 2], [3, 0], [3, 0], [3, 0], [3, 1], [3, 1], [3, 1], [3, 2], [3, 2], [3, 2], [3, 3], [3, 3], [4, 0], [4, 0], [4, 0], [4, 0], [4, 1], [4, 1], [4, 1], [4, 1], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4]]) == 3\n assert candidate(n = 7,pick = [[0, 1], [0, 2], [0, 3], [1, 1], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3], [4, 1], [4, 2], [4, 3], [4, 4], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]) == 2\n assert candidate(n = 5,pick = [[0, 0], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3]]) == 4\n assert candidate(n = 6,pick = [[0, 0], [1, 0], [1, 0], [1, 0], [2, 0], [2, 0], [2, 0], [2, 0], [3, 0], [3, 0], [3, 0], [3, 0], [3, 0], [4, 0], [4, 0], [4, 0], [4, 0], [4, 0], [5, 0], [5, 0], [5, 0], [5, 0], [5, 0], [5, 0]]) == 6\n assert candidate(n = 5,pick = [[0, 0], [0, 1], [1, 0], [1, 0], [1, 1], [2, 1], [2, 1], [2, 1], [3, 2], [3, 2], [3, 2], [3, 2]]) == 4\n assert candidate(n = 10,pick = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2]]) == 1\n assert candidate(n = 7,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]) == 4\n assert candidate(n = 6,pick = [[0, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 2], [1, 2], [2, 2], [2, 2], [2, 2], [2, 3], [2, 3], [2, 3], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5]]) == 6\n assert candidate(n = 10,pick = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1]]) == 1\n assert candidate(n = 5,pick = [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [2, 2], [3, 2], [3, 2], [3, 3], [4, 3], [4, 4], [4, 4], [4, 4]]) == 1\n assert candidate(n = 4,pick = [[0, 0], [0, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]]) == 4\n assert candidate(n = 7,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [0, 0], [1, 1], [2, 2]]) == 3\n assert candidate(n = 5,pick = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4]]) == 1\n assert candidate(n = 6,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]) == 1\n assert candidate(n = 4,pick = [[0, 1], [0, 1], [0, 1], [1, 1], [1, 1], [1, 1], [1, 1], [2, 1], [2, 1], [2, 1], [2, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1]]) == 4\n assert candidate(n = 8,pick = [[0, 0], [0, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]]) == 4\n assert candidate(n = 5,pick = [[0, 0], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [3, 3], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4]]) == 1\n assert candidate(n = 5,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 4\n assert candidate(n = 5,pick = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 0], [1, 1], [1, 1], [1, 2], [1, 2], [2, 0], [2, 0], [2, 1], [2, 2], [3, 0], [3, 0], [3, 0], [4, 0]]) == 2\n assert candidate(n = 10,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0], [9, 0], [9, 0], [9, 0], [9, 0]]) == 1\n assert candidate(n = 10,pick = [[0, 0], [0, 0], [0, 0], [1, 0], [1, 0], [1, 0], [1, 1], [1, 1], [2, 0], [2, 0], [2, 0], [2, 1], [2, 1], [2, 2], [2, 2], [3, 0], [3, 0], [3, 0], [3, 1], [3, 1], [3, 1], [3, 2], [3, 2], [3, 2], [3, 3], [3, 3], [4, 0], [4, 0], [4, 0], [4, 0], [4, 1], [4, 1], [4, 1], [4, 1], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 4], [4, 4], [4, 4], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [6, 6], [6, 6], [6, 6], [6, 6], [6, 6], [6, 6], [6, 6], [7, 7], [7, 7], [7, 7], [7, 7], [7, 7], [7, 7], [7, 7], [7, 7], [8, 8], [8, 8], [8, 8], [8, 8], [8, 8], [8, 8], [8, 8], [8, 8], [8, 8], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9], [9, 9]]) == 8\n assert candidate(n = 6,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]) == 5\n assert candidate(n = 6,pick = [[0, 1], [0, 1], [1, 2], [1, 2], [1, 2], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [4, 5], [4, 5], [5, 6]]) == 3\n assert candidate(n = 10,pick = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1]]) == 1\n assert candidate(n = 5,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [0, 3], [1, 4], [2, 5], [3, 6], [4, 7]]) == 1\n assert candidate(n = 5,pick = [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5]]) == 5\n assert candidate(n = 10,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 4\n assert candidate(n = 4,pick = [[0, 0], [0, 1], [1, 0], [1, 1], [1, 0], [1, 1], [1, 0], [1, 1], [1, 0], [1, 1], [2, 0], [2, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [3, 0], [3, 1], [3, 2], [3, 0], [3, 1], [3, 2], [3, 0], [3, 1], [3, 2], [3, 0], [3, 1], [3, 2]]) == 4\n assert candidate(n = 5,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]) == 5\n assert candidate(n = 10,pick = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]]) == 3\n assert candidate(n = 6,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [0, 1], [0, 1], [1, 2], [1, 2], [2, 3], [2, 3], [3, 4], [3, 4], [4, 5], [4, 5], [5, 6], [5, 6], [0, 1], [0, 1], [0, 1], [1, 2], [1, 2], [1, 2], [1, 2], [2, 3], [2, 3], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [5, 6], [5, 6], [5, 6], [5, 6], [5, 6], [5, 6], [5, 6]]) == 6\n assert candidate(n = 4,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [0, 1], [1, 2], [2, 3], [3, 4], [0, 1], [1, 2]]) == 2\n assert candidate(n = 7,pick = [[0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [3, 1], [4, 1], [5, 1], [6, 1], [4, 1], [5, 1], [6, 1], [5, 1], [6, 1], [6, 1]]) == 7\n assert candidate(n = 9,pick = [[0, 0], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [3, 3], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 5], [8, 6], [8, 7], [8, 8]]) == 1\n assert candidate(n = 6,pick = [[0, 0], [0, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4]]) == 5\n assert candidate(n = 5,pick = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [4, 0]]) == 1\n assert candidate(n = 5,pick = [[0, 0], [1, 1], [1, 2], [2, 2], [2, 3], [3, 3], [3, 3], [3, 4], [4, 0], [4, 1], [4, 1]]) == 1\n assert candidate(n = 10,pick = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [0, 1], [0, 1], [1, 2], [1, 2], [1, 2], [2, 3], [2, 3], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4]]) == 4\n assert candidate(n = 5,pick = [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [2, 2], [3, 2], [3, 3], [3, 3], [3, 3]]) == 1\n assert candidate(n = 5,pick = [[0, 1], [1, 1], [1, 2], [2, 2], [2, 3], [2, 3], [3, 3], [3, 4], [3, 4], [3, 4], [4, 4]]) == 1\n assert candidate(n = 10,pick = [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [2, 2], [3, 2], [3, 3], [3, 3], [3, 3], [4, 3], [4, 4], [4, 4], [4, 4], [5, 4], [5, 4], [5, 5], [5, 5], [5, 5], [5, 5], [6, 5], [6, 5], [6, 5], [6, 6], [6, 6], [7, 6], [7, 6], [7, 6], [7, 6], [7, 7], [8, 7], [8, 7], [8, 7], [8, 7], [8, 8], [8, 8], [9, 8], [9, 8], [9, 8], [9, 8], [9, 9], [9, 9], [9, 9], [9, 9]]) == 1\n assert candidate(n = 6,pick = [[0, 0], [0, 0], [0, 0], [0, 0], [1, 1], [1, 1], [1, 1], [2, 2], [2, 2], [2, 2], [3, 3], [3, 3], [4, 4], [4, 4], [4, 4], [4, 4], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5], [5, 5]]) == 4\n assert candidate(n = 6,pick = [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [2, 2], [3, 2], [3, 3], [3, 3], [3, 3], [4, 3], [4, 4], [4, 4], [4, 4], [5, 4], [5, 4], [5, 5], [5, 5], [5, 5], [5, 5]]) == 1\n assert candidate(n = 5,pick = [[0, 1], [1, 1], [1, 1], [1, 1], [1, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3]]) == 3\n assert candidate(n = 7,pick = [[0, 0], [1, 0], [1, 1], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2], [3, 3], [4, 0], [4, 1], [4, 2], [4, 3], [4, 4], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5], [6, 0], [6, 0], [6, 1], [6, 1], [6, 2], [6, 2], [6, 3], [6, 3], [6, 4], [6, 4], [6, 5], [6, 5]]) == 1\n assert candidate(n = 5,pick = [[0, 0], [1, 0], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3]]) == 5\n", "comparison": "exact"}, "public_tests": ["4\n[[0,0],[1,0],[1,0],[2,1],[2,1],[2,0]]", "5\n[[1,1],[1,2],[1,3],[1,4]]", "5\n[[1,1],[2,4],[2,4],[2,4]]"], "hints": ["Keep track of the number of balls of each color for each user using hashing.", "Find the maximum color that occurred for each player."], "metadata": {"canonical_parameter_names": ["n", "pick"], "leetcode_dataset_entry_point": "Solution().winningPlayerCount", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:18:02+00:00", "tests_total": 69, "tests_dropped": 0, "flags": [], "topic_tags": ["array", "hash-table", "counting"]}, "language": "php", "interface": {"raw_signature": "function winningPlayerCount($n, $pick) {", "container": "Solution", "callable": "winningPlayerCount", "parameters": [{"name": "n", "type": "Integer"}, {"name": "pick", "type": "Integer[][]"}], "return_type": "Integer", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} {"question_id": 3239, "task_id": "minimum-number-of-flips-to-make-binary-grid-palindromic-i", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix grid.\n\nA row or column is considered palindromic if its values read the same forward and backward.\n\nYou can flip any number of cells in grid from 0 to 1, or from 1 to 0.\n\nReturn the minimum number of cells that need to be flipped to make either all rows palindromic or all columns palindromic.\n\nExample 1:\n\nInput: grid = [[1,0,0],[0,0,0],[0,0,1]]\nOutput: 2\nExplanation:\nFlipping the highlighted cells makes all the rows palindromic.\n\nExample 2:\n\nInput: grid = [[0,1],[0,1],[0,0]]\nOutput: 1\nExplanation:\nFlipping the highlighted cell makes all the columns palindromic.\n\nExample 3:\n\nInput: grid = [[1],[0]]\nOutput: 0\nExplanation:\nAll rows are already palindromic.\n\nConstraints:\n\n- m == grid.length\n- n == grid[i].length\n- 1 <= m * n <= 2 * 10^5\n- 0 <= grid[i][j] <= 1\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 1, 1], [1, 1, 0, 0], [1, 0, 1, 0]]) == 2\n assert candidate(grid = [[1], [0]]) == 0\n assert candidate(grid = [[0, 1], [0, 1], [0, 0]]) == 1\n assert candidate(grid = [[1, 1, 0], [0, 1, 0], [0, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0], [0, 0, 0], [0, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 4\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 1, 1], [1, 0, 1, 0, 0], [0, 0, 1, 1, 1]]) == 6\n assert candidate(grid = [[0, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 0], [0, 1, 1, 0, 1], [1, 0, 0, 1, 1], [0, 1, 1, 0, 1]]) == 6\n assert candidate(grid = [[0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0]]) == 4\n assert candidate(grid = [[1, 1, 1, 0, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 0, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 0, 0, 1]]) == 2\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 0, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0]]) == 6\n assert candidate(grid = [[0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1, 1, 0]]) == 20\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 12\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1], [0, 0, 0, 1, 0, 0, 1, 1], [0, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 24\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 12\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]) == 16\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0]]) == 6\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 0]]) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0], [0, 0, 1, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 1, 0], [1, 0, 0, 1], [0, 1, 1, 0], [1, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 0, 1], [1, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1]]) == 3\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1]]) == 16\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(grid = [[0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 1, 1, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1]]) == 6\n assert candidate(grid = [[1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 6\n assert candidate(grid = [[1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1, 1], [0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 7\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 9\n assert candidate(grid = [[0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0]]) == 4\n assert candidate(grid = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 20\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 20\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 1, 1, 1, 1, 0, 1], [0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1, 0], [1, 1, 0, 1, 1, 1, 1, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]]) == 2\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1]]) == 16\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[0, 0, 1, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == 3\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == 0\n", "comparison": "exact"}, "public_tests": ["[[1,0,0],[0,0,0],[0,0,1]]", "[[0,1],[0,1],[0,0]]", "[[1],[0]]"], "hints": ["We need to perform the operation only when the equivalent element of i from the back is not equal."], "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().minFlips", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:18:05+00:00", "tests_total": 77, "tests_dropped": 0, "flags": ["has_images"], "topic_tags": ["array", "two-pointers", "matrix"]}, "language": "php", "interface": {"raw_signature": "function minFlips($grid) {", "container": "Solution", "callable": "minFlips", "parameters": [{"name": "grid", "type": "Integer[][]"}], "return_type": "Integer", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}} {"question_id": 3240, "task_id": "minimum-number-of-flips-to-make-binary-grid-palindromic-ii", "difficulty": "Medium", "problem_description": "You are given an m x n binary matrix grid.\n\nA row or column is considered palindromic if its values read the same forward and backward.\n\nYou can flip any number of cells in grid from 0 to 1, or from 1 to 0.\n\nReturn the minimum number of cells that need to be flipped to make all rows and columns palindromic, and the total number of 1's in grid divisible by 4.\n\nExample 1:\n\nInput: grid = [[1,0,0],[0,1,0],[0,0,1]]\nOutput: 3\nExplanation:\n\nExample 2:\n\nInput: grid = [[0,1],[0,1],[0,0]]\nOutput: 2\nExplanation:\n\nExample 3:\n\nInput: grid = [[1],[1]]\nOutput: 2\nExplanation:\n\nConstraints:\n\n- m == grid.length\n- n == grid[i].length\n- 1 <= m * n <= 2 * 10^5\n- 0 <= grid[i][j] <= 1\n", "canonical_tests": {"language": "python", "source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 1\n assert candidate(grid = [[0, 1], [0, 1], [0, 0]]) == 2\n assert candidate(grid = [[0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 0, 0, 1], [1, 1, 0, 0, 1], [0, 0, 1, 1, 0]]) == 6\n assert candidate(grid = [[1], [1]]) == 2\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0], [0, 1], [1, 0]]) == 3\n assert candidate(grid = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]]) == 8\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 8\n assert candidate(grid = [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 0], [1, 0, 1], [0, 1, 0]]) == 0\n assert candidate(grid = [[1, 0], [0, 1], [1, 0], [0, 1]]) == 4\n assert candidate(grid = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0]]) == 2\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1], [0, 1, 0, 1, 1, 0]]) == 12\n assert candidate(grid = [[1, 1, 0, 1], [0, 0, 0, 0], [1, 0, 0, 1], [1, 1, 1, 1]]) == 3\n assert candidate(grid = [[1, 1, 0, 1], [1, 1, 0, 1], [0, 0, 1, 0], [0, 0, 1, 0], [1, 1, 0, 1], [1, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 1], [0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0]]) == 6\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 10\n assert candidate(grid = [[1, 1, 0, 0], [0, 0, 1, 1], [1, 1, 0, 0], [0, 0, 1, 1]]) == 8\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 18\n assert candidate(grid = [[1, 1, 1, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 0, 0, 0, 1], [1, 1, 1, 1, 1]]) == 1\n assert candidate(grid = [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 0, 1]]) == 6\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0]]) == 8\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0, 1], [1, 1, 0, 0, 0, 1, 1, 0], [0, 0, 1, 1, 1, 0, 0, 1]]) == 15\n assert candidate(grid = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]) == 2\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 12\n assert candidate(grid = [[1, 0, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1]]) == 12\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 0, 1, 1, 0, 1, 0, 1], [0, 1, 0, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [0, 1, 0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1, 0, 1]]) == 4\n assert candidate(grid = [[0, 1, 1, 1, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1, 0, 1], [1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0]]) == 2\n assert candidate(grid = [[1, 1, 0, 0, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0]]) == 15\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1]]) == 8\n assert candidate(grid = [[1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1]]) == 12\n assert candidate(grid = [[1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) == 10\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 1, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1], [1, 1, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0, 1, 1]]) == 16\n assert candidate(grid = [[1, 0, 0, 0, 1, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1]]) == 4\n assert candidate(grid = [[1, 1, 0, 0, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0], [1, 1, 0, 0, 1]]) == 3\n assert candidate(grid = [[1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0], [1, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0], [0, 0, 0, 1, 1], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 1, 1, 0, 0]]) == 7\n assert candidate(grid = [[1, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [1, 0, 0, 0, 0, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1, 0, 0, 0]]) == 18\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 1\n assert candidate(grid = [[1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0, 1]]) == 10\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 20\n assert candidate(grid = [[1, 1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 1, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 0, 1, 1, 0, 0, 1], [1, 1, 0, 0, 1, 1, 1]]) == 7\n assert candidate(grid = [[0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0], [1, 1, 0, 0, 1, 1], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0], [1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 1, 0]]) == 14\n assert candidate(grid = [[0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0]]) == 14\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0]]) == 10\n assert candidate(grid = [[0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0]]) == 8\n assert candidate(grid = [[1, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 35\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]]) == 50\n assert candidate(grid = [[0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]]) == 9\n assert candidate(grid = [[1, 0, 0, 0, 1], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0]]) == 9\n assert candidate(grid = [[1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 1, 0, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 1, 0, 1, 1]]) == 10\n assert candidate(grid = [[1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 1\n assert candidate(grid = [[1, 0, 1, 1, 0], [0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [1, 0, 1, 1, 0]]) == 5\n assert candidate(grid = [[0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 1]]) == 12\n assert candidate(grid = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 0, 0]]) == 12\n assert candidate(grid = [[0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1]]) == 14\n assert candidate(grid = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1]]) == 0\n assert candidate(grid = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1]]) == 10\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 0, 0, 1, 1, 1, 0, 0, 1], [1, 0, 0, 1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1]]) == 2\n assert candidate(grid = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]) == 0\n assert candidate(grid = [[1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1]]) == 4\n assert candidate(grid = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) == 22\n assert candidate(grid = [[1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 1]]) == 0\n", "comparison": "exact"}, "public_tests": ["[[1,0,0],[0,1,0],[0,0,1]]", "[[0,1],[0,1],[0,0]]", "[[1],[1]]"], "hints": ["For each (x, y), find (m - 1 - x, y), (m - 1 - x, n - 1 - y), and (x, n - 1 - y); they should be the same.", "Note that we need to specially handle the middle row (column) if the number of rows (columns) is odd."], "metadata": {"canonical_parameter_names": ["grid"], "leetcode_dataset_entry_point": "Solution().minFlips", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T21:18:07+00:00", "tests_total": 88, "tests_dropped": 0, "flags": ["has_images"], "topic_tags": ["array", "two-pointers", "matrix"]}, "language": "php", "interface": {"raw_signature": "function minFlips($grid) {", "container": "Solution", "callable": "minFlips", "parameters": [{"name": "grid", "type": "Integer[][]"}], "return_type": "Integer", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"}}