강의

멘토링

로드맵

Inflearn Community Q&A

qazaq1096407's profile image
qazaq1096407

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

1. Merging two arrays (Two Pointers Algorithm)

도저히 이해가 안되요

Written on

·

250

0

선생님 arr[p1]에서 ++를 넣지 않으면

원래 while문은 저런상태면 어떻게 돌아가는건가요?

 

&&까지 붙어있어서 어떤식으로 컴퓨터가 탐색하는지 모르겠어요

javascript코테 준비 같이 해요!

Quiz

45% of people got it wrong. Give it a try!

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

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

p1이 증가해야지 while 문이 거짓이 되는 순간이 생기고 그 때 while문이 멈추는 것입니다.

while(조건1 && 조건2) 식으로 되어 있으면 조건1이 거짓이되거나 조건2가 거짓이 되는 순간 while문은 멈추게 됩니다. 즉 둘 중 어느 하나가 거짓이 되면 while문은 멈춥니다.

qazaq1096407's profile image
qazaq1096407

asked

Ask a question