팰린드롬(회전문 문제)
2022. 3. 23. 17:47ㆍ알고리즘
728x90
bool palindrome(int idx)
{
for (int i = 0; idx + i < length - i - 1; i++)
//하나라도 성립안하면 palindrome 아님
if (S[idx + i] != S[length - i - 1])
return false;
return true;
}
https://www.acmicpc.net/problem/1254
https://www.acmicpc.net/problem/14444
728x90
'알고리즘' 카테고리의 다른 글
[C++][STL] map 사용법 정리 (0) | 2022.05.30 |
---|---|
소수구하기 에라토스테네스의 체 (0) | 2022.05.19 |
최대 공약수, 최소 공배수 구하는 문제 (0) | 2022.05.19 |
백준 1764 듣보잡 C++ (0) | 2022.05.19 |
1.시간 복잡도 빅오 표기법 O(N) (0) | 2021.11.05 |