Skip to content

Commit ab52800

Browse files
author
cpppy
authored
Create 168_Excel_Sheet_Column_Title.cc
1 parent 1c60c89 commit ab52800

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

168_Excel_Sheet_Column_Title.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
public:
3+
void rotate(vector<int>& nums, int k) {
4+
vector<int> result;
5+
if(nums.empty()||k%nums.size()==0) return;
6+
int newk=k%nums.size();
7+
int startPoint=nums.size()-newk;
8+
for(int i=0;i<nums.size();++i){
9+
result.push_back(nums[startPoint]);
10+
startPoint++;
11+
if(startPoint==nums.size()) startPoint=0;
12+
}
13+
nums=result;
14+
15+
}
16+
};

0 commit comments

Comments
 (0)