Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 비재귀셰그먼트
- FBX
- 트랜잭션 관리
- 오손데이터읽기
- oracle
- 백준
- 2단계로킹
- C++
- command not found
- 1967번
- 5639
- 민겸수
- SQL
- 1759번
- 백준 1253번
- 데이터베이스 배움터
- 언리얼 커스텀 플러그인
- OS
- 1253번
- 실습
- 의미와 무의미의 경계에서
- hackerank
- 셰그먼트트리
- UnrealMP
- 언리얼 플러그인
- Security
- objtofbx
- UActor
- Unreal
- Linux
Archives
- Today
- Total
fatalite
Mars Exploration 본문
Letters in some of the SOS messages are altered by cosmic radiation during transmission.
Given the signal received by Earth as a string, s, determine how many letters of the SOS message have been changed by radiation.
Example
The original message was SOSSOS. Two of the message's characters were changed in transit.
Function Description
Complete the marsExploration function in the editor below.
marsExploration has the following parameter(s):
- string s: the string as received on Earth
Returns
- int: the number of letters changed during transmission
Input Format
There is one line of input: a single string s
int marsExploration(string s) {
int changed = 0;
for(int i = 0; i < s.size(); i = i + 3){
if(s[i] != 'S'){
changed++;
}
if(s[i+1] != 'O'){
changed++;
}
if(s[i+2] != 'S'){
changed++;
}
}
return changed;
}
'코딩 인터뷰 > C++' 카테고리의 다른 글
Subarray Division 2 (0) | 2023.02.03 |
---|---|
Permuting Two Arrays (0) | 2023.01.26 |
Counting Valleys (0) | 2023.01.17 |
Diagonal Difference (0) | 2023.01.13 |
Flipping Bits (0) | 2023.01.12 |