Daily/Code Fest

LeetCode 2020 July Challenge | LeetCode 2020 July Challenge

지난 회고에 알고리즘 공부좀 해야겠다고 적었다.이전에 5월 챌린지, 6월 챌린지도 조금 했었는데 두번 다 그냥 대충 내가 아는문제만 풀다가(dfs, tree 문제들 푸는걸 귀찮아 해서 그런 문제가 나오면 넘겼다.) 끝까지 완주하지 않고 안했었다.회고에 적었던 알고리즘 공부를 사실 안 지키고 있었는데ㅋㅋ코딩테스트 준비를 하려고 알고리즘 공부를 한 2일정도 했는데, 묘하게 재밌다 싶어서 시작하게 되었다.https://leetcode.com/explore/challenge/card/july-leetcoding-challenge/ Explore - LeetCodeLeetCode Explore is the best place for everyone to start practicing and learning on ..

LeetCode 2020 July Challenge | LeetCode 2020 July Challenge

728x90

지난 회고에 알고리즘 공부좀 해야겠다고 적었다.

이전에 5월 챌린지, 6월 챌린지도 조금 했었는데 두번 다 그냥 대충 내가 아는문제만 풀다가(dfs, tree 문제들 푸는걸 귀찮아 해서 그런 문제가 나오면 넘겼다.) 끝까지 완주하지 않고 안했었다.

회고에 적었던 알고리즘 공부를 사실 안 지키고 있었는데ㅋㅋ
코딩테스트 준비를 하려고 알고리즘 공부를 한 2일정도 했는데, 묘하게 재밌다 싶어서 시작하게 되었다.

https://leetcode.com/explore/challenge/card/july-leetcoding-challenge/

 

Explore - LeetCode

LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore.

leetcode.com

리트코드에서 매일매일 24시간안에 한 문제를 풀어야하는 과제가 내려오는 형식인데 
한국 시간 기준으로는 오후 4시에 새로운 문제가 업로드 된다.

이 챌린지를 계속 하다보니 일일커밋도 자연스럽게 하게 되었다 (지금 깃캣도 키우고있음..ㅎㅎ) 
7월 레포지토리 기준 33 커밋이다.

매일매일 문제를 풀고 싶었으나 그럼에도 머리가 안돌아가서 못푼문제, 사람들의 discussion을 봐도 이해가 안되는 문제들은 가볍게 패스했다. 풀다보면 나중에 봤을때 이해가 되는 순간이 있지 않을까 싶어서 그랬다.

7월 챌린지는 84 프로로, 27 / 31 ( solve / total ) 달성 했다.

생각보다 하나씩 해결하는게 재밌어서 8월에도 할 듯?

In my last retrospective, I wrote that I should study algorithms.

I had done a bit of the May Challenge and June Challenge before, but both times I just half-heartedly solved only the problems I already knew how to do (I was too lazy to solve DFS and tree problems, so I'd skip them whenever they came up) and never finished either one.

I wasn't actually keeping up with the algorithm study I mentioned in my retrospective lol
But I spent about 2 days studying algorithms to prepare for a coding test, and it was oddly fun, so I decided to jump in.

https://leetcode.com/explore/challenge/card/july-leetcoding-challenge/

 

Explore - LeetCode

LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore.

leetcode.com

The format is that LeetCode gives you one problem each day that you have to solve within 24 hours. 
Based on Korean time, new problems are uploaded at 4 PM.

Keeping up with this challenge naturally led me to make daily commits too (I'm even raising a GitCat right now lol). 
Based on the July repository, I've made 33 commits.

I wanted to solve a problem every single day, but there were still some problems I couldn't solve because my brain just wouldn't cooperate, and some that I couldn't understand even after reading people's discussions — I just lightly skipped those. I figured that if I keep at it, there'll come a time when I look back and finally get them.

I finished the July Challenge at 84 percent, achieving 27 / 31 ( solve / total ).

It was more fun than I expected to knock them out one by one, so I'll probably keep going in August too!

댓글

Comments

Algorithm

[Xcode] 여러개 main.cpp을 한 프로젝트에서 실행하는 법 | [Xcode] How to Run Multiple main.cpp Files in a Single Project

백준알고리즘, 리트코드를 풀다보면 여러개의 solution.cpp 파일 혹은 main.cpp을 만들어서 실행해야하는 경우가 많습니다.한개의 Xcode 프로젝트에 여러개의 main.cpp를 만드는 방법을 포스팅하려 합니다.1. 새로운 Xcode 프로젝트를 생성합니다.이때 프로젝트의 Command Line Tool 으로 만들어 줍니다.2. 새로운 프로젝트의 옵션을 적어줍니다.3. Xcode project 프로젝트를 클릭합니다.4. 프로젝트의 하단을 보면 프로젝트와 타겟에 대해 적혀있는 바의 하단을 보면 + - 가 있습니다. 이때 +를 눌러서 새로운 Target을 생성해줍니다.Target 생성도 역시 1~2와 같이 Command Line Tool로 선택을 하고, Product Name을 지정해서 생성합니다.5..

[Xcode] 여러개 main.cpp을 한 프로젝트에서 실행하는 법 | [Xcode] How to Run Multiple main.cpp Files in a Single Project

728x90

백준알고리즘, 리트코드를 풀다보면 여러개의 solution.cpp 파일 혹은 main.cpp을 만들어서 실행해야하는 경우가 많습니다.
한개의 Xcode 프로젝트에 여러개의 main.cpp를 만드는 방법을 포스팅하려 합니다.

1. 새로운 Xcode 프로젝트를 생성합니다.
이때 프로젝트의 Command Line Tool 으로 만들어 줍니다.

2. 새로운 프로젝트의 옵션을 적어줍니다.

3. Xcode project 프로젝트를 클릭합니다.

4. 프로젝트의 하단을 보면 프로젝트와 타겟에 대해 적혀있는 바의 하단을 보면 + - 가 있습니다. 이때 +를 눌러서
새로운 Target을 생성해줍니다.

Target 생성도 역시 1~2와 같이 Command Line Tool로 선택을 하고, Product Name을 지정해서 생성합니다.

5. 다음과 같이 두개의 main이 생성되었습니다.

6. 편의를 위해 첫번째로 생성한 Target의 폴더 명 및 Products 이름을 first_main으로 바꿔주겠습니다.
자세한 과정은 펼치기 클릭

더보기

6-1. Xcode 프로젝트의 Target에서 algo 타겟을 더블클릭하여 바꿉니다.

6-2. 폴더 명 역시 바꾸어주고, first_main 폴더(구 algo 폴더) 안의 main.cpp의 타겟이 first_main product로 잘 선택되어있는지 확인합니다.

 6-3. 위에 있는 Run에는 여전히 algo로 떠있습니다. 이대로 실행을 할 경우에는 algo에서 first_main으로 target명만 바꾼 것이기 때문에 first_main > main.cpp를 새로 작성하고 재 컴파일을 해도 올바르게 컴파일이 됩니다. 하지만, 나중에 헷갈릴 가능성이 있기 때문에 run을 위해 사용하는 Target이름 명 역시 바꾸어 주기 위해 Run 옆에 있는 Target 선택에서 Manage Schemes를 클릭합니다.

6-4. Manage Scheme에서 실행할 Target들을 관리할 수 있습니다. 여기에서 - 를 이용하여 기존의 algo라는 이름의 scheme를 지워주고 + 를 first_main이라는 이름으로 schemes에 target을 추가해 줍니다.

7. 실행을 합니다! 이때 왼쪽 상단에서 어떤 Target으로 실행을 할지를 선택해주면,
알고리즘용으로 여러개의 main을 한개의 프로젝트에서 작동시킬 수 있습니다.

 

여기까지 Xcode로 여러개의 main.cpp 파일을 만들어야할 때 방법입니다.
알고리즘을 cpp로 풀고, git으로 한 폴더에 관리하려다 보니까 환경을 세팅하다보니까 이렇게 포스팅까지 하게되었습니다 :)
혹시 더 좋은 꿀팁이 있다면 댓글 달아주세요  감사합니다.

When solving problems on Baekjoon Online Judge or LeetCode, you often need to create and run multiple solution.cpp or main.cpp files.
I'm going to show you how to create multiple main.cpp files in a single Xcode project.

1. Create a new Xcode project.
Make sure to select Command Line Tool when creating the project.

2. Fill in the options for the new project.

3. Click on the Xcode project.

4. At the bottom of the project, you'll see a bar listing the project and targets. At the bottom of that bar, there are + and - buttons. Click the + button to
create a new Target.

Just like in steps 1–2, select Command Line Tool for the Target and specify a Product Name to create it.

5. Now you can see that two main files have been created.

6. For convenience, I'll rename the folder and Products name of the first Target to first_main.
Click the expand toggle for the detailed steps

더보기

6-1. Double-click the algo target under Targets in the Xcode project to rename it.

6-2. Rename the folder as well, then check that the main.cpp inside the first_main folder (formerly the algo folder) has its target correctly set to the first_main product.

 6-3. The Run button at the top still shows algo. If you run it as-is, it will still compile correctly since you only changed the target name from algo to first_main — even if you rewrite first_main > main.cpp and recompile. However, to avoid confusion later, let's also rename the Target used for running. Click on the Target selector next to Run and select Manage Schemes.

6-4. In Manage Schemes, you can manage the Targets available for running. Here, use the - button to remove the old scheme named algo, then use the + button to add a target to the schemes with the name first_main.

7. Run it! Just select which Target to run from the top-left corner,
and you can run multiple main files for algorithm problems within a single project.

 

And that's how you handle multiple main.cpp files in Xcode.
I ended up writing this post while setting up my environment to solve algorithm problems in C++ and manage them in a single folder with git :)
If you have any better tips, please leave a comment. Thanks!

댓글

Comments