일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 주정부이민
- 코딩테스트
- 방송통신대학교
- C++
- EOI
- leetcode
- 선형대수
- 프로그래머스
- 매트랩
- cpp
- 온라인석사
- machine learning
- omscs
- LAA
- 컴퓨터과학과
- Deep learning
- 머신러닝
- 알고리즘
- 캐나다 영주권
- 방통대
- LV1
- Plotting
- 딥러닝
- 기본
- 개발자
- zeros
- 조지아텍
- 위니펙
- MATLAB
- mpnp
Archives
- Today
- Total
Byte by Byte
1812. Determine Color of a Chessboard Square.cpp 본문
class Solution {
public:
bool squareIsWhite(string coordinates) {
string& s = coordinates;
if((s[0]%2==0 &&s[1]%2==0) || s[0]%2==1&&s[1]%2==1) return false;
return true;
}
};
//better solution
class Solution {
public:
bool squareIsWhite(string coordinates) {
return coordinates[0]%2 != coordinates[1]%2;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
1941. Check if All Characters Have Equal Number of Occurrences.cpp (0) | 2021.10.07 |
---|---|
1381. Design a Stack With Increment Operation.cpp (0) | 2021.10.07 |
980. Unique Paths III.cpp (0) | 2021.10.07 |
1967. Number of Strings That Appear as Substrings in Word.cpp (0) | 2021.10.06 |
1089. Duplicate Zeros.cpp (0) | 2021.10.06 |