blackntt

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...

1 min read

Array Manipulation Problem link: https://www.hackerrank.com/challenges/crush/problem Solution // Complete the arrayManipulation function below. long arrayManipulation(int n, vector<vector<int>> queries) { vector<long> addArr(n,0);...

1 min read

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; for(size_t...