LeetCode Biweekly Contest 4 2問目 - Remove Vowels from a String [1119]

Source

LeetCode Biweekly Contest 4
問題文

問題概要

省略

解法

省略

cLayversion 20190714-1)のコード [C++に変換後]

#include<bits/stdc++.h>
using namespace std;
inline int isVowel(const char c){
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    return 1;
  }
  if(c=='A'||c=='I'||c=='U'||c=='E'||c=='O'){
    return 1;
  }
  return 0;
}
class Solution{
  public:
  string removeVowels(string S){
    int i;
    string res;
    for(i=0;i<S.size();i++){
      if(!isVowel(S[i])){
        res += S[i];
      }
    }
    return res;
  }
}
;

// cLay varsion 20190714-1

// --- original code ---
// class Solution {
// public:
//   string removeVowels(string S) {
//     int i;
//     string res;
//     rep(i,S.size()) if(!isVowel(S[i])) res += S[i];
//     return res;
//   }
// };
// 
// {
//   // main関数を適当に処理する
// }

Current time: 2024年04月20日19時38分33秒
Last modified: 2019年07月14日04時17分52秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る

Logged in as: unknown user (not login)

ログイン: