From e9bbdd606016f46460b30185c62e066aa061d78e Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Fri, 9 Jan 2026 18:58:13 +0900 Subject: [PATCH] logseq 20260109 --- .../pages_πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md | 1 + pages/Swift.md | 32 +++++ pages/javascript_typescript.md | 3 +- pages/μ˜μ–΄κΈ°μ΄ˆ 30κ°•.md | 64 +++++++++ pages/μ˜μ–΄κΈ°μ΄ˆκ°•μ˜(μ„±μ •ν˜œ).md | 3 +- pages/μ½”λ”©νŒ.md | 44 ++++++ pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리.md | 2 +- pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md | 136 ------------------ pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전.md | 23 +-- pages/πŸ“‹ Index Page.md | 1 - 10 files changed, 147 insertions(+), 162 deletions(-) create mode 100644 logseq/.recycle/pages_πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md create mode 100644 pages/μ˜μ–΄κΈ°μ΄ˆ 30κ°•.md create mode 100644 pages/μ½”λ”©νŒ.md delete mode 100644 pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md diff --git a/logseq/.recycle/pages_πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md b/logseq/.recycle/pages_πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md new file mode 100644 index 0000000..3cf20d5 --- /dev/null +++ b/logseq/.recycle/pages_πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md @@ -0,0 +1 @@ +- \ No newline at end of file diff --git a/pages/Swift.md b/pages/Swift.md index 789d10a..434aa17 100644 --- a/pages/Swift.md +++ b/pages/Swift.md @@ -29,6 +29,38 @@ deck:: Logseq/coding tip } ``` - +- ## **β–Ί λΉ„ κ³ μ°¨ λ‚΄μž₯ν•¨μˆ˜ λͺ¨μŒ** + - ### **β—ΌοΈŽ stride()** + - **μ •μ˜** + - μΌμ •ν•œ κ°„κ²©μœΌλ‘œ 숫자 {{c1 μ‹œν€€μŠ€}}λ₯Ό μƒμ„±ν•˜λŠ” ν•¨μˆ˜. + extra:: python의 range와 λΉ„μŠ·ν•¨. + id:: 6960b576-ad59-4da0-bd9b-cdc8a293e99e + - **νŒŒλΌλ―Έν„°** + - stride의 νŒŒλΌλ―Έν„°λŠ” {{c1 from}}, {{c1 to}}, {{c1 through}}, {{c1 by}} 이닀. + extra:: (from, to, by) ν˜Ήμ€ (from, through, by) μ‘°ν•©μœΌλ‘œ 쓰인닀. + id:: 6960b5b7-4154-4ed8-adc1-1f1d8d5b70d2 + - νŒŒλΌλ―Έν„° νƒ€μž…μ€ μ •μˆ˜ν˜•(Int, Int8, UInt λ“±λ“±)뿐 μ•„λ‹ˆλΌ {{c1 μ‹€μˆ˜ν˜•(Double, Float)}}도 κ°€λŠ₯ν•˜λ‹€. + id:: 6960b6dc-ce22-47fb-9d7c-2615053e8abd + - stride(from: **a**, to: **b**, by: **c**) 의 μ˜λ―ΈλŠ”? + id:: 6960b6af-74bd-43cc-9124-eb59c73027d2 + :-> aλΆ€ν„° μ‹œμž‘ν•΄μ„œ bκΉŒμ§€ c κ°„κ²©μœΌλ‘œ μ‹œν€€μŠ€λ₯Ό 생성함(μ΄λ•Œ bλŠ” ν¬ν•¨λ˜μ§€ μ•ŠμŒ) + - stride(from: **a**, through: **b**, by: **c**) 의 μ˜λ―ΈλŠ”? + id:: 6960b79d-7044-4c17-953e-8e2eac6470f9 + :-> aλΆ€ν„° μ‹œμž‘ν•΄μ„œ bκΉŒμ§€ c κ°„κ²©μœΌλ‘œ μ‹œν€€μŠ€λ₯Ό 생성함(μ΄λ•Œ b도 포함됨.) + - **μ˜ˆμ œμ½”λ“œ** + - 0λΆ€ν„° 1 사이λ₯Ό 0.1κ°„κ²©μœΌλ‘œ λ‚˜λˆˆ 배열을 μƒμ„±ν•˜λΌ.(0은 ν¬ν•¨ν•˜μ§€ μ•ŠλŠ”λ‹€) #card + id:: 6960b85a-b8e7-4a8b-a5b6-e5087647bfc7 + - ```swift + var arr = stride(from:1.0, to: 0.0, by: -0.1).map{$0} + var arr = Array(stride(from:1.0, to: 0.0, by: -0.1)) + ``` + - 0λΆ€ν„° 20κΉŒμ§€ 4의 κ°„κ²©μœΌλ‘œ ν¬ν•¨ν•˜λŠ” 배열을 μƒμ„±ν•˜λΌ(20은 ν¬ν•¨λœλ‹€) #card + id:: 6960b921-ae3e-4a8a-9430-2d56ec243992 + - ```swift + var arr = stride(from:0, through: 20, by: 4).map{$0} + var arr = Array(stride(from:0, through: 20, by: 4)) + ``` +- - ## **β–Ί κ³ μ°¨ν•¨μˆ˜ λͺ¨μŒ** - ### **β—ΌοΈŽ .map()** - #### **μ •μ˜** #card diff --git a/pages/javascript_typescript.md b/pages/javascript_typescript.md index df96edb..289b711 100644 --- a/pages/javascript_typescript.md +++ b/pages/javascript_typescript.md @@ -145,4 +145,5 @@ deck:: Logseq/coding tip if(a.name === b.name) return a.value - b.value; return b.name - a.name; }) // 객체의 μ΄λ¦„μˆœ λ‚΄λ¦Όμ°¨μˆœμœΌλ‘œ μ •λ ¬ν•˜κ³  이름이 같을 경우 κ°’ κΈ°μ€€μœΌλ‘œ μ˜€λ¦„μ°¨μˆœμœΌλ‘œ μ •λ ¬ - ``` \ No newline at end of file + ``` +- \ No newline at end of file diff --git a/pages/μ˜μ–΄κΈ°μ΄ˆ 30κ°•.md b/pages/μ˜μ–΄κΈ°μ΄ˆ 30κ°•.md new file mode 100644 index 0000000..47f2cb8 --- /dev/null +++ b/pages/μ˜μ–΄κΈ°μ΄ˆ 30κ°•.md @@ -0,0 +1,64 @@ +deck:: Logseq/μ˜μ–΄ 문법 + +- ## **β–Ί When** + - ### λ‹€μŒ 3개의 λ¬Έμž₯ 쀑 μ˜³μ€ λ¬Έμž₯을 λͺ¨λ‘ κ³ λ₯΄λ©΄? 그리고 μ˜³μ§€ μ•Šλ‹€λ©΄ μ™œ μ˜³μ§€ μ•Šμ€μ§€ μ„€λͺ…ν•˜λ©΄? + id:: 6960aef3-5e9b-4bd1-8b7d-24e49adecf97 + β‘  **Do you know the time when the test is going to start?** + β‘‘ **Do you know the time that the test is going to start?** + β‘’ **Do you know when the test is going to start?** + #card + - β‘ β‘‘β‘’ λͺ¨λ‘ μ˜³λ‹€. + - β‘  : μ•„μ£Ό 기본적인 관계뢀사 λ¬Έμž₯. + - β‘‘ : 관계뢀사 when은 thatμœΌλ‘œλ„ μ“Έ 수 있음. + #+BEGIN_EXTRA + κ΄€κ³„λŒ€λͺ…사, 접속사 thatκ³Ό κ΅¬λΆ„ν•˜κΈ° λ³΄λ‹€λŠ” ν•΄μ„μ˜ 차이λ₯Ό μ΄ν•΄ν•˜λŠ” 것이 μ€‘μš”. + #+END_EXTRA + - β‘’ : 선행사가 νŠΉλ³„ν•œ μ˜λ―Έκ°€ μ—†λŠ” 것(the time)일 경우 μƒλž΅ ν•  수 있음. +- +- ## **β–Ί Where** + - ### λ‹€μŒ 3개의 λ¬Έμž₯ 쀑 μ˜³μ€ λ¬Έμž₯을 λͺ¨λ‘ κ³ λ₯΄λ©΄? 그리고 μ˜³μ§€ μ•Šλ‹€λ©΄ μ™œ μ˜³μ§€ μ•Šμ€μ§€ μ„€λͺ…ν•˜λ©΄? + id:: 6a845910-0231-4ab4-88ac-1f6feb3a516c + β‘  **This is the place where I worked.** + β‘‘ **This is the place that I worked.** + β‘’ **This is where I worked.** + #card + - β‘ β‘‘β‘’ λͺ¨λ‘ μ˜³λ‹€. + - β‘  : μ•„μ£Ό 기본적인 관계뢀사 λ¬Έμž₯. + - β‘‘ : 관계뢀사 where은 thatμœΌλ‘œλ„ μ“Έ 수 있음. + #+BEGIN_EXTRA + κ΄€κ³„λŒ€λͺ…사, 접속사 thatκ³Ό κ΅¬λΆ„ν•˜κΈ° λ³΄λ‹€λŠ” ν•΄μ„μ˜ 차이λ₯Ό μ΄ν•΄ν•˜λŠ” 것이 μ€‘μš”. + #+END_EXTRA + - β‘’ : 선행사가 νŠΉλ³„ν•œ μ˜λ―Έκ°€ μ—†λŠ” 것(the place)일 경우 μƒλž΅ ν•  수 있음. +- +- ## **β–Ί Why** + - ### λ‹€μŒ λ¬Έμž₯의 빈 칸에 λ“€μ–΄ 갈 수 μžˆλŠ” 것은? + id:: 088a652e-6bcc-4323-b024-0dcea4786ab0 + **Tell me ( ) your son were absent.** + #card + - **β‘  : the reason why** + extra:: 기본적인 관계뢀사 ν˜•νƒœ(선행사 + 관계뢀사) + - **β‘‘ : the reason** + extra:: μ„ ν–‰μ‚¬λ§Œ 남기고 whyλŠ” μƒλž΅ κ°€λŠ₯ + - **β‘’ : why** + extra:: 선행사가 νŠΉλ³„ν•œ μ˜λ―Έκ°€ μ—†λŠ” 것(the reason)일 경우 μƒλž΅ ν•  수 있음. +- +- ## **β–Ί How** + - ### λ‹€μŒ λ¬Έμž₯의 빈 칸에 λ“€μ–΄ 갈 수 μžˆλŠ” 것은? + id:: 3ce4a662-2014-4317-b1c7-51f272e332bb + **This is ( ) she solved the problem.** + #card + - **β‘  : how** + extra:: 선행사가 방법일 경우의 관계뢀사 μ‚¬μš© + - **β‘‘ : the way** + extra:: μ„ ν–‰μ‚¬λ§Œ 있고 κ΄€κ³„λΆ€μ‚¬λŠ” μ—†μŒ. + - **β‘’ : ~~the way how~~** + extra:: How의 경우 선행사와 관계뢀사 λ‘˜ 쀑 ν•˜λ‚˜λ§Œ 써야함! λ‘˜ λ‹€ μ“Έ 수 μ—†μŒ. + - ### λ‹€μŒ 관계뢀사 λ¬Έμž₯을 κ΄€κ³„λŒ€λͺ…사 λ¬Έμž₯으둜 λ§Œλ“€μ–΄λΌ. + id:: 6960b300-1cfb-4a7b-bae5-5c4df25c83f5 + **This is how she solved the problem.** + #card + - This is the way **which** she solved the problem **in**. + 선행사 the wayλ₯Ό κΈ°μ€€μœΌλ‘œ κ΄€κ³„λŒ€λͺ…사λ₯Ό λ„£μ–΄μ„œ 두 λ¬Έμž₯을 ν•©μΉ¨. + - This is the way **in which** she solved the problem. + κ΄€κ³„λŒ€λͺ…사 that이 μ•„λ‹Œ 경우 맨 뒀에 μ „μΉ˜μ‚¬λ§Œ 남을 경우 μ „μΉ˜μ‚¬ μ•žμœΌλ‘œ 이동 κ°€λŠ₯. + - This is the way **that** she solved the problem in. \ No newline at end of file diff --git a/pages/μ˜μ–΄κΈ°μ΄ˆκ°•μ˜(μ„±μ •ν˜œ).md b/pages/μ˜μ–΄κΈ°μ΄ˆκ°•μ˜(μ„±μ •ν˜œ).md index e7eb5b8..79bab97 100644 --- a/pages/μ˜μ–΄κΈ°μ΄ˆκ°•μ˜(μ„±μ •ν˜œ).md +++ b/pages/μ˜μ–΄κΈ°μ΄ˆκ°•μ˜(μ„±μ •ν˜œ).md @@ -26,4 +26,5 @@ - [[μ˜μ–΄κΈ°μ΄ˆ 26κ°•]] 타동사 해석 비법 - [[μ˜μ–΄κΈ°μ΄ˆ 27κ°•]] 접속사 해석 비법 - [[μ˜μ–΄κΈ°μ΄ˆ 28κ°•]] μˆ˜λ™νƒœ, λŠ₯λ™νƒœ 해석 비법 -- [[μ˜μ–΄κΈ°μ΄ˆ 29κ°•]] κ΄€κ³„λŒ€λͺ…사 해석 비법 \ No newline at end of file +- [[μ˜μ–΄κΈ°μ΄ˆ 29κ°•]] κ΄€κ³„λŒ€λͺ…사 해석 비법 +- [[μ˜μ–΄κΈ°μ΄ˆ 30κ°•]] 관계뢀사 해석 비법 \ No newline at end of file diff --git a/pages/μ½”λ”©νŒ.md b/pages/μ½”λ”©νŒ.md new file mode 100644 index 0000000..f2c7ede --- /dev/null +++ b/pages/μ½”λ”©νŒ.md @@ -0,0 +1,44 @@ +deck:: Logseq/coding tip + +- ## **β–Ί λΉ„νŠΈμ—°μ‚° XOR(배타적 논리합)** + - **기호** : {{c1 ^}} + id:: 6960ba6a-cbcf-48e0-ba15-39f4e3dbc76a + - **μ—°μ‚°κ°’ :** (0, 0) -> {{c1 0}}, (0, 1) -> {{c1 1}}, (1, 0) -> {{c1 1}}, (1, 1) -> {{c1 0}} + extra:: κ°™μœΌλ©΄ 0, λ‹€λ₯΄λ©΄ 1 + id:: 6960baa5-ffe5-4782-ad1c-a75e7c3f25e8 + - **ν•΅μ‹¬μ„±μ§ˆ 3κ°€μ§€** #card + id:: 6960bada-97e7-4f50-8cf7-1d1af57983b2 + - 같은 κ°’ 끼리 μ—°μ‚°ν•˜λ©΄ 0이 λœλ‹€. + extra:: a ^ a = 0 + - 0κ³Ό μ—°μ‚°ν•˜λ©΄ 자기 μžμ‹ μ΄ λœλ‹€. + extra:: a ^ 0 = a + - κ΅ν™˜λ²•μΉ™, 결합법칙이 μ„±λ¦½ν•œλ‹€. + extra:: a ^ b = b ^ a, (a ^ b) ^ c = a ^ (b ^ c) + - **ν™œμš©** + - μž„μ‹œλ³€μˆ˜(temp) 없이 두 λ³€μˆ˜μ˜ 값을 swap #card + id:: 6960bbba-cf88-4072-ac55-c6edc540749a + - ```c + int a = 3; + int b = 5; + + a = a^b; + b = a^b; + a = a^b; + // a = 5, b = 3 + ``` + - μ€‘λ³΅λ˜λŠ” μˆ˜λ“€μ˜ λ°°μ—΄μ—μ„œ μ€‘λ³΅λ˜μ§€ μ•ŠλŠ” ν•˜λ‚˜μ˜ 숫자λ₯Ό 찾을 λ•Œ + - μ‚¬μš©κ°€λŠ₯ν•œ 쑰건 #card + id:: 6960bc58-3189-4ec8-9554-cfa526027fb7 + - λͺ¨λ“  μˆ«μžλ“€ 쀑 단 ν•œκ°œλ₯Ό μ œμ™Έν•œ λͺ¨λ“  μˆ˜κ°€ μ€‘λ³΅λ˜λŠ” 수 일 λ•Œ + - μ€‘λ³΅λ˜λŠ” μˆ«μžλ“€μ΄ 각각 짝수개둜 μ‘΄μž¬ν•˜κ³  μžˆμœΌλ©΄μ„œ μ°ΎμœΌλ €λŠ” μˆ«μžλŠ” 1개 ν˜Ήμ€ ν™€μˆ˜κ°œκ°€ μ‘΄μž¬ν•  경우 + - λ‹€μŒ μ½”λ“œμ˜ 좜λ ₯κ²°κ³ΌλŠ”? + id:: 6960bc99-5059-4e25-bd9f-502967918f5c + ```c + int arr[] = {1, 2, 5, 2, 2, 3, 2, 1, 5}; + int res = 0; + for(int i=0; i<9; i++) res ^= arr[i]; + printf("%d\n", res); + ``` + #card + - 3 (9개의 μˆ«μžλ“€ 쀑 1은 2개, 2λŠ” 4개, 5λŠ” 2개, 3은 1개, λ”°λΌμ„œ 3만 λ‚¨μŒ) + - \ No newline at end of file diff --git a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리.md b/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리.md index baab491..2bbb804 100644 --- a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리.md +++ b/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리.md @@ -6,4 +6,4 @@ - [[자료ꡬ쑰]] - [[μ•Œκ³ λ¦¬μ¦˜]] - [[μ½”λ”©λ¬Έμ œ 볡슡용]] -- \ No newline at end of file +- [[μ½”λ”©νŒ]] \ No newline at end of file diff --git a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md b/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md deleted file mode 100644 index 582a4fd..0000000 --- a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전.md +++ /dev/null @@ -1,136 +0,0 @@ -deck:: Logseq/coding tip - -- ## **파이썬, μžλ°”μŠ€ν¬λ¦½νŠΈ 반볡문 순회 및 객체/λ”•μ…”λ„ˆλ¦¬ 순회** - - ### **β–Ί 일반적인 λ°˜λ³΅κ°€λŠ₯ 객체λ₯Ό ν™œμš©ν•œ 반볡문 순회(κΈ°λ³Έ 순회)** - - **● pythron** - id:: 684e9cfd-e828-43ac-9f6c-76492bdcf94a - - ```python - arr = [1,2,3,4,5] - - for i in arr : - print(i) - - # 좜λ ₯ - # 1 2 3 4 5 - ``` - - - - ### **β–Ί μžλ°”μŠ€ν¬λ¦½νŠΈμ˜ 객체(Object) λŠ” 파이썬의 λ”•μ…”λ„ˆλ¦¬(Dictionary)** - - **ν‚€(key)와 κ°’(value)을 κ°€μ§€λŠ” λ°μ΄ν„°μ˜ μ§‘ν•©(각각의 μ–Έμ–΄μ—μ„œ μ„œλ‘œ λ™μΌν•˜λ‹€κ³  생각해도 무방함)** - - **β—Ž μ„ μ–Έ 및 접근방법** - - **● pythron** - id:: 684e9fb3-3cf0-4fa0-8539-e53bfe7fbcc1 - - ```python - # λΉˆλ°μ΄ν„° μ΄ˆκΈ°ν™” 방법 - dic = {} # dict() - - # 직접 μ„ μ–Έ 방법 - dic = { - "name": "Yechan", - "age" : 30 - } - - # 좜λ ₯ - print(dic["name"]) - print(dic["age"]) - # Yechan - # 30 - ``` - - **β—Ž ν‚€ 및 κ°’ 순회(반볡문 μ‚¬μš©, μˆœμ„œλŠ” 보μž₯λ˜μ§€ μ•ŠμŒ)** - - **● pythron** - id:: c506e90a-c84b-4498-ba5f-5028f5a874f6 - - ```python - dic = { - "name": "Yechan", - "age" : 30 - } - - # key 순회 - for key in dic : - print(dic[key]) - # Yechan - # 30 - - # key, value 순회 - for key, value in dic.items() : - print(key, value) - # name Yechan - # age 30 - ``` - - - - ### **β–Ί νŒŒμ΄μ¬μ—μ„œ λ°˜λ³΅κ°€λŠ₯ν•œ λ°μ΄ν„°μ…‹μ˜ κ°’κ³Ό 인덱슀λ₯Ό λΆˆλŸ¬μ™€μ„œ μˆœνšŒν•˜κΈ°** - - **enumerate()** - id:: 6857c511-ce76-4075-ba45-a38956deb7df - - λ°˜λ³΅κ°€λŠ₯ν•œ λ°μ΄ν„°μ…‹μ˜ κ°’κ³Ό 인덱슀λ₯Ό νŠœν”Œν˜•νƒœλ‘œ λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜ - id:: 6857c541-93f0-441f-8ff1-ca3cf8a3b186 - - ```python - arr = ["apple", "banana", "cat"] - for i in enumerate(arr) : - print(i) - # 좜λ ₯ - # (0, apple) - # (1, banana) - # (2, cat) - ``` - - λ°˜λ³΅λ¬Έμ—μ„œ μΈλ±μŠ€μ™€ 값을 λ™μ‹œμ— μˆœνšŒν•  수 있음. - id:: 6857c6b6-3201-47a1-a090-c0ebe75d5e4c - - ```python - arr = ["apple", "banana", "cat"] - for index, value in enumerate(arr) : - print(index, value) - # 좜λ ₯ - # 0 apple - # 1 banana - # 2 cat - ``` - - μ‹œμž‘ 인덱슀λ₯Ό λ°”κΏ€ μˆ˜λ„ 있음. - id:: 6857c623-b8e4-4325-a8c2-27a9446118bd - - ```python - arr = ["apple", "banana", "cat"] - for index, value in enumerate(arr, start=1) : - print(index, value) - # 좜λ ₯ - # 1 apple - # 2 banana - # 3 cat - ``` - - -- -- -- ## **λΉ„νŠΈμ—°μ‚° 정리** - - ### **XOR(배타적 논리합)** - - 기호 : ^ - id:: 684eaf61-54bb-4f69-af87-f75f280bd119 - - μ—°μ‚°κ°’ : (0,0)->0, (0,1)->1, (1,0)->1, (1,1)->0 [κ°™μœΌλ©΄ 0, λ‹€λ₯΄λ©΄ 1] - id:: 684eafb2-7091-4d69-8c3f-0540d687b782 - - ν•΅μ‹¬μ„±μ§ˆ - id:: 684eaff6-5a2b-4cdd-ba5d-cba163b087fa - - 같은 값끼리 XORν•˜λ©΄ 0이 λœλ‹€: `a ^ a = 0` - - 0κ³Ό XORν•˜λ©΄ 자기 μžμ‹ μ΄ λœλ‹€: `a ^ 0 = a` - - κ΅ν™˜λ²•μΉ™, 결합법칙이 μ„±λ¦½ν•œλ‹€: `a ^ b = b ^ a`, `(a ^ b) ^ c = a ^ (b ^ c)` - - ν™œμš© - id:: 684eb038-f987-419b-b531-2b7a868c0842 - collapsed:: true - - μ€‘λ³΅λ˜λŠ” μ—¬λŸ¬ μˆ˜λ“€ 쀑에 단 ν•˜λ‚˜ λ‹€λ₯Έ 수λ₯Ό μ°ΎλŠ” λ°©λ²•μœΌλ‘œ ν™œμš© - id:: 684eb045-4df8-4943-bdfb-65f983f2704e - - λͺ¨λ“  수λ₯Ό ν•˜λ‚˜ν•˜λ‚˜ xorν•˜λ©΄ κ²°κ΅­ μ΅œμ’…μ μœΌλ‘œ λ‚˜μ˜€λŠ” κ²°κ³ΌλŠ” λ‹€λ₯Έ ν•˜λ‚˜κ°€ λ‚˜μ˜΄. - - ```C - int arr[] = {1, 2, 3, 2, 1}; - int res = 0; - for(int i=0; i<5; i++) res ^= arr[i]; - // res == 3 (짝이 μ—†λŠ” κ°’) - ``` - - μ€‘λ³΅λ˜λŠ” μˆ˜κ°€ ν™€μˆ˜κ°œλ‘œ 짝지어져 있으면 μ‚¬μš©ν•  수 μ—†μŒ - - 단 단 ν•˜λ‚˜μ˜ 수λ₯Ό μ œμ™Έν•œ λͺ¨λ“  μˆ˜κ°€ 같은 숫자라면 μ‚¬μš© κ°€λŠ₯ - - μž„μ‹œλ³€μˆ˜ 없이 두 λ³€μˆ˜μ˜ 값을 swap - id:: 684eb1a1-f13d-45c3-b03b-da9372da5e7c - - XOR μ—°μ‚°μ˜ μ„±μ§ˆμ„ 잘 μ‘μš©ν•˜λ©΄ μ•„λž˜μ˜ μ½”λ“œμ²˜λŸΌ 두 λ³€μˆ˜λ₯Ό κ΅ν™˜ν•  수 있음. - - ```C - int a = 3; - int b = 5; - - a = a ^ b; - b = a ^ b; - a = a ^ b; - // 이제 a=5, b=3 (값이 μ„œλ‘œ λ°”λ€œ) - ``` -- \ No newline at end of file diff --git a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전.md b/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전.md index eb4ae32..8b774d9 100644 --- a/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전.md +++ b/pages/πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전.md @@ -1,25 +1,4 @@ -## **❖ Javascript / Typescript** - - ### **β–Ί λ°°μ—΄ λ§€μ„œλ“œ** - - ### **β—ΌοΈŽ Array.slice(start_idx, end_idx)** - id:: 68692600-551c-488b-ad74-de8145729133 - - **λ°°μ—΄μ—μ„œ νŠΉμ • λ²”μœ„μ˜ 인덱슀 λΆ€λΆ„λ§Œ μž˜λΌλ‚΄μ„œ κ·Έ 배열을 λ°˜ν™˜ν•˜λŠ” λ§€μ„œλ“œ** - - **end_idxλŠ” μƒλž΅ κ°€λŠ₯ν•˜λ‹€** - - 이 κ²½μš°μ—λŠ” start_idx λΆ€ν„° λκΉŒμ§€ λ°˜ν™˜ν•œλ‹€. - - **λ°°μ—΄μ˜ start_idx 인덱슀 λΆ€ν„° end_idx - 1 μΈλ±μŠ€κΉŒμ§€μ˜ 배열을 μž˜λΌλ‚΄μ„œ λ°˜ν™˜ν™€** - - 예λ₯Ό λ“€λ©΄ arr.slice(2,7) 은 arr의 인덱슀2 λΆ€ν„° 인덱슀 6κΉŒμ§€μ˜ 배열을 λ°˜ν™˜ν•¨. - - **λ²”μœ„λ₯Ό μ΄ˆκ³Όν•΄λ„ μ—λŸ¬λ₯Ό λ‚΄μ§€ μ•ŠμŒ. κ·Έμ € 빈 배열을 λ°˜ν™˜ν•  λΏμž„.** - - **아무리 ν˜ΈμΆœν•΄λ„ 원본 λ°°μ—΄ 자체λ₯Ό λ°”κΎΈμ§€λŠ” μ•ŠλŠ”λ‹€.** - - ```javascript - const arr = [0,1,2,3,4,5,6,7,8,9,10]; - - const arr1 = arr.slice(2); // [2,3,4,5,6,7,8,9,10] - const arr2 = arr.slice(5,10); // [5,6,7,8,9] - const arr3 = arr.slice(12); // [] - ``` -- ## **❖ Python** -- ## **❖ C** -- ## **❖ Java** -- ## **❖ ν”„λ‘œκ·Έλž˜λ° κ΄€λ ¨ 이둠 정리** +## **❖ ν”„λ‘œκ·Έλž˜λ° κ΄€λ ¨ 이둠 정리** - ### **β–Ί μ•Œκ³ λ¦¬μ¦˜** - ### **β—ΌοΈŽ μ§„μˆ˜λ³€ν™˜ μ•Œκ³ λ¦¬μ¦˜** - β—‰ **Bμ§„μˆ˜ 숫자 N을 10μ§„μˆ˜λ‘œ λ°”κΎΈκΈ°(λˆ„μ κ³±)** diff --git a/pages/πŸ“‹ Index Page.md b/pages/πŸ“‹ Index Page.md index d4d190e..c2f49d9 100644 --- a/pages/πŸ“‹ Index Page.md +++ b/pages/πŸ“‹ Index Page.md @@ -1,6 +1,5 @@ - [[πŸ”€ μ˜μ–΄κ³΅λΆ€]] - [[πŸ‘©πŸ»β€πŸ’»μ½”λ”© 지식_팁 정리]] - [[πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전이전]] -- [[πŸ‘©πŸ»β€πŸ’»μ½”λ”© 팁 μ½”λ“œ λͺ¨μŒ_이전]] - - [[πŸ’Ύ template]] \ No newline at end of file