본문 바로가기

Career

[대기업공채기출유형] 슬라이딩 윈도우 & 투 포인터

반응형

Sliding Window

Data Structure: Sliding Window Technique | by Coding Freak | Techie Delight | Medium

Window를 한 칸 옮기면 w-1칸은 겹친다

w를 계속 다 더하지 말고 이전 결과를 이용하자

(앞 제거 뒤 추가)

 

투 포인터 기법

두 개의 포인터를 만듬

각각의 요소에 의미부여

ex) 구간 합

 

> 투 포인터 사이가 window가 된다.

 

유사 유형 풀어보기

Find All Anagrams in a String - LeetCode

 

Find All Anagrams in a String - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

해답 : [leetcode] 438. Find All Anagrams in a String @ python - Programmer Sought

 

[leetcode] 438. Find All Anagrams in a String @ python - Programmer Sought

Original question Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100. The order of output do

www.programmersought.com

2470번: 두 용액 (acmicpc.net)

 

2470번: 두 용액

첫째 줄에는 전체 용액의 수 N이 입력된다. N은 2 이상 100,000 이하이다. 둘째 줄에는 용액의 특성값을 나타내는 N개의 정수가 빈칸을 사이에 두고 주어진다. 이 수들은 모두 -1,000,000,000 이상 1,000,00

www.acmicpc.net

Longest subsegment of '1's formed by changing at most k '0's - GeeksforGeeks

 

Longest subsegment of '1's formed by changing at most k '0's - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org

 

반응형