GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add 412_Fizz_Buzz (#20) · manondidi/leetcode@6699908

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cpp
    • 412_Fizz_Buzz.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cpp/412_Fizz_Buzz.cpp‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#define pb push_back
2+
class Solution {
3+
public:
4+
vector<string> fizzBuzz(int n) {
5+
int i;
6+
vector<string> s;
7+
for(i=0;i<n;i++){
8+
if((i+1)%15==0)s.pb("FizzBuzz");
9+
else if((i+1)%5==0)s.pb("Buzz");
10+
else if((i+1)%3==0)s.pb("Fizz");
11+
else s.pb(to_string(i+1));
12+
}
13+
return s;
14+
}
15+
};

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.