스트링 디코드 문제에서 망하고, 43분 후 복수에 성공한 이야기 (feat. 중첩 괄호도 처리함)

## 🔧 배경 얼마 전 기술 면접을 보다가 `decodeString` 문제를 받았습니다. 알고리즘 공부는 주로 BFS, DFS 쪽만 하던 터라, 문자열 파싱 문제에서 완전히 발목 잡혔습니다. 거기다 라이브 코딩. 제한 시간 30분. 당연히… 못 풀었죠. 멘탈까지 디코딩당한 날이었습니다. --- ## 🔥 복수의 시작 면접이 끝난 뒤에도 이 문제는 계속 머릿속을 맴돌았습니다. “내가 이걸 못 풀었다고? 진짜?” 그 순간부터 **마음속의 디버거**가 켜졌고, 라이브 코딩에서 시도했던 방식에서 출발해 다시 파기 시작했습니다. 스택도 쓰지 않았습니다. 재귀도 쓰지 않았습니다. 그냥 제 방식대로, 끈질기게 문자열을 조작하면서 풀었습니다. **걸린 시간: 추가 43분.** --- ## 🧠 접근 방식 요약 - `[`와 `]`를 찾는다. 가장 안쪽 괄호부터 시작. - 그 안의 문자열을 꺼내고, 반복 횟수를 계산한다. - 원래 문자열 배열을 `splice`로 조작해서 새로운 문자열을 삽입한다. - 그리고… **처음부터 다시 돌린다.** - 이걸 괄호가 다 없어질 때까지 반복한다. 사실상 **재귀를 흉내 내는 루프 기반 수동 파서**입니다. --- ## ✅ 최종 코드 (with 주석) ```javascript /** * @param {string} s * @return {string} */ var decodeString = function(s) { const strArr = s.split(''); let startIndex = -1; let endIndex = -1; for(let i = 0; i = 0 && endIndex >= 0 && endIndex > startIndex){ const addedStr = strArr.slice(startIndex + 1, endIndex).join(''); ...

한국에서 외국인과 결혼하기 - How to get married with global girlfriend in Korea

중요: 해당 포스팅은 참고용으로 2022년 7월 15일을 기준으로 작성되었습니다. 모든 서식은 하이코리아에서 다운받으시고, 시간이 지남에 따라 작성 방식은 변경될 수 있습니다.

 NOTE : All I wrote and reference here is from July 15th, 2022. You must download all the documents you need from 'Hi Korea' official website, because as time goes by how to write the documents can change.

NOTE : This is for writing Marriage Registration IN KOREA 


혼인신고





제가 직접 작성하면서 헷갈렸던 부분을 위주로 설명합니다.
I will explain below about the parts I confused.

해당 문서는 모두! 한글로 작성해야 합니다. 처음에 저는 아내의 이름을 외국인 등록증에 적힌 그대로 적었다가 한글로 수정해야 했어요. 증인중에 한명을 아내 친구로 했는데 증인 이름 역시 한글로 적어야 합니다.
You must write everything in KOREAN. At the first time, I also wrote my wife's name in English as same as in Alien Registration Card and I fixed it in Korean. One of my witness is wife's friend. I wrote her name in English but I fixed it too.

등록기준지는 가족관계증명서를 떼면 나옵니다. 아버지, 어머니, 본인 모두 각각 조회해봐야 해요.
You can get your 등록기준지 from your Family Relations Certificate. You should check yours, your father's and your mother's each.

저는 증인중 한명을 아내의 친구(미국인)으로 했는데, 외국인 등록증에 적힌 주민번호를 다 작성했음에도 시스템이 연동이 안되어있어서 구청에서 확인을 못하더라구요. 문서에 들어가는 사람 중 외국인이 있는 경우, 외국인 등록증 사본이 필요합니다. 저는 그 친구한테 카톡으로 외국인 등록증 사진을 찍어달라고 요청해서 구청 직원분께 확인시켜드렸습니다.
As I said, one of my witness is wife's friend who is from U.S. In this case, you need their ARC copy even though you write their resident registration number in the document. I didn't know that either. When staff asked me that copy, I asked her to send me the picture of her ARC using kakao talk.

제출인은 결혼 당사자가 직접 문서를 제출하지 않는 경우에만 작성합니다.
Don't write 제출인 part. This is only required if the other person which is not you or your partner report this document.

제 아내는 미국인 입니다. 미국인의 경우 대한민국 미 대사관에 가서 혼인성립요건 구비증명서 (미혼자 증명서) 를 받아오면 됩니다. 구청에 제출할 때에는 해당 문서를 한글로 번역한 번역본도 같이 제출해야하는데, 이는 공증이 필요한 문서가 아니어서 직접 번역을 해도 됩니다. 아내가 해당 문서를 받아왔을 때에는 번역 문서도 같이 주더라구요. (미 대사관 방문은 예약이 필요하니 최대한 빠르게 방문 일정을 예약하시기 바랍니다. 저희의 경우엔 가장 빠른 예약이 1달 뒤였습니다.)
My wife is American. U.S. citizen can take 혼인성립요건 구비증명서 (Affidavit of Eligibility for Marriage) from U.S. Embassy in Korea. You also need Korean translation version of Affidavit of Eligibility for Marriage. Korean translation version doesn't have to be official, so you can translate by yourself. In my case, U.S. Embassy gave us translation version too. P.S. Check your embassy for an appointment early before you plan to register, as many have a long wait time for an appointment. For example, the soonest appointment my wife was able to make was 1 month away, due to the service she needed is only open for a small amount of time each week. 

한국인의 경우 신분증 (주민등록증, 운전면허증 등) 원본을 제출하고
외국인의 경우 외국인 등록증여권 원본 둘 다! 제출합니다. (저의 경우엔 구청 직원분이 두가지 다 요청하셨습니다.)
You need your and your partner's ID card. For Korean, it would be 주민등록증 or driver's license etc. For foreigner, they need ARC AND passport both. (Staff asked me both. So please prepare both just in case)

수정테이프는 사용불가하나 수정 시 취소선을 긋고 옆에 수정한 사람의 서명을 하게 되어있습니다.
You can't use correction tape or white out but you can correct your information using strikethrough. After using strikethrough, you must sign your name next to strikethrough.

혹시 모르니 2~3부 준비하여 증인 서명을 모두 받아가세요. 그렇지 않으면 문서가 훼손되거나 많이 수정해야할 경우 증인 서명을 다시 받아야하는 불상사가 생길 수 있습니다.
Bring 2~3 more copies with witness' signature, or you should have to make them sign again if your document becomes damaged or you need to edit the document too much. Having several blank copies with only the witness' signatures is a type of insurance incase a mistake happens on a document. 

Comments

Popular posts from this blog

Operating System Concepts 9th

스티키 헤더 여러개 만들기 (Multiple sticky header)

Operating System Concept