
id가 admin이면 풀리는 문제다. 넘겨 받은 값을 strtolower 함수를 통해 소문자로 변환하고, str_replace 함수를 통해 'admin'을 공백("")으로 바꾼다. 즉, 'admin'이 공백으로 치환된 뒤에도 id에 'admin'이 남아있으면 해결된다. 그래서 id=adadminmin을 입력해보았다. Clear!

id가 admin이면 풀리는 문제다. 싱글쿼터와 'admin'이 필터링 되는데, 'admin'을 필터링하는 preg_match 문을 보면 i가 없기 때문에 소문자 'admin'만 필터링된다. 즉, 'admin'을 'Admin'으로 쓰는 등의 방법으로 필터링을 우회할 수 있다. id=Admin 을 입력해 문제를 해결했다. Clear!

https://www.hackerrank.com/challenges/find-the-median/problem Find the Median | HackerRank Find the median in a list of numbers. www.hackerrank.com Algorithms > Sorting element의 개수가 홀수인 배열이 주어지면 중간값을 찾는 문제이다. 코드 int findMedian(int arr_count, int* arr) { int i, j, temp; for(i = 1; i temp; j--) arr[j + 1] = arr[j]; arr[j + 1] = temp; } ret..

https://www.hackerrank.com/challenges/icecream-parlor/problem Ice Cream Parlor | HackerRank Help Sunny and Johnny spend all their money during each trip to the Ice Cream Parlor. www.hackerrank.com Algorithms > Search 아이스크림의 맛에 대한 가격 리스트가 주어지면, 두 개의 아이스크림을 골라 그 가격의 합이 가지고 있는 돈과 같게 되는 경우를 찾는 문제다. 코드 int* icecreamParlor(int m, int arr_count, int* arr, int* result_count) { *result_count = 2; int* co..