<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Segment Tree on Kelly Dev</title><link>https://kelly-chui.github.io/algorithmtags/segment-tree/</link><description>Recent content in Segment Tree on Kelly Dev</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 13 Aug 2026 20:45:10 +0900</lastBuildDate><atom:link href="https://kelly-chui.github.io/algorithmtags/segment-tree/index.xml" rel="self" type="application/rss+xml"/><item><title>Leetcode 2213. Longest Substring of One Repeating Character</title><link>https://kelly-chui.github.io/ps/2026/ps-leetcode-2213-longest-substring-of-one-repeating-character/</link><pubDate>Thu, 13 Aug 2026 20:45:10 +0900</pubDate><guid>https://kelly-chui.github.io/ps/2026/ps-leetcode-2213-longest-substring-of-one-repeating-character/</guid><description>&lt;h2 id="문제"&gt;문제&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://leetcode.com/problems/longest-substring-of-one-repeating-character"&gt;https://leetcode.com/problems/longest-substring-of-one-repeating-character&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="풀이"&gt;풀이&lt;/h2&gt;
&lt;p&gt;스트링 &lt;code&gt;s&lt;/code&gt;에 대해 여러 번의 문자 변경 쿼리가 주어진다. 각 쿼리마다 특정 인덱스의 문자를 변경하고, 같은 문자가 연속되는 가장 긴 부분 스트링의 길이를 리턴하면 된다.&lt;/p&gt;
&lt;p&gt;스트링의 길이와 쿼리의 개수가 최대 $10^5$이므로, 문자를 변경할 때마다 스트링 전체를 탐색하는 방식으로는 해결할 수 없다.&lt;/p&gt;
&lt;p&gt;문자 하나를 변경하는 업데이트가 반복되고, 변경 이후 스트링 전체에서 가장 긴 연속 스트링의 길이를 구해야 한다. 따라서 변경된 구간만 갱신할 수 있는 &lt;a href="https://kelly-chui.github.io/posts/cs-data-structure-segment-tree/"&gt;Segment Tree&lt;/a&gt;를 사용했다.&lt;/p&gt;
&lt;p&gt;다만, 단순히 concat을 하면 안되고, 두 접합부의 경계를 확인한 다음 처리를 해줘야 한다.&lt;/p&gt;</description></item></channel></rss>