blackntt

1 min read

Problem Link: https://www.hackerrank.com/challenges/construct-the-array/problem Solution Giaỉ pháp với dynamic programming: - Giải pháp này bị hạn chế về space complexity O(k*n)...

1 min read

Problem https://www.hackerrank.com/challenges/sherlock-and-cost/problem Solution Use by dynamic programming: long cost(vector<int> B) { map<pair<int,int>, long> v; long v1 = 0; long v2...

1 min read

Problem link: https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem Solution // Complete the rotLeft function below. vector<int> rotLeft(vector<int> a, int d) { vector<int> rotArr(a.size(),0); for(size_t i...

1 min read

Dynamic Array Problem https://www.hackerrank.com/challenges/dynamic-array/problem Solution vector<int> dynamicArray(int n, vector<vector<int>> queries) { vector<int> answers; int lastAnswer = 0; vector<vector<int>> seqs(n,vector<int>()); for...