[HackerRank] Minimum Swaps 2

Minimum Swaps 2 Problem Link: https://www.hackerrank.com/challenges/minimum-swaps-2 Solution // Complete the minimumSwaps function below. int minimumSwaps(vector<int> arr) { pair<int,int> arrPos[arr.size()]; for(size_t i = 0;i<arr.size();i++){ arrPos[i].first = arr[i]; arrPos[i].second = i; } sort(arrPos, arrPos + arr.size()); int minSwap = 0; vector<bool> visit(arr.size(),false);…

Read More

[Prometheus] Minotoring hệ thống bằng Prometheus

Run prometheus bằng docker Tạo file docker-compose.yml version: “3” services: prometheus: image: prom/prometheus:latest container_name: prometheus volumes: – ./prometheus.yml:/etc/prometheus/prometheus.yml ports: – 9090:9090 Tạo file prometheus.yml chứa danh sách targets hay instance để prometheus server gửi request scrapse metrics: global: scrape_interval: 15s…

Read More