Skip to content

Instantly share code, notes, and snippets.

View phu529's full-sized avatar

hvphu phu529

View GitHub Profile
@phu529
phu529 / Exercise 2
Created December 2, 2025 14:49
queen_number_in_a_array2D
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;
@phu529
phu529 / Exercise 1
Created December 2, 2025 14:46
container_with_most_water.leetcode
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++;