MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / main

Function main

189-Rotate-Array/189_Rotate_Array.cpp:27–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27int main() {
28 Solution sol;
29
30 vector<int> test1 = {1, 2, 3, 4, 5, 6, 7};
31 sol.rotate(test1, 3);
32 printVector(test1); // Expected: 5 6 7 1 2 3 4
33
34 vector<int> test2 = {-1, -100, 3, 99};
35 sol.rotate(test2, 2);
36 printVector(test2); // Expected: 3 99 -1 -100
37
38 vector<int> test3 = {1, 2};
39 sol.rotate(test3, 0);
40 printVector(test3); // Expected: 1 2 (no change)
41
42 vector<int> test4 = {};
43 sol.rotate(test4, 1);
44 printVector(test4); // Expected: empty
45
46 return 0;
47}
48

Callers

nothing calls this directly

Calls 2

printVectorFunction · 0.85
rotateMethod · 0.45

Tested by

no test coverage detected