-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[투 포인터] 2076278 윤지윤 #316
base: 2076278-윤지윤
Are you sure you want to change the base?
[투 포인터] 2076278 윤지윤 #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[투포인터 필수 알고리즘 코드리뷰 완료]
안녕하세요 지윤님~ 투포인터 필수 알고리즘 문제 코드 리뷰 완료되셨습니다😀 투포인터와 슬라이딩 윈도우를 잘 활용해서 문제를 풀어주셨네요👍👍 메인도 정말 깔끔해서 코드 읽으면서 감탄했습니다😆 사소한 코멘트 몇 가지 남겨드렸어요! 확인해보시고 질문 있으시면 언제든 리뷰어로 호출해주세요:) 수고 많으셨습니다~
cout <<-1; | ||
}else{ | ||
cout <<ans.first<<" "<<ans.second; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main 깔끔하고 좋습니다!!😍
cin.tie(NULL); | ||
cout.tie(NULL); | ||
int T,k; | ||
string w; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
변수명의 표기법은 통일해서 사용해주세요! 참고로 저희 튜터링에서는 변수명은 스네이크 표기법을, 상수명은 대문자로 표기할 것을 권장해드리고 있습니다😊
|
||
for (int i =0;i<w.length();i++){ | ||
if(al[w[i]-'a']<k){ | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 if문을 통과하는 경우 continue를 만나게 되므로 아래 코드를 실행하지 않게 되죠! 아래 else문은 인덴테이션이 많아질 경우 작성하지 않으셔도 괜찮을 것 같네요😀
max_len =max(len,max_len); | ||
min_len = min(len,min_len); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인덴테이션이 많아지고 있네요! 3중 이상의 인덴테이션이 생기면 이 중괄호가 어디에 속한 중괄호인지 알아보기 어려워질 때가 있죠😥 if(w[i] != w[j]) { continue; }
를 사용해 인덴테이션을 하나 제거해보면 어떨까요?
cnt--; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
투 포인터 활용 너무 좋네요😍😍
for( int i=0;i<n;i++){ | ||
cin >>seq[i]; | ||
} | ||
cout << cntSubseq(k,n,seq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메인도 아주 깔끔하고 좋습니다😎👍👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 지윤님~ 질문해주셨던 20437번 관련하여 코멘트 남겨드렸습니다! 아주 사소한 부분 때문에 백준을 통과하고 있지 못하는 것 같네요😂 확인해보시고 질문 있으시면 리뷰어로 호출해주시거나 슬랙으로 질문 남겨주세요😁
cout <<-1; | ||
}else{ | ||
cout <<ans.first<<" "<<ans.second; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
출력 형식만 한번 확인해주세요...! 이 부분이 놓치기 쉬운 부분이죠😂 딱 하나만 수정해주시면 코드는 잘 돌아갈 것 같네요! 다만 위에서 이중 for문을 돌면서 시간 초과가 날 것 같네요😥 cnt가 k보다 커지면 탐색할 의미가 없어지니 cnt==k
가 되면 탐색을 중지시켜보면 어떨까요? 한번 시도해보시고 그래도 어려우시다면 다시 한 번 질문해주세요😁
[투포인터 추가제출 확인 완료] |
인적사항
학번: 2076278
이름: 윤지윤
과제 제출
기존 제출 : 20922, 20437
추가 제출 : 14503
20437번 투포인터 사용으로 푸는 방법은 잘 모르겠어서 원래 제가 작성했던 방법대로라도 풀어보려고 했는데 계속 틀렸습니다가 뜹니다 ㅠㅠ
어떻게 고쳐야 할까요?