This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int queen_number(int arr[][10], int row,int col) { | |
| int count = 0; | |
| for (int i = 0; i < row; i++) { | |
| for (int j = 0; j < col; j++) { | |
| bool cucdai = true; | |
| for (int dx = -1; dx >= 1; dx++) { | |
| for (int dy = -1; dy >= 1; dy++) { | |
| if (dx == 0 && dy == 0)continue; | |
| int x = i + dx; | |
| int y = j + dy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int container(int arr[], int n) { | |
| int left = 0, right = n-1, count = 0, max = 0; | |
| while (true) { | |
| count = min(arr[left], arr[right]) * (right - left); | |
| if (max < count) { | |
| max = count; | |
| } | |
| if (arr[left] < arr[right]) { | |
| left++; |