Inflearn Community Q&A
연속부분수열2 질문
Written on
·
313
0
선생님 안녕하세요.
해당 강의 보다가 궁금한 점이 있어서 질문 드립니다.
혹시 배열의 특정 원소가 m보다 크면,
(만약 m=5이고 [1,7,1,2,3] 이라는 배열이 주어진다면)
어떻게 풀이가 되는지 알려주실 수 있을까요?
javascript코테 준비 같이 해요!
Quiz
What is the main reason why two-pointer or sliding window techniques are more efficient than nested loops?
Because it uses less memory?
Is it because the code is shorter?
Is it because it achieves O(N) time complexity in most cases?
Is it because it's not affected by the input data size?
Answer 1
0
영상에 있는 풀이 그대로 해도 상관없을것같아요!
while(sum>m) sum -= arr[lt++];
부분에서 lt가 rt보다 오른쪽에 (rt+1 == lt)있게돼서 answer 에는 결국 0(rt-lt+1) 이 더해집니다.





