Programmers

ยทpython
๋ฌธ์ œ for๋ฌธ ๋‚ด์—์„œ queires ๋‚ด์˜ index๋“ค์„ ๋ฐ˜๋ณต์ ์œผ๋กœ my_string์— ์ ์šฉ์‹œํ‚ค๋ฉด์„œ, ์ ์šฉ๋œ ๋‚ด์šฉ์„ ๋‹ค์‹œ my_string์— ์ €์žฅํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค. ์ฝ”๋“œ ๋ฐ ์„ค๋ช… def solution(my_string, queries): result = my_string for index in queries: front_string = result[:index[0]] mid_string = result[index[0]: index[1] + 1] back_string = result[index[1] + 1:len(result)] result = front_string + mid_string[::-1] + back_string return result for๋ฌธ ์†์˜ string slicing ..
Chan Lee
'Programmers' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก